trav.west Posted December 18, 2007 Share Posted December 18, 2007 I'm writing a report that shows managers when employees clock in and out. So, I'm grouping by employee, and inside of that I group by the date of the clock-in. I display the hours/minutes worked, but I need to do a daily total for each employee and a grand total for each employee. Here's an example of the format I need Code:John Smith September 5, 2007 10:00 - 2:00 4:00 3:30 - 9:30 6:00 Daily Total 10:00 September 6, 2007 11:15 - 2:15 3:00 5:30 - 8:25 2:55 Daily Total 5:55 Grand Total 15:55However, I am have to do the hours/minutes math in a scriptlet. When I try to run the report, my daily total and grand total always come out twice what they should be. How do I do this? Thanks,Travis West Link to comment Share on other sites More sharing options...
vinays84 Posted December 18, 2007 Share Posted December 18, 2007 If the fields which sums these totals are of date format, the time can be calculated by using Date.getTime(), which will return the time in milliseconds, which you can use to calculate whatever time you like and display accordingly. Link to comment Share on other sites More sharing options...
trav.west Posted December 18, 2007 Author Share Posted December 18, 2007 Unfortunately they aren't. There is instead a Double field for the hours and a Double field for the minutes. I've got the totals working for the grand total, but now it's just displaying the last value for the daily total. Thanks,Travis West Link to comment Share on other sites More sharing options...
vinays84 Posted December 18, 2007 Share Posted December 18, 2007 Post code..there's no way to troubleshoot without seeing exactly what you're working with. Link to comment Share on other sites More sharing options...
trav.west Posted December 18, 2007 Author Share Posted December 18, 2007 Link to comment Share on other sites More sharing options...
svenn Posted December 18, 2007 Share Posted December 18, 2007 It would probably be easier if you posted you jrxml file and the scriptlet file that you are generating. Link to comment Share on other sites More sharing options...
trav.west Posted December 18, 2007 Author Share Posted December 18, 2007 My scriptlet file right now just basically logs if it is being called, so I don't think the problem is in there. Travis West Link to comment Share on other sites More sharing options...
svenn Posted December 18, 2007 Share Posted December 18, 2007 Ok, well you should attach your jrxml file. Link to comment Share on other sites More sharing options...
trav.west Posted December 18, 2007 Author Share Posted December 18, 2007 I thought I had posted my jrxml file, but here's it as an attachment. Thanks,Travis West [file name=time_sheet2.jrxml size=24756]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/time_sheet2.jrxml[/file] Link to comment Share on other sites More sharing options...
trav.west Posted December 18, 2007 Author Share Posted December 18, 2007 Sorry, I posted the jrxml file with some test code I was working on. Here is the correct jrxml (note that the problem is with the duration_total variable). [file name=time_sheet2-aca8c736c073775065729c7780a0fda2.jrxml size=24701]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/time_sheet2-aca8c736c073775065729c7780a0fda2.jrxml[/file] Post edited by: trav.west, at: 2007/12/17 22:16 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now