C
Charles May
Anyone have a simple concept for the best way to store timeclock information
in a database.
I currently have my table set up like this with a typical daily entry.
tcID empID Type Date Time
1 37 'Clockin' 1/18/08 7:45:39 AM
2 38 'Clockin' 1/18/08 7:55:42 AM
3 39 'Clockin' 1/18/08 7:55:42 AM
4 38 'BreakOut' 1/18/08 10:01:00 AM
5 39 'BreakOut' 1/18/08 10:01:15 AM
6 37 'BreakOut' 1/18/08 10:03:27 AM
7 39 'BreakIn' 1/18/08 10:10:10 AM
8 37 'BreakIn' 1/18/08 10:11:01 AM
9 38 'BreakIn' 1/18/08 10:13:07 AM
10 39 'LunchOut' 1/18/08 12:00:10 AM
11 37 'LunchOut' 1/18/08 12:00:45 AM
12 38 'LunchOut' 1/18/08 12:01:27 AM
13 39 'LunchIn' 1/18/08 12:55:40 AM
14 37 'LunchIn' 1/18/08 12:57:45 AM
15 38 'LunchIn' 1/18/08 12:59:11 AM
16 38 'BreakOut' 1/18/08 03:01:00 AM
17 39 'BreakOut' 1/18/08 03:01:15 AM
18 37 'BreakOut' 1/18/08 03:03:27 AM
19 39 'BreakIn' 1/18/08 03:10:10 AM
20 37 'BreakIn' 1/18/08 03:11:01 AM
21 38 'BreakIn' 1/18/08 03:13:07 AM
22 37 'ClockOut' 1/18/08 05:00:39 AM
23 38 'ClockOut' 1/18/08 05:00:41 AM
24 39 'ClockOut' 1/18/08 05:01:12 AM
The problem I'm having is parsing out the information to calculate the time
and generate a report. I'm struggling with the logic of pulling the
information for total time in a Clockin-Clockout sequence. Currently I'm
ignoring breaks but want them logged to monitor if anyone is taking longer
breaks. We pay the 10 minute breaks so I am really only looking at Total
Time - Lunch Time (of course I will adjust the start time and end time for
the work day to 8am - 5pm as needed) Keep in mind there can be an incident
where an employee has to leave sometime and which will lead to an additional
Clockin-Clockout sequence that will have to be subtracted from the total
hours for the day or the occurrence of a missing piece of data like
forgetting to clock back in from lunch etc...
I am also not locked into this database format. This is just something I
came up with and it seemed to be a good design however it's a nightmare when
trying to calculate.
Anyone done anything like this before?
Any help is greatly appreciated.
Thanks
Charlie
in a database.
I currently have my table set up like this with a typical daily entry.
tcID empID Type Date Time
1 37 'Clockin' 1/18/08 7:45:39 AM
2 38 'Clockin' 1/18/08 7:55:42 AM
3 39 'Clockin' 1/18/08 7:55:42 AM
4 38 'BreakOut' 1/18/08 10:01:00 AM
5 39 'BreakOut' 1/18/08 10:01:15 AM
6 37 'BreakOut' 1/18/08 10:03:27 AM
7 39 'BreakIn' 1/18/08 10:10:10 AM
8 37 'BreakIn' 1/18/08 10:11:01 AM
9 38 'BreakIn' 1/18/08 10:13:07 AM
10 39 'LunchOut' 1/18/08 12:00:10 AM
11 37 'LunchOut' 1/18/08 12:00:45 AM
12 38 'LunchOut' 1/18/08 12:01:27 AM
13 39 'LunchIn' 1/18/08 12:55:40 AM
14 37 'LunchIn' 1/18/08 12:57:45 AM
15 38 'LunchIn' 1/18/08 12:59:11 AM
16 38 'BreakOut' 1/18/08 03:01:00 AM
17 39 'BreakOut' 1/18/08 03:01:15 AM
18 37 'BreakOut' 1/18/08 03:03:27 AM
19 39 'BreakIn' 1/18/08 03:10:10 AM
20 37 'BreakIn' 1/18/08 03:11:01 AM
21 38 'BreakIn' 1/18/08 03:13:07 AM
22 37 'ClockOut' 1/18/08 05:00:39 AM
23 38 'ClockOut' 1/18/08 05:00:41 AM
24 39 'ClockOut' 1/18/08 05:01:12 AM
The problem I'm having is parsing out the information to calculate the time
and generate a report. I'm struggling with the logic of pulling the
information for total time in a Clockin-Clockout sequence. Currently I'm
ignoring breaks but want them logged to monitor if anyone is taking longer
breaks. We pay the 10 minute breaks so I am really only looking at Total
Time - Lunch Time (of course I will adjust the start time and end time for
the work day to 8am - 5pm as needed) Keep in mind there can be an incident
where an employee has to leave sometime and which will lead to an additional
Clockin-Clockout sequence that will have to be subtracted from the total
hours for the day or the occurrence of a missing piece of data like
forgetting to clock back in from lunch etc...
I am also not locked into this database format. This is just something I
came up with and it seemed to be a good design however it's a nightmare when
trying to calculate.
Anyone done anything like this before?
Any help is greatly appreciated.
Thanks
Charlie