====== ====== ===== Explanation of SQL ===== This query provides the basic information for employees detail timecards. This does not include the overall clock in and clock out, but only the time cards that are created for production purposes. This query filters out any time clock entries where the employee did not clock into a line item. This query is useful to determining the average productive hours for an employee per day, week, year, etc. versus their actual clocked in hrs. ===== Risk of Data Corruption if Run Improperly ===== **None**. This is a selection query and no data is modified in the running of it. ===== SQL ===== Declare @MinDate datetime; -- Set the absolute earliest date you want to query Declare @MaxDate datetime; -- Set the absolue latest date you want to query -- uncomment this for SQL, comment this out for Cyrious SQL Reports -- set @MinDate = '4/1/2010'; -- set @MaxDate = '4/30/2010 11:59'; -- comment this out for SQL, uncomment this for Cyrious SQL Reports SET @MinDate = Convert(DateTime, ); SET @MaxDate = Convert(DateTime, ); SELECT (LastName + ', ' + FirstName) as [Employee Name] ,P.ItemName ,J.Description ,StartDateTime ,EndDateTime ,OrderNumber ,StraightTime ,OverTime ,DoubleTime ,ShiftDiffTime FROM TIMECARD TC LEFT JOIN Journal J ON J.ID = TC.ID LEFT JOIN TransHeader T ON T.ID = J.TransActionID LEFT JOIN TransPart TP ON TP.ID = TC.TransPartID LEFT JOIN Part P ON P.ID = TP.PartID LEFT JOIN Employee E ON E.ID = J.EmployeeID WHERE TC.TransDetailID IS NOT NULL AND J.StartDateTime BETWEEN @MINDATE AND @MAXDATE ORDER BY J.StartDateTime ===== Version Information ===== * Entered : __11/5/2010__ * Version : Control 4.5