====== pears.NetOwnerEmployeeDetails ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."NetOwnerEmployeeDetails"( in "pWebUserID" char(20),in "pEmployeeID" char(20) )
result( "ObjID" char(20),"Forenames" char(50),"Surname" char(50),"Salutation" char(50),"Direct_Phone" char(250),"Mobile" char(250),"Email" char(250),"Direct_Fax" char(250),"Position" char(100),"Department" char(100),"Notes" char(100) )
begin
declare "divid" char(20);
set "divid" = (select first "staff"."divisionid" from "iqxnetuser" key join "staff" where "iqxnetuser"."iqxnetuserid" = "pwebuserid");
if "divid" is null then
return
end if;
if "isnull"("pEmployeeID",'') = '' then
select '','','','','','','','','','',''
else
select first
"Person"."personid" as "ObjID",
"Person"."forenames" as "Forenames",
"Person"."surname" as "Surname",
"Person"."salutation" as "Salutation",
"getphone"('CP','Direct Telephone',"pEmployeeID") as "Direct_Phone",
"getphone"('CP','Mobile',"pEmployeeID") as "Mobile",
"getphone"('CP','E-mail',"pEmployeeID") as "Email",
"getphone"('CP','Direct Fax',"pEmployeeID") as "Direct_Fax",
"employment"."position" as "Position",
"employment"."department" as "Department",
"employment"."note" as "Notes"
from "Person" key join "employment" key join "company"
where "Person"."personid" = "pEmployeeID" and "company"."divisionid" = "divid"
end if
end
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetOwnerEmployeeDetails" IS
{create procedure pears."NetOwnerEmployeeDetails"( in "pWebUserID" char(20),in "pEmployeeID" char(20) )
result( "ObjID" char(20),"Forenames" char(50),"Surname" char(50),"Salutation" char(50),"Direct_Phone" char(250),"Mobile" char(250),"Email" char(250),"Direct_Fax" char(250),"Position" char(100),"Department" char(100),"Notes" char(100) )
begin
declare "divid" char(20);
set "divid" = (select first "staff"."divisionid" from "iqxnetuser" key join "staff" where "iqxnetuser"."iqxnetuserid" = "pwebuserid");
if "divid" is null then
return
end if;
if "isnull"("pEmployeeID",'') = '' then
select '','','','','','','','','','',''
else
select first
"Person"."personid" as "ObjID",
"Person"."forenames" as "Forenames",
"Person"."surname" as "Surname",
"Person"."salutation" as "Salutation",
"getphone"('CP','Direct Telephone',"pEmployeeID") as "Direct_Phone",
"getphone"('CP','Mobile',"pEmployeeID") as "Mobile",
"getphone"('CP','E-mail',"pEmployeeID") as "Email",
"getphone"('CP','Direct Fax',"pEmployeeID") as "Direct_Fax",
"employment"."position" as "Position",
"employment"."department" as "Department",
"employment"."note" as "Notes"
from "Person" key join "employment" key join "company"
where "Person"."personid" = "pEmployeeID" and "company"."divisionid" = "divid"
end if
end
}