Skip navigation
derrick@work
Currently Being Moderated

TimeSheet to round to nearest quarter hour

Jun 16, 2009 6:24 AM

I have this time sheet that has four "In" and four "Out" columns,and calculates hours worked in a two week pay period. There is a column on the right that calculates the hours worked for the day (see script below). I need it to round to the nearest quarter hour i.e.,

 

If an employee arrives or leaves between:

 

":00" to ":07" minutes after the hour, calculate from the top of the hour

 

":08" to ":22" minutes after the hour, calculate from quarter after the hour

 

":23" to ":37" minutes after the hour, calculate from the half hour

 

":38" to ":52" minutes after the hour, calculate from three quarters past the hour

 

":53" to ":60" minutes after the hour, calculate from the top of the hour

 


Examples:

 

An employee records that they arrived at 8:07 a.m. Calculate from 8:00

 

An employee records that they arrived at 8:08 a.m. Calculate from 8:15

 

An employee records that they arrived at 8:22 a.m. Calculate from 8:30

 

An employee records that they arrived at 8:37 a.m. Calculate from 8:45

 

An employee records that they arrived at 8:53 a.m. Calculate from 9:00

 

Script in "Hours Worked" column


// compute block 0
var StartInterval = 0
if(HasValue(OUTA1[0]) and HasValue(INA1[0])) then
StartInterval = Time2Num(OUTA1[0].formattedValue, "HH:MM") - Time2Num(INA1[0].formattedValue, "HH:MM")
endif

 


// compute block 1
var LunchInterval = 0
if(HasValue(OUTA1[1]) and HasValue(INA1[1])) then
LunchInterval = Time2Num(OUTA1[1].formattedValue, "HH:MM") - Time2Num(INA1[1].formattedValue, "HH:MM")
endif

 


// compute block 2
var EndInterval = 0
if(HasValue(OUTA1[2]) and HasValue(INA1[2])) then
EndInterval = Time2Num(OUTA1[2].formattedValue, "HH:MM") - Time2Num(INA1[2].formattedValue, "HH:MM")
endif

 


// compute total time in hours from the millisecond value
Round(Sum(StartInterval, LunchInterval, EndInterval) / 3600000,2)

 

I know in excel I can use =(ROUND(B2*96, 0)/96)-(ROUND(A2*96, 0)/96) to get the results I want. So I tried entering in something similar into the FormCalc script but with no luck. If you could tell me what I need to do to get this to work I'd be very appreciative. Thank you, Derrick

Attachments:
 
