On Tuesday February 16 2010 15:42:28 Mike Evans wrote: > Displaying payments on a printed bill doubled the bill instead of > subtracting the payment. > I've added to patch to fix this bug in bugzilla. > > Mike E > I forgot to update fancy and easy invoices so here are the patches to do just that.
-- GPG Key: 1024D/050895C2 Keyserver: http://pgp.mit.edu/ Search String: 0x050895C2
Index: . =================================================================== --- . (revision 18684) +++ . (working copy) @@ -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 <mi...@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
Index: . =================================================================== --- . (revision 18684) +++ . (working copy) @@ -439,15 +439,31 @@ (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 <mi...@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 (gnc-print-date (gnc-transaction-get-date-posted t))))
_______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel