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.GetMinWage ====== <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"."GetMinWage"( in "persid" char(20),in @period integer ) returns double begin declare "rv" double; declare "myage" integer; set "rv" = 0; select "truncnum"("datediff"("day","dob","weekmonthenddate"(@period,'W'))/365.25,0) into "myage" from "person" where "personid" = "persid"; if "isnull"("GetQuestDate"('X','MDT','X'),"weekmonthenddate"(@period,'W')) > "weekmonthenddate"(@period,'W') then select(if "myage" < 18 then "GetQuestAnswer"('X','OIN','X') else if "myage" in( 18,19,20 ) then "GetQuestAnswer"('X','O18','X') else if "myage" in( 21,22 ) then "GetQuestAnswer"('X','O21','X') else "GetQuestAnswer"('X','O25','X') endif endif endif) into "rv" else select(if "myage" < 18 then "GetQuestAnswer"('X','MIN','X') else if "myage" in( 18,19,20 ) then "GetQuestAnswer"('X','M18','X') else if "myage" in( 21,22 ) then "GetQuestAnswer"('X','M21','X') else "GetQuestAnswer"('X','M25','X') endif endif endif) into "rv" end if; return "rv" end </code> database/functions/pears_getminwage.txt Last modified: 2026/08/07 19:24by 127.0.0.1