Click here to Skip to main content
13,145,068 members (56,227 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Good Day,

I am so confused which is the best approach to get employee's (first time in) & (last time out) each day when they have login to our biometrics clock system.

For instance if "Jorge" has a schedule of 8am - 5pm on March 9, 2013
and he logged many times and has a record attendance of: time in at 10:10, 10:05, 10:15 and Time out at : 5:00. 5:30, 5:45

System should only gets "Jorge's" attendance for today like:

Time in: March 9, 2013 - 10:05 am & Time out: March 9, 2013 - 05:45 pm

Employee	Time Record	Type
Jorge	        3/9/2013 10:00	In
Jorge	        3/9/2013 10:10	In
Jorge	        3/9/2013 17:00	Out
Jorge	        3/9/2013 17:30	Out
Mike	        3/9/2013 17:40	Out
Jorge	        3/9/2013 10:02	In
Jorge	        3/9/2013 17:00	Out
Jorge	        3/9/2013 17:00	Out
Jorge	        3/9/2013 17:00	Out
Jorge	        3/9/2013 10:14	In
Mike	        3/9/2013 10:00	In
Mike	        3/9/2013 10:10	In
Jorge	        3/9/2013 17:00	Out
Mike	        3/9/2013 17:30	Out
Jorge	        3/9/2013 17:40	Out
Mike	        3/9/2013 10:02	In
Mike	        3/9/2013 17:00	Out
Mike	        3/9/2013 17:00	Out
Mike	        3/9/2013 17:00	Out
Jorge	        3/9/2013 10:14	In

Honestly i haven't tried any code because i am still thinking what is the best approach to get (first time in) & (last time out) for each employees attendance record on each day.

An idea from anyone would be very much helpful. thanks in advance.

[edit]Code block added - OriginalGriff[/edit]
Posted 9-Mar-13 4:42am
Updated 9-Mar-13 5:23am
ThePhantomUpvoter 9-Mar-13 11:29am
My first idea would to sit down and re-think what it is that you are doing. Why do allow people to clock in with clocking out? Why can they clock in multiple times? According to your sample Jorge clocks in a 10:00 but his start time is 10:05. He clocks out at 17:40 but his stop time is 17:45. How do you get that? The "best" approach is to get the clock out time and subtract the clock in time from it to get the total time.
JMAM 9-Mar-13 11:35am
Because we have a biometrics device which still accepts time in even thoug employee had already done it. Likewise when you have punch it to traditional time clock using time card then once you have decided to re punch in at the same date.time clock will just over write the card.however on the device we can't modify this and what it does to simply insert new record.

Thanks for your advice btw.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Exactly how you do it is difficult to say, because you don't say how you are storing your data, and where you want to do this data checking.

For example, if it is in an SQL database and stored as dates, then its is a case of a simple SQL query to return the max and min value by group:
SELECT Employee,MAX(TimeRecord), MIN(TimeRecord) FROM myTable GROUP BY Employee

If you are storing it somewhere else, then we would need to know.

[edit]Typo: "say" for "don't" - OriginalGriff[/edit]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170915.1 | Last Updated 9 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100