Solved

Reporting Services - Calculate Time Clock punchtimes

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

707 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now