====== pears.NetAgencyCurrentRequirementSearch ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."NetAgencyCurrentRequirementSearch"( in "pWebUserID" char(20),in "pSlice" integer default 0,in "pSliceSize" integer default 20,in "pLineID" char(20) default null,in "pStatus" char(1),in "pCompanyName" char(50) default null,in "pPermOrShift" char(1) default null,in "pPosition" char(50) default null,in "pRef" char(10) default null,in "pSearchStartDate" char(26) default null,in "pSearchEndDate" char(26) default null )
result( "LineID" char(30),"StartDate" date,"StartTime" time,"FinishDate" date,"FinishTime" time,"Position" char(50),"ShiftDescription" char(50),"CompanyName" char(60),"ContactName" char(60),"Status" char(40),"ConsultantName" char(60),"OurRef" char(20),"TheirRef" char(50),"ContractRef" char(20),"CascadeDateTime" timestamp,"CascadeLevel" smallint,"WhenEntered" timestamp,"SubmittedCandidates" long varchar,"LongDescription" long varchar,"Interest" long varchar,"Declined" char(50),"Notes" long varchar )
begin
// IQXWeb
declare @SecAgID char(20);
declare @PlacedCode char(1);
declare "SearchStr" char(100);
declare "x" integer;
declare "y" integer;
declare "CompanySearch" char(60);
declare "PositionSearch" char(60);
declare local temporary table "DSet"(
"LineID" char(30) null,
"StartDate" date null,
"StartTime" time null,
"FinishDate" date null,
"FinishTime" time null,
"Position" char(50) null,
"ShiftDescription" char(50) null,
"CompanyName" char(60) null,
"ContactName" char(30) null,
"Status" char(40) null,
"ConsultantName" char(60) null,
"OurRef" char(20) null,
"TheirRef" char(50) null,
"ContractRef" char(20) null,
"CascadeDateTime" timestamp null,
"CascadeLevel" smallint null,
"WhenEntered" timestamp null,
"SubmittedCandidates" long varchar null,
"LongDescription" long varchar null,
"Interest" long varchar null,
"Declined" char(50) null,
"Notes" long varchar null,
"LineStatus" char(1) null,
) not transactional;
set @SecAgID = (select top 1 "employment"."companyid" from "employment" key join "iqxnetuserlink" where "iqxnetuserlink"."iqxnetuserid" = "pwebuserid" order by "isnull"("employment"."leavedate",current date) desc);
set @PlacedCode = (select top 1 "s"."status" from "status" as "s" where "type" = 'R' and "name" = 'Placed' order by "sortorder" asc);
set "x" = "isnull"("pSliceSize",20);
set "y" = "x"*"isnull"("pSlice",0)+1;
set "CompanySearch" = "isnull"("pCompanyName",'');
set "PositionSearch" = "isnull"("pPosition",'');
if "isnull"("pRef",'') <> '' then
set "CompanySearch" = null;
set "PositionSearch" = null;
set "pStatus" = null;
set "pPermOrShift" = null
end if;
insert into "DSet"
select 'V'+"v"."VacancyID" as "LineID",
"v"."StartDate",
null,
"v"."FinishDate",
null as "FinishTime",
"v"."Position" as "Position",
'' as "ShiftDescription",
"c"."Name" as "CompanyName",
"Person"."Name" as "ContactName",
(select "Name" from "Status" where "Status"."Status" = "v"."Status" and "Status"."Type" = 'V') as "Status",
"s"."Name" as "Consultant",
"v"."RefCode" as "OurRef",
"v"."TheirRef" as "TheirRef",
"v"."ContractRef",
"v"."CascadeDateTime",
"v"."CascadeLevel",
"v"."WhenEntered",
(select "list"(distinct "person"."name",', ') from "vacancy" key join "progress" key join "person" key join "pay_employee" where "vacancy"."vacancyid" = "v"."vacancyid" and "pay_employee"."secondaryagencyid" = @secagid) as "SubmittedCandidates",
"v"."OtherNotes" as "LongDescription",
"isnull"(
(select top 1 'Declined Interest at '+cast("dateformat"("cv"."whendeclined",'dd/mm/yyyy hh:nn') as char) from "cascadedvacancy" as "cv" right outer join "vacancy" as "va" where "cv"."whendeclined" is not null and("cv"."secondaryagencyid" is null or "cv"."secondaryagencyid" = @secagid) and "cv"."vacancyid" = "v"."vacancyid" order by "whendeclined" desc),
(select top 1 "ce"."Description"+' at '+cast("dateformat"("ce"."contactdate",'dd/mm/yyyy') as char)+' '+cast("dateformat"("ce"."contacttime",'hh:nn') as char)+' sent to '+"s"."name"+'. Note: '+"ce"."notes" from "cascadedvacancy" as "cv" right outer join "vacancy" as "va" key join "contactevent" as "ce" key join "staff" as "s","contactevent" as "ce" key join "employment" as "e" where(("ce"."classcode" = 'CI') or("ce"."classcode" = 'DI')) and("cv"."secondaryagencyid" is null or "cv"."secondaryagencyid" = @secagid) and "ce"."vacancyid" = "v"."vacancyid" and "e"."companyid" = "cv"."secondaryagencyid" order by "ce"."description" desc,"contactdate" asc,"contacttime" desc)) as "Interest",
(select top 1 "cv"."whendeclined" from "cascadedvacancy" as "cv" where "cv"."vacancyid" = "v"."vacancyid" and "cv"."secondaryagencyid" = @secagid order by "whendeclined" desc) as "Declined",
"v"."othernotes",
"v"."status" as "LineStatus"
from "Vacancy" as "v" key join "Employment" as "e" key join("Company" as "c","Person")
,"Vacancy" as "v" left outer join "CascadedVacancy" as "cv"
,"Company" as "c" key join "CompanyStatus" as "compstat"
,"Company" as "c" left outer join "division" as "d"
,"Vacancy" as "v" key join "staff" as "s"
where "Declined" is null
and "cv"."whendeclined" is null
and(("Interest" like 'Confirm%') or("Interest" is null))
and "isnull"("cv"."secondaryagencyid","c"."companyid") = @secagid
and "isnull"((select "desktype" from "tempdesk" where "tempdeskid" = "v"."tempdeskid"),'') <> 'S' union all
select 'P'+"p"."TempShiftPlanID" as "LineID",
"isnull"("ts"."shiftdate","p"."ShiftDate"),
"isnull"("ts"."timefrom","p"."TimeFrom"),
(if "isnull"("ts"."timefrom","p"."TimeFrom") < "isnull"("ts"."timefrom","p"."TimeTo") then "isnull"("ts"."shiftdate","p"."ShiftDate") else "isnull"("ts"."shiftdate","p"."ShiftDate")+1 endif) as "FinishDate",
"isnull"("ts"."timeto","p"."TimeTo") as "FinishTime",
"v"."Position",
"p"."Description" as "ShiftDescription",
"c"."Name" as "CompanyName",
"Person"."Name" as "ContactName",
(case "isnull"("ts"."state",'U')
when 'B' then 'Booked'
when 'P' then 'Provisional'
when 'W' then 'Worked'
when 'C' then 'Cancelled'
when 'U' then 'Unfilled' end) as "Status",
(select "Name" from "Staff" where "Staff"."StaffID" = "v"."StaffID") as "ConsultantName",
cast("p"."ShiftSerialNumber" as char(20)) as "OurRef",
"p"."ReferenceCode" as "TheirRef",
"v"."ContractRef",
"p"."CascadeDateTime",
"p"."CascadeLevel",
"p"."WhenEntered",
(select "list"(distinct "person"."name",', ') from "tempshiftprogress" key join "person" key join "pay_employee" where "tempshiftprogress"."tempshiftplanid" = "p"."tempshiftplanid" and "pay_employee"."secondaryagencyid" = @secagid) as "SubmittedCandidates",
'' as "LongDescription",
(select top 1 "ce"."Description"+' at '+cast("dateformat"("ce"."contactdate",'dd/mm/yyyy') as char)+' '+cast("dateformat"("ce"."contacttime",'hh:nn') as char)+' sent to '+"s"."name"+'. Note: '+"ce"."notes" from "cascadedvacancy" as "cv" right outer join "vacancy" as "va" key join "contactevent" as "ce" key join "staff" as "s" where(("ce"."classcode" = 'CI') or("ce"."classcode" = 'DI')) and("cv"."secondaryagencyid" is null or "cv"."secondaryagencyid" = @secagid) and "ce"."vacancyid" = "v"."vacancyid" and "substr"("ce"."description","charindex"(':',"ce"."description")+1) = "OurRef" order by "ce"."description" desc,"contactdate" asc,"contacttime" desc) as "Interest",
(select top 1 "cs"."WhenDeclined" from "cascadedshift" as "cs" where "cs"."tempshiftplanid" = "p"."tempshiftplanid" and "cs"."secondaryagencyid" = @secagid order by "cascadelevel" desc) as "Declined",
"p"."ClientNote",
"v"."Status" as "LineStatus"
from "TempShiftPlan" as "p" key join "Vacancy" as "v" key join "Employment" key join("Company" as "c","Person")
,"TempShiftPlan" as "p" left outer join "CascadedShift" as "cs"
,"TempShiftPlan" as "p" left outer join "TempShift" as "ts"
,"Company" as "c" key join "CompanyStatus" as "compstat"
,"Company" as "c" left outer join "division" as "d"
where "Declined" is null
and "cs"."whendeclined" is null
and(("Interest" like 'Confirm%') or("Interest" is null))
and "cs"."secondaryagencyid" = @secagid;
select top "x" start at "y"
"LineID","StartDate","StartTime","FinishDate","FinishTime","Position","ShiftDescription","CompanyName","ContactName","Status","ConsultantName","OurRef","TheirRef","ContractRef","CascadeDateTime","CascadeLevel","WhenEntered","SubmittedCandidates","LongDescription","Interest","Declined","Notes"
from "DSet"
where("LineID" = "pLineID"
or("LineStatus" = "isnull"("pStatus","LineStatus")
and "left"("CompanyName","length"("CompanySearch")) = "isnull"("CompanySearch","left"("CompanyName"+"ContactName","length"("CompanySearch")))
and "left"("LineId",1) = "isnull"("pPermOrShift","left"("LineId",1))
and "left"("Position","length"("PositionSearch")) = "isnull"("PositionSearch","left"("Position","length"("PositionSearch")))
and "isnull"("pLineID",'') = ''
and("isnull"("dateformat"("pSearchStartDate",'yyyy-mm-dd'),"today"()) <= "isnull"("FinishDate","dateformat"("now"(),'yyyy-mm-dd')) and "isnull"("dateformat"("pSearchEndDate",'yyyy-mm-dd'),"today"()) >= "isnull"("StartDate","dateformat"("now"(),'yyyy-mm-dd'))))
or("OurRef" = "pRef"
and "isnull"("pLineID",'') = '')
or "isnull"("pLineID","pStatus","pCompanyName","pPermOrShift","pPosition","pRef",'') = '')
order by "startdate" desc,"starttime" desc
end /* DOC
2016-09-29 PC v0.1 create searchable list, combined with greater detail, searchable on Line ID
2016-11-29 PC Test and doc
2017-01-17 PC search dates added
2018-06-15 PC revise tests
2019-03-05 PC IW-873 add top 1 and order by on subqueries
tests:
valid pWebUser, pslice, pSliceSize, pLineID for V
valid pWebUser, pslice, pSliceSize, pStatus
valid pWebUser, pslice, pSliceSize, pLineID for P
*/
/* TEST
call NetTestSetup('');
update iqxnetuserlink set employmentid=null where IQXNetUserLinkID in ('test.candidate','test.client','test.owner');
update iqxnetuserlink set employmentid='TEST' where IQXNetUserLinkID='test.agency';
delete from cascadedvacancy where cascadedvacancyid='TEST';
delete from cascadedshift where cascadedshiftid='TEST';
insert into cascadedvacancy (CascadedVacancyID,VacancyID,SecondaryAgencyID,cascadetime,cascadelevel,method) values ('TEST','TEST','TEST',now(*),1,9);
update vacancy set staffid='TEST',refcode='TestRef',status='[' where vacancyid='TEST';
update tempdesk set desktype='W' where tempdeskid='TEST';
select * from NetAgencyCurrentRequirementSearch('test.agency',null,null,null,null,null,null,null,null,null,null) where lineid='VTEST';
expect LineId=VTEST,Position=test,CompanyName=test,ContactName=test,ConsultantName=TestStaff;
insert into tempshiftplan (tempshiftplanid,vacancyid,description) on existing update defaults off values ('TEST','TEST','test2');
insert into cascadedshift (cascadedshiftid,tempshiftplanid,secondaryagencyid,cascadetime,cascadelevel,method) values ('TEST','TEST','TEST',now(*),1,9);
select * from NetAgencyCurrentRequirementSearch('test.agency',0,10,null,null,null,null,null,null,null,null) where lineid='PTEST';
expect LineId=PTEST,Position=test,CompanyName=test,ContactName=test,ConsultantName=TestStaff;
select * from NetAgencyCurrentRequirementSearch('test.agency',0,10,'PTEST',null,null,null,null,null,null,null);
expect LineId=PTEST,Position=test,CompanyName=test,ContactName=test,ConsultantName=TestStaff;
delete from cascadedvacancy where cascadedvacancyid='TEST';
delete from cascadedshift where cascadedshiftid='TEST';
*/
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetAgencyCurrentRequirementSearch" IS
{create PROCEDURE pears."NetAgencyCurrentRequirementSearch"(in pWebUserID char(20),in pSlice integer default 0,in pSliceSize integer default 20,in pLineID char(20) default null,in pStatus char(1),in pCompanyName char(50) default null,in pPermOrShift char(1) default null,in pPosition char(50) default null, in pRef char(10) default null, in pSearchStartDate char(26) default null, in pSearchEndDate char(26) default null)
RESULT(LineID char(30),StartDate date,StartTime time,FinishDate date,FinishTime time,Position char(50),ShiftDescription char(50),CompanyName char(60),ContactName char(60),Status char(40),ConsultantName char(60),OurRef char(20),TheirRef char(50),ContractRef char(20),CascadeDateTime timestamp,CascadeLevel smallint,WhenEntered timestamp,SubmittedCandidates long varchar,LongDescription long varchar,Interest long varchar,Declined char(50),Notes long varchar )
BEGIN
// IQXWeb
declare @SecAgID char(20);
declare @PlacedCode char(1);
declare "SearchStr" char(100);
declare x integer;
declare y integer;
declare CompanySearch char(60);
declare PositionSearch char(60);
declare local temporary table "DSet"(
"LineID" char(30) null,
"StartDate" date null,
"StartTime" time null,
"FinishDate" date null,
"FinishTime" time null,
"Position" char(50) null,
"ShiftDescription" char(50) null,
"CompanyName" char(60) null,
"ContactName" char(30) null,
"Status" char(40) null,
"ConsultantName" char(60) null,
"OurRef" char(20) null,
"TheirRef" char(50) null,
"ContractRef" char(20) null,
"CascadeDateTime" timestamp null,
"CascadeLevel" smallint null,
"WhenEntered" timestamp null,
"SubmittedCandidates" long varchar null,
"LongDescription" long varchar null,
"Interest" long varchar null,
"Declined" char(50) null,
Notes long varchar null,
LineStatus char(1) null
) not transactional;
set @SecAgID = (select top 1 "employment"."companyid" from "employment" key join "iqxnetuserlink" where "iqxnetuserlink"."iqxnetuserid" = "pwebuserid" order by isnull(employment.leavedate,current date) desc);
set @PlacedCode = (select top 1 "s"."status" from "status" as "s" where "type" = 'R' and "name" = 'Placed' order by sortorder);
set x=isnull(pSliceSize,20);
set y=x*isnull(pSlice,0)+1;
set CompanySearch=isnull(pCompanyName,'');
set PositionSearch=isnull(pPosition,'');
if isnull(pRef,'')<> '' then
set CompanySearch=null;
set PositionSearch=null;
set pStatus=null;
set pPermOrShift=null;
end if;
insert into "DSet"
select 'V'+"v"."VacancyID" as "LineID",
"v"."StartDate",
null,
"v"."FinishDate",
null as FinishTime,
"v"."Position" as "Position",
'' as "ShiftDescription",
"c"."Name" as "CompanyName",
"Person"."Name" as "ContactName",
(select "Name" from "Status" where "Status"."Status" = "v"."Status" and "Status"."Type" = 'V') as "Status",
s."Name" as "Consultant",
"v"."RefCode" as "OurRef",
"v"."TheirRef" as TheirRef,
"v"."ContractRef",
"v"."CascadeDateTime",
"v"."CascadeLevel",
"v"."WhenEntered",
(select "list"(distinct "person"."name",', ') from "vacancy" key join "progress" key join "person" key join "pay_employee" where "vacancy"."vacancyid" = "v"."vacancyid" and "pay_employee"."secondaryagencyid" = @secagid) as "SubmittedCandidates",
"v"."OtherNotes" as "LongDescription",
"isnull"(
(select top 1 'Declined Interest at '+cast("dateformat"("cv"."whendeclined",'dd/mm/yyyy hh:nn') as char) from "cascadedvacancy" as "cv" right outer join "vacancy" as "va" where "cv"."whendeclined" is not null and("cv"."secondaryagencyid" is null or "cv"."secondaryagencyid" = @secagid) and "cv"."vacancyid" = "v"."vacancyid" order by whendeclined desc),
(select top 1 "ce"."Description"+' at '+cast("dateformat"("ce"."contactdate",'dd/mm/yyyy') as char)+' '+cast("dateformat"("ce"."contacttime",'hh:nn') as char)+' sent to '+"s"."name"+'. Note: '+"ce"."notes" from "cascadedvacancy" as "cv" right outer join "vacancy" as "va" key join "contactevent" as "ce" key join "staff" as "s","contactevent" as "ce" key join "employment" as "e" where(("ce"."classcode" = 'CI') or("ce"."classcode" = 'DI')) and("cv"."secondaryagencyid" is null or "cv"."secondaryagencyid" = @secagid) and "ce"."vacancyid" = "v"."vacancyid" and "e"."companyid" = "cv"."secondaryagencyid" order by "ce"."description" desc,"contactdate" asc,"contacttime" desc)) as "Interest",
(select top 1 "cv"."whendeclined" from "cascadedvacancy" as "cv" where "cv"."vacancyid" = "v"."vacancyid" and "cv"."secondaryagencyid" = @secagid order by whendeclined desc) as "Declined",
v.othernotes,
v.status as LineStatus
from "Vacancy" as "v" key join "Employment" as "e" key join("Company" as "c","Person")
,"Vacancy" as "v" left join "CascadedVacancy" as "cv"
,"Company" as "c" key join "CompanyStatus" as "compstat"
,"Company" as "c" left join "division" as "d",
Vacancy as v key join staff s
where "Declined" is null
and "cv"."whendeclined" is null
and(("Interest" like 'Confirm%') or("Interest" is null))
and isnull("cv"."secondaryagencyid",c.companyid) = @secagid
and "isnull"((select "desktype" from "tempdesk" where "tempdeskid" = "v"."tempdeskid"),'') <> 'S'
union all
select 'P'+"p"."TempShiftPlanID" as "LineID",
"isnull"("ts"."shiftdate","p"."ShiftDate"),
"isnull"("ts"."timefrom","p"."TimeFrom"),
(if "isnull"("ts"."timefrom","p"."TimeFrom") < "isnull"("ts"."timefrom","p"."TimeTo") then "isnull"("ts"."shiftdate","p"."ShiftDate") else "isnull"("ts"."shiftdate","p"."ShiftDate")+1 endif) as "FinishDate",
"isnull"("ts"."timeto","p"."TimeTo") as "FinishTime",
"v"."Position",
"p"."Description" as "ShiftDescription",
"c"."Name" as "CompanyName",
"Person"."Name" as "ContactName",
(case isnull(ts.state,'U')
when 'B' then 'Booked'
when 'P' then 'Provisional'
when 'W' then 'Worked'
when 'C' then 'Cancelled'
when 'U' then 'Unfilled'
end case) as "Status",
(select "Name" from "Staff" where "Staff"."StaffID" = "v"."StaffID") as "ConsultantName",
cast("p"."ShiftSerialNumber" as char(20)) as "OurRef",
"p"."ReferenceCode" as "TheirRef",
"v"."ContractRef",
"p"."CascadeDateTime",
"p"."CascadeLevel",
"p"."WhenEntered",
(select "list"(distinct "person"."name",', ') from "tempshiftprogress" key join "person" key join "pay_employee" where "tempshiftprogress"."tempshiftplanid" = "p"."tempshiftplanid" and "pay_employee"."secondaryagencyid" = @secagid) as "SubmittedCandidates",
'' as "LongDescription",
(select top 1 "ce"."Description"+' at '+cast("dateformat"("ce"."contactdate",'dd/mm/yyyy') as char)+' '+cast("dateformat"("ce"."contacttime",'hh:nn') as char)+' sent to '+"s"."name"+'. Note: '+"ce"."notes" from "cascadedvacancy" as "cv" right outer join "vacancy" as "va" key join "contactevent" as "ce" key join "staff" as "s" where(("ce"."classcode" = 'CI') or("ce"."classcode" = 'DI')) and("cv"."secondaryagencyid" is null or "cv"."secondaryagencyid" = @secagid) and "ce"."vacancyid" = "v"."vacancyid" and "substr"("ce"."description","charindex"(':',"ce"."description")+1) = "OurRef" order by "ce"."description" desc,"contactdate" asc,"contacttime" desc) as "Interest",
(select top 1 "cs"."WhenDeclined" from "cascadedshift" as "cs" where "cs"."tempshiftplanid" = "p"."tempshiftplanid" and "cs"."secondaryagencyid" = @secagid order by cascadelevel desc) as "Declined",
p.ClientNote,
v.Status as LineStatus
from "TempShiftPlan" as "p" key join "Vacancy" as "v" key join "Employment" key join("Company" as "c","Person")
,"TempShiftPlan" as "p" left join "CascadedShift" as "cs"
,"TempShiftPlan" as "p" left outer join "TempShift" as "ts"
,"Company" as "c" key join "CompanyStatus" as "compstat"
,"Company" as "c" left join "division" as "d"
where "Declined" is null
and "cs"."whendeclined" is null
and(("Interest" like 'Confirm%') or("Interest" is null))
and "cs"."secondaryagencyid" = @secagid;
select top x start at y
"LineID","StartDate","StartTime","FinishDate","FinishTime","Position","ShiftDescription","CompanyName","ContactName","Status","ConsultantName","OurRef","TheirRef","ContractRef","CascadeDateTime","CascadeLevel","WhenEntered","SubmittedCandidates","LongDescription","Interest",Declined,Notes
from DSet
where LineID = pLineID
or(
LineStatus = isnull(pStatus,LineStatus)
and left(CompanyName,length(CompanySearch)) = isnull(CompanySearch,left(CompanyName+ContactName,length(CompanySearch)))
and left(LineId,1)=isnull(pPermOrShift,left(LineId,1))
and left(Position,length(PositionSearch)) = isnull(PositionSearch,left(Position,length(PositionSearch)))
and isnull(pLineID,'')=''
and (isnull(dateformat(pSearchStartDate,'yyyy-mm-dd'),today(*)) <= isnull(FinishDate,dateformat(now(*),'yyyy-mm-dd')) and isnull(dateformat(pSearchEndDate,'yyyy-mm-dd'),today(*)) >= isnull(StartDate,dateformat(now(*),'yyyy-mm-dd')))
)
or (OurRef = pRef
and isnull(pLineID,'')='')
or isnull(pLineID,pStatus,pCompanyName,pPermOrShift,pPosition,pRef,'')=''
order by startdate desc,starttime desc
END
/* DOC
2016-09-29 PC v0.1 create searchable list, combined with greater detail, searchable on Line ID
2016-11-29 PC Test and doc
2017-01-17 PC search dates added
2018-06-15 PC revise tests
2019-03-05 PC IW-873 add top 1 and order by on subqueries
tests:
valid pWebUser, pslice, pSliceSize, pLineID for V
valid pWebUser, pslice, pSliceSize, pStatus
valid pWebUser, pslice, pSliceSize, pLineID for P
*/
/* TEST
call NetTestSetup('');
update iqxnetuserlink set employmentid=null where IQXNetUserLinkID in ('test.candidate','test.client','test.owner');
update iqxnetuserlink set employmentid='TEST' where IQXNetUserLinkID='test.agency';
delete from cascadedvacancy where cascadedvacancyid='TEST';
delete from cascadedshift where cascadedshiftid='TEST';
insert into cascadedvacancy (CascadedVacancyID,VacancyID,SecondaryAgencyID,cascadetime,cascadelevel,method) values ('TEST','TEST','TEST',now(*),1,9);
update vacancy set staffid='TEST',refcode='TestRef',status='[' where vacancyid='TEST';
update tempdesk set desktype='W' where tempdeskid='TEST';
select * from NetAgencyCurrentRequirementSearch('test.agency',null,null,null,null,null,null,null,null,null,null) where lineid='VTEST';
expect LineId=VTEST,Position=test,CompanyName=test,ContactName=test,ConsultantName=TestStaff;
insert into tempshiftplan (tempshiftplanid,vacancyid,description) on existing update defaults off values ('TEST','TEST','test2');
insert into cascadedshift (cascadedshiftid,tempshiftplanid,secondaryagencyid,cascadetime,cascadelevel,method) values ('TEST','TEST','TEST',now(*),1,9);
select * from NetAgencyCurrentRequirementSearch('test.agency',0,10,null,null,null,null,null,null,null,null) where lineid='PTEST';
expect LineId=PTEST,Position=test,CompanyName=test,ContactName=test,ConsultantName=TestStaff;
select * from NetAgencyCurrentRequirementSearch('test.agency',0,10,'PTEST',null,null,null,null,null,null,null);
expect LineId=PTEST,Position=test,CompanyName=test,ContactName=test,ConsultantName=TestStaff;
delete from cascadedvacancy where cascadedvacancyid='TEST';
delete from cascadedshift where cascadedshiftid='TEST';
*/
}