Timesheet PDF form: split total hours into regular and overtime (40-hour week)
I’m sharing the calculation scripts I use for a timesheet PDF form. Make sure TotalHours comes first in the calculation order (Tools > Prepare a Form > More > Set Field Calculation Order).
Regular hours field (custom calculation script):var t = Number(this.getField("TotalHours").value) || 0;event.value = Math.min(t, 40);
Overtime hours field:var t = Number(this.getField("TotalHours").value) || 0;event.value = Math.max(0, t - 40);
For example, 46 hours gives 40 regular and 6 overtime. To check what that overtime is worth in pay, a free overtime pay calculator lets you enter the rate and hours. Has anyone found a cleaner way to handle weeks where the normal hours are not 40?
