# Salary Component Formula

Hi everyone, I am not a programmer. I am still trying to figure out phyton coding… How can I set the formula in Salary Component like below:

When wages exceed RM800 but not exceed RM900, contribution amount is RM1.70
When wages exceed RM900 but not exceed RM1,000, contribution amount is RM1.90
When wages exceed RM1,000 but not exceed RM1,100, contribution amount is RM2.10
.
.
.
When wages exceed RM4,000, contribution amount is RM7.90

Above mentioned wages is the total of basic salary, overtime pay, allowance, incentive and bonuses.

Hi,

So you do not need any python coding for this. You can simply add a condition and formula in the salary components itself. Just check the box “Amount based on formula”. Screenshot attached:

Regards,
Reema

Hi @Reema_Mehta, thank you for your reply. Do you mind guiding me in the formula? I have tried multiple formula but I get “Syntax Error”

Hi, you can fill in your salary components (basic salary, overtime pay, allowance, incentive and bonuses) in the “earning” table and apply formulae as required (make sure the “amount based on formula” checkbox is checked). Since contribution is a deduction, it should be written in the “deduction” table and then write the amount in the “amount” column. You can then type the following “condition” for “when wages exceed RM800 but not exceed RM900, contribution amount is RM1.70”
Condition: B>=800 and B<=900
(assuming the contribution is based on the Basic (B) component)
Similarly for other conditions…
Please check the attached screenshots for further clarification.

Regards,
Michelle

1 Like

Thank you @michelle for your help but unfortunately, I have tried but it does not work. I still receive syntax error. Below is the screenshot

uncheck amount based on formula and try it.

Hi @Raymond_Liew, Please find the attached screenshot and try the formula… I think this should work.

Tried it on three different conditions and it worked. You can modify the conditions as per your requirement.

Regards,
Michelle

3 Likes

@Raymond_Liew Check this screenshot too…

B = Basic
HRA = House Rent Allowance
BO = Bonus

So in the formula, you change the salary components accordingly.

Regards,
Michelle

3 Likes

Hi Michelle,

What if i have 2 type of shift (normal & overtime), and i want to pay my employee based on their total working hour per week/per month.

At current system I set 2 shift type, normal (8-17) and overtime (17-24) and i thought i would use the late entry and late exit to adjust their working hour (if overtime end past 24 or before 24 or something like that).

Problem is i find the working hour on Attendance report is 0 even though i already set the shift type to the employee.

Look at the problem above, i thought i don’t have Base Salary for my employee? Since their salary is paid based on Total working hour. Am i right?

Hope you can give an insight for my problem.

Thanks & regards,
Randy

Continues here Salary Formulate for Working Hour Based Salary

1 Like

Hello Michele,
I’m getting this error when using the formula (adapted) as you posted:
`Syntax error in formula or condition: unexpected EOF while parsing (, line 1)`
Does the system changed the way to implement this since you posted?

No, the formula should’ve worked fine. Could you provide the screenshots of the formula used?

I fixed this issue by adding Else at the end of the code

My apologies for nto providing further information on this.
The issue was with my formula, I had to review my understanding of python sintaxe

@ahmadRagheb, yes, I’m using a final else at the end .

Things are working as expected now.

Thanks for all support.

why Amount showing 0.00 and also I’ve used the same formula but when I generate salary slip…it is still not updating to original amount. any suggestions?

somewhere formula or conditions are not working.
Faced the same issue:
The base salary was fixed for some and formula-based for others