Home      Ask a Question      My Stuff      Help   
  
TimeWorksPlus: Scripting - Overtime Allocation to other departments
*NOTE* This script only works for weekly overtime, and only up to 2 punch sets each day.

The following script will allocate overtime hours to departments that are not their home department first, and then allocate the rest to their home department. You will need to change the following for it to apply to your client:

1. Change FieldNameOfDepartmentPrompt to whatever the field name of your department clock prompt is.

2. If the home department of the employee is not in the department field, it will have to be changed to what field you are validating off of like employee.location instead of employee.department.

3. Set up a Numeric clock prompt that shows online but does not collect anything that is whole numbers and has a field name of 'overtimehours'

$diff = reportingdate.weekhours("Regular") - 40;
$leftoverothours = $diff - reportingdate.totalweek("overtimehours");
if(FieldNameOfDepartmentPrompt != employee.department and reportingdate.weekhours("Regular") > 40 and $leftoverothours > 0){
if($leftoverothours > hours){
ot1daythreshold = 0;
overtimehours = hours;
}
else
{
ot1daythreshold = (hourstopunchot + hours) - ($leftoverothours + reportingdate.totalday("overtimehours"));
overtimehours = $leftoverothours;
}
}
ID
1154
Category
<Unassigned>
Date Created
4/11/2014 1:26:24 PM
Date Updated
8/17/2015 1:13:43 PM
Back to Search Results