Use Case: An employee's overtime is recorded using timesheets, and the employee needs to be compensated for the same during payroll apart from his usual salary.
Steps:
Create an Employee.
Create a Salary Component called "Overtime" of type Earning.
Create a Salary Structure and include "Overtime" with amount set to 0.
In the Salary Structure itself, select the "Salary Slip Based on Timesheet" checkbox, select Salary Component as "Overtime" and enter the Hour Rate.
Submit the Salary Structure and assign this Salary Structure to an Employee via Salary Structure Assignment.
Create Timesheets for this Employee through the Timesheet DocType.
In the above example shown, the Employee has worked overtime for a total of 8 hours in the month of January.
Create a new Payroll Entry for the month of January and select the "Salary Slip Based on Timesheet" checkbox. Save. Click on the "Get Employees" button. Next, click on "Create Salary Slips".
The Salary Slip of the employee will fetch all the timesheets (if any) of that employee created for that particular month and calculate the Overtime Component in the Salary Slip accordingly.