Split at the Moment of Overtime - TWP

This script determines the moment an employee reaches 40 hours and splits the punchset at that time. It will also change all hours after the split to a separate category called "OT". This can be useful if overtime is paid at a rate other than 1.5x or you need to apply a different shift premium to overtime hours.

IMPORTANT: This script is heavily affected by other scripts and rules in place on an account. For that reason, use this script at your own risk. If you are unsure about how to implement or test this script, please reach out to support.

Why Would This Script be Necessary?

The reason this script is necessary is that by default, Overtime is not an individual punch category rather, it is a type of Regular hours. If you go to the PunchCategories rule, you will notice Overtime is not listed on its own. Instead, you will see categories that are Overtime eligible and have an option for an overtime name. This also means the time card doesn't show the exact time overtime was reached. This script will identify the actual time that overtime was reached by splitting the punch at that time.

Script for Splitting at 40 Hours in a Week

  1. Go to the PunchCategories rule and add a new category called "OT"
  2. Copy and paste the following script into the SplitPostReportingDateScript rule. 
$ot = 40;
$whours = reportingdate.hourstodateot;
$dhours = reportingdate.totalhoursot;
$uptohours = hourstopunchot + ($whours - $dhours);
$uptohoursinc = $uptohours + hours;
$uptohoursinc = round($uptohoursinc, 2);

if($uptohoursinc > $ot and $uptohours < $ot and istimes and category <> "OT" and reportingdate.totalhours("OT") = 0){
     ogcat = category;
     $diff = $ot - $uptohours;
     category = "OT";
     split(dateadd("h", $diff, intime),false,true);
     category = ogcat;

$whours = reportingdate.hourstodateot;
$dhours = reportingdate.totalhoursot;
$uptohours = hourstopunchot + ($whours - $dhours);
$uptohoursinc = $uptohours + hours;
$uptohours = round($uptohours, 2);
if($uptohours >= $ot and istimes){
     category = "OT";}


Splitting at a Moment Other Than 40 Hours

This can be done with the exact same script with one alteration. In the first line, change the $ot variable from 40 to your preferred amount.

Did you find this article helpful?