mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug #564380 Payment on bills doubles bill
Patch by Mike Evans git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18666 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
4e99711ef8
commit
d30a59b46e
@ -388,15 +388,31 @@
|
||||
(define (add-payment-row table used-columns split total-collector)
|
||||
(let* ((t (xaccSplitGetParent split))
|
||||
(currency (xaccTransGetCurrency t))
|
||||
;; XXX Need to know when to reverse the value
|
||||
(invoice (opt-val invoice-page invoice-name))
|
||||
(owner '())
|
||||
(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>
|
||||
;; Reverse the value when needed
|
||||
(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
|
||||
(gnc-print-date (gnc-transaction-get-date-posted t))))
|
||||
|
Loading…
Reference in New Issue
Block a user