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 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))))
|
(loop (1+ idx) (cdr bucket-dates))))
|
||||||
(lp (cdr splits))))
|
(lp (cdr splits))))
|
||||||
|
|
||||||
;; next split is a payment. analyse its sister APAR splits. any
|
;; next split is a payment. analyze using
|
||||||
;; split whose lot has no invoice is an overpayment.
|
;; gnc:payment-txn->payment-info and use its overpayment
|
||||||
((eqv? (xaccTransGetTxnType (xaccSplitGetParent (car splits)))
|
((eqv? (xaccTransGetTxnType (xaccSplitGetParent (car splits)))
|
||||||
TXN-TYPE-PAYMENT)
|
TXN-TYPE-PAYMENT)
|
||||||
(let* ((txn (xaccSplitGetParent (car splits)))
|
(let* ((txn (xaccSplitGetParent (car splits)))
|
||||||
(splitlist (xaccTransGetAPARAcctSplitList txn #f))
|
(payment-info (gnc:payment-txn->payment-info txn))
|
||||||
(overpayment
|
(overpayment (vector-ref payment-info 2)))
|
||||||
(fold
|
(define (not-txn? s) (not (equal? txn (xaccSplitGetParent s))))
|
||||||
(lambda (a b)
|
|
||||||
(if (null? (gncInvoiceGetInvoiceFromLot (xaccSplitGetLot a)))
|
|
||||||
(- b (gnc-lot-get-balance (xaccSplitGetLot a)))
|
|
||||||
b))
|
|
||||||
0 splitlist)))
|
|
||||||
(gnc:msg "next " (gnc:strify (car splits))
|
(gnc:msg "next " (gnc:strify (car splits))
|
||||||
" overpayment " overpayment)
|
" overpayment " overpayment)
|
||||||
(addbucket! (1- num-buckets) (if receivable? (- 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.
|
;; not invoice/prepayment. regular or payment split.
|
||||||
(else
|
(else
|
||||||
|
Loading…
Reference in New Issue
Block a user