Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.PlacementDayHours ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Original SQL ===== <code sql> create function "pears"."PlacementDayHours"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "bProcess" tinyint,in "placid" char(20),in "pdate" date,in "startdate" date,in "enddate" date ) returns char(10) begin declare "bcanc" tinyint; declare "scancid" char(10); declare "nhrs" real; declare "d" smallint; declare "bdayticked" tinyint; if "isnull"("bProcess",0) = 0 then return '' end if; if "pdate" < "startdate" then return '' end if; if "pdate" > "enddate" then return '' end if; select first "v"."WorkCancelled","isnull"("r"."shortcode","v"."TempShiftCancelReasonID"),"v"."WorkHours" into "bcanc","scancid", "nhrs" from "PlacementDayVariation" as "v" key left outer join "tempshiftcancelreason" as "r" where "v"."placementid" = "placid" and "v"."VariationDate" = "pdate"; if "bcanc" = 1 then return "isnull"("scancid",'C') end if; if "nhrs" is not null then return "nhrs" end if; set "d" = "dow"("pdate")-1; select(case "d" when 0 then "worksunday" when 1 then "workmonday" when 2 then "worktuesday" when 3 then "workwednesday" when 4 then "workthursday" when 5 then "workfriday" when 6 then "worksaturday" end), "worknormalhours" into "bdayticked","nhrs" from "placement" where "placementid" = "placid"; if "bdayticked" = 1 then return "nhrs" end if; return '' end </code> database/functions/pears_placementdayhours.txt Last modified: 2026/08/07 19:24by 127.0.0.1