Skip to Content
मेन्यू
This question has been flagged

Hi, I want to generate the total business days within a given date range(payslip.date_from and payslip.date_to) and use it for calculation of basic salary on payslip. I want to compare total business days(no_of_days) with WORK100.number_of_days(which is manually entered on payslip) and calculate the basic salary(contract.wage)


Below is the logic:

if no_of_days = worked_days.WORK100.number_of_days

result = contract.wage

elif no_of_days> worked_days.WORK100.number_of_days

result = ((contract.wage / 22) * (22 - (no_of_days- actual_days)))


*WHERE "no_of_days" is the total business days within a given date range (payslip.date_from and payslip.date_to)

Thank you in advance

Avatar
Discard
Best Answer

Hi Michael:

It looks like you want to define a "daily wage" which is currently not provided in the system. You can add a custom field on the Contract to capture the daily wage rate and use the custom field in your Salary Rule. Once you add the custom field the rule will be like so.

For example, if the custom field is called x_daily_wage, the rule will be

result = contract.x_daily_wage * worked_days.WORK100.number_of_days
Avatar
Discard
Author

Thanks for the response. What I really want is to calculate the number of business within any given date range on the payslip (payslip.date_from and payslip.date_to).In my case, Actual days worked / Total attendance (WORK100) for any employee will be entered manually. I need to compare that number with total business days within "payslip.date_from" and "payslip.date_to" to generate an accurate BASIC

Hi Michael: Can you elaborate on what you mean by "Actual days worked / Total attendance (WORK100) for any employee will be entered manually" ? For example, which variable is being used to capture this information in the payslip ?

Author Best Answer

I found this code in the forum to generate the total business days but i always get an error when I run it.

########

datej = str (payslip.date_to)

datek = str (payslip.date_from)

dj = datej [-2:]

x = 0

new = 0

while (x <= 31):

x = x + 1

if str (x) == dj or "0" + str (x) == dj:

new = x

dk = datek [-2:]

y = 0

old = 0

while (y <= 31):

y = y + 1

if str (y) == dk or "0" + str (y) == dk:

old = y

no_of_days = new-old + 1

###### 


if no_of_days = worked_days.WORK100.number_of_days

result = contract.wage

elif no_of_days> worked_days.WORK100.number_of_days

result = ((contract.wage / 22) * (22 - (no_of_days- actual_days)))

Avatar
Discard
Related Posts Replies Views Activity
0
नव॰ 16
4816
1
दिस॰ 22
4407
0
मार्च 22
2643
2
अप्रैल 18
6238
0
जून 17
3352