mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[report-utilities] fix: gnc:owner-splits->aging-list uses APAR splits
... instead of payment splits to calculate payment amount, because payment splits may be in a different currency. using APAR split total minus invoice amounts is guaranteed to produce correct overpayment amount in APAR currency.
This commit is contained in:
@@ -1147,14 +1147,14 @@ flawed. see report-utilities.scm. please update reports.")
|
||||
TXN-TYPE-PAYMENT)
|
||||
(let* ((txn (xaccSplitGetParent (car splits)))
|
||||
(payment (apply + (map xaccSplitGetAmount
|
||||
(xaccTransGetPaymentAcctSplitList txn))))
|
||||
(xaccTransGetAPARAcctSplitList txn #f))))
|
||||
(overpayment
|
||||
(fold
|
||||
(lambda (inv-and-splits payment-left)
|
||||
(if (member txn (map xaccSplitGetParent (cdr inv-and-splits)))
|
||||
(- payment-left (gncInvoiceGetTotal (car inv-and-splits)))
|
||||
payment-left))
|
||||
(if receivable? payment (- payment)) invoices-and-splits)))
|
||||
(if receivable? (- payment) payment) invoices-and-splits)))
|
||||
(gnc:pk 'payment (car splits) payment "->" overpayment)
|
||||
(when (positive? overpayment)
|
||||
(addbucket! (1- num-buckets) (- overpayment)))
|
||||
|
||||
Reference in New Issue
Block a user