Solved

Reporting Services - Calculate Time Clock punchtimes

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

Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

Question has a verified solution.

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

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

717 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