3 Replies Latest reply on Aug 30, 2010 9:22 AM by philmodjunk

    Logging work hours



      Logging work hours


      Hello FMForum,

      I'm searching for yet another piece of coding that I can cannibalize.  What I want to do is log the hours that each employee has worked as well as whether they are getting regular, "time-and-a-half pay" or "double-time pay."  Also, it should state whether they got their 34 hours of off-time.  And if they are called in to work a short day, then they are logged, at least, 4 hours of work time.

      Phew! That just feels like a tall order.  If you've even got a part of the solution to offer, it would still be a step in the right direction. 

        • 1. Re: Logging work hours

          Have you searched this forum using keywords such as "time sheet" or "time and a half"? I know there have been several such threads in the past you might want to check out.

          Generally you'll want to log time with timestamp fields (They will compute correctly even for people working past midnight) instead of time.

          You can log people in with one such record per day (Shift) or one such record each time they log in and and out--there are trade off's with each approach and your particular business model can make one or the other a better "fit". If you need them to log in and out with each break, the second option may be the easier to work with.

          Computing totals from this such as total time worked, time and a half time, time off etc. can be computed from either summary fields in the time sheet table or with aggregate functions such as sum in a related table.

          Time calcs:

          Regular time: Minimum ( DaysTotalHours ; 8 ) //assumes maximum of 8 hours regular time
          Time and a half : Case ( DaysTotalHours < 8 ; 0 ;
                                                 DaysTotalHours < 12 ; DaysTotalHours - 8 ; // assumes 8 - 12 hours are time and a half
                                                 4 ) // assumes a maxium of 4 hours time and a half with the remainder to be Double time
          Double Time : IF ( DaysTotalHours > 12 ; DaysTotalHours - 12 ; 0 )

          • 2. Re: Logging work hours

            I follow you.  Our lives are complicated by some pretty wacky work schedules.  Can the manager preemptively use time stamp, because my schedule was preplanned? Maybe I should show some data , for instance here was my work schedule for the week (8/23-8/29):

            Mon 07:30 - 22:00

            Tue Off

            Wed 09:00- 17:00

            Thu 22:00 - 0:600 (the next day)

            Fri 22:00 - 0:600 

            Sat 13:00-14:00

            Sun 09:00- 17:00

            • 3. Re: Logging work hours

              That sounds like a perfect example of why I recommend timestamps for this. The difference of the time stamp for Thu 22:00 and 06:00 the next day will correctly compute the elapsed time in seconds (which you can then convert to hours if necessary).