Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
5598 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Tác giả

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 ?

Tác giả Câu trả lời hay nhất

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)))

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 11 16
4828
1
thg 12 22
4447
0
thg 3 22
2672
2
thg 4 18
6251
0
thg 6 17
3361