From 2fd2b7bb64e07de4f4319b47b4c1e291af6f0a48 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Tue, 18 Aug 2020 22:27:03 +0800 Subject: [PATCH] Bug 797852 - Error in Accounts Payable Aging re cut off dates Finally the proper fix in aging-report. The aging-report must consider only activity in the report period specified. If an invoice is paid after the report period, it is considered unpaid. --- gnucash/report/report-utilities.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gnucash/report/report-utilities.scm b/gnucash/report/report-utilities.scm index 1ceb1276d8..f5c2f256e3 100644 --- a/gnucash/report/report-utilities.scm +++ b/gnucash/report/report-utilities.scm @@ -908,7 +908,13 @@ (let* ((invoice (gncInvoiceGetInvoiceFromTxn (xaccSplitGetParent (car splits)))) (lot (gncInvoiceGetPostedLot invoice)) - (bal (gnc-lot-get-balance lot)) + (lot-splits (gnc-lot-get-split-list lot)) + (bal (fold + (lambda (a b) + (if (<= (xaccTransGetDate (xaccSplitGetParent a)) to-date) + (+ (xaccSplitGetAmount a) b) + b)) + 0 lot-splits)) (bal (if receivable? bal (- bal))) (date (if (eq? date-type 'postdate) (gncInvoiceGetDatePosted invoice)