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.wtd_start_of_hol_year ====== <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"."wtd_start_of_hol_year"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "pid" char(20),in "yr" integer,in "wk" integer ) returns date begin declare "sdate" date; declare "wedate" date; set "wedate" = "date"("weekenddate"("yr","wk")); if "wedate" is null then -- Off the range of known weeks return null end if; select "min"("startdate") into "sdate" from "pay_employment" where "personid" = "pid" and("enddate" is null or "enddate" >= "wedate"-13); --(still working or stopped >= last week) if "sdate" is null then return null end if; set "sdate" = "getholidayyear"("sdate","wedate"-7); --Does 1/10/1998 threshold, and rolls forward if > 1 year ago return "sdate" end </code> database/functions/pears_wtd_start_of_hol_year.txt Last modified: 2026/08/07 19:24by 127.0.0.1