On Sun, 15 Jan 2012 23:07:25 Sébastien Villemot wrote: > Here is a more detailed description of my concerns:
Thank you for review. Actually it's even worse that you described. I found it breaks table layout under some circumstances so you were right about everything. I only embarrassed myself by submitting it. But now I've made another one - this time properly. Customisation options are greatly extended comparing to first version. Introduced options extend the report template but mimic the original design with default settings. By default it looks very much like original one. Some hard-coded messages are moved to default values for new options, so new 'tax invoice' report can be localised. Also I fixed a bug when customer's name in billing address is listed twice. We might change the names of the options before forwarding it upstream but functionality is well done and ready. > > - you remove the display of the "billcontact" variable, but you still > assign it in the main "let" Well spotted, thanks. > > The goal should be to get a patch which is acceptable by upstream. I > don't want Debian and upstream to permanently diverge, though a > temporary divergence is acceptable if that makes the Debian version more > useful to Australian users. When you have streamlined the patch, we > should submit it to upstream bug tracker. > I Agree - this time I'm doing my best to provide customisation properly. Have a look at the second try - I hope you'll find it much better. I think this time it is suitable for upstream unless you suggest to improve something. I had in mind all your suggestions and criticism while I was working on second version - thank you. > If users are expected to extend GnuCash by programming in Scheme (as was > the original purpose), then this bug is of severity wishlist. If instead > we don't expect average users to program in Scheme, then the severity is > higher. I agree with you that the latter probably better corresponds to > the reality, so I raised the severity to normal. I don't think this bug > deserves severity important (which corresponds to a "major usability > problem" since 1) small-business Australian users are probably a small > share of our users (even though of course they deserve the same > consideration than others) 2) there are sensible workarounds: your > custom reports, and others that can be found on mailing lists. Thank you for understanding. (I agree, severity 'important' was too strong - sorry) Regarding realistic expectations, I have to say that historically we do not observe many template customisations likely due to Scheme complexity and lack of user's experience. Personally I found Scheme is quite difficult. Perhaps from user prospective it was a poor choice but I'm not sure what alternatives were available at that time. 1) There might be that I'm the only user in Australia so far. :) But this unlikely to change without addressing the problems I experienced. And you see, I'm trying to change it... 2) When you mention "other custom reports" I wish I could find any when I needed it. I'm not saying there are none, but I had no choice but to customise standard template myself because I failed to find anything useful. My custom reports wasn't available to public until I decided to bring this work to debian as a patch to original template. Older templates (non-eguile) are more limited and they are even harder to customise. Please find the new patch attached. (it goes to debian/patches with corresponding record in debian/patches/series). Also in the attached README-AU.txt you can find instructions hot to set up customised report for Australian GST invoices. (I do believe those instructions must be provided with the updated template) Regards, Dmitry.
Last-Update: 2012-01-21 Author: Dmitry Smirnov <only...@member.fsf.org> Forwarded: no Description: customizable taxinvoice Original taxinvoice template lacks flexibility necessary to make legaly valid Australian Tax Invoices. This patch introduces customization options useful to comply with Australian requirements, but not limited to. * Hardcoded messages in English are replaced with options and defaults matching original report. This makes possible report localization. * Added options to change report presentation and embed CSS. * Fixed bug when customer's name in billing address is listed twice. --- a/src/report/business-reports/taxinvoice.eguile.scm +++ b/src/report/business-reports/taxinvoice.eguile.scm @@ -9,6 +9,7 @@ ;; (c) 2009 Chris Dennis ch...@starsoftanalysis.co.uk ;; ;; $Author: chris $ $Date: 2009/07/23 10:42:08 $ $Revision: 1.33 $ +;; Modified by Dmitry Smirnov <only...@member.fsf.org> Sat, 21 Jan 2012 12:20:09 +1100 ;; ;; This file is a mixture of HTML and Guile -- ;; see eguile-gnc.scm for details. @@ -53,8 +54,8 @@ (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))) + (owneraddr (gnc:owner-get-address-dep owner)) + (ownername (gnc:owner-get-name-dep owner)) ; flags and counters (discount? #f) ; any discounts on this invoice? (tax? #f) ; any taxable entries on this invoice? @@ -62,8 +63,9 @@ (payments? #f) ; have any payments been made on this invoice? (units? #f) ; does any row specify units? (qty? #f) ; does any row have qty <> 1? - (spancols1 2) ; for total line - (spancols2 2)) ; for subtotal line + (spancols_subtotal 1) ; for subtotal line + (spancols_payments 0) ; for payments line (between total and subtotal) + (spancols_total 0)) ; for total line ; load splits, if any (if (not (null? lot)) @@ -120,18 +122,24 @@ } table { /* table does not inherit font */ <?scm:d opt-text-font ?> + <?scm:d opt-css-border-collapse ?> } + table[border="1"] th { + border-color:<?scm:d opt-css-border-color-th ?>; + } + table[border="1"] td { + border-color:<?scm:d opt-css-border-color-td ?>; + } + h1.coyname { <?scm:d opt-heading-font ?> - /* font-size: 141%; */ - text-align: left; } + <?scm:d opt-extra-css ?> </style> <?scm )) ?> </head> <body> - <div class="main"> <!-- company info --> @@ -149,16 +157,18 @@ <td align="left"> <h1 class="coyname"><?scm:d (or coyname (_ "Company Name")) ?></h1> </td> - <td align="right"><h2 class="invoice"><?scm:d opt-report-title ?></h2></td> + <td align="right"><h2 class="invoice"><?scm:d opt-report-title ?> + <?scm (if opt-invnum-next-to-title (begin ?><?scm:d (nbsp opt-invoice-number-text) ?><?scm:d invoiceid ?><?scm )) ?> + </h2></td> </tr> </table> <table border="0" width="100%"> <tr valign="top"> <td align="left"> - <?scm (if coycontact (begin ?> + <?scm (if (and opt-row-contact coycontact) (begin ?> <strong><?scm:d coycontact ?></strong><br> <?scm )) ?> - <?scm (if coyaddr (begin ?> + <?scm (if (and opt-row-address coyaddr) (begin ?> <?scm:d (nl->br coyaddr) ?><br> <?scm )) ?> <?scm (if coyid (begin ?> @@ -199,21 +209,24 @@ <table border="0" width="100%"> <tr valign="top"> <!-- customer info --> + <th align="left" width="1%"><?scm:d opt-to-text ?></th> <td align="left"> - <?scm (if (not (string=? billcontact "")) (begin ?> - <strong>Attn: <?scm:d billcontact ?></strong><br> + <?scm (if (and opt-row-recipient (not (string=? ownername ""))) (begin ?> + <?scm:d ownername ?><br> <?scm )) ?> <?scm (if (not (string=? owneraddr "")) (begin ?> - <strong><?scm:d (nl->br owneraddr) ?></strong> + <?scm:d (nl->br owneraddr) ?> <?scm )) ?> </td> <!-- invoice number etc. --> <td align="right"> <table border="0"> + <?scm (if opt-row-invoice-number (begin ?> <tr> - <td align="right" class="invnum"><big><strong><?scm:d (nbsp (_ "Invoice Number")) ?>:</strong></big> </td> + <td align="right" class="invnum"><big><strong><?scm:d (nbsp opt-invoice-number-text) ?></strong></big></td> <td align="right" class="invnum"><big><strong><?scm:d invoiceid ?></strong></big></td> </tr> + <?scm )) ?> <?scm (if (equal? postdate (cons 0 0)) (begin ?> <tr> <td colspan="2" align="right"><?scm:d (_ "Invoice in progress...") ?></td> @@ -246,31 +259,30 @@ <table border="1" width="100%" cellpadding="4" class="entries"> <thead> <tr bgcolor="#ccc" valign="bottom"> + <?scm (if opt-col-date (begin ?> <th align="center" ><?scm:d (_ "Date") ?></th> + <?scm (set! spancols_subtotal (+ spancols_subtotal 1)) (set! spancols_total (+ spancols_total 1)))) ?> <th align="left" width="80%"><?scm:d (_ "Description") ?></th> - <?scm (if units? (begin ?> + <?scm (if (and units? opt-col-units) (begin ?> <th align="left"><?scm:d opt-units-heading ?></th> - <?scm (set! spancols1 (+ spancols1 1)) - (set! spancols2 (+ spancols2 1)))) ?> + <?scm (set! spancols_subtotal (+ spancols_subtotal 1)) (set! spancols_total (+ spancols_total 1)))) ?> <?scm (if (or units? qty?) (begin ?> <th align="right"><?scm:d opt-qty-heading ?></th> - <?scm (set! spancols1 (+ spancols1 1)) - (set! spancols2 (+ spancols2 1)))) ?> + <?scm (set! spancols_total (+ spancols_total 1)) (set! spancols_subtotal (+ spancols_subtotal 1)))) ?> <?scm (if (or units? qty? discount?) (begin ?> <th align="right"><?scm:d opt-unit-price-heading ?></th> - <?scm (set! spancols1 (+ spancols1 1)) - (set! spancols2 (+ spancols2 1)))) ?> + <?scm (set! spancols_total (+ spancols_total 1)) (set! spancols_subtotal (+ spancols_subtotal 1)))) ?> <?scm (if discount? (begin ?> <th align="right"><?scm:d opt-disc-rate-heading ?></th> <th align="right"><?scm:d opt-disc-amount-heading ?></th> - <?scm (set! spancols1 (+ spancols1 2)) - (set! spancols2 (+ spancols2 1)))) ?> + <?scm (set! spancols_total (+ spancols_total 3)) (set! spancols_subtotal (+ spancols_subtotal 1)))) ?> <?scm (if (and tax? taxtables?) (begin ?> <th align="right"><?scm:d opt-net-price-heading ?></th> + <?scm (if opt-col-taxrate (begin ?> <th align="right"><?scm:d opt-tax-rate-heading ?></th> + <?scm (set! spancols_total (+ spancols_total 1)))) ?> <th align="right"><?scm:d opt-tax-amount-heading ?></th> - <?scm (set! spancols1 (+ spancols1 3)) - (set! spancols2 (+ spancols2 0)))) ?> + <?scm (set! spancols_total (+ spancols_total 3)) (set! spancols_subtotal (+ spancols_subtotal 0)))) ?> <th align="right"><?scm:d opt-total-price-heading ?></th> </tr> </thead> @@ -300,11 +312,15 @@ (dsc-total 'add currency rdiscval) ?> <tr valign="top"> - <td align="center"><?scm:d (gnc-print-date (gncEntryGetDate entry)) ?></td> + <?scm (if opt-col-date (begin ?> + <td align="center"><?scm:d (nbsp (gnc-print-date (gncEntryGetDate entry))) ?></td> + <?scm )) ?> <td align="left"><?scm:d (gncEntryGetDescription entry) ?></td> <!-- td align="left">< ?scm:d (gncEntryGetNotes entry) ?></td --> - <?scm (if units? (begin ?> - <td align="left"><?scm:d action ?></td> + <?scm (if opt-col-units (begin ?> + <?scm (if units? (begin ?> + <td align="left"><?scm:d action ?></td> + <?scm )) ?> <?scm )) ?> <?scm (if (or units? qty?) (begin ?> <td align="right"><?scm:d (fmtnumeric qty) ?></td> @@ -322,7 +338,11 @@ <?scm )) ?> <?scm (if (and tax? taxtables?) (begin ?> <td align="right"><?scm:d (fmtmoney currency rval) ?></td> + + <?scm (if opt-col-taxrate (begin ?> <td align="right"><?scm (taxrate taxable taxtable currency) ?></td> + <?scm )) ?> + <td align="right"><?scm:d (fmtmoney currency rtaxval) ?></td> <?scm )) ?> <!-- TO DO: need an option about whether to display the tax-inclusive total? --> @@ -333,13 +353,17 @@ <!-- display subtotals row --> <?scm (if (or tax? discount? payments?) (begin ?> <tr valign="top"> - <td align="left" class="subtotal" colspan="<?scm:d spancols2 ?>"><strong><?scm:d opt-subtotal-heading ?></strong></td> + <td align="left" class="subtotal" colspan="<?scm:d spancols_subtotal ?>"><strong><?scm:d opt-subtotal-heading ?></strong></td> <?scm (if discount? (begin ?> <td align="right" class="subtotal"><strong><?scm (display-comm-coll-total dsc-total #f) ?></strong></td> <?scm )) ?> <?scm (if (and tax? taxtables?) (begin ?> <td align="right" class="subtotal"><strong><?scm (display-comm-coll-total sub-total #f) ?></strong></td> + + <?scm (if opt-col-taxrate (begin ?> <td> </td> + <?scm )) ?> + <td align="right" class="subtotal"><strong><?scm (display-comm-coll-total tax-total #f) ?></strong></td> <?scm )) ?> <td align="right" class="subtotal"><strong><?scm (display-comm-coll-total inv-total #f) ?></strong></td> @@ -355,17 +379,21 @@ (let ((c (xaccTransGetCurrency t)) (a (xaccSplitGetValue split))) (inv-total 'add c a) + (set! spancols_payments (+ 0 spancols_total)) ?> <tr valign="top"> + <?scm (if opt-col-date (begin ?> <td align="center"><?scm:d (gnc-print-date (gnc-transaction-get-date-posted t)) ?></td> - <td align="left" colspan="<?scm:d (- spancols1 1) ?>"><?scm:d opt-payment-recd-heading ?></td> + <?scm (set! spancols_payments (- spancols_payments 1)))) ?> + <td align="left" colspan="<?scm:d spancols_payments ?>"><?scm:d opt-payment-recd-heading ?></td> <td align="right"><?scm:d (fmtmoney c a) ?></td> </tr> <?scm ))))) ?> <!-- total row --> <tr valign="top"> - <td align="left" class="total" colspan="<?scm:d spancols1 ?>"><strong><?scm:d opt-amount-due-heading ?></strong></td> + <td align="left" class="total" colspan="<?scm:d spancols_total ?>"><strong><?scm:d opt-amount-due-heading ?><?scm (if (not (string=? (gnc-commodity-get-mnemonic opt-report-currency) "")) (begin ?>, + <?scm:d (gnc-commodity-get-mnemonic opt-report-currency) ?><?scm )) ?></strong></td> <td align="right" class="total"><strong><?scm (display-comm-coll-total inv-total #f) ?></strong></td> </tr> --- a/src/report/business-reports/taxinvoice.scm +++ b/src/report/business-reports/taxinvoice.scm @@ -87,7 +87,23 @@ ;(define filespage (N_ "Files")) (define displaypage (N_ "Display")) (define generalpage gnc:pagename-general) +(define elementspage (N_ "Elements")) ; option names +(define optname-col-date (N_ "column: Date")) +(define optname-col-taxrate (N_ "column: Tax Rate")) +(define optname-col-units (N_ "column: Units")) +(define optname-row-address (N_ "row: Address")) +(define optname-row-contact (N_ "row: Contact")) +(define optname-row-invoice-number (N_ "row: Invoice Number")) +(define optname-row-recipient (N_ "row: Recipient")) +(define optname-report-currency (N_ "Report's Currency")) +(define optname-border-collapse (N_ "table: border-collapse")) +(define optname-border-color-th (N_ "table-header-border-color")) +(define optname-border-color-td (N_ "table-cell-border-color")) +(define optname-invoice-number-text (N_ "Invoice number text")) +(define optname-to-text (N_ "To text")) +(define optname-invnum-next-to-title (N_ "Invoice number next to title")) +(define optname-extra-css (N_ "Embedded CSS")) (define optname-report-title (N_ "Report title")) (define optname-invoice-number (N_ "Invoice number")) (define optname-template-file (N_ "Template file")) @@ -136,6 +152,18 @@ "a" "" (lambda () '()) #f)) ;customers-only)) ;-- see above +(add-option (gnc:make-currency-option generalpage optname-report-currency "b" "" (N_ ""))) + + ;; Elements page options +(add-option (gnc:make-simple-boolean-option elementspage optname-col-date "a" (N_ "Display the date?") #t)) +(add-option (gnc:make-simple-boolean-option elementspage optname-col-taxrate "b" (N_ "Display the Tax Rate?") #t)) +(add-option (gnc:make-simple-boolean-option elementspage optname-col-units "c" (N_ "Display the Units?") #t)) +(add-option (gnc:make-simple-boolean-option elementspage optname-row-contact "d" (N_ "Display the contact?") #t)) +(add-option (gnc:make-simple-boolean-option elementspage optname-row-address "e" (N_ "Display the address?") #t)) +(add-option (gnc:make-simple-boolean-option elementspage optname-row-invoice-number "f" (N_ "Display the Invoice Number?") #t)) +(add-option (gnc:make-simple-boolean-option elementspage optname-row-recipient "g" (N_ "Display the bill contact?") #t)) +(add-option (gnc:make-simple-boolean-option elementspage optname-invnum-next-to-title "h" (N_ "Invoice Number next to title?") #f)) + ;; Display options (add-option (gnc:make-string-option displaypage optname-template-file "a" (N_ "The file name of the eguile template part of this report. This file should either be in your .gnucash directory, or else in its proper place within the GnuCash installation directories.") @@ -155,6 +183,9 @@ "")) (add-option (gnc:make-string-option displaypage optname-logo-width "f" (N_ "Width of the logo in CSS format, e.g. 10% or 32px. Leave blank to display the logo at its natural width. The height of the logo will be scaled accordingly.") "")) +(add-option (gnc:make-simple-boolean-option displaypage optname-border-collapse "g" (N_ "Border-collapse?") #f)) +(add-option (gnc:make-string-option displaypage optname-border-color-th "h" "CSS color" (N_ "black"))) +(add-option (gnc:make-string-option displaypage optname-border-color-td "i" "CSS color" (N_ "black"))) ;; Heading options (add-option (gnc:make-string-option @@ -185,13 +216,18 @@ (add-option (gnc:make-string-option headingpage2 optname-payment-recd "c" "" (N_ "Payment received, thank you"))) +(add-option (gnc:make-string-option headingpage2 optname-invoice-number-text "d" "" (N_ "Invoice number: "))) +(add-option (gnc:make-string-option headingpage2 optname-to-text "e" "" (N_ "Attn: "))) (add-option (gnc:make-text-option notespage optname-extra-notes "a" (N_ "Notes added at end of invoice -- may contain HTML markup") - "")) + "Thank you for your patronage.")) ;(N_ "(Development version -- don't rely on the numbers on this report without double-checking them.<br>Change the 'Extra Notes' option to get rid of this message)"))) + (add-option (gnc:make-text-option notespage optname-extra-css "b" + (N_ "Embedded CSS") "h1.coyname { text-align: left; }")) + (gnc:options-set-default-section report-options generalpage) @@ -222,6 +258,19 @@ (opt-value displaypage optname-text-font))) (opt-logofile (opt-value displaypage optname-logofile)) (opt-logo-width (opt-value displaypage optname-logo-width)) + (opt-col-date (opt-value elementspage optname-col-date)) + (opt-col-taxrate (opt-value elementspage optname-col-taxrate)) + (opt-col-units (opt-value elementspage optname-col-units)) + (opt-row-contact (opt-value elementspage optname-row-contact)) + (opt-row-address (opt-value elementspage optname-row-address)) + (opt-row-invoice-number (opt-value elementspage optname-row-invoice-number)) + (opt-row-recipient (opt-value elementspage optname-row-recipient)) + (opt-invnum-next-to-title (opt-value elementspage optname-invnum-next-to-title)) + (opt-report-currency (opt-value generalpage optname-report-currency)) + (opt-css-border-collapse (if (opt-value displaypage optname-border-collapse) "border-collapse:collapse;")) + (opt-css-border-color-th (opt-value displaypage optname-border-color-th)) + (opt-css-border-color-td (opt-value displaypage optname-border-color-td)) + (opt-report-title (opt-value headingpage optname-report-title)) (opt-units-heading (opt-value headingpage optname-units)) (opt-qty-heading (opt-value headingpage optname-qty)) @@ -235,6 +284,9 @@ (opt-subtotal-heading (opt-value headingpage2 optname-subtotal)) (opt-amount-due-heading (opt-value headingpage2 optname-amount-due)) (opt-payment-recd-heading (opt-value headingpage2 optname-payment-recd)) + (opt-invoice-number-text (opt-value headingpage2 optname-invoice-number-text)) + (opt-to-text (opt-value headingpage2 optname-to-text)) + (opt-extra-css (opt-value notespage optname-extra-css)) (opt-extra-notes (opt-value notespage optname-extra-notes)) (css? #t) ;(and (defined? 'gnc-html-engine-supports-css) (gnc-html-engine-supports-css))) (html #f))
Set up customised report for Australian GST invoices ---------------------------------------------------- This is a sample "tax invoice" report ([Report]-->[Business]-->[Tax Invoice]) setup for GST invoices, \ see Australian tax invoices "specification": ["Goods and Services Tax Ruling" GSTR 2011/D1](http://law.ato.gov.au/atolaw/view.htm?Docid=DGS/GSTR2011D1/NAT/ATO/00001) ### Edit Report Options: #### Display (cosmetic settings - non-critical) table:border-collapse [*] table-header-border-color: [grey] table-cell-border-color: [silver] #### Elements (let to enable/disable report components) column: Date [_] column: Tax Rate [_] column: Units [*] row: contact [_] row: address [_] row: Invoice Number [_] // Invoice number on right-hand side above "Invoice Date" row: Recipient [_] // Display of [Customer::Company Name] on left hand side Invoice Number next to title [*] // Invoice number on right-hand after [General::Report title] #### General Report name: [AU Tax Invoice] Report currency: [AUD] // Displayed after "Amount Due" if set. #### Headings1 Report title: [Tax Invoice] // Displayed on top-right Net Price: [Net Price (excl GST)] Tax Amount: [GST Amount] Total Price: [Total Price (incl GST)] Note: Use ` ` instead of white space to prevent word wrap. Alternatively on GNU/Linux systems a non-breaking space can be entered as: [Ctrl+Shift+U + a0] #### Headings2 Amount Due: [Total Amount Due] Invoice number text: [#] To text: [To:] After customisation use menu [File]-->[Add report] to save report under name given in [Report options]-->[General]-->[Report name] \ (Report will be available in menu [Reports]-->[Custom reports] * * * * * [How to set up Accounts for Australian GST](http://wiki.gnucash.org/wiki/Alternate_Australian_GST_setup) ----------------------------------------- The following GST scheme is used by MYOB BussinessBasics. Since GST is money you owe the government (or visa versa) you create an account called: Liabilities:GST Then, to make your balance sheet more informative, you create two sub accounts: Liabilities:GST:Collected Liabilities:GST:Paid Whenever you receive income you record the GST component in Liabilities:GST:Collected and whenever you make a purchase you record the GST component in Liabilities:GST:Paid. At the end of each accounting period if you owe the government money then you record the amount you paid it in Liabilities:GST:Paid. Or if the government owes you money then the amount you receive should be recorded in Liabilities:GST:Collected. This simple scheme can easily be modified to be the same as the 3-account system. In this scheme Liabilities:GST:Paid is exactly the same as in the 3-account system, but Liabilities:GST:Collected is given the rather confusing name of Liabilities:GST:Payable. To move to the 3-account system all you need to do is create a new account called: Liabilities:GST:BAS This is where all of the GST money you pay the government is recorded. In the 3-account system this account is called Liabilities:GST:Payments. Another variation of the 3-account setup is to have the BAS payments (or refunds) as separate sub-accounts, rather then entering the transactions directly in the Collected and Paid accounts. Liabilities GST Sales Collected (gst received from sales) BAS (net gst payments to ATO) Purchases Paid (gst paid on purchases) BAS (net gst refunds from ATO) You are free to change the names to be more explicit if it makes things easier for you :) Liabilities GST Sales GST Received (gst received from sales) BAS Payments (net gst payments to ATO) Purchases GST Paid (gst paid on purchases) BAS Refunds (net gst refunds from ATO)
signature.asc
Description: This is a digitally signed message part.