473,513 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need Ideas for Storing Time Clock information.

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
Jan 18 '08 #1
5 2184
On Jan 18, 10:42*am, "Charles May" <nu...@bidniz.comwrote:
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?
Just a thought, but it might be easier if you split out the Type
information to two columns, one column for In/Out and other for
Reason.
Jan 18 '08 #2
Charles May wrote:
Anyone have a simple concept for the best way to store timeclock
information in a database.
Better places to ask might be

microsoft.public.sqlserver.programming
comp.databases.ms-sqlserver

where there are also answers to "how do I calculate timespan"-type
questions.

Andrew
Jan 18 '08 #3
your current table structure is certainly not normalized and may
present replication and / or cohesion problems in the future.

in our timeclock application, the recorded time table contains a
column for each in / out instance. so there is a dayIn, lunchOut,
lunchIn, and dayOut column.

the application itself does not allow the user select which instance
they are clocking in / out for. so, if all four columns are empty,
it's assumed that the user is clocking in for the day and the dayIn
column is populated by the application. if dayIn already contains a
datetime, then the lunchOut is populated.

of course, your sql query must return a single row for the current
date.

i suppose if you're including breaks additional columns could be
created.

i found this structure the easiest when attempting to create reports.

i'm not sure if i've been thorough enough in this description so let
me know if i can help.

joe c.

On Jan 18, 7:42 am, "Charles May" <nu...@bidniz.comwrote:
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
Jan 18 '08 #4
Charles,

How do you want to do it better, in my idea it is impossible.

Just registrate what happens and put there your business logic around.

Cor
Jan 18 '08 #5
Joe,
As I was testing this I decided to try just what you specified. But then I
came upon an employee having to leave sometime in the day for maybe an
emergency or a dr.'s appointment and returns to finish out the day. I guess
I could just create a couple of extra columns for extra Ins and outs to
cover this. I just thought that someone had an ideal way of handling it that
I might be over-looking.

Another idea I had was to create multiple tables and calculate the time in
the database between clockins and clockouts for each type. So for example I
would have the following tables:

WorkHours
WorkHoursID
EmpID
Date
TimeIn
TimeOut
TotalTime

LunchHours
WorkHoursID
EmpID
Date
TimeIn
TimeOut
TotalTime

same with breaks... anyway if I clockin and and there is an occurrence of a
clockin present for that employee and date then create a new row (this
should allow extra clock logs for a given date).

When a clock out occurs, find the clockin that occurred that doesn't have a
clockout entered and update the row with the time out and calculate the
total time.

Then I could just SELECT sum(TotalTime) from WorkHours WHERE EmpID = 39 and
Date = ... for each table and then minus any lunch time from it.

Does this make sense?

I guess my biggest problem is trying to make it idiot proof when indeed that
cannot happen. If someone forgets to clock in but then later has to leave
and clocks out. I need to just create an entry to show a missing clockin and
notify the operater to inform their supervisor. I have seen so many problems
with paperless time clocks in the past that I guess I'm just trying to
alleviate a lot of them and it's making it harder than it actually needs to
be. I actually had a guy come in to work one day and forgot to clock in.
About 35 minutes into the shift he receive an emergency phone call and asked
to leave, he was in such a rush he ran out of the office and didn't clock
out. When he returned 2 hours later he clocked in and never realized that to
the people in payroll it looked like he didn't come in until 10:45. I guess
I just need to play it by ear and get something that functions and then work
on trying to solve the worlds problems ;)

I'm going to test this over the weekend to see what I can come up with.

Thanks for the input,
Charlie

"Joe C." <js******@gmail.comwrote in message
news:6b**********************************@e6g2000p rf.googlegroups.com...
your current table structure is certainly not normalized and may
present replication and / or cohesion problems in the future.

in our timeclock application, the recorded time table contains a
column for each in / out instance. so there is a dayIn, lunchOut,
lunchIn, and dayOut column.

the application itself does not allow the user select which instance
they are clocking in / out for. so, if all four columns are empty,
it's assumed that the user is clocking in for the day and the dayIn
column is populated by the application. if dayIn already contains a
datetime, then the lunchOut is populated.

of course, your sql query must return a single row for the current
date.

i suppose if you're including breaks additional columns could be
created.

i found this structure the easiest when attempting to create reports.

i'm not sure if i've been thorough enough in this description so let
me know if i can help.

joe c.

On Jan 18, 7:42 am, "Charles May" <nu...@bidniz.comwrote:
>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

Jan 19 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2913
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
11
3228
by: srkkreddy | last post by:
Hi, I have written a large program which makes multiple calls to number of functions (also written by me) of the program. Now, I want to know the collective time taken by all the calls to a...
2
2374
by: Boban Dragojlovic | last post by:
I'm building a complex web-based reservations system. Gathering the user's data requires between 8 and 15 pages (depending on which options they are interested in). I use the "Session" object to...
5
3089
by: Sinan Nalkaya | last post by:
hello, i need a function like that, wait 5 seconds: (during wait) do the function but function waits for keyboard input so if you dont enter any it waits forever. i tried time.sleep() but when...
20
12571
by: Jean Johnson | last post by:
Hello - I have a start and end time that is written using the following: time.strftime("%b %d %Y %H:%M:%S") How do I calculate the elapsed time? JJ
7
1215
by: Daniel | last post by:
Hey guys I have a app that runs fine on my deve machine, in debug oe or straight from my installer. Stick it on another machine, similar spec and when i close a child form it closes the whole...
6
6375
by: Matik | last post by:
Hi, I have a funny situation. Within: MSSQL 2000 SP3, everything below described is running on same PC. there is a program running, which sends information to two other programs. This...
5
2410
by: Hunter | last post by:
Hi all, I know it may sound like dump newbie question (which is very much true, as I am a newbie, not even a real programmer), but I need to implement a calendar time clock with a millisecond...
12
3291
by: pekka | last post by:
I'm trying to measure user input time with my Timer class object. It isn't as easy as I expected. When using std::cin between timer start and stop, I get zero elapsed time. For some unknown reason,...
0
7267
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7553
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5697
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4754
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3247
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3235
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
466
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.