As a part of a program I am working on I need a bit of advice.
The problem: I receive a report containing employee clock records. I need to determine the first clock IN for the day based on a shift setup. For instance Shift A starts at 8:00am and ends at 17:00pm. This is strait forward but what happens if the person worked overtime till 1:00am the next morning and then clocked IN again at 7:30, OUT at 7:45, in at 7:48. How do I determine the first clock in for the day?
I can calculate fine if the person works normal hours but what happens in the event of overtime that extends to the next day?
Usually time attendance is to be measure by the time IN of the particular employee plus the time he spends at work and then the time OUT. Something like this (just a pseudocode)
Now that you have the time_spent of the employee, you can keep track of the next day check-in time and make sure that they don't overlap. Keep in mind that you will have to some-how differentiate between IN and OUT times.
The other way would be to keep check-INs and check-OUTs in a completely separate clock, that way it will be very easy to determine IN and OUT times and maintaining overtimes will be far easier.