[new-owner-report] LHS payment->RHS invoices show partial amounts

This commit is contained in:
Christopher Lam 2020-01-23 22:05:34 +08:00
parent 3866d9bb7c
commit cbb7431752

View File

@ -607,7 +607,7 @@
overpayment overpayment
(if (member invoice invoices) (if (member invoice invoices)
invoices invoices
(cons invoice invoices))))))))) (cons (cons invoice split) invoices)))))))))
(define (make-payment->invoices-list txn) (define (make-payment->invoices-list txn)
(list (list
@ -615,17 +615,18 @@
(apply (apply
gnc:make-html-text gnc:make-html-text
(map (map
(lambda (inv) (lambda (inv-split-pair)
(let ((inv (car inv-split-pair)))
(gnc:html-markup-anchor (gnc:html-markup-anchor
(gnc:invoice-anchor-text inv) (gnc:invoice-anchor-text inv)
(gncInvoiceGetID inv))) (gncInvoiceGetID inv))))
(cdr (payment-txn->overpayment-and-invoices txn))))))) (cdr (payment-txn->overpayment-and-invoices txn)))))))
(define (make-payment->invoices-table txn) (define (make-payment->invoices-table txn)
(define overpayment-and-invoices (payment-txn->overpayment-and-invoices txn)) (define overpayment-and-invoices (payment-txn->overpayment-and-invoices txn))
(let lp ((invoices (cdr overpayment-and-invoices)) (let lp ((invoice-split-pairs (cdr overpayment-and-invoices))
(result '())) (result '()))
(match invoices (match invoice-split-pairs
(() (()
(let ((overpayment (car overpayment-and-invoices))) (let ((overpayment (car overpayment-and-invoices)))
(reverse (reverse
@ -635,7 +636,7 @@
(_ "Pre-Payment") (_ "Pre-Payment")
(gnc:make-gnc-monetary currency overpayment)) (gnc:make-gnc-monetary currency overpayment))
result))))) result)))))
((inv . rest) (((inv . APAR-split) . rest)
(let* ((tfr-txn (gncInvoiceGetPostedTxn inv)) (let* ((tfr-txn (gncInvoiceGetPostedTxn inv))
(tfr-split (txn->transfer-split tfr-txn))) (tfr-split (txn->transfer-split tfr-txn)))
(lp rest (lp rest
@ -646,11 +647,17 @@
(gnc:invoice-anchor-text inv) (gnc:invoice-anchor-text inv)
(gncInvoiceGetID inv))) (gncInvoiceGetID inv)))
(gncInvoiceGetTypeString inv) (gncInvoiceGetTypeString inv)
(splits->desc (txn->assetliab-splits tfr-txn)) (splits->desc (list APAR-split))
(gnc:make-html-text (gnc:make-html-text
(gnc:html-markup-anchor
(gnc:split-anchor-text APAR-split)
(gnc:make-gnc-monetary
currency (AP-negate (- (xaccSplitGetAmount APAR-split)))))
" of "
(gnc:html-markup-anchor (gnc:html-markup-anchor
(gnc:split-anchor-text tfr-split) (gnc:split-anchor-text tfr-split)
(gnc:make-gnc-monetary currency (invoice->total inv))))) (gnc:make-gnc-monetary
currency (invoice->total inv)))))
result))))))) result)))))))
(define (invoice->sale invoice) (define (invoice->sale invoice)