Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
5570 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Autor

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 ?

Autor Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
nov 16
4818
1
dic 22
4427
0
mar 22
2647
2
abr 18
6243
0
jun 17
3354