The Little Guy Posted November 23, 2010 Share Posted November 23, 2010 I am making a time clock, and I was wondering what is the best way to calculate the number of hours an employee worked? I have a table called "statuses" it holds names of punch types: - id = the auto_inc - status = "in/out/break/lunch" text statuses - paid = whether or not the punch is paid or not (true/false) I have another table called "logging" This table holds the information about the punch type: - id = the auto_inc - owner = the member id - ip = members ip - inout = the punch type from the statuses table - location = the city/state of where the punch took place - date = the time the member punched Maybe I am over thinking this, but what is the best way to calculate the hours a person has worked? Right now I am getting all the punches for for a particular member between a date range. then loop through the data to display it and passing it to a method in a class called Calc. I want to then add the times from punch in to punch out, then the next punch in to punch out. Any suggestions? Quote Link to comment Share on other sites More sharing options...
Stevis2002 Posted November 23, 2010 Share Posted November 23, 2010 Can you use the datetime() function maybe.? Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted November 23, 2010 Author Share Posted November 23, 2010 What I am thinking is putting the times in an array, then grouping the into groups of two and add each group together. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.