TimeWorksPlus Knowledge Base

Split at the Moment of Overtime - TWP

Last Updated: Dec 15, 2017 07:22AM MST
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.

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 meand 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($uptohoursinc > $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.
  • Get More in Support Center

    Swipeclock partners can submit cases to technical support and view additional articles in Support Center.

    Your accountant login to TimeWorksPlus is required to access Support Center.
75a03bdcd095922b9b9f549098e014fe@swipeclock.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete