I have been working our payroll successfully on a bimonthly or fortnightly basis, but had not used the attendance module and leave applications yet.
As we aim to switch our entire payroll procedure to ERPNext using salary slips that automatically track attendance and Leave Without Pay I have encountered some difficulty in calculating.
I understand that ERPNext begins with the calendar month, say June 2019 which has 30 days.
1. Working Days
It first calculates Working Days based on the Holiday List.
Let’s assume for our purposes that the Holiday list states that Sundays are non-working days, and this holiday list is properly configured in our employee doctype. This takes out the following Dates from June 2019: 2, 9, 16, 23, and 30. Total sundays = 5. Total holiday list-adjusted working days: 30 -5 = 25 Working Days. (Days of Month - Days listed as Holidays in Holiday List Assigned to Employees = Working Days)
2. Payment Days
If our example employee misses 2 working days, this means 25 - 2 = 23 Payment Days. (Working Days - Absences = Payment Days)
3. Payment Days Net of Days of Leave Without Payment
If our example employee also applies for a LWP of 3 days, not related to the 2 days employee was absent, the: 23 - 3 = 20 Payment Days ( Payment Days - Days of Leave Without Pay = Payment Days Net of Leave Without Pay Days)
Question
So far, so good. Now, the problem I have is the Payroll Frequency configuration in the Salary structure, must it be a Daily or can it be Fortnightly or Bimonthly? So far I have had no luck with Fortnightly.
EDIT
After some trial and error, I realized that when I was Amending a previous salary structure, it was not copying the formula to calculate the base, thus the error where it underestimated the salary to be paid. I erroneously thought it was a problem with the Payroll Frequency setting. However, I have confirmed that what ERPNext does is that it will calculate the formulas first and then will pro-rate or change the proportion of payment based on a formula where:
(amount of salary component per period / working days ) * payment days = amount of salary component for payment days.