Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Reporting Services - Calculate Time Clock punchtimes

Posted on 2009-07-08
6
Medium Priority
?
527 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 27

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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

636 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