====== pears.iqacSelfBillCreate ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."iqacSelfBillCreate"(
/* Application Maintained Function / Procedure - DO NOT EDIT*/
in "pSessionID" char(20),in "pDocDate" date )
result( "pResult" char(250),"pinvcount" integer )
begin
declare "res" integer;
declare "invcount" integer;
declare "acc" char(12);
set "invcount" = 0;
-- rewrite as loop
select first "accountcode" into "acc" from "InvoiceValidReportData" where "sessionid" = "psessionid" and "processed" = 0 order by "sortorder" asc;
while "acc" is not null loop
call "iqacSelfBillOneAccount"("acc","psessionid","pdocdate","invcount");
-- update InvoiceValidReportData set processed = 1 where accountcode = acc;
-- above done for each timesheet
set "acc" = null;
select first "accountcode" into "acc" from "InvoiceValidReportData" where "sessionid" = "psessionid" and "processed" = 0 order by "sortorder" asc
end loop;
select '0:~Success',"invcount"
exception
when others then
resignal;
select '1:~Failed',"invcount"
end
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."iqacSelfBillCreate" IS
{create procedure iqacSelfBillCreate
/* Application Maintained Function / Procedure - DO NOT EDIT*/
(
in pSessionID char(20),in pDocDate date )
result( pResult char(250),pinvcount integer )
begin
declare res integer;
declare invcount integer;
declare acc char(12);
set invcount = 0;
-- rewrite as loop
select first accountcode into acc from InvoiceValidReportData where sessionid = psessionid and processed = 0 order by sortorder asc;
while acc is not null loop
call iqacSelfBillOneAccount(acc,psessionid,pdocdate,invcount);
-- update InvoiceValidReportData set processed = 1 where accountcode = acc;
-- above done for each timesheet
set acc = null;
select first accountcode into acc from InvoiceValidReportData where sessionid = psessionid and processed = 0 order by sortorder asc
end loop;
select '0:~Success',invcount
exception
when others then
resignal;
select '1:~Failed',invcount
end
}