Jump to content

Need Help with Timecard php/mysql


ViperG

Recommended Posts

I have someone that wants me to make them a timecard website. Where the employee can punch in, punch out, punch out for lunch and punch in for lunch. Then it saves all this to a database.

I already have the part where they can create a new employee, and fill in the personal info, and the boss can remove new employes and change their info. Then the boss needs to be able to modify the times. each weak gives a total amount of hours.

My question is how do I save the times? I was thinking to make a new table called Days, and have it have 4 fields that store the time.

Link to comment
Share on other sites

Something like this then

[pre]
employee                    timecard
-----------                ------------
emp_id      <------------- emp_id
emp_name                    card_date
reports_to                  time_in_1
                            time_out_1
                            time_in_2
                            time_out_2
[/pre]

If you want it for multiple departments then set up the employees like this

[pre]
1 | John Doe      | 0      <-- Boss, reports to is 0
2 | Fred Smith    | 1
3 | Mary Brown    | 1
4 | Captain Slog  | 0      <-- Boss, reports to is 0
5 | Luc Picard    | 4
6 | Will Ryker    | 4
[/pre]

the you know who the bosses are and who works for them
Link to comment
Share on other sites

Adding four times will not solve the purpose. An employee can clock in and out as many times as he wants. So pretty much you just need an employee table with clock in and out with the time stamp of the transaction. So when you find the clock ins and outs of a day you aggregate by date of transaction.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.