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.TempGetWeekAgo ====== <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"."TempGetWeekAgo"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "StartYear" integer,in "StartWeek" integer,in "WeeksAgo" smallint ) returns integer /* Function returns year and week in format: yyyyww */ begin declare "MaxWeek" smallint; if "WeeksAgo" > 52 then return null end if; if "WeeksAgo" < "StartWeek" then return("StartYear"*100+("StartWeek"-"WeeksAgo")) end if; select "numberofweeks" into "MaxWeek" from "payrollyear" where "yearnumber" = "StartYear"-1; if "maxweek" is null then set "maxweek" = 52 end if; return("StartYear"-1)*100+("MaxWeek"-("WeeksAgo"-"StartWeek")) end </code> database/functions/pears_tempgetweekago.txt Last modified: 2026/08/07 19:24by 127.0.0.1