How do i get the data from timesheet to salary component?

as you can see on the screenshot. I have 2 types of Activity Type; “Regular” and “Regular OT”

I want to fetch the hours time base on the ACTIVITY TYPE in the timesheet to my Salary Component.
the default settings the Salary Component fetching the total working hours.
I want to separate it, is that possible?

I will create 2 kinds of Salary Component
#1 Name: Regular day, Condition: , Formula, (no condition and formula, because it fetching the total working hours as default in the system)

#2 Name: Regular Overtime, What do i need to put in the condition or in the formula to fetch the data (hours) from timesheet base on the Activity Type; “Regular OT”.

Thank you!

i tried this code in my salary component but i got Syntax error

activity_type = "Regular"
total_hours = frappe.db.get_value("Timesheet Detail", {"parent": Timesheet, "activity_type": activity_type}, "SUM(hours)")
hour_rate = doc.hour_rate
if total_hours and hour_rate:
    return total_hours * hour_rate
else:
    return 0.0```

anyone can help me please?
1 Like

anyone please? Thanks!

1 Like