pears.iqacSelfBillOneTimesheet

Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.

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
}
  • database/procedures/pears_iqacselfbillonetimesheet.txt
  • Last modified: 2026/08/07 19:24
  • by 127.0.0.1