r21991 - gnucash/trunk/src/report/business-reports - Modify Tax Invoice report to work properly with credit notes
Geert Janssens
gjanssens at code.gnucash.org
Fri Feb 10 10:33:25 EST 2012
Author: gjanssens
Date: 2012-02-10 10:33:25 -0500 (Fri, 10 Feb 2012)
New Revision: 21991
Trac: http://svn.gnucash.org/trac/changeset/21991
Modified:
gnucash/trunk/src/report/business-reports/taxinvoice.eguile.scm
Log:
Modify Tax Invoice report to work properly with credit notes
Note that contrary to the other invoice reports the invoice title is not
automatically set to "Credit Note", because on the tax invoice report
that title is a user settable option.
Modified: gnucash/trunk/src/report/business-reports/taxinvoice.eguile.scm
===================================================================
--- gnucash/trunk/src/report/business-reports/taxinvoice.eguile.scm 2012-02-10 15:33:15 UTC (rev 21990)
+++ gnucash/trunk/src/report/business-reports/taxinvoice.eguile.scm 2012-02-10 15:33:25 UTC (rev 21991)
@@ -31,30 +31,31 @@
(define (display-report opt-invoice owner endowner ownertype)
;; Main function that creates the tax invoice report
(let* (; invoice and company details
- (invoiceid (gncInvoiceGetID opt-invoice))
- (book (gncInvoiceGetBook opt-invoice))
- (postdate (gncInvoiceGetDatePosted opt-invoice))
- (duedate (gncInvoiceGetDateDue opt-invoice))
- (billingid (gncInvoiceGetBillingID opt-invoice))
- (notes (gncInvoiceGetNotes opt-invoice))
- (terms (gncInvoiceGetTerms opt-invoice))
- (termsdesc (gncBillTermGetDescription terms))
- (lot (gncInvoiceGetPostedLot opt-invoice))
- (txn (gncInvoiceGetPostedTxn opt-invoice))
- (currency (gncInvoiceGetCurrency opt-invoice))
- (entries (gncInvoiceGetEntries opt-invoice))
- (splits '())
- (slots (qof-book-get-slots book))
- (coyname (coy-info slots gnc:*company-name*))
- (coycontact (coy-info slots gnc:*company-contact*))
- (coyaddr (coy-info slots gnc:*company-addy*))
- (coyid (coy-info slots gnc:*company-id*))
- (coyphone (coy-info slots gnc:*company-phone*))
- (coyfax (coy-info slots gnc:*company-fax*))
- (coyurl (coy-info slots gnc:*company-url*))
- (coyemail (coy-info slots gnc:*company-email*))
- (owneraddr (gnc:owner-get-name-and-address-dep owner))
- (billcontact (gncAddressGetName (gnc:owner-get-address owner)))
+ (invoiceid (gncInvoiceGetID opt-invoice))
+ (credit-note? (gncInvoiceGetIsCreditNote opt-invoice))
+ (book (gncInvoiceGetBook opt-invoice))
+ (postdate (gncInvoiceGetDatePosted opt-invoice))
+ (duedate (gncInvoiceGetDateDue opt-invoice))
+ (billingid (gncInvoiceGetBillingID opt-invoice))
+ (notes (gncInvoiceGetNotes opt-invoice))
+ (terms (gncInvoiceGetTerms opt-invoice))
+ (termsdesc (gncBillTermGetDescription terms))
+ (lot (gncInvoiceGetPostedLot opt-invoice))
+ (txn (gncInvoiceGetPostedTxn opt-invoice))
+ (currency (gncInvoiceGetCurrency opt-invoice))
+ (entries (gncInvoiceGetEntries opt-invoice))
+ (splits '())
+ (slots (qof-book-get-slots book))
+ (coyname (coy-info slots gnc:*company-name*))
+ (coycontact (coy-info slots gnc:*company-contact*))
+ (coyaddr (coy-info slots gnc:*company-addy*))
+ (coyid (coy-info slots gnc:*company-id*))
+ (coyphone (coy-info slots gnc:*company-phone*))
+ (coyfax (coy-info slots gnc:*company-fax*))
+ (coyurl (coy-info slots gnc:*company-url*))
+ (coyemail (coy-info slots gnc:*company-email*))
+ (owneraddr (gnc:owner-get-name-and-address-dep owner))
+ (billcontact (gncAddressGetName (gnc:owner-get-address owner)))
; flags and counters
(discount? #f) ; any discounts on this invoice?
(tax? #f) ; any taxable entries on this invoice?
@@ -78,7 +79,7 @@
; pre-scan invoice entries to look for discounts and taxes
(for entry in entries do
(let ((action (gncEntryGetAction entry))
- (qty (gncEntryGetQuantity entry))
+ (qty (gncEntryGetDocQuantity entry credit-note?))
(discount (gncEntryGetInvDiscount entry))
(taxtable (gncEntryGetInvTaxTable entry)))
(if (not (string=? action ""))
@@ -282,12 +283,12 @@
(dsc-total (gnc:make-commodity-collector))
(inv-total (gnc:make-commodity-collector)))
(for entry in entries do
- (let ((qty (gncEntryGetQuantity entry))
+ (let ((qty (gncEntryGetDocQuantity entry credit-note?))
(each (gncEntryGetInvPrice entry))
(action (gncEntryGetAction entry))
- (rval (gncEntryGetIntValue entry #t #t))
- (rdiscval (gncEntryGetIntDiscountValue entry #t #t))
- (rtaxval (gncEntryGetIntTaxValue entry #t #t))
+ (rval (gncEntryGetDocValue entry #t #t credit-note?))
+ (rdiscval (gncEntryGetDocDiscountValue entry #t #t credit-note?))
+ (rtaxval (gncEntryGetDocTaxValue entry #t #t credit-note?))
(disc (gncEntryGetInvDiscount entry))
(disctype (gncEntryGetInvDiscountType entry))
(acc (gncEntryGetInvAccount entry))
More information about the gnucash-changes
mailing list