Home      Ask a Question      My Stuff      Help   
  
Script - Rounding Break and Lunch Times
The below script allows you to script a break time to a set amount by rounding the in and out punch to the value you set. "Minutesout(0)" only gives you a minute value, it does not give seconds, or a decimal. This could potentially causes the time to round incorrectly.

For TimeWorks the scripting would be:

timeout = 10;

if (minutesout (0) > 0 and minutesout(0) < timeout)
{
RoundString = ("" + dateadd("n",0,intime) + "-" + dateadd("n",(timeout - minutesout(0)),intime) + "=" + dateadd("n",(timeout - minutesout(0)),intime));
round(RoundString);
}


For TimeWorksPlus the scripting would be the following and would need to be placed in the RoundScript:

timeout = 10;

if (minutesout(false)> 0 and minutesout(false) < timeout)
{
RoundString = ("" + dateadd("n",0,intime) + "-" + dateadd("n",(timeout - minutesout(false)),intime) + "=" + dateadd("n",(timeout - minutesout(false)),intime));
round(RoundString);
}


The above script states that if there is an out time of less than 10 minutes round the punches so that the out time and the proceeding in time makes the time out exactly 10 minutes.

This is easily editable to any other times just by editing that first line. So now it states "timeout = 10;" but this can easily be changed to 30 minutes by changing that line to "timeout = 30;". So with that if they have an out time for a break that is less than 30 minutes, round the punches so that the out time and the proceeding in time makes the time out exactly 30 minutes.

NOTE: There is a draw back in that it will do this every time it sees an out punch to an in punch of less than the marked Timeout minutes. So it is an either on or off thing.

ID
649
Category
>Support
  Rounding
Date Created
10/18/2011 11:01:07 AM
Date Updated
4/24/2018 9:58:58 AM
Back to Search Results