When using a variable whose value is affected by “Depends on Payment Days (DPD)” in the formula of any other component, it takes the total value and not the value affected by “Depends on Payment Days”.
Output of bench version
erpnext 12.1.7
frappe 12.0.17
Steps to reproduce the issue
Create a new Salary Structure
Add a new Salary Component for example Basic Salary (BS) with a formula value as: base, and set Depends on Payment Days (DPD) as enabled.
Add a new Salary Component for example Basic Salary Two (BS2) with a formula value as: BS, and with Depends on Payment Days (DPD)disabled.
Test the Salary Structure with an employee that has less Payment Days than Working Days
Example configuration
Working Days: 30
Payment Days: 15 base: 1.000
Basic Salary (BS) = base
Basic Salary Two (BS2) = BS
Observed result BS = 500 (Correct as it’s affected by DPD, he only worked half month) BS2 = 1.000 (Incorrect as BS has a value of 500, it should be also 500)
Expected result BS = 500 BS2 = 500
My scenario is as follows:
I need to calculate other components, taking into account the BS (affected by DPD), but adding another variable that should not be affected by DPD, example:
BS = base = 1.000 = (with DPD) = 500 X = 5.000 (Fixed value that should not be affected by DPD) BS2= BS + X = 5.500 (But right know it displays 6.000 incorrectly as it takes BS as 1.000)
Does ERPNext count days since the Join date if an employee join in middle of month? (right now it is not when I set base salary component as Depends on Payment days)
Will date marked as Absent (in Attendance tool) be excluded from “Payment days” or still be included ?
You have to enable DEPEND ON PAYMENT DAYS for BS2 to get the desired output.
Now, what the system is doing is
IF " Depend on payment days " is checked, it will calculate according to the payment days ( present days)
IF " Depend on payment days " is not checked, it will calculate according to the payment_days = total working days and not present days.
So, In your case :
Working days : 30
Payment days : 15
base = 1000 rs
So, For BS it calculates as :
1000 / 30 = 33.33 rs per day
AS, depend on payment days is enabled.
Base will be - 33.33 * 15 ( payment days ) = 500 rs
BS = base = 500 rs
Now for BS2,
As, depend on payment days is disabled.
So, here base will be 33.33 * 30 = 1000 rs.
Here it will consider the payment_days = 30 because depend on payment days in unchecked.
SO BS2= BS and here BS will be = (( 1000/30 )* 30 ) = 1000 .
I hope you got their logic .
This is how the latest version of ERPNext Works.
Please try it once, whether it is same for your version or not!
This basic functionality is still working after 1 year
I’m on latest version 12, I found another one having same issue in 2018 however it was another version I think because there is no “Leave without pay” checkbox anymore