amt has asked for the wisdom of the Perl Monks concerning the following question:

Gentlemen,
I have been asked to implement a time clock application for my company's internal management system. This message serves two purposes; the first is to ask if any monks may know of an existing CPAN module for this metaphor, and second, to grind the wheels of discussion in an accelerated design phase.

The application must be able to account for the special case of an employee being "Out to Lunch". I was considering using a seperate MySQL table for time considered to be out to lunch, and when calculating time, subtract the time out to lunch from the primary table of "Arrival/Departure"

Any other thoughts?
amt.

perlcheat

Replies are listed 'Best First'.
Re: PERL/MySQL Punch Clock
by talexb (Chancellor) on Jan 26, 2005 at 18:50 UTC

    If this is a Perl question, my eyes must be going .. I can't see any, apart from a mention of CPAN (and what key words did you say you used for your CPAN search?)

    From a database schema point of view (something I love to kick around), I'd probably create an event table with some sort of Employee ID, a timestamp and an event type (in, out, going to lunch, back from lunch). I'd have another table that holds the current status of an employee, so that if an employee tries to go to lunch when they forgot to punch in, the application would raise an alarm. Hmm .. actually, forget the second table, we can just go back and look at the most recent entry for that employee and see if the new entry makes sense. Yeah. Less is More.

    Then there are the safety catches like flagging when an employee has stayed past 6pm (say) but hasn't clocked out yet.

    Interesting question. But still not Perl.

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Re: PERL/MySQL Punch Clock
by g0n (Priest) on Jan 26, 2005 at 15:36 UTC
    Gentlemen, I have been asked to implement ..
    We gonna get into trouble with that mode of address!

    Difficult to say without knowing more about your design, but would it not be simpler to have: employeeNumber, clockedInAt,ClockedOutAt
    and then add up all the instances for the individual employeeNumber in the day?

    So a given individual would have perhaps two lines in the table for day x, one from clock in until lunch when he or she clocks out, then another from clocking back in after lunch until quitting time.

      Much apologies. I was thinking of using that method, after rethinking it a bit i am considering using the structure.
      uid varchar(255) #uid from ldap date date #date time time #time stat enum() #transaction type
      This way when i want to do reporting i can pull the dates seperately from the times, and do the math of the times.
      amt.

      perlcheat