SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    time tracking attendance using php

    Hi All,

    In my website (PHP & MYSQL), I have on functionality which tracks the in-out data from swipe card system and displays first in and last out in report.

    This I have done. But, now I am having an issue for the employee working in night shifts. The swip card system is in MSSQL Server.
    And the data is stored in one of the table with fields cardno, iodatetime. The field iodatetime stores the data for in and out both. Consider the following scenario
    Night Shift Employee 'A' comes in the office at 17:00PM (Consider: Date 9th Aug, 2012) and leaves on 9:00AM (Date: 10th Aug, 2012).and I want to show in-out data date wise like
    Date 9Aug 10thAug
    In Time 18:00 9:00AM
    Out Time 23:58(if left for a break)
    Total Hours 5:58

    Please let me know the approach for calculating the total hours datewise for employee working in shifts.

    Your help will be highly appreciated.

    Thanks in advance.
    Barbara

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,050
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Using a DateTime object should get you started. Once you have some code started, post it and I'll be glad to help you work out the bugs

  3. #3
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    69 Post(s)
    Tagged
    0 Thread(s)
    I could swear we've answered this before from another user... anyway.

    Your demonstration doesnt show what you think it shows.
    You said:
    Night Shift Employee 'A' comes in the office at 17:00PM (Consider: Date 9th Aug, 2012) and leaves on 9:00AM (Date: 10th Aug, 2012)

    That would be a shift of 16 hours (17-24+0-9).

    You then show the data as:

    Date 9Aug 10thAug
    In Time 18:00 9:00AM
    Out Time 23:58(if left for a break)
    Total Hours 5:58

    Where did Out Time come from? Why does your total hours think he was only there for a hair under 6 hours? (18:00-23:58) Did he leave then and not come back? Where did the 9:00 come from (or go?)
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •