Multiple problems with Payroll

This is the first year using payroll. I thought I had everything figured out and working but I’m now seeing several issues. Any help is greatly appreciated.

  1. When opening a Salary Structure assigned to an employee, with several pay periods already completed, the year_to_date field is zero for all components. Is this normal? I’m expecting to see $2,000 * 4 pay periods or $8,000.

  1. It seems Condition statements are ignored, but perhaps the issue is related to the above missing YTD amount.

The following component is still being calculated even after ‘gross_year_to_date’ is $8,000.

My environment:
ERPNext: v15.58.2 (version-15)
Frappe Framework: v15.65.2 (version-15)
Frappe HR: v15.43.1 (version-15)

Montly payroll with one employee.

I’m using the built-in workflow (Create Payroll Entry, Submit, then Submit Salary Slips from Payroll Entry docType).

Salary slips and journal entries are correct.

Thanks in advance for looking.

Where exactly are you seeing this? The Salary Structure document a template, not specific to any particular employee, and likewise the YTD value there will always be zero. There should be, however a running total in the component child tables in the salary slips. (YTD values are, if I remember correctly, exclusive of the current month, but if you’ve run 4 months already there should be something there.)

Very possibly. It’s worth figuring out the first issue before troubleshooting this one, I think.

Thank you @peterg.

The screenshot is indeed from a Salary Component, from my Salary Structure (Submitted and assigned to a single Employee). If you are correct, it seems that field should not exist in this doctype (it would always return zero). This would mean it does not indicate an issue with my setup.

I believe you are referring to tabSalary Detail which has all of the entries for each component including transactional detail from Salary Slips.

Indeed Salary Detail has the field ‘year_to_date’ and it correctly is accumating the amount from each salary slip.

Using the following query I can confirm gross_year_to_date is over 7000.

According to ChatGPT I should be using ‘base_year_to_date’ not ‘gross_year_to_date’ in my conditional statement.

Can anyone confirm, or let me know how to verify if my statement is true or false?

EDIT:
I don’t think that is correct. Since I’m not using base. When I look at the most recent salary slip, base_year_to_date = 0, gross_year_to_date = 8000

The reason it exists there is that both Salary Structure (the template) and Salary Slip (the employee- and period-specific instance) use the Salary Detail child doctype. If you’re seeing accurate values in the salary slip components, that’s what’s being counted.

gross_year_to_date is a field in your salary slip, and the formula should have access to it. I have no idea what base_year_to_date is. I can’t find any reference to it in the source other than the field def. My hunch would be that it’s a legacy field of some sort.

As for why gross_year_to_date isn’t being picked up correctly, it’s tricky to troubleshoot. I’ve usually had to use the debugger in my development environment to pinpoint exactly what the issue is. I’m not sure offhand, for example, when the gross_year_to_date value is populated.

This is not the first time the Condition statement has caused issues. I think moving forward, I will avoid using it and put all logic in the formula instead.