====== pears.EntityRateFilter ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create function "pears"."EntityRateFilter"( in "FilterNo" smallint,in "WeekNo" integer,in "VacID" char(20),in "PersID" char(20),in "PlacID" char(20),in "ShiftID" char(20) ) returns char(4) begin declare "rv" char(4); declare "qual" integer; -- Used to filter the rate tables -- Return null if specified FilterNo is not applicable to this entity set "rv" = null; if "filterno" = 1 then -- AWR if "weekno" is null then return null -- Filter only applied in timesheet entry end if; set "qual" = "AWRQualified"(null,"WeekNo","VacID","PersID","PlacID","ShiftID"); if "qual" is null then return null else if "qual" = 0 then return 'N' else return 'Y' end if end if end if; if "filterno" = 2 then -- Ltd Co. if "trim"("isnull"("persid",'')) <> '' then -- Note empty parameters cannot be relied upon to be null if exists(select * from "pay_employee" where "personid" = "persid" and "taxmethod" = 2) then set "rv" = 'Y' else set "rv" = 'N' -- If persid not supplied then leave rv as NULL for don't know end if end if end if; if "filterno" = 3 then return "EntitySpeciality"("VacID","PersID","PlacID","ShiftID") end if; return "rv" end