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.ValuesForInvoiceNIRechargeLine ====== <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"."ValuesForInvoiceNIRechargeLine"( in "tsid" char(20),in "tslineid" char(20),in "RecordType" char(1) ) returns long varchar -- can do line specific stuff with timesheet line id begin declare "rv" long varchar; declare "vex" integer; set "rv" = null; case "RecordType" when 'D' then set "rv" = 'Employers N.I.' when 'N' then select "analysis" into "rv" from "temptimesheet" key join "placement" key join "staff" key join "agencydetails" where "temptimesheetid" = "tsid"; set "rv" = "string"('1000',"rv") when 'V' then select "companyaccount"."vatexempt" into "vex" from "temptimesheet" key join "placement" key join "employment" key join "company" key join "companyaccount" where "temptimesheetid" = "tsid"; if "vex" = 1 then set "rv" = 'E' else set "rv" = 'S' end if end case; return("rv") end </code> database/functions/pears_valuesforinvoicenirechargeline.txt Last modified: 2026/08/07 19:24by 127.0.0.1