Home      Ask a Question      My Stuff      Help   
  
Scripting - Shift Differential (Advanced)
This is used to more easily and more accurately split shifts at midnight and switch to different rated shifts, which because of the way our system handles punches could prove problematic.

Because of the way that our system works there are two issues that can make this hard:

1. Our system matches the in punch to the out punch regardless of if the out punch ends in a new day, and does not split the punch off at midnight and continue the time on a new day.

2. There previously wasn't a way to script things off of a split time because the system creates the split in a sort of way that is recognized in a very unique way.

This makes running a shift deferential based on a shifts that crosses midnight difficult. But there is a way to do this using scripting that can simplify it.

This can be done in two parts:

1. We create a script using two variables (in_date, punch_date) that can if you place the following lines towards the top of your script recognize and display the split time and day, and if the split is at midnight or a day not the same as the in punch it is pared to we can show the difference:

in_date = left(indt,10);
punch_date = left(punchdate,10);

Using additional scripting (not needed for this process) below is an example screen shot of what the above script does if there is a split at midnight on a time card and using our above script what dates it pulls:



As you can see in the image under the column "Actual Date" you can see the different dates even though the system creates the split punch on the same day. Also note that "+12:00am" also signifies the punch was made on a new day and because of how the system orders punches using the earliest time regardless of the date (12:00a comes before 8:00pm even though day wise it is the opposite).

Now that we can get the actual dates to appear correctly using our script we can then script against the different dates in our Shift Differential script. We use the below if statement:

if(in_date <> punch_date)

This tells the system if the dates are not the same for before and after the split then do something, like change the job code and or rate.

Below is an example of this in a shift differential script:

split (12:00am);

if("W" contains weekday (punchdate))
{
if(in_date <> punch_date)
{
category = " Thursday Shift";
payrate = payrate + 1;
}
else
{
category = "Wednesday Shift";
}
}

So in this script we:

1. First have our split at midnight "split (12:00am);"

2. Then we verify the day is Wednesday or in other words if the in punch was created on a Wednesday using "if("W" contains weekday (punchdate))".

3. Next is the critical part, "if(in_date <> punch_date)" if the date of the in punch and the date of the split punch are not the same/not equal then change the category to "Thursday Shift" and add a dollar to the current pay rate.

4. "Else" the category is "Wednesday Shift".

Below is a screen shot of the same time card and also running the next part of the script:



In the image we now see the category and rate change based on our midnight split (+12:00am).

Below is the complete compiled script:

in_date = left(indt,10);
punch_date = left(punchdate,10);

split (12:00am);

if("W" contains weekday (punchdate))
{
if(in_date <> punch_date)
{
category = " Thursday Shift";
payrate = payrate + 1;
}
else
{
category = "Wednesday Shift";
}
}




ID
576
Category
Training
  FAQ's
Date Created
5/31/2011 12:18:50 PM
Date Updated
5/31/2011 1:58:49 PM
Back to Search Results