Morty880 Posted February 21, 2013 Share Posted February 21, 2013 I have a database of timecards, looks like this: userid start time end time totalmins lunch lunchmins Everytime an employee punches in/out it creates a new entry. Example - Employee started at 8AM, went to lunch at 12PM, at lunch for 30mins, returned at 1230PM, went home at 430PM. 1 2013-02-21 08:00:00 2013-02-21 12:00:00 240 1 30 1 2013-02-21 12:30:00 2013-02-21 16:30:00 240 0 0 I have 2 entries for every employee, every work day since Jan 2nd. Now I made a change, the database looks like this using the same example above userid start time end time totalmins lunchout lunchin lunchmins 1 2013-02-21 08:00:00 2013-02-21 16:30:00 510 2013-02-21 12:00:00 2013-02-21 12:30:00 30 Now I have 1 enrty per employee, per day. Question, how do you think I could take the old entries and combine them into 1 entry using the new format??? Example from data above Start time is fine, in same entry lunchout needs to be the checkouttime from the old data, lunchin needs to be the checkintime from the old data (2nd entry from the same day), and the checkout time needs to be checkouttime from the old data (2nd entry from the same day). Quote Link to comment https://forums.phpfreaks.com/topic/274791-php-help/ Share on other sites More sharing options...
Jessica Posted February 21, 2013 Share Posted February 21, 2013 Your original structure was better. What if someone needs to clock in and out for a second break? What about when they don't take a lunch? The original design is more flexible. Quote Link to comment https://forums.phpfreaks.com/topic/274791-php-help/#findComment-1413994 Share on other sites More sharing options...
Morty880 Posted February 21, 2013 Author Share Posted February 21, 2013 That isn't allowed here, you have to take a 30 min lunch, and thats all you get. If you clock out again, you have to go home for the day. Quote Link to comment https://forums.phpfreaks.com/topic/274791-php-help/#findComment-1413996 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.