Home      Ask a Question      My Stuff      Help   
  
Scripting - Changing or Excluding Hours for Holiday Worked for Night Shift Workers
Question
ID
457
Category
Training
  FAQ's
Date Created
1/15/2010 11:12:27 AM
Date Updated
1/9/2013 1:08:54 PM
We have employees that have times that cross midnight. For holidays they work on the day before and cross midnight into the holiday but do not get the holiday worked pay. How can we resolve this?
Answer
The way the system works is that all times are assigned to the initial in punch so with this issue because the shift started on the day before the holiday all times are assigned to that day even if there are times they work that crossed midnight and are actually holiday hours.

Through scripting we can fix this by making the day before a holiday a holiday also but for only hours that cross midnight.


==THE DAY BEFORE A HOLIDAY CROSSING INTO THE HOLIDAY (CROSSING 12:00AM)==

To do this we would use a Floating Holiday script (Scripting - Floating Holidays) that if it is the day before the holiday and there are hours worked create a split at midnight then make all hours after midnight holiday worked pay.

Below we will us the example of the day before Christmas or Chrsitmas Eve (12/24/2009) as our holiday:

if ((dateadd("m", 0, "12/24/2009") = punchdate) or //Christmas Eve
(dateadd("m", 0, "12/31/2009") = punchdate)) //New Years Eve
{
if (istimes = true)
{
split (12:00am);
if (intime = 12:00am)
{
category = "Holiday Worked";
}}}

So the first line is scripting for the day (Floating Holiday). The next line uses the "istimes" keyword that ensures this will only work for actual time worked. If so our next line specifies to split (Scripting - Splits) the time at 12:00am (midnight).

Our next condition states that if the in punch is midnight which our split will create then any times after that will be category "Holiday Worked".


==THE DAY AFTER A HOLIDAY CROSSING OUT OF THE HOLIDAY (CROSSING MIDNIGHT)==

Another issue is that on the day of the holiday Night Shift worker also come across the problem of hours that start on the holiday but end on the day after (after midnight).

Our next example shows how to have it exclude hours from being changed to a "Holiday Worked" category. Using an example of an employee that works the Night Shift on a Holiday and the shift crosses into the day after the Holiday which our client does not want included and changed to our "Holiday Worked" category but remain as "Regular" time.

So what we can do through scripting is to sort of reverse our above script.

In our below example script if it is a Holiday we have it react to the day after first then the Holiday:

if (isholiday)
{
split (12:00am);
if (intime = 12:00am)
{
category = "Regular";
}
else
{
category = "Holiday Worked";
}}

So in our script it states that:

1. If it is a Holiday (isholiday) first split 12:00am or Midnight.

2. Next if the in time is equal to 12:00am (which was created by our split) then make all hours after that category "Regular" or the default category as these are hours for the day after the Holiday.

3. Lastly we use the "else" keyword next that states if their in time does not equal 12:00am or in other words any hours that are worked before Midnight then change the category to "Holiday Worked".

A side note on this, as with any shift that crosses midnight and since our system does not order times chronologically from punch to punch but strictly on the time value of the punches when crossing midnight it will be out of sequence as the system will always take the lowest value and enter it first which our split creates (12:00am).

The way the system distinguishes this for read ability is to add a "+" in front of the time to signify +1 day or the next day or for our example +12:00am.

Attached is a screen shot of this working for both of our examples (Before to the Holiday and the Holiday to the Day after) as well as the above noted "+12:00am" times out of sequence:



Back to Search Results