Time & Attendance

1.5k views Asked by At

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?

1

There are 1 answers

0
Saif Asif On

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)

employee_checks_in_event = in_time (a timer is started at this point)
fixed_out_time = expected_out_time (this is the normal out time of employee)
if employee_checks_in_again:
    in_time = new_in_time # here the employee may have overlapped next shift IN time due to overtime
employee_checks_out_event = out_time - in_time (lets call it time_spent)
if time_spent < fixed_out_time:
    employee_left_early
else:
    we know employee completed his time and maybe he over-timed as well.
    time_spent = over_time

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.