====== pears.SDSRequired ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."SDSRequired" IS
{create function SDSRequired
/* Application Maintained Function / Procedure - DO NOT EDIT*/
( IN COID char(20),IN PID char(20))
RETURNS SMALLINT
NOT DETERMINISTIC
BEGIN
if WPKMaintainGetSwitchValue('IR35SDSON','','L') = 'N' then return 0
end if;
-- if exists (select 1 from company where PrivateSector = 1 and companyid = COID) then return 0
-- end if;
if exists(select 1 from pay_employee where personid = PID and taxmethod = 1) then return 0
end if;
if exists(select 1 from pay_employee where personid = PID and HMRCEngagementDetail = 'F') then return 0
end if;
if exists(select 1 from companySDS where personid = PID and companyid = COID) then return 0
end if;
return 1
END
}