====== pears.NetOwnerPayRateEdit ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create procedure "pears"."NetOwnerPayRateEdit"( in "pWebUserID" char(20),in "pVacancyID" char(20),in "pObjID" char(20),in "pCode" char(20),in "pParentObject" char(20),in "pPay_Rate" char(10),in "pCharge_Rate" char(10),in "pOldDescription" char(60),in "pOldUnits" char(20),in "pOldPay_Rate" char(10),in "pOldCharge_Rate" char(10) ) result( "pResult" char(250) ) begin declare "ssql" char(255); declare "divid" char(20); declare "TJobRateID" char(20); set "divid" = (select first "staff"."divisionid" from "iqxnetuser" key join "staff" where "iqxnetuser"."iqxnetuserid" = "pwebuserid"); if "divid" is null then select '99:~Permission denied'; return end if; set "ssql" = ''; if "pCode" = '' then select '100:~Please enter a valid shift type'; return end if; if "pPay_Rate" = '' or("isnumeric"("pPay_rate") = 0) then select '101:~Please enter a valid Pay Rate'; return end if; if "pCharge_Rate" = '' or("isnumeric"("pCharge_rate") = 0) then select '102:~Please enter a valid Charge Rate'; return end if; if "isnull"("pPay_Rate",'') <> "isnull"("pOldPay_Rate",'') then set "ssql" = "ssql"+',payrate = pPay_Rate' end if; if("isnull"("pCharge_Rate",'') <> "isnull"("pOldCharge_Rate",'')) then set "ssql" = "ssql"+',chargerate = pCharge_Rate' end if; execute immediate 'update TempJobRate set temppaybandid = pCode'+"ssql"+' where TempJobRateid = pObjID'; if @@rowcount = 0 then set "TJobRateID" = "uniquekey"("pCode"); insert into "TempJobRate"( "TempJobRateID","TempPayBandID","VacancyID","payrate","Chargerate" ) values( "TJobRateID","pCode","pVacancyID","pPay_Rate","pCharge_Rate" ) end if; select '0:TJobRateID~Success' --select string('0:',TJobRateID,'#',pParentObject,'~Success') end go COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetOwnerPayRateEdit" IS {create procedure pears."NetOwnerPayRateEdit"( in "pWebUserID" char(20),in "pVacancyID" char(20),in "pObjID" char(20),in "pCode" char(20),in "pParentObject" char(20),in "pPay_Rate" char(10),in "pCharge_Rate" char(10),in "pOldDescription" char(60),in "pOldUnits" char(20),in "pOldPay_Rate" char(10),in "pOldCharge_Rate" char(10) ) result( "pResult" char(250) ) begin declare "ssql" char(255); declare "divid" char(20); declare "TJobRateID" char(20); set "divid" = (select first "staff"."divisionid" from "iqxnetuser" key join "staff" where "iqxnetuser"."iqxnetuserid" = "pwebuserid"); if "divid" is null then select '99:~Permission denied'; return end if; set "ssql" = ''; if "pCode" = '' then select '100:~Please enter a valid shift type'; return end if; if "pPay_Rate" = '' or("isnumeric"("pPay_rate") = 0) then select '101:~Please enter a valid Pay Rate'; return end if; if "pCharge_Rate" = '' or("isnumeric"("pCharge_rate") = 0) then select '102:~Please enter a valid Charge Rate'; return end if; if "isnull"("pPay_Rate",'') <> "isnull"("pOldPay_Rate",'') then set "ssql" = "ssql"+',payrate = pPay_Rate' end if; if("isnull"("pCharge_Rate",'') <> "isnull"("pOldCharge_Rate",'')) then set "ssql" = "ssql"+',chargerate = pCharge_Rate' end if; execute immediate 'update TempJobRate set temppaybandid = pCode'+"ssql"+' where TempJobRateid = pObjID'; if @@rowcount = 0 then set "TJobRateID" = "uniquekey"("pCode"); insert into "TempJobRate"( "TempJobRateID","TempPayBandID","VacancyID","payrate","Chargerate" ) values( "TJobRateID","pCode","pVacancyID","pPay_Rate","pCharge_Rate" ) end if; select '0:TJobRateID~Success' --select string('0:',TJobRateID,'#',pParentObject,'~Success') end }