Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.iqacSelfBillOneTimesheet ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Original SQL ===== <code sql> create procedure "pears"."iqacSelfBillOneTimesheet"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "ptsid" char(20),in "pDocDate" date,in "pdocid" char(8),in "paccountcode" char(12) ) begin declare "vrate" double; -- loop over lines for "timesheetlines" as "tslcursor" no scroll cursor for select "l"."linenumber",-"l"."payrate" as "payrate","l"."unitspaid", ("l"."unitspaid"*-"l"."payrate") as "pay", "selfbillnominalfortimesheetline"("l"."temptimesheetlineid","paccountcode") as "nominal", "selfbilldescriptionfortimesheetline"("l"."temptimesheetlineid","paccountcode") as "descrip", "selfbillvatcodefortimesheetline"("l"."temptimesheetlineid","paccountcode") as "vcode", "l"."temptimesheetlineid", "b"."unit" from "temptimesheetline" as "l" key join "temppayband" as "b" where "l"."temptimesheetid" = "ptsid" and "pay" <> 0.0 order by "l"."linenumber" asc for read only do -- invoice a line (pdocid) select "vatrate" into "vrate" from "iqacvatrate" where "vatcode" = "vcode"; call "iqacCreateNominal"("nominal",'P','SelfBill Expenditure '+"nominal",'Purchase','NoAccount',null,null,"res"); call "iqacPostJournalLine"("pdocid","nominal","descrip","vcode","temptimesheetlineid",'',"payrate","vrate","unitspaid","pdocdate","unit",'T','InvoiceGoods','Purchase') end for end go COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."iqacSelfBillOneTimesheet" IS {create procedure iqacSelfBillOneTimesheet /* Application Maintained Function / Procedure - DO NOT EDIT*/ ( in ptsid char(20),in pDocDate date,in pdocid char(8), in paccountcode char(12) ) begin declare vrate double; -- loop over lines for timesheetlines as tslcursor no scroll cursor for select l.linenumber,-l.payrate as payrate,l.unitspaid, (l.unitspaid*-l.payrate) as pay, selfbillnominalfortimesheetline(l.temptimesheetlineid,paccountcode) as nominal, selfbilldescriptionfortimesheetline(l.temptimesheetlineid,paccountcode) as descrip, selfbillvatcodefortimesheetline(l.temptimesheetlineid,paccountcode) as vcode, l.temptimesheetlineid, b.unit from temptimesheetline as l key join temppayband as b where l.temptimesheetid = ptsid and pay <> 0.0 order by l.linenumber asc for read only do -- invoice a line (pdocid) select vatrate into vrate from iqacvatrate where vatcode = vcode; call iqacCreateNominal(nominal,'P','SelfBill Expenditure '+nominal,'Purchase','NoAccount',null,null,res); call iqacPostJournalLine(pdocid,nominal,descrip,vcode,temptimesheetlineid,'',payrate,vrate,unitspaid,pdocdate,unit,'T','InvoiceGoods','Purchase') end for end } </code> database/procedures/pears_iqacselfbillonetimesheet.txt Last modified: 2026/08/07 19:24by 127.0.0.1