How about, I'm doing a program in c # that shows the hours of the employees of a store in a week, and also calculates the hours worked, the problem or what I could not calculate correctly are the hours worked, since I have two tables in a bd in mysql, the table schedules and the checked table.
The timetable table has the following structure:
TIENDA | EMPLEADO | FECHA | E1 | S1 | E2 | S2 |
Store is the store number to which the employee belongs.
Employee is the key with which an employee is identified
The date is assigned per day and E1
S1
E2
S2
are the hours of entry and exit.
For example, an employee can be assigned to the day schedule on 07/21/2016 where he enters at 10:00 a.m., goes out to eat at 2:00 p.m., returns from lunch at 4:00 p.m. and leaves at 9:00 p.m.
Now in the checked table you have:
TIENDA | FECHA | FHORA | EMPLEADO | TIPO | HUELLA
FHORA
is the date together with the exact employee check time.
TIPO
indicates if it is entry or exit
Huella
if you checked with a fingerprint reader or password.
My problem is that I have to calculate the actual hours worked, I know that I have to relate the date of the assigned schedule with the date of the checked table, what I do not know how to do is save the hours of entry and exit so that I I add them up and in the end show me the actual hours that an employee worked.
(In case an employee has not checked, for example, his meal return time, he is not assigned time)
I hope you have explained me and can help me, thanks:)