aspose file tools*
The moose likes JSP and the fly likes Calculating with timefields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Calculating with timefields" Watch "Calculating with timefields" New topic
Author

Calculating with timefields

Rob Proesmans
Greenhorn

Joined: Aug 16, 2012
Posts: 8
Dear people

For my school project I need to make a clocking system for employees in jsp. I management to become a clocking card for each employee. This data comes from a date/time field in the database.
But now I want to know how many minutes each employee has worked each day. I have searched for some sql functions to do this, but I don't think there is any proper function that is capable of managing what I ask for.


What I want to become is that an employee can clock 4 times each day. And that there is an overview of how many minutes each employee worked each day.

In the attachment you can find the clocking card that I already have.

How can I do this in jsp?

Thank you in advance!!

If there are any questions I will answer fast.

Greetings from Belgium

Cedric


[Thumbnail for screenProjectCedric.png]

Rob Proesmans
Greenhorn

Joined: Aug 16, 2012
Posts: 8
Or maybe there is still a solution in sql to have an overview for each day..
Emanuel Kadziela
Ranch Hand

Joined: Mar 24, 2005
Posts: 186
I can help you with the SQL part of your problem.

Build a table (let's call it EmplyeeReports) in your database with three columns: employee_id, date_time, minutes. Every time an employee clocks in (you said 4 times a day) and enters the number of minutes they worked since the last time they clocked in, you insert a row in that table with their employee id, the exact date and time of when they are clocking in and the minutes they are reporting.

Once you have the data, here is the query (for MySQL) to retrieve the number of minutes for each employee for each day:

select employee_id, date(date_time), sum(minutes) from EmployeeReports group by employee_id, date(date_time);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calculating with timefields