I have a very simple time sheet that I need the total hours worked rounded to the nearest quarter of an hour.
An employee that arrives between 8 and 8:07 needs to be 8:00
An employee that arrives between 8:08 and 8:22 needs to be 8:15
An employee that arrives between 8:23 and to 8:37 needs to be 8:30
An employee that arrives between 8:38 and 8:52 needs to be 8:45
An employee that arrives between 8:53 and 9 needs to be 9:00.
I copied a FormCalc from one discussion but it is not working
var timeStamp
var timeOut
var timeIn
var Cat
var timep1
var timep2
var timep3
var timep4
var StartInterval
if (HasValue($.parent.TIME_OUT89) and HasValue($.parent.TIME_IN89)) then
timeStamp = $.parent.TIME_OUT89.formattedValue
Cat = At(timeStamp,":")
timep1 = Left(timeStamp, Cat-1)
timep2 = Right(timeStamp, len(timeStamp)- Cat)
timeStamp = $.parent.TIME_IN89.formattedValue
Cat = At(timeStamp,":")
timep3 = Left(timeStamp, Cat-1)
timep4 = Right(timeStamp, len(timeStamp)- Cat)
if (Ceil(timep1) < Ceil(timep3)) then
timep1 = timep1+12
if (timep1 <= 9) then
timep1 = Concat("0", timep1)
endif
if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) then
timeOut = Concat(timep1, ":", "00")
if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) then
timeOut = Concat(timep1, ":", "15")
if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) then
timeOut = Concat(timep1, ":", "30")
if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) then
timeOut = Concat(timep1, ":", "45")
if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) then
timep1 = timep1+1
if (timep1 <= 9) then
timep1 = Concat("0", timep1)
endif
timeOut = Concat(timep1, ":", "00")
if (Ceil(timep4) >= 0 and Ceil(timep4) <= 7) then
timeIn = Concat(timep3, ":", "00")
if (Ceil(timep4) >= 8 and Ceil(timep4) <= 22) then
timeIn = Concat(timep3, ":", "15")
if (Ceil(timep4) >= 23 and Ceil(timep4) <= 37) then
timeIn = Concat(timep3, ":", "30")
if (Ceil(timep4) >= 38 and Ceil(timep4) <= 52) then
timeIn = Concat(timep3, ":", "45")
if (Ceil(timep4) >= 53 and Ceil(timep4) <= 59) then
timep3 = timep3+1
if (timep3 <= 9) then
timep3 = Concat("0", timep3)
endif
timeIn = Concat(timep3, ":", "00")
StartInterval = Abs(Time2Num(TIME_OUT89, "HH:MM") - Time2Num(TIME_IN89, "HH:MM"))
StartInterval = 0
Round(Sum(StartInterval)/3600000,2)