diff --git a/calicut_textiles/public/python/payroll_entry.py b/calicut_textiles/public/python/payroll_entry.py index 94fa94a..f51504d 100644 --- a/calicut_textiles/public/python/payroll_entry.py +++ b/calicut_textiles/public/python/payroll_entry.py @@ -220,9 +220,7 @@ def create_overtime(pe, employees, employee_map, checkin_map, holiday_map): ) total_ot_minutes = 0 - total_early_minutes = 0 - total_late_minutes = 0 - + total_early_late_minutes = 0 for date, rows in checkin_map.get(emp, {}).items(): times = filter_noise([r.time for r in rows]) if len(times) < 2: @@ -256,6 +254,8 @@ def create_overtime(pe, employees, employee_map, checkin_map, holiday_map): total_ot_minutes += threshold + minutes(out_time - normal_end) # --------- LATE / EARLY (NON-HOLIDAY ONLY) --------- + total_early_minutes = 0 + total_late_minutes = 0 for row in rows: custom_late_coming_minutes = row.custom_late_coming_minutes if row.custom_late_coming_minutes else 0 custom_early_going_minutes = row.custom_early_going_minutes if row.custom_early_going_minutes else 0 @@ -263,6 +263,7 @@ def create_overtime(pe, employees, employee_map, checkin_map, holiday_map): total_late_minutes += int(custom_late_coming_minutes) if custom_early_going_minutes > early_threshold: total_early_minutes += int(custom_early_going_minutes) + total_early_late_minutes += total_early_minutes + total_late_minutes # if in_time > normal_start_for_late: # total_early_minutes += early_threshold + minutes(in_time - normal_start_for_late) @@ -285,7 +286,6 @@ def create_overtime(pe, employees, employee_map, checkin_map, holiday_map): round(rate * total_ot_minutes, 2), ot_component ) - total_early_late_minutes = total_early_minutes + total_late_minutes if total_early_late_minutes > 0: create_monthly_overtime( emp,