Try ERPNext Buy Support Partners Foundation

Salary calculation is not carrying start date and end date

github issue https://github.com/frappe/erpnext/issues/18618

This happens in 2 cases

  1. A staff joins the company in middle of a month for example, the salary do not get calculated correctly, it gives whole monthly salary when you create salary slip. I think this case should be handled specially even “Depend on payment days” option is enabled or not

  2. We define a new salary structure assignment for a staff and start date is in middle of a month then when we create the salary slip, the new salary structure assignment affect for whole month which we apply new structure in middle.

Checked the 1st issue and it works perfectly fine. The system calculates salary based on the working days only from the date of joining. Could you please post screenshots of issue 1?

@michelle I have tested

  1. In my case, I don’t use option “Depend on payment days” therefore I’m not sure if this affect. But I just tested and the system still give whole salary for the month if the employee join in the middle of the month. Payment days count shows correctly
    image

  2. This issue remain same as well.

Maybe if I use “Depend on payment days” for all salary components then this correctly however we could like to pay when they take holiday or days off but we don’t want to pay for days before they join the company.

Check to ensure date of joining is date employee started working and salary structure assignment is set to the day employee started.

Also, are you running payroll or just testing the salary sleep for the new employee after salary structure assignment? If you’re just checking salary slip after assignment it will always show the full pay regardless of the date of joining. It only calculates based on date of joining when you actually run payroll entry.

Check to ensure date of joining is date employee started working and salary structure assignment is set to the day employee started.

Yes, I can confirm this. When I tried to assign salary structure with an early date, the system validate and don’t allow so I have joining date and salary structure assignment start on same day 16/2/2020

Also, are you running payroll or just testing the salary sleep for the new employee after salary structure assignment? If you’re just checking salary slip after assignment it will always show the full pay regardless of the date of joining. It only calculates based on date of joining when you actually run payroll entry.

Because you said that so I had to test again with payroll entry but I see no difference. For me, I think payroll entry is just creating salary slip in bulk, everything seems to work same as creating salary slip directly

Hello,

You will have to set the “Depends on Payment Days” checkbox. As for the leaves, make sure to uncheck “Is Leave Without Pay” in the Leave Type so that Salary is not deducted in spite of the leaves taken.

Hope this helps!

Thanks, I will try in this way. But I have a question, will attendance data will affect to the calculation? Employees still get paid when they are absent?

I just tried to change all salary component to be ticked “Depends on payment days” then I try to create a new salary slip, still no change.

Salary will only be deducted if there is exists a leave application with leave type LWP and the “Depends on Payment Days” is checked for the Salary Component.

I understand but it is not the cases we are discussing now

  1. This case is when the staff join in the middle of month and you can see we can’t set a leave application for a period where he is not belong to the company :slightly_smiling_face:
  2. Another similar case is when the new salary structure is applied in middle of month, the same issue happen. The calculation only use the new salary structure for whole month

Regarding issue 1, you can allocate leaves through leave allocation from the date of joining.

Regarding issue 2, this is not a bug but an intentional design assuming an employee can have only 1 salary structure for a given month. If this is a necessary feature for you, kindly create a feature request on GitHub for the same.

  1. Look like you are losing the context. I have no problem with creating leaves however it doesn’t help. The calculation still give the whole salary for the staff instead of a half of the salary even they join from the middle of month. Don’t you think this is a bug??

  2. OK. If this is intended design then I will create a feature request.