ODBC Aged Creditors Query
Posted: 28 Oct 2016, 15:32
Hi All
I'm producing a workbook that sucks up all sorts of data from sage. TB, Projects, Nom ledger, etc all working well. I have written code to get the aged debtors & creditors listings but they includes future payments. Can anyone help with the code that would be required which would exclude future payments.
Aged Creditors Code as it stands...
Many thanks in advance
Sage 22.1.10.394 SP5
Excel 2013 32 bit
Win 10 64 bit
I'm producing a workbook that sucks up all sorts of data from sage. TB, Projects, Nom ledger, etc all working well. I have written code to get the aged debtors & creditors listings but they includes future payments. Can anyone help with the code that would be required which would exclude future payments.
Aged Creditors Code as it stands...
Code: Select all
SELECT
purchase_LEDGER.ACCOUNT_REF AS 'Account',
purchase_LEDGER.NAME AS 'Supplier Name',
Sum(AUDIT_HEADER.AGED_BALANCE) AS 'Balance',
Sum(AUDIT_HEADER.AGED_FUTURE) AS 'Future',
Sum(AUDIT_HEADER.AGED_30) AS '30',
Sum(AUDIT_HEADER.AGED_60) AS '60',
Sum(AUDIT_HEADER.AGED_90) AS '90',
Sum(AUDIT_HEADER.AGED_OLDER) AS 'Older'
FROM AUDIT_HEADER AUDIT_HEADER, purchase_LEDGER purchase_LEDGER
WHERE
purchase_LEDGER.ACCOUNT_REF = AUDIT_HEADER.ACCOUNT_REF AND ((AUDIT_HEADER.AGED_BALANCE<>0) AND (AUDIT_HEADER.DELETED_FLAG<>1) AND (AUDIT_HEADER.DATE<=?))
GROUP BY purchase_LEDGER.ACCOUNT_REF, purchase_LEDGER.NAME
Sage 22.1.10.394 SP5
Excel 2013 32 bit
Win 10 64 bit