====== pears.weekmonthenddate ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create function "pears"."weekmonthenddate"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "perd" integer,in "worm" char(1) ) returns date begin declare "rv" date; declare "w" integer; declare "y" integer; set "y" = "truncnum"("perd",-2); set "w" = "perd"-"y"; set "y" = "y"/100; if "worm" = 'W' then return "weekenddate"("y","w") end if; set "rv" = "dateadd"("month",1+(select "monthoneoffset" from "params"),"ymd"("y","w",1))-1; return("rv") end