From 00d00a465090107acaad95080d9c40be7e76afee Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Mon, 27 Jan 2020 06:38:33 +0800 Subject: [PATCH] [report-utilities] fix overpayments calc overpayment is lot->balance rather than split->amount. --- gnucash/report/report-system/report-utilities.scm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm index 9f40770eb7..1c595a6735 100644 --- a/gnucash/report/report-system/report-utilities.scm +++ b/gnucash/report/report-system/report-utilities.scm @@ -1169,15 +1169,14 @@ flawed. see report-utilities.scm. please update reports.") TXN-TYPE-PAYMENT) (let* ((txn (xaccSplitGetParent (car splits))) (splitlist (xaccTransGetAPARAcctSplitList txn #f)) - (payment (apply + (map xaccSplitGetAmount splitlist))) (overpayment (fold (lambda (a b) (if (null? (gncInvoiceGetInvoiceFromLot (xaccSplitGetLot a))) - (- b (xaccSplitGetAmount a)) + (- b (gnc-lot-get-balance (xaccSplitGetLot a))) b)) 0 splitlist))) - (gnc:msg "next " (gnc:strify (car splits)) " payment " payment + (gnc:msg "next " (gnc:strify (car splits)) " overpayment " overpayment) (addbucket! (1- num-buckets) (if receivable? (- overpayment) overpayment)) (lp (cdr splits))))