When I have entered a tax rate on an invoice as 14.975% and then display it using the "Tax Invoice" report, it is shown as "599/40%" which is equal to the number I entered, but not what I want to show the customer. This is on 4.4 flatpak. I'm actually mainly using 3.10 (Ubuntu default repos) and in the case of 3.10, this weirdly also affects the quantity field of the invoice (so "0.2" will be shown as "1/5"). But in 4.4 only tax rate, not quantity, seems to suffer from the problem.
Try modify taxinvoice.scm as follows modified gnucash/report/reports/standard/taxinvoice.scm @@ -64,7 +64,9 @@ (set! pc? #t) (pctot 'add (gncTaxTableEntryGetAmount entry))))) entries) - (if pc? (format #t "~a%" (pctot 'total #f))) + (when pc? + (display (string-trim-both (format #f "~g" (pctot 'total #f)))) + (display "%")) (if (and amt? pc?) (display " + ")) (if amt? (display-comm-coll-total amttot #f)) (if (equal? amt? pc? #f) (display (G_ "n/a")))))))
I made that change and got the same result. I then tried commenting out that bit altogether (all four lines affected by + or -) and still got the same result. At that point I started to worry maybe I had the wrong file or something, so I tried doing mv taxinvoice.scm taxinvoice.scm.bak and the report did indeed vanish, so I believe I was doing it correctly.
try: modified gnucash/report/reports/standard/taxinvoice.scm @@ -24,6 +24,7 @@ ; (see https://wiki.gnucash.org/wiki/Custom_Reports ) (define-module (gnucash reports standard taxinvoice)) +(use-modules (ice-9 match)) (use-modules (ice-9 local-eval)) ; for the-environment (use-modules (gnucash engine)) (use-modules (gnucash utilities)) @@ -45,29 +46,25 @@ ;; depending on how complicated the tax table is. ;; (When called from within the eguile template, anything ;; (display)ed becomes part of the HTML string.) - (cond - ((or (not taxable) (eq? taxtable '())) - (display " ")) - (else - (let* ((amttot (gnc:make-commodity-collector)) - (pctot (gnc:make-value-collector)) - (entries (gncTaxTableGetEntries taxtable)) - (amt? #f) ; becomes #t if any entries are amounts - (pc? #f)) ; becomes #t if any entries are percentages - (for-each - (lambda (entry) - (cond - ((eqv? (gncTaxTableEntryGetType entry) GNC-AMT-TYPE-VALUE) - (set! amt? #t) - (amttot 'add curr (gncTaxTableEntryGetAmount entry))) - (else - (set! pc? #t) - (pctot 'add (gncTaxTableEntryGetAmount entry))))) - entries) - (if pc? (format #t "~a%" (pctot 'total #f))) - (if (and amt? pc?) (display " + ")) - (if amt? (display-comm-coll-total amttot #f)) - (if (equal? amt? pc? #f) (display (G_ "n/a"))))))) + + (define (amt-type? entry) + (eqv? (gncTaxTableEntryGetType entry) GNC-AMT-TYPE-VALUE)) + + (let lp ((entries (if taxable (gncTaxTableGetEntries taxtable) '())) (res '())) + + (match entries + (() (display (if (null? res) (G_ "n/a") (string-join res " + ")))) + + (((and (? amt-type?) (= gncTaxTableEntryGetAmount amt) . rest)) + (lp rest + (cons (gnc:default-html-gnc-monetary-renderer + (gnc:make-gnc-monetary curr amt) #f) + res))) + + (((= gncTaxTableEntryGetAmount percent) . rest) ;percent + (lp rest + (cons (string-append (gnc:default-html-number-renderer percent #f) "%") + res)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Define all the options
Created attachment 374016 [details] use this candidate patch instead This change will modify the tax rate renderer by showing individual tax rate entries instead of aggregate percent + amount.
Individual tax rate entries would be ideal for my use case. I tried the patch and still no change to the result. Is it at all possible I'm doing something wrong on my end?
Dilemma - do we show individual tax rates, or continue showing aggregated tax rates???
I'm not sure whether this question is directed at me or at developers but I will give my thoughts. Please feel welcome to ignore if you weren't soliciting this. In my context I have a federal (Canadian) VAT tax of 5% and provincial (Quebec) VAT tax of 9.975% totaling the 14.975% that I mentioned in my original post. The standard practice on invoices in Canada for other retailers, and what would probably be best, is to indicate only the pre-tax amount for each invoice line item. Then have two separate lines at the bottom showing the total amount of the federal VAT tax, and the total provincial VAT tax. The description for each usually includes 15-digit retailer tax account numbers which we are legally required to indicate on invoices for customers. Obviously then grand total amount due adds all this together. If this can't be done, then it's probably best for my use case to keep them aggregated as currently done. What I do is indicate my tax numbers and explain the breakdown of the 14.975% tax number in the notes part of the invoice. If you were to break them down individually, I think the benefits in added clarity would probably be outweighed by being too busy visually and unacceptably reducing the signal-to-noise ratio as far as the information being presented. For use cases where there are more than two different taxes being applied I expect it could become a real nightmare.
Created attachment 374090 [details] 798142.patch We've missed the 4.6 deadline. In any case I'd think the Tax Rate column would be more informative, expanded, with every taxtable entry shown.
Created attachment 374091 [details] example output
Fixed in maint; tax rates will show individual tt-entries. My reasoning is that it would be much more common to have single/few tt-entries, and the column will not be overly verbose. If there's pushback I think we can add option to summarise tax column. https://github.com/Gnucash/gnucash/commit/774dc5dd