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.ValuesForAWRInvoiceFixedNIWTRLine ====== <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"."ValuesForAWRInvoiceFixedNIWTRLine"( in "tsid" char(20),in "tslineid" char(20),in "RecordType" char(1) ) returns double begin -- RecordType W - WTR N - NI declare "vid" char(20); declare "cid" char(20); declare "rv" double; set "rv" = 0; select "companyid","vacancyid" into "cid","vid" from "employment" key join "placement" key join "temptimesheet" where "temptimesheetid" = "tsid"; case "RecordType" when 'W' then //'Fixed WTR Rate. check vacancy, then company then non-awr' select "AWRFixedWTR" into "rv" from "vacancy" where "vacancyid" = "vid"; if "isnull"("rv",0) <> 0 then return "rv" end if; select "AWRFixedWTR" into "rv" from "companyaccount" where "companyid" = "cid"; if "isnull"("rv",0) <> 0 then return "rv" end if; select "FixedWTR" into "rv" from "companyaccount" where "companyid" = "cid" when 'N' then //'Fixed NI Rate.' select "AWRFixedNI" into "rv" from "vacancy" where "vacancyid" = "vid"; if "isnull"("rv",0) <> 0 then return "rv" end if; select "AWRFixedNI" into "rv" from "companyaccount" where "companyid" = "cid"; if "isnull"("rv",0) <> 0 then return "rv" end if; select "FixedNI" into "rv" from "companyaccount" where "companyid" = "cid" end case; return("rv") end </code> database/functions/pears_valuesforawrinvoicefixedniwtrline.txt Last modified: 2026/08/07 19:24by 127.0.0.1