I have implemented the biometric auto attendance system and it is working well. I am wondering if we can somehow punish those that have Late Entry or Early Exit with something like a partial leave. I.E.
1 Late Entry = 1/6 Day cut.
Currently the system only mentions Late Entry or Early exit but having an automatic counter would be a great addition. I am a novice coder so some guidance on where to do what would be appreciated.
I had achieved something similar using a custom app approach to make use of custom hook for salary slip to perform a count of all the late entry and early exit and add the total deduction for that employee in the salary slip.
@bibinqcs Thanks, that’s really helpful, but I am much more lost in setting up the web hooks, how does it add a parameter to the salary slip. If you could shed some more light in that part of logic, it would be a lot of help.
I have implemented most of the required components, but whenever I try to update the slip, it triggers the validate function which bypasses all my changes. How did you bypass this? Thanks.
Hello @niteya, I read all replies to this post but was wondering if there is any chance I could achieve the following workflow through hooks and existing attendance features provided by ERPNext.
Suppose an employee has worked 6 hours last day and 7 hours today. Daily work hours for this employee are 8. With current support from ERPNext features, I can deduct salary based on payment days, which do not take into account the working hours of employees.
In this scenario, the employee has not completed his working hours but is marked “present” for both days. How can I deduct the salary in the salary slip, if the employee has worked less than 8 hours a day? Also, if the employee compensates his working hours some other day, how can I take that into account and tell the system not to deduct the salary then?
Please note that Timesheets is not an option for me. I would really appreciate your help on this. Thank you.
@Aamir_Khan, based on the scenario you mentioned, You could add a custom field to capture the total working hours in the salary slip. Trigger the calculation of total working hours for the salary period using hooks (before_insert) when a salary slip is created.
While configuring the salary structure set a deduction salary component with a condition to trigger the component only if the total working hours are not met and formula based on the total working hours.
When payroll entry generates salary slips the salary component would get added based on the condition and formula.
Hey @bibinqcs, thanks for taking out time to respond.
As you have mentioned:
I doubt if it’s possible to access total_working_hours in the salary component or salary structure formulas. How can I get past this problem first. Also, how can I deal with compensation? I guess that would be based on total monthly working hours and total monthly hours of employee.
You can add custom fields in Salary Slip, and use it in the formula of Salary Components and created a Salary Structure with it. I have done it
In the use case you mentioned,
You can calculate the deduction using the Payment Days field in salary slip to get working days for the salary period and find out the total monthly working hour and compare it with Total Working Hours for the employee from Attendance