File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calculating with timefields

 
Rob Proesmans
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
screenProjectCedric.png
[Thumbnail for screenProjectCedric.png]
 
Rob Proesmans
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or maybe there is still a solution in sql to have an overview for each day..
 
Emanuel Kadziela
Ranch Hand
Posts: 187
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic