Home      Ask a Question      My Stuff      Help   
  
Scripting - Resetting Daily Overtime Calculations
In some cases there are employee's that work mid shifts and because the ending of their shift and start of a new shift can be on the same day the system will calculate both shifts as one towards overtime.

As an example an employee works from 10pm to 7am on Tuesday with a lunch break at 2am so he clocks out at 2am and back in at 3am which will put the in punch in most cases on Wednesday on his time card. He then clocks out at 7am which gives him a punch of 4 hours on a Tuesday punch and 4 hours on a Wednesday punch he then leaves for the day.

He then reports back for work at 10pm again on Wednesday and takes a later lunch at 5am to 6am then clocks out 7am. This gives him an additional 7 hours for Wednesday and 1 hour on a Thursday punch.

The problem arises for any overtime rules set for the day like overtime after 8 hours in a day. Since he made 4 hours on Wednesday on the end of his first and another 7 hours on Wednesday from the beginning of his following shift the system adds these up and gives him 8 hours of regular and an additional 3 hours of overtime (4 + 7 = 11 - 8 = 3).

This issue can be solved using two new scripts designed for this and which calculates time clocked OUT and depending the amount hours resets the overtime time back to zero on the next in punch.

The 'hoursclockedout' rule gives you a decimal number between 0 and 24 (hours in a day) to say how long the person has been clocked out. But you must check to make sure that the test number is GREATER than 0, (and possibly less than 24), before making a legitimate determination.

Note: Any test conditions less than 0 or more than 24 will not work.

Normally the calculation for the above script is the number of hours between an out punch to the next preceding in punch.

But if the out punch is missing, then Previous in will be used in its place. Likewise, if the current punch has an out but missing an in punch, then that out punch will be used instead.

Note: This script only looks backwards to punches that actually have IN or OUT times present.
*Note: Any non-regular punches (i.e. straight hours, bonus/commission entries, etc.) are ignored and skipped.

In conjunction to the above script we will use the 'resetotdayindex(0);' which tells the system that the CURRENT punch should be the start of a new day for same-day OT calculation purposes. (The number 0 is an empty parameter and is ignored, but needs to be present to tell the system you are calling a “function”).

Below is an example that reads, if the employee has been clocked out for more than '6' hours and less than '24' hours reset the same-day OT on the next in punch:

If (HoursClockedOut > 6 AND HoursClockedOut < 24)
{
ResetOTDayIndex(0);
}

You only need to Reset the OT Day Index of the first punch where the employee has returned for a new shift. Subsequent punches will continue the count.

Be advised these scripts will only work in combination and in this fashion and cannot be combined with other scripts.
ID
413
Category
Training
  FAQ's
Date Created
6/5/2009 9:52:12 AM
Date Updated
6/5/2009 2:55:36 PM
Back to Search Results