Home      Ask a Question      My Stuff      Help   
  
TimeWorksPlus: Scripting - Split at the moment of Overtime
The following script will split at the moment they reach Overtime which is set by the "$ot" variable in the below script currently set to 40 and change the category to OT. You will need OT set up as a punch category in the PunchCategories rule and place the script in the SplitPostReportingDateScript:

$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);
$uptohours = round($uptohours, 2);
if($uptohours >= $ot and istimes){
category = "OT";
}

//HD Edited on 9/3/18 to remove weird characters. Same script, just reformatted in Notepad++ so it is easily copied without errors. Also added category of "Scripting" to this article.
ID
1089
Category
>Support
  Scripting
Date Created
1/27/2014 9:19:28 AM
Date Updated
9/3/2018 7:03:42 PM
Back to Search Results