Home      Ask a Question      My Stuff      Help   
  
Scripting - Rounding Lunch Punches
Be advised this only ideally works if an employee only clocks out once a day during his shift for a lunch.

Sometimes rounding can be made difficult as in most cases when you round it also affects the first in and out punches.

But using the "isfirsttoday" and "islasttoday" keywords and test for a false statement meaning these punches are not the first or the last punch of the day we can round interior punches.

To use an example, say you have employees that are supposed to clock out for lunch at 11:00am everyday for lunch we can with rounding now round those lunch punches and not affect any first in or last out punches that may overlap. See the below example:

if (isfirsttoday = false)
{
roundout ("10:30am - 11:00am = 11:00am");
}

As you can see we use the a script that provides a 30 minute range that if he clocks out anywhere between 10:30am to 11:00am then round to 11:00am his normal clock out time.

So what if an employee is allowed a 60 minute break and knows if he clocks in early his in time and out times will be rounded so that he will still get the 60 minute break deducted and not get any extra time for clocking in early.

if (minutesout (0) > 0 and minutesout (0) < 30)
{

OffsetMinutes = 30 - minutesout(0);
OldInTime = dateadd("n",0,intime);
RoundedInTime = dateadd("n",OffsetMinutes,intime);
RoundString = ("" + OldInTime + "-" + RoundedInTime + "=" + RoundedInTime);

roundin(RoundString);
x = RoundString;
}
ID
562
Category
Training
  FAQ's
Date Created
5/9/2011 3:03:10 PM
Date Updated
10/4/2011 12:12:37 PM
Back to Search Results