Home      Ask a Question      My Stuff      Help   
  
Scripting - Shift Differentials (Advanced) (OLD)
Note: This is an older process for shift differentials. Though it still can work, a new process has been developed that is easier and more accurate to use here Scripting - Shift Differential (Advanced). This is left in mostly for reference purposes.

Sometimes when doing a shift differential script issues arise when clients may want to do a week long shift differential to include the weekends or in other words Sunday through Saturday and they want multiple differentials not only based on times but on days of the week.

The best way to explain this would be to give an example and go through the steps of creating the script:

1. Three shifts for Monday through Friday.
a. 6:00am - 2:00pm (Day Shift)
b. 2:00pm - 10:00pm (Mid Shift)
c. 10:00pm - 6:00am (Night Shift)

2. They also want Saturday and Sunday to be a 'Weekend Shift' for the whole day so from 12:00am on Saturday till 11:59:59pm on Sunday.

Now with this request issues happen with the Friday 'Night Shift' and the Monday 'Night Shift' as now these days will have to make allowances when the times cross midnight and change over from Fridays 'Night Shift' to the 'Weekend Shift' and on Sunday when it crosses midnight and changes from 'Weekend Shift' to Mondays 'Night Shift'.

So now it looks like this:

1. Three Shifts for Monday
a. 12:00am - 2:00pm (Dayshift)
b. 2:00pm - 10:00pm (Mid Shift)
c. 10:00pm - 6:00am (Night Shift)

2. Three shifts for Tuesday - Thursday.
a. 6:00am - 2:00pm (Day Shift)
b. 2:00pm - 10:00pm (Mid Shift)
c. 10:00pm - 6:00am (Night Shift)

3. Three shifts for Friday.
a. 6:00am - 2:00pm (Day Shift)
b. 2:00pm - 10:00pm (Mid Shift)
c. 10:00pm - 11:59:59am (Night Shift)

4. One Shift for Saturday and Sunday.
a. 12:00am (Saturday) - 11:59:59pm (Sunday) (Weekend Shift)

Now for the really big issue. Because of the way our system works when times cross midnight, the system will always try to keep an out punch assigned to the same day as the preceding in punch.

So if there is an in punch at 10:00pm on Sunday and the next out punch is at 6:00am all the punches will be still assigned to Sunday instead of splitting the day at midnight and placing the times from then on, on Monday (12:00am - 6:00am).

In effect this also messes up the differential and placing even the Monday hours of 'Night Shift' (12:00am - 6:00am) as 'Weekend Shift' because it considers all hours as Sunday time.

This will also do the same with Friday with it sticking to 'Night Shift' and not switching to 'Weekend Shift' at midnight instead of switching to the Saturday 'Weekend Shift' at 12 midnight.

To get around this we will have to set up boundaries or test conditions based on times for Friday (into Saturday) and Sunday (into Monday) so that it will display the correct category on the correct day and not carry over or exclude the following days category.

An example of the 'Weekend Shift' (Sat-Sun) and the 'Night Shift' for Friday and Monday is below:

1. 'Weekend Shift'. If it's Saturday or Sunday change the category to 'Weekend Shift'.

if ("US" contains weekday (punchdate)){
category = "Weekend Shift";}

2. Sunday 'Weekend Shift' into Monday 'Night Shift'. If it's Sunday split the time at midnight (12:00am). If the in time is 12am (which our split will create) and the out time is less than 8am split the time at 6am and name the category 'Night Shift'.

The 8am out time is an example time used to tell the system that this is now Monday. This may fluctuate depending on your situation. What you want to remember is that you want your boundary or test condition to be a time that you are sure that someone working the night shift will not work past so as to distinguish them from the Monday day shift workers.

if ("U" contains weekday (punchdate)){
split (12:00am);}
if (intime = 12:00am){
if (outtime < 8:00am){
split (6:00am); category = "Night Shift";}}}

3. On the Friday 'Night Shift' into the Saturday 'Weekend Shift'. If it's Friday split the time at 12 midnignt which is when the 'Nightshift' starts. If the in time is equal to 12 midnight (which our split will create) and the out time is less than 8am split the time at 12 am and name the category 'Weekend Shift'.

The 6pm on is an example time used to tell the system that this is now Monday. This may fluctuate depending on your situation. What you want to remember is that you want your boundary or test condition to be a time that you are sure that someone working the night shift will not work past.

if ("F" contains weekday (punchdate)){
split (10:00pm);
if (intime >= 6:00pm){
payrate = payrate + 1.00; category = "Nightshift";}}



ID
406
Category
Training
  FAQ's
Date Created
6/3/2009 7:24:27 AM
Date Updated
7/14/2011 1:08:09 PM
Back to Search Results