Replies
  • Currently Being Moderated
    Jun 16, 2009 7:34 AM   in reply to derrick@work

    It is clearly for Acrobat's AcroForms and not LiveCycle Designer forms. It is a document level user defined JavaScript funciton. You call the function with the start time and end time fields. The function then uses the field names to get the field values and convert those strings to the value of the JavaScript'x date time object. For each date time object a second user function is called to round the values to the nearest 15 minutes, quarter hour.

     

    You do not have the code for the second user defined function.

     

    The function then converts the rounded time values to hours and then computes the difference and returns this difference to the location where the functions was called from.

     

    A function that takes variable input and returns a result is used because within a time sheet, one could have from 5 to 28 repatitions of this type of calculation with only the name of the imput fields being changed.

     

    The code can be simplier in LiveCycle Designer because LiveCycle Designer FormCalc does some of the work that one needs to do in JavaScript. But one could modify this code to work in LiveCycle Designer JavaScript.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 16, 2009 11:53 AM   in reply to derrick@work

    I would change your FormCalc script to look like this..........

     

    var timeStamp
    var timeOut
    var timeIn
    var Cat
    var timep1
    var timep2

     

    var StartInterval

    if (HasValue(OUTA1[0]) and HasValue(INA1[0])) {
    timeStamp = OUTA1[0].rawValue //OUTA1[0].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) {
      timeOut = Concat(timep1, ":", "00")
    }
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) {
      timeOut = Concat(timep1, ":", "15")
    }
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) {
      timeOut = Concat(timep1, ":", "30")
    }
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) {
      timeOut = Concat(timep1, ":", "45")
    }
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) {
      timeOut = Concat(timep1+1, ":", "00")
    }

    timeStamp = INA1[0].rawValue //INA1[0].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) {
      timeIn = Concat(timep1, ":", "00")
    }
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) {
      timeIn = Concat(timep1, ":", "15")
    }
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) {
      timeIn = Concat(timep1, ":", "30")
    }
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) {
      timeIn = Concat(timep1, ":", "45")
    }
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) {
      timeIn = Concat(timep1+1, ":", "00")
    }

    StartInterval = Time2Num(timeOut, "HH:MM") - Time2Num(timeIn, "HH:MM")
    }else {
    StartInterval = 0
    }


    var LunchInterval

    if (HasValue(OUTA1[1]) and HasValue(INA1[1])) {
    timeStamp = OUTA1[1].rawValue //OUTA1[1].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) {
      timeOut = Concat(timep1, ":", "00")
    }
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) {
      timeOut = Concat(timep1, ":", "15")
    }
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) {
      timeOut = Concat(timep1, ":", "30")
    }
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) {
      timeOut = Concat(timep1, ":", "45")
    }
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) {
      timeOut = Concat(timep1+1, ":", "00")
    }

    timeStamp = INA1[1].rawValue //INA1[1].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) {
      timeIn = Concat(timep1, ":", "00")
    }
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) {
      timeIn = Concat(timep1, ":", "15")
    }
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) {
      timeIn = Concat(timep1, ":", "30")
    }
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) {
      timeIn = Concat(timep1, ":", "45")
    }
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) {
      timeIn = Concat(timep1+1, ":", "00")
    }

    LunchInterval = Time2Num(timeOut, "HH:MM") - Time2Num(timeIn, "HH:MM")
    }else {
    LunchInterval = 0
    }

     

    var EndInterval

    if (HasValue(OUTA1[2]) and HasValue(INA1[2])) {
    timeStamp = OUTA1[2].rawValue //OUTA1[2].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) {
      timeOut = Concat(timep1, ":", "00")
    }
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) {
      timeOut = Concat(timep1, ":", "15")
    }
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) {
      timeOut = Concat(timep1, ":", "30")
    }
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) {
      timeOut = Concat(timep1, ":", "45")
    }
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) {
      timeOut = Concat(timep1+1, ":", "00")
    }

    timeStamp = INA1[2].rawValue //INA1[2].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) {
      timeIn = Concat(timep1, ":", "00")
    }
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) {
      timeIn = Concat(timep1, ":", "15")
    }
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) {
      timeIn = Concat(timep1, ":", "30")
    }
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) {
      timeIn = Concat(timep1, ":", "45")
    }
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) {
      timeIn = Concat(timep1+1, ":", "00")
    }

    EndInterval = Time2Num(timeOut, "HH:MM") - Time2Num(timeIn, "HH:MM")
    }else {
    EndInterval = 0
    }

    // compute total time in hours from the millisecond value
    Round(Sum(StartInterval, LunchInterval, EndInterval) / 3600000,2)

     

     

    may have to tweak little in this code, hope you can handle it form here.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 16, 2009 1:15 PM   in reply to derrick@work

    Well this one I can actually answer, I'm fairly new to scripting wiht LCD myself.  I've done this several times myself.  Be sure to check that your scripting language is set to Formcalc and not Java.  If were using Java previously and forgot to change to Formcalc you will get that scripting error.  Easy mistake and very frustrating.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 16, 2009 1:17 PM   in reply to derrick@work

    your attachment says queued....... I am not able to open it. Would you mind email your template to "n_varma AT lycos.com".

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 16, 2009 2:08 PM   in reply to derrick@work

    Here you go....... It was silly mistake on my part....... messed up with syntax. FormCalc do not like "{, }"  instead we use "Then, Endif"

     

     

    var timeStamp
    var timeOut
    var timeIn
    var Cat
    var timep1
    var timep2

    var StartInterval

    if (HasValue($.parent.OUTA1[0]) and HasValue($.parent.INA1[0])) then
    timeStamp = $.parent.OUTA1[0].rawValue //OUTA1[0].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) then
      timeOut = Concat(timep1, ":", "00")
    endif
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) then
      timeOut = Concat(timep1, ":", "15")
    endif
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) then
      timeOut = Concat(timep1, ":", "30")
    endif
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) then
      timeOut = Concat(timep1, ":", "45")
    endif
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) then
      timeOut = Concat(timep1+1, ":", "00")
    endif

    timeStamp = $.parent.INA1[0].rawValue //INA1[0].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) then
      timeIn = Concat(timep1, ":", "00")
    endif
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) then
      timeIn = Concat(timep1, ":", "15")
    endif
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) then
      timeIn = Concat(timep1, ":", "30")
    endif
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) then
      timeIn = Concat(timep1, ":", "45")
    endif
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) then
      timeIn = Concat(timep1+1, ":", "00")
    endif

    StartInterval = Time2Num(timeOut, "HH:MM") - Time2Num(timeIn, "HH:MM")
    else
    StartInterval = 0
    endif

    var LunchInterval

    if (HasValue($.parent.OUTA1[1]) and HasValue($.parent.INA1[1])) then
    timeStamp = $.parent.OUTA1[1].rawValue //OUTA1[1].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) then
      timeOut = Concat(timep1, ":", "00")
    endif
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) then
      timeOut = Concat(timep1, ":", "15")
    endif
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) then
      timeOut = Concat(timep1, ":", "30")
    endif
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) then
        timeOut = Concat(timep1, ":", "45")
    endif
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) then
      timeOut = Concat(timep1+1, ":", "00")
    endif

    timeStamp = $.parent.INA1[1].rawValue //INA1[1].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) then
      timeIn = Concat(timep1, ":", "00")
    endif
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) then
    timeIn = Concat(timep1, ":", "15")
    endif
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) then
      timeIn = Concat(timep1, ":", "30")
    endif
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) then
      timeIn = Concat(timep1, ":", "45")
    endif
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) then
      timeIn = Concat(timep1+1, ":", "00")
    endif

    LunchInterval = Time2Num(timeOut, "HH:MM") - Time2Num(timeIn, "HH:MM")
    else
    LunchInterval = 0
    endif

    var EndInterval

    if (HasValue($.parent.OUTA1[2]) and HasValue($.parent.INA1[2])) then
    timeStamp = $.parent.OUTA1[2].rawValue //OUTA1[2].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) then
      timeOut = Concat(timep1, ":", "00")
    endif
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) then
      timeOut = Concat(timep1, ":", "15")
    endif
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) then
      timeOut = Concat(timep1, ":", "30")
    endif
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) then
      timeOut = Concat(timep1, ":", "45")
    endif
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) then
      timeOut = Concat(timep1+1, ":", "00")
    endif

    timeStamp = $.parent.INA1[2].rawValue //INA1[2].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) then
      timeIn = Concat(timep1, ":", "00")
    endif
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) then
      timeIn = Concat(timep1, ":", "15")
    endif
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) then
      timeIn = Concat(timep1, ":", "30")
    endif
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) then
      timeIn = Concat(timep1, ":", "45")
    endif
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) then
    timeIn = Concat(timep1+1, ":", "00")
    endif

    EndInterval = Time2Num(timeOut, "HH:MM") - Time2Num(timeIn, "HH:MM")
    else
    EndInterval = 0
    endif

    // compute total time in hours from the millisecond value
    Round(Sum(StartInterval, LunchInterval, EndInterval) / 3600000,2)

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 16, 2009 3:16 PM   in reply to derrick@work

    Improved again to fix other possible issues...........

     

    var timeStamp
    var timeOut
    var timeIn
    var Cat
    var timep1
    var timep2
    var timep3
    var timep4

    var StartInterval

    if (HasValue($.parent.OUTA1[0]) and HasValue($.parent.INA1[0])) then
    timeStamp = $.parent.OUTA1[0].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    timeStamp = $.parent.INA1[0].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)
       xfa.host.messageBox(timep1)
      endif
    endif

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) then
      timeOut = Concat(timep1, ":", "00")
    endif
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) then
      timeOut = Concat(timep1, ":", "15")
    endif
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) then
      timeOut = Concat(timep1, ":", "30")
    endif
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) then
      timeOut = Concat(timep1, ":", "45")
    endif
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) then
      timep1 = timep1+1
      if (timep1 <= 9) then
       timep1 = Concat("0", timep1)
    //   xfa.host.messageBox(timep1)
      endif
      timeOut = Concat(timep1, ":", "00")
    endif

    if (Ceil(timep4) >= 0 and Ceil(timep4) <= 7) then
      timeIn = Concat(timep3, ":", "00")
    endif
    if (Ceil(timep4) >= 8 and Ceil(timep4) <= 22) then
      timeIn = Concat(timep3, ":", "15")
    endif
    if (Ceil(timep4) >= 23 and Ceil(timep4) <= 37) then
      timeIn = Concat(timep3, ":", "30")
    endif
    if (Ceil(timep4) >= 38 and Ceil(timep4) <= 52) then
      timeIn = Concat(timep3, ":", "45")
    endif
    if (Ceil(timep4) >= 53 and Ceil(timep4) <= 59) then
      timep3 = timep3+1
      if (timep3 <= 9) then
       timep3 = Concat("0", timep3)
    //   xfa.host.messageBox(timep1)
      endif
      timeIn = Concat(timep3, ":", "00")
    endif

    StartInterval = Time2Num(timeOut, "HH:MM") - Time2Num(timeIn, "HH:MM")
    else
    StartInterval = 0
    endif

    var LunchInterval

    if (HasValue($.parent.OUTA1[1]) and HasValue($.parent.INA1[1])) then
    timeStamp = $.parent.OUTA1[1].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    timeStamp = $.parent.INA1[1].formattedValue
    Cat = At(timeStamp,":")
    timep3 =  Left(timeStamp, Cat-1)
    timep4 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep1) < Ceil(timep3)) then
      timep1 = timep1+12
    endif

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) then
      timeOut = Concat(timep1, ":", "00")
    endif
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) then
      timeOut = Concat(timep1, ":", "15")
    endif
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) then
      timeOut = Concat(timep1, ":", "30")
    endif
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) then
      timeOut = Concat(timep1, ":", "45")
    endif
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) then
      timep1 = timep1+1
      if (timep1 <= 9) then
       timep1 = Concat("0", timep1)
    //   xfa.host.messageBox(timep1)
      endif
      timeOut = Concat(timep1, ":", "00")
    endif

    if (Ceil(timep4) >= 0 and Ceil(timep4) <= 7) then
      timeIn = Concat(timep3, ":", "00")
    endif
    if (Ceil(timep4) >= 8 and Ceil(timep4) <= 22) then
      timeIn = Concat(timep3, ":", "15")
    endif
    if (Ceil(timep4) >= 23 and Ceil(timep4) <= 37) then
      timeIn = Concat(timep3, ":", "30")
    endif
    if (Ceil(timep4) >= 38 and Ceil(timep4) <= 52) then
      timeIn = Concat(timep3, ":", "45")
    endif
    if (Ceil(timep4) >= 53 and Ceil(timep4) <= 59) then
      timep3 = timep3+1
      if (timep3 <= 9) then
       timep3 = Concat("0", timep3)
    //   xfa.host.messageBox(timep1)
      endif
      timeIn = Concat(timep3, ":", "00")
    endif

    LunchInterval = Time2Num(timeOut, "HH:MM") - Time2Num(timeIn, "HH:MM")
    else
    LunchInterval = 0
    endif

    var EndInterval

    if (HasValue($.parent.OUTA1[2]) and HasValue($.parent.INA1[2])) then
    timeStamp = $.parent.OUTA1[2].formattedValue
    Cat = At(timeStamp,":")
    timep1 =  Left(timeStamp, Cat-1)
    timep2 = Right(timeStamp, len(timeStamp)- Cat)

    timeStamp = $.parent.INA1[2].formattedValue
    Cat = At(timeStamp,":")
    timep3 =  Left(timeStamp, Cat-1)
    timep4 = Right(timeStamp, len(timeStamp)- Cat)

    if (Ceil(timep1) < Ceil(timep3)) then
      timep1 = timep1+12
    endif

    if (Ceil(timep2) >= 0 and Ceil(timep2) <= 7) then
      timeOut = Concat(timep1, ":", "00")
    endif
    if (Ceil(timep2) >= 8 and Ceil(timep2) <= 22) then
      timeOut = Concat(timep1, ":", "15")
    endif
    if (Ceil(timep2) >= 23 and Ceil(timep2) <= 37) then
      timeOut = Concat(timep1, ":", "30")
    endif
    if (Ceil(timep2) >= 38 and Ceil(timep2) <= 52) then
      timeOut = Concat(timep1, ":", "45")
    endif
    if (Ceil(timep2) >= 53 and Ceil(timep2) <= 59) then
      timep1 = timep1+1
      if (timep1 <= 9) then
       timep1 = ""+Concat("0", timep1)
    //   xfa.host.messageBox(timep1)
      endif
      timeOut = Concat(timep1, ":", "00")
    endif

    if (Ceil(timep4) >= 0 and Ceil(timep4) <= 7) then
      timeIn = Concat(timep3, ":", "00")
    endif
    if (Ceil(timep4) >= 8 and Ceil(timep4) <= 22) then
      timeIn = Concat(timep3, ":", "15")
    endif
    if (Ceil(timep4) >= 23 and Ceil(timep4) <= 37) then
      timeIn = Concat(timep3, ":", "30")
    endif
    if (Ceil(timep4) >= 38 and Ceil(timep4) <= 52) then
      timeIn = Concat(timep3, ":", "45")
    endif
    if (Ceil(timep4) >= 53 and Ceil(timep4) <= 59) then
      timep3 = timep3+1
      if (timep3 <= 9) then
       timep3 = Concat("0", timep3)
    //   xfa.host.messageBox(timep1)
      endif
      timeIn = Concat(timep3, ":", "00")
    endif

    EndInterval = Time2Num(timeOut, "HH:MM") - Time2Num(timeIn, "HH:MM")
    else
    EndInterval = 0
    endif

    // compute total time in hours from the millisecond value
    Round(Sum(StartInterval, LunchInterval, EndInterval) / 3600000,2)

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points