====== pears.GetWorkPatternWeeklyHours ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."GetWorkPatternWeeklyHours" IS {create function GetWorkPatternWeeklyHours /* Application Maintained Function / Procedure - DO NOT EDIT*/ (in placid char(20), in pstartdate date, in penddate date) returns double begin declare Absense Integer; declare Hours Double; declare Days Integer; declare WeekHours Double; select (select count(state) from TempShift where shiftdate between pStartDate and pEndDate and tempshift.state in ('H','U') and tempshift.personid = employment.personid) as Absense, Placement.WorkNormalHours as Hours, (isnull(Placement.WorkMonday,0) + isnull(Placement.WorkTuesday,0) + isnull(Placement.WorkWednesday,0) + isnull(Placement.WorkThursday,0) + isnull(Placement.WorkFriday,0) + isnull(Placement.WorkSaturday,0) + isnull(Placement.WorkSunday,0) ) - Absense as Days, (if Days > 0 then Days * Hours else 0 endif) as WeekHours into Absense, Hours, Days, WeekHours from placement key join employment where placementid = placid; return isnull(weekhours,0); end }