Solved

Reporting Services - Calculate Time Clock punchtimes

Posted on 2009-07-08
6
515 Views
Last Modified: 2012-05-07
I am build a report using SSRS that shows an employee weekly time punches and calculate the employees hours.  So far, I am able to show the punches and clock actions but I am having a breakdown on calculating the time between clock in and clock out; thusly giving me the weekly sum of hours.

I must take into account any missed punches....  Any assistance is greatly appreciated.
SELECT     EmployeeNum_1.EmployeeID, EmployeeNum_1.TempId, EmployeeNum_1.Unldr_#, EmployeeNum_1.Last_name, EmployeeNum_1.First_name, 
                      EmployeeNum_1.Active, EmployeeNum_1.PayRateHourly, EmployeeNum_1.PayRatePercentage, EmployeeNum_1.SpecialPay, 
                      EmployeeNum_1.HolidayPay, EmployeeNum_1.SalaryPay, WorkDays_1.Workdate, WorkdayPunches_1.Punchkey AS PunchKey, 
                      WorkdayPunches_1.PunchTime, WorkdayPunches_1.Action, WorkdayPunches_1.Note, WorkdayPunches_1.Deleted AS PunchDelete, 
                      WorkDays_1.deleted AS WorkDayDelete, EmployeeNum_1.JobTitle
FROM         EmployeeNum AS EmployeeNum_1 INNER JOIN
                      WorkDays AS WorkDays_1 ON EmployeeNum_1.Unldr_# = WorkDays_1.Unldr_# INNER JOIN
                      WorkdayPunches AS WorkdayPunches_1 ON WorkDays_1.UID = WorkdayPunches_1.Punchkey
WHERE     (EmployeeNum_1.Active = 1) AND (DATEPART(wk, WorkdayPunches_1.PunchTime) = DATEPART(wk, @Date))
ORDER BY WorkDays_1.Workdate, WorkdayPunches_1.PunchTime

Open in new window

0
Comment
Question by:NCSO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 26

Expert Comment

by:Chris Luttrell
ID: 24810297
Can you give some example data and the expected results?  Include an example of a Missed Punch and what you want to do with it in the results.
0
 

Author Comment

by:NCSO
ID: 24850889
If an employee misses a time punch the supervisor is responsible for correcting it before the pay period ends; I must calculate the span of time between a clock in and a clock out.  Graphically, it would be nice to show the hours on the clock out line and then show a cumulative total for the period in the "Total"

Thanks!
timecard.JPG
0
 
LVL 14

Expert Comment

by:Emes
ID: 24851924
You need to change your sql to get the hours for the start time and end time.

Add an  join to your statement that will get the last clock time.
 

this way you can then place the hours in the hour column since you can take the 2 times and do a date diff by hours on it . You can then sum the hours to get the proper total hours


0
 

Author Comment

by:NCSO
ID: 24852735
Emes,
Can you give me an example for the join statement?
0
 
LVL 14

Accepted Solution

by:
Emes earned 500 total points
ID: 24853021
give some sample data from

FROM         EmployeeNum  
INNER JOIN   WorkDays
INNER JOIN       WorkdayPunches

Need to use this to get the next record. but I need to see the data and table formats to get it
exact.
 
inner join (select PunchTime as Punchtime1 from WorkdayPunches_1
      Where   Max(WorkDays_1.UID) < WorkDays_1.UID ) as Time2 on  WorkDays_1.UID = WorkdayPunches_1.Punchkey                    
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently went through setting up a JasperReports Server using the AWS EC2 instance, and this article will cover some basic administration tasks I had to perform.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question