-1

In my office, I am creating an HR website for employees. There is a module to calculate attendance details, working hours etc.. So if an employee came to office in the morning and if he left the office at about 8PM in the night its OK. Because both In and Out and are on the same day. This is the happy path.

So then I drawing graph base on it. enter image description here

But some employees are come to the office around 6pm and leaving the office on next day 2am in the morning. So their attendance is totally messed. If we check the first day they have an IN but no OUT. if we check the second day they start the day with an OUT. :D

So cant calculates time on both days.

So how to handle this problem?

** Note:** No matter what all employees will leave the office at 4am. if an employee sits after 4am it will be very rare. So if we can adjust normal day to till next day 4am that will be OK with me.

I am using MYSQL DB and ASP.net to build the site.

ucMedia
  • 4,105
  • 4
  • 38
  • 46
Prageeth Liyanage
  • 1,612
  • 2
  • 19
  • 41

2 Answers2

0

I think you have two options, depending on your business logic.

  1. Calculate the attendance by subtracting the start time from the end time to give the attendance hours. For every end-time, find the previous start time which may or may not be on the same day.
  2. If you need the attendance for each day, where you don't have an end time, subtract the start time from 24:00:00 and for the day where you don't have a start time subtract the end time from 00:00:00.
0

here is a suggestion:

At 12:00 AM check which users has not checked out, than checkout them automatically and check in them again.When user will leave at 2pm than user have only option to checkout. From this you can check which users were checkout at 12:00 AM and at same time checked in and when user actually checkout you can calculate the time. -Mean whenever you calculate the time check whether user was checkout and check in at 12.

I hope this will solve your problem.

farrukh aziz
  • 162
  • 1
  • 2
  • 9