[new-owner-report] fix: payment->invoice gets invoice totals

previously the payment-amount deduction loop used the
payment-split-list to obtain the invoice-posting-split's amount. this
would occasionally fail and would return the invoice-payment-split
amount, obtaining the wrong sign.

modify to retrieve the invoice total via gncInvoice API.

therefore payment-amount, minus gncInvoiceGetTotal(inv) amounts,
results in the overpayment amount.
This commit is contained in:
Christopher Lam 2019-11-21 20:30:16 +08:00
parent b3493509d1
commit 063a270499

View File

@ -374,8 +374,7 @@
(else
(let* ((payment-split (car payment-splits))
(inv (car payment-split))
(inv-split (cadr payment-split))
(inv-amount (AP-negate (xaccSplitGetAmount inv-split))))
(inv-amount (gncInvoiceGetTotal inv)))
(lp (cdr payment-splits)
(- amount inv-amount)
(cons (list