mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-01 04:59:29 -06:00
[report-utilities] fix gnc:owner-splits->aging-list prepayment calc
aging-list uses the exported function instead of calculating overpayment using a different algorithm.
This commit is contained in:
parent
dc516bd5d7
commit
d1997c59bc
@ -1085,23 +1085,18 @@ query instead.")
|
||||
(loop (1+ idx) (cdr bucket-dates))))
|
||||
(lp (cdr splits))))
|
||||
|
||||
;; next split is a payment. analyse its sister APAR splits. any
|
||||
;; split whose lot has no invoice is an overpayment.
|
||||
;; next split is a payment. analyze using
|
||||
;; gnc:payment-txn->payment-info and use its overpayment
|
||||
((eqv? (xaccTransGetTxnType (xaccSplitGetParent (car splits)))
|
||||
TXN-TYPE-PAYMENT)
|
||||
(let* ((txn (xaccSplitGetParent (car splits)))
|
||||
(splitlist (xaccTransGetAPARAcctSplitList txn #f))
|
||||
(overpayment
|
||||
(fold
|
||||
(lambda (a b)
|
||||
(if (null? (gncInvoiceGetInvoiceFromLot (xaccSplitGetLot a)))
|
||||
(- b (gnc-lot-get-balance (xaccSplitGetLot a)))
|
||||
b))
|
||||
0 splitlist)))
|
||||
(payment-info (gnc:payment-txn->payment-info txn))
|
||||
(overpayment (vector-ref payment-info 2)))
|
||||
(define (not-txn? s) (not (equal? txn (xaccSplitGetParent s))))
|
||||
(gnc:msg "next " (gnc:strify (car splits))
|
||||
" overpayment " overpayment)
|
||||
(addbucket! (1- num-buckets) (if receivable? (- overpayment) overpayment))
|
||||
(lp (cdr splits))))
|
||||
(lp (filter not-txn? splits))))
|
||||
|
||||
;; not invoice/prepayment. regular or payment split.
|
||||
(else
|
||||
|
Loading…
Reference in New Issue
Block a user