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? Link to comment https://forums.phpfreaks.com/topic/219637-time-clock-time-worked/ Share on other sites More sharing options...
Stevis2002 Posted November 23, 2010 Share Posted November 23, 2010 Can you use the datetime() function maybe.? Link to comment https://forums.phpfreaks.com/topic/219637-time-clock-time-worked/#findComment-1138748 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. Link to comment https://forums.phpfreaks.com/topic/219637-time-clock-time-worked/#findComment-1138758 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.