ERPNext Conference 2019* Blog

Salary Slip overtime to be calculated based on the employee salary




I need to calculate the overtime (rate hour) for the salary slip time sheet based on the employee salary and not based on flat rate. The main question is: the custom script to do this task should be build based on which event (activity)? Is it based on refresh for example?
Actually, it should be executed when we need to create salary slip (from Payroll --> Process Payroll, or from Project --> timesheet, or from Payroll --> Salary Slip).
Another question: if we said that the custom script to be executed based on Refresh event, then: do I have to create this custom script under the document Salary Slip or where?
I am trying to understand if creating salary slip from timesheet or from process payroll is same as creating salary slip (Payroll --> Salary Slip)?


Any help?


Yes, it is all the same. Just that you should have overtime hours fetched from the Timesheet, and value for rest of the component will be fetched from “Salary Structure”. In the Salary Structure, you can update component for the overtime and flat hour rate. In the Salary Slip, when timesheet is pulled, it will calculated total time calculated, and based on the hour rate, value for the component of the overtime will be calculated.


Actually I found a workaround solution, I have now two components: One is Flat rate overtime and one is overtime. When I do not need to calculate based on flat rate, I set the hour rate 0 and I depend on the total_hours value to calculate the overtime based on employee salary.
Thanks a lot for the kindly reply and help.


the problem you will face if you have the overtime rate calculated based on working time if he worked night not the same rate if he do it in a weekend.



Here I can do a custom script to calculate the number of hours based on the time of the working. For example: if he worked in week end, then the hour is 2 hours and if he worked in the night, then the hour is 1.5 hour and so on.

What do u think?


Hi Umair,

I’ve been trying to setup Overtime for my company. I’ve tried almost all possible solutions out there. But none of them seem to work.

Im just curious as to how other ERPNext customers are using the HR module to solve this scenario.

In the comment you have said use timesheet based payroll but we cannot arrive at a combined flat rate for all the employees.

Also If you have any solution to this or something that is planned and sitting there in the backlog we would love to take it up and build it and contribute to the system so that all users would be able to utilise this feature.