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.NetReportAgedDebtors ====== <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"."NetReportAgedDebtors"( in "pwebuserid" char(20),in "Date__D31a" char(20) ) -- RESULT( column_name column_type, ... ) begin declare "repdate" date; declare "divid" char(20); set "repdate" = "iqxnetstringtodate"("Date__D31a"); set "divid" = (select first "staff"."divisionid" from "iqxnetuser" key join "staff" where "iqxnetuser"."iqxnetuserid" = "pwebuserid"); select "IQAcA"."AccountCode", "IQAcA"."Name", "IQAcD"."AccountingDate" as "AcDate", "IQAcD"."DocumentID", "IQAcD"."DocumentType" as "TranType", "IQAcD"."OurRef", "IQAcD"."Amount", "IQacDocumentOutstandingAmount"("IQAcD"."documentid",:REPDATE) as "OutStanding", "IQAcD"."XRefID" as "PlacementID", "IQAcD"."TheirRef", "repdate"-"AcDate" as "Age" from "IQacDocument" as "IQAcD" key join "IQacAccount" as "IQacA" where "IQAcD"."LedgerID" = 'Sales' and "AcDate" <= "date"(:REPDATE) and("fullyallocated" is null or "fullyallocated" > "date"(:REPDATE)) order by "IQAcA"."Name" asc,"AcDate" asc end go COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetReportAgedDebtors" IS {create procedure pears."NetReportAgedDebtors"( in "pwebuserid" char(20),in "Date__D31a" char(20) ) -- RESULT( column_name column_type, ... ) begin declare "repdate" date; declare "divid" char(20); set "repdate" = "iqxnetstringtodate"("Date__D31a"); set "divid" = (select first "staff"."divisionid" from "iqxnetuser" key join "staff" where "iqxnetuser"."iqxnetuserid" = "pwebuserid"); select "IQAcA"."AccountCode", "IQAcA"."Name", "IQAcD"."AccountingDate" as "AcDate", "IQAcD"."DocumentID", "IQAcD"."DocumentType" as "TranType", "IQAcD"."OurRef", "IQAcD"."Amount", "IQacDocumentOutstandingAmount"("IQAcD"."documentid",:REPDATE) as "OutStanding", "IQAcD"."XRefID" as "PlacementID", "IQAcD"."TheirRef", "repdate"-"AcDate" as "Age" from "IQacDocument" as "IQAcD" key join "IQacAccount" as "IQacA" where "IQAcD"."LedgerID" = 'Sales' and "AcDate" <= "date"(:REPDATE) and("fullyallocated" is null or "fullyallocated" > "date"(:REPDATE)) order by "IQAcA"."Name" asc,"AcDate" asc end } </code> database/procedures/pears_netreportageddebtors.txt Last modified: 2026/08/07 19:24by 127.0.0.1