Fix bug #564380 additionally for easy invoice and fancy invoice.

Patch by Mike Evans.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18686 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2010-02-19 17:03:06 +00:00
parent 2ff0d7507d
commit 3bac2105e8
2 changed files with 38 additions and 7 deletions

View File

@ -422,14 +422,29 @@
(define (add-payment-row table used-columns split total-collector)
(let* ((t (xaccSplitGetParent split))
(currency (xaccTransGetCurrency t))
(invoice (opt-val invoice-page invoice-name))
(owner '())
;; XXX Need to know when to reverse the value
(amt (gnc:make-gnc-monetary currency (xaccSplitGetValue split)))
(payment-style "grand-total")
(row '()))
(total-collector 'add
(gnc:gnc-monetary-commodity amt)
(gnc:gnc-monetary-amount amt))
; Update to fix bug 564380, payment on bill doubles bill. Mike Evans <mikee@saxicola.co.uk>
(if (not (null? invoice))
(begin
(set! owner (gncInvoiceGetOwner invoice))
(let ((type (gncOwnerGetType
(gncOwnerGetEndOwner owner))))
(cond
((eqv? type GNC-OWNER-CUSTOMER)
(total-collector 'add
(gnc:gnc-monetary-commodity amt)
(gnc:gnc-monetary-amount amt)))
((eqv? type GNC-OWNER-VENDOR)
(total-collector 'add
(gnc:gnc-monetary-commodity amt)
(gnc:gnc-monetary-amount (gnc:monetary-neg amt))))
))))
(if (date-col used-columns)
(addto! row

View File

@ -439,14 +439,30 @@
(define (add-payment-row table used-columns split total-collector)
(let* ((t (xaccSplitGetParent split))
(currency (xaccTransGetCurrency t))
(invoice (opt-val invoice-page invoice-name))
(owner '())
;; XXX Need to know when to reverse the value
(amt (gnc:make-gnc-monetary currency (xaccSplitGetValue split)))
(payment-style "grand-total")
(row '()))
(total-collector 'add
(gnc:gnc-monetary-commodity amt)
(gnc:gnc-monetary-amount amt))
; Update to fix bug 564380, payment on bill doubles bill. Mike Evans <mikee@saxicola.co.uk>
(if (not (null? invoice))
(begin
(set! owner (gncInvoiceGetOwner invoice))
(let ((type (gncOwnerGetType
(gncOwnerGetEndOwner owner))))
(cond
((eqv? type GNC-OWNER-CUSTOMER)
(total-collector 'add
(gnc:gnc-monetary-commodity amt)
(gnc:gnc-monetary-amount amt)))
((eqv? type GNC-OWNER-VENDOR)
(total-collector 'add
(gnc:gnc-monetary-commodity amt)
(gnc:gnc-monetary-amount (gnc:monetary-neg amt))))
))))
(if (date-col used-columns)
(addto! row