RE: [PHP] Timetables
| From: | Chris W. Parker | Date: | Mon, 25 Apr 2005 23:24:08 +0000 |
| Subject: | RE: [PHP] Timetables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-213838@lists.php.net to get a copy of this message | ||
Richard Collyer <mailto:richard@firebadger.net>
on Monday, April 25, 2005 3:15 PM said:
> My idea of doing this was to have a database with each record being a
> day for a particular employee. Recording ID, Start Time, Finish Time
> in TimeStamp.
You need to tie those records to the employee records. You need a
foreign key in there somewhere. i.e. employee_id.
Also, by "day" you don't mean Monday, Tuesday, Wednesday, etc. right?
What I'm getting at is, a record should be created only when an employee
"logs in" and not for each day of the week. Don't create empty records
for each day the employee does not work.
> So I could then do a search for the number of employees whose shift
> start or finished in that particular day. If there is a start and a
> finish left add up the hours, if only a start do start -> midnight and
> if only a finish do midnight -> finish.
>
> Is this a sensible way to do it? Or can anyone suggest a better tried
> and tested way.
Are you trying to determine how much an employee has worked in a certain
period of time? i.e. Week/month/year?
What triggers the creation and modification of each record? Is the
employee required to clock in and clock out manually or is this all
predetermined?
hth,
Chris.