Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
SELECT DISTINCT
VP_PERSON.HOMELABORLEVELNAME2,
TIMESHEETITEM.WORKEDSHIFTID,
VP_PERSON.HOMELABORLEVELNAME3,
VP_PERSON.HOMELABORLEVELNAME4,
VP_PERSON.PERSONFULLNAME,
VP_TIMESHEETPUNCH.PERSONNUM,
datediff(yy,VP_PERSON.BIRTHDTM,getdate()) AS AGE,
VP_TIMESHEETPUNCH.EVENTDATE,
ISNULL(VP_TIMESHEETPUNCH.INPUNCHDTM, VP_TIMESHEETPUNCH.STARTDTM) AS PUNCH1,
ISNULL(VP_TIMESHEETPUNCH.OUTPUNCHDTM, VP_TIMESHEETPUNCH.ENDDTM) AS PUNCH2,
MINORRULE.MINORRULENM,
VP_TIMESHEETPUNCH.TIMEINSECONDS,
VP_TIMESHEETPUNCH.STARTREASON,
(SELECT SUM(DISTINCT VP_TIMESHEETPUNCH.TIMEINSECONDS)
FROM WFC_PRD.dbo.TIMESHEETITEM,
WFC_PRD.dbo.VP_TIMESHEETPUNCH
WHERE TIMESHEETITEM.WORKEDSHIFTID = TIMESHEETITEM.WORKEDSHIFTID
AND VP_TIMESHEETPUNCH.TIMESHEETITEMID = TIMESHEETITEM.TIMESHEETITEMID
AND (VP_TIMESHEETPUNCH.EVENTDATE >= '2008-06-01 00:00:00.000'
AND VP_TIMESHEETPUNCH.EVENTDATE < '2008-06-02 00:00:00.000')
AND [!]VP_TIMESHEETPUNCH.PERSONNUM = '099136'[/!]
group by TIMESHEETITEM.WORKEDSHIFTID) AS A
FROM WFC_PRD.dbo.VP_TIMESHEETPUNCH,
WFC_PRD.dbo.VP_PERSON,
WFC_PRD.dbo.PRSNMINORRULEMM,
WFC_PRD.dbo.MINORRULE,
WFC_PRD.dbo.TIMESHEETITEM
WHERE VP_TIMESHEETPUNCH.PERSONID = VP_PERSON.PERSONID
AND VP_TIMESHEETPUNCH.TIMESHEETITEMID = TIMESHEETITEM.TIMESHEETITEMID
AND datediff(yy,VP_PERSON.BIRTHDTM,getdate()) < 18
AND VP_TIMESHEETPUNCH.PERSONID = PRSNMINORRULEMM.PERSONID
AND PRSNMINORRULEMM.MINORRULEID = MINORRULE.MINORRULEID
AND VP_TIMESHEETPUNCH.TMSHTITEMTYPEID not in (1, 2, 3)
AND VP_TIMESHEETPUNCH.LABORLEVELNAME4 <> ''
AND VP_TIMESHEETPUNCH.PAIDSW = 1
AND (VP_TIMESHEETPUNCH.EVENTDATE >= '2008-06-01 00:00:00.000'
AND VP_TIMESHEETPUNCH.EVENTDATE < '2008-06-02 00:00:00.000')
-- AND VP_TIMESHEETPUNCH.PERSONNUM = '099136'
ORDER BY VP_TIMESHEETPUNCH.EVENTDATE , TIMESHEETITEM.WORKEDSHIFTID ASC
Select WorkShiftId,
Sum(DurationSecQty),
Min(StartDTM),
Max(EndDTM),
DateDiff(Second, Min(StartDTM), Max(EndDTM)) - Sum(DurationSecQty) As BreakTime
From @TimeSheetItem
Group By WorkShiftID