I'm developing an attendance system using VB.NET & SQL server 2008. there is a shifts table with Start & End time of each shift. and there is an employee table. each employee may have one or more shifts. I'm using a log file taken from the fingerprint device. I'm having trouble analyzing the log data which contains the Employee ID, the date & time of the fingerprint, the log data looks like this:
4 2015-05-02 10:00:09
3 2015-05-02 10:24:54
4 2015-05-02 14:12:08
3 2015-05-02 14:13:32
4 2015-05-02 15:46:16
7 2015-05-02 18:36:21
6 2015-05-02 20:55:05
4 2015-05-02 22:00:38
3 2015-05-02 22:01:00
3 2015-05-19 10:13:13
7 2015-05-19 16:08:02
11 2015-05-19 17:26:29
11 2015-05-19 21:25:19
7 2015-05-19 21:26:07
3 2015-05-19 21:47:42
I have read the log data and store Employee ID, Date, Time separately in a DataTable. I'm facing many cases & conditions with this data, for example the employee may have forgotten to scan his/her finger upon arrival or leave. The employee may have scanned only after leaving his 1st shift and came in later for his/her 2nd shift. The employee may come in another time other than his regular shift. If The employee has a morning & evening shift, he may scan in the morning and stay until his evening shift is over. and other cases like this.
I want to insert this data into a table like this [EmployeeID, ShiftID, In, Out, Date ] I've been struggling to accomplish this for more than a week.
any advise would help, thank you.