====== pears.NetCandidateProvTimesheetCount ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."NetCandidateProvTimesheetCount"( in "pWebUserID" char(20),in "pCompleted" smallint default null )
result( "pResult" long varchar )
// IQXNet
begin
select "count"() from "NetProvTimesheets"("pWebUserID",0) where("completed" = "pCompleted" or "pCompleted" is null)
end /* DOC
2017-05-10 PC front-page widget to provide a count of provisional timesheets
2018-05-21 MHS allow optional specification of completed status. Simplify tests.
*/
/* TEST
call NetTestSetup('');
delete from tempprovtimesheetline from tempprovtimesheetline key join tempprovtimesheet s where s.personid='TEST';
delete from tempprovtimesheet where personid='TEST';
insert into tempprovtimesheet (tempprovtimesheetid,personid,vacancyid,tempdeskid,periodlength,period,extnumber)
values (uniquekey(''),'TEST','TEST','TEST','W',weekcontaining(current date),1);
select * from NetCandidateProvTimesheetCount('test.candidate');
expect 1;
select * from NetCandidateProvTimesheetCount('test.candidate',1);
expect 0;
update tempprovtimesheet set extnumber=2 where personid='TEST';
select * from NetCandidateProvTimesheetCount('test.candidate');
expect 1;
select * from NetCandidateProvTimesheetCount('test.candidate',0);
expect 0;
select * from NetCandidateProvTimesheetCount('test.candidate',1);
expect 1;
*/
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetCandidateProvTimesheetCount" IS
{create PROCEDURE pears."NetCandidateProvTimesheetCount"(pWebUserID char(20), pCompleted smallint default null)
RESULT(pResult long varchar )
// IQXNet
BEGIN
select count(*) from "NetProvTimesheets"(pWebUserID, 0) where completed=pCompleted or pCompleted is null
END
/* DOC
2017-05-10 PC front-page widget to provide a count of provisional timesheets
2018-05-21 MHS allow optional specification of completed status. Simplify tests.
*/
/* TEST
call NetTestSetup('');
delete from tempprovtimesheetline from tempprovtimesheetline key join tempprovtimesheet s where s.personid='TEST';
delete from tempprovtimesheet where personid='TEST';
insert into tempprovtimesheet (tempprovtimesheetid,personid,vacancyid,tempdeskid,periodlength,period,extnumber)
values (uniquekey(''),'TEST','TEST','TEST','W',weekcontaining(current date),1);
select * from NetCandidateProvTimesheetCount('test.candidate');
expect 1;
select * from NetCandidateProvTimesheetCount('test.candidate',1);
expect 0;
update tempprovtimesheet set extnumber=2 where personid='TEST';
select * from NetCandidateProvTimesheetCount('test.candidate');
expect 1;
select * from NetCandidateProvTimesheetCount('test.candidate',0);
expect 0;
select * from NetCandidateProvTimesheetCount('test.candidate',1);
expect 1;
*/
}