Solved

Reporting Services - Calculate Time Clock punchtimes

Posted on 2009-07-08
6
514 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
  • 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

828 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