Home      Ask a Question      My Stuff      Help   
  
Scripting - Consecutive days, Overtime
Question
ID
473
Category
<Unassigned>
Date Created
3/1/2010 12:42:50 PM
Date Updated
8/12/2015 11:35:37 AM
How do I script overtime to happen after a certain number of consecutive days in the OT week?
Answer
We can script for the number of consecutive days worked in the work week using the OTDAYNUMBER keyword.

Some things to remember when using OTDAYNUMBER are:
1. The system looks at the work week only, not the pay period - what this means is that the days will only number 1-7, when the work week ends, the counter starts over.
2. The system must be in the phase of processing the overtime calculations. In order to do this we need write this script inside a DURING statement.

The system can evaluate against the OTDayNumber using greater-than, less-than, and equal to. Example: if(OTDaynumber > 5) would evaluate to TRUE for any hours worked on the 6th and 7th consecutive and days; if(OtDayNumber = 7) would evaluate to TRUE only on the 7th consecutive day worked.

Here is an example of a script using this concept:

DURING(CalculateOTThreshold)
{
if(Home1 <> "Non Union")
{
ot1daythreshold = 8;
ot1threshold = 40;
if(OtDayNumber = 6)
{
ot1daythreshold = 0;
}
}
}

*DURING will not work if it is placed in an IF statement. This example shows us testing for the 6th consecutive day and creating a special rule for it. The code example says that all hours on the 6th consecutive day will be counted as overtime.

*Just to make sure this part is clear - the OTDayNumber counts the number of consecutive days the employee has worked work within the OT week (aka work week). The first day worked is 1, the second day is 2, and so on. It will reset back to 1 whenever an entire day goes by without any OT eligible clocked hours OR whenever a new work week is started.

TIMEWORKSPLUS NOTE
While the same outcome could be done in TimeWorksPlus through scripting, it is not necessary in TWP to use the DURING(CalculateOTThreshold) line. Instead, TWP uses the OTThreshold Script box for scripting overtime.

An example of how this script would look in TWP would be:
if(employee.home1 <> "Non Union")
{
ot1daythreshold = 8;
ot1threshold = 40;
if(OtDayNumber = 6)
{
ot1daythreshold = 0;
}
}

Back to Search Results