r18609 - gnucash/trunk/src - Bug #590332: New eguile-based Tax Invoice report

Christian Stimming cstim at code.gnucash.org
Wed Feb 3 16:01:18 EST 2010


Author: cstim
Date: 2010-02-03 16:01:18 -0500 (Wed, 03 Feb 2010)
New Revision: 18609
Trac: http://svn.gnucash.org/trac/changeset/18609

Added:
   gnucash/trunk/src/business/business-reports/taxinvoice.css
   gnucash/trunk/src/business/business-reports/taxinvoice.eguile.scm
   gnucash/trunk/src/business/business-reports/taxinvoice.scm
   gnucash/trunk/src/report/report-system/eguile-html-utilities.scm
   gnucash/trunk/src/report/report-system/eguile-utilities.scm
Modified:
   gnucash/trunk/src/business/business-reports/Makefile.am
   gnucash/trunk/src/business/business-reports/business-reports.scm
   gnucash/trunk/src/report/report-system/Makefile.am
Log:
Bug #590332: New eguile-based Tax Invoice report

Patch by Chris Dennis.

Modified: gnucash/trunk/src/business/business-reports/Makefile.am
===================================================================
--- gnucash/trunk/src/business/business-reports/Makefile.am	2010-02-03 20:58:02 UTC (rev 18608)
+++ gnucash/trunk/src/business/business-reports/Makefile.am	2010-02-03 21:01:18 UTC (rev 18609)
@@ -4,6 +4,9 @@
    business-reports.scm \
    easy-invoice.scm \
    fancy-invoice.scm \
+   taxinvoice.scm \
+   taxinvoice.eguile.scm \
+   taxinvoice.css \
    invoice.scm \
    job-report.scm \
    owner-report.scm \

Modified: gnucash/trunk/src/business/business-reports/business-reports.scm
===================================================================
--- gnucash/trunk/src/business/business-reports/business-reports.scm	2010-02-03 20:58:02 UTC (rev 18608)
+++ gnucash/trunk/src/business/business-reports/business-reports.scm	2010-02-03 21:01:18 UTC (rev 18609)
@@ -102,6 +102,7 @@
 (use-modules (gnucash report fancy-invoice))
 (use-modules (gnucash report invoice))
 (use-modules (gnucash report easy-invoice))
+(use-modules (gnucash report taxinvoice))
 (use-modules (gnucash report owner-report))
 (use-modules (gnucash report job-report))
 (use-modules (gnucash report payables))

Added: gnucash/trunk/src/business/business-reports/taxinvoice.css
===================================================================
--- gnucash/trunk/src/business/business-reports/taxinvoice.css	                        (rev 0)
+++ gnucash/trunk/src/business/business-reports/taxinvoice.css	2010-02-03 21:01:18 UTC (rev 18609)
@@ -0,0 +1,71 @@
+/* Stylesheet for taxinvoice.scm -- eguile-based Gnucash invoice report */
+/* Version 0.03 */
+
+/**
+;; (c) 2009 Chris Dennis chris at starsoftanalysis.co.uk
+;;
+;; $Author: chris $ $Date: 2009/07/23 10:41:58 $ $Revision: 1.25 $
+;;
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2 of the
+;; License, or (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+;; 02111-1307 USA
+**/
+
+/* Note that body and table font family and size will be overridden */
+/* by separate report options.                                      */
+  div.main { 
+    margin: 2em;
+  }
+  table { /* table does not inherit font sizes for some reason */
+  }
+  table.entries {
+    border: none;
+    border-spacing: 0.1em; 
+    empty-cells: show;
+  }
+  table.entries th {
+    background: #ccc;
+    font-weight: bold;
+    padding: 0.2em 0.4em;
+  }
+  table.entries td {
+    padding: 0.2em 0.4em;
+  }
+  td.invnum {
+    font-size: 120%;
+    font-weight: bold;
+  }
+  td.subtotal {
+    font-weight: bold;
+  }
+  td.total {
+    font-size: 110%;
+    font-weight: bold;
+  }
+  table.coytable td, table.coytable tr {
+    vertical-align: top;
+  }
+  img.logo {
+    margin-right: 0.5em;
+  }
+  h1.coyname {
+    margin-top: 0em;
+    padding-top: 0em;
+    text-align: left;
+  }
+  h2.invoice {
+    padding-top: 0em;
+    margin-top: 0em;
+  }
+

Added: gnucash/trunk/src/business/business-reports/taxinvoice.eguile.scm
===================================================================
--- gnucash/trunk/src/business/business-reports/taxinvoice.eguile.scm	                        (rev 0)
+++ gnucash/trunk/src/business/business-reports/taxinvoice.eguile.scm	2010-02-03 21:01:18 UTC (rev 18609)
@@ -0,0 +1,408 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+<?scm 
+(let ((x 42)) ; only here to allow (define)s
+              ; i.e. to avoid "Bad define placement" error
+
+;; taxinvoice.eguile.scm  0.03
+;; GnuCash report template called from taxinvoice.scm 0.02
+;; (c) 2009 Chris Dennis chris at starsoftanalysis.co.uk
+;;
+;; $Author: chris $ $Date: 2009/07/23 10:42:08 $ $Revision: 1.33 $
+;;
+;; This file is a mixture of HTML and Guile --
+;; see eguile-gnc.scm for details.
+;;
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2 of the
+;; License, or (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+;; 02111-1307 USA
+
+  (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      (gnc-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?
+           (taxtables? #t) ; are tax tables available in this version?
+           (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
+
+      ; load splits, if any
+      (if (not (null? lot))
+        (set! splits
+          (sort-list (gnc-lot-get-split-list lot) ; sort by date
+                     (lambda (s1 s2)
+                       (let ((t1 (xaccSplitGetParent s1))
+                             (t2 (xaccSplitGetParent s2)))
+                         (< (car (gnc-transaction-get-date-posted t1))
+                            (car (gnc-transaction-get-date-posted t2))))))))
+
+      ; pre-scan invoice entries to look for discounts and taxes
+      (for-each 
+        (lambda (entry) 
+          (let ((action    (gncEntryGetAction entry)) 
+                (qty       (gncEntryGetQuantity entry))
+                (discount  (gncEntryGetInvDiscount entry))   
+                (taxtable  (gncEntryGetInvTaxTable entry)))
+            (if (not (string=? action "")) 
+              (set! units? #t))
+            (if (not (= (gnc-numeric-to-double qty) 1.0))
+              (set! qty? #t))
+            (if (not (gnc-numeric-zero-p discount)) (set! discount? #t))
+            ;(if taxable - no, this flag is redundant
+            (if (not (eq? taxtable '()))
+              (begin ; presence of a tax table means it's taxed
+                (set! tax? #t)
+                (let ((ttentries (gncTaxTableGetEntries taxtable)))
+                  (if (string-prefix? "#<swig-pointer PriceList" (object->string ttentries))
+                    ; error in SWIG binding -- disable display of tax details
+                    ; (see http://bugzilla.gnome.org/show_bug.cgi?id=573645)
+                    (set! taxtables? #f))))))) ; hack required until Swig is fixed
+        entries)
+
+      ; pre-scan invoice splits to see if any payments have been made
+      (for-each
+        (lambda (split)  
+          (let* ((t (xaccSplitGetParent split)))
+            (if (not (equal? t txn))
+              (set! payments? #t))))
+        splits) 
+
+?>
+
+<!-- ====================================================================== -->
+<!-- The HTML for the invoice starts here -->
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
+<title><?scm:d (_ "Invoice") ?> <?scm:d invoiceid ?></title>
+
+<?scm (if css? (begin ?>
+<link rel="stylesheet" href="<?scm:d opt-css-file ?>" type="text/css">
+<!-- Note that the external stylesheet file is overridden by this following: -->
+<style type="text/css">
+  body { 
+    <?scm:d opt-text-font ?>
+  }
+  table { /* table does not inherit font */
+    <?scm:d opt-text-font ?>
+  }
+  h1.coyname {
+    <?scm:d opt-heading-font ?>
+    /* font-size: 141%; */
+    text-align: left;
+  }
+</style>
+<?scm )) ?>
+
+</head>
+<body>
+
+<div class="main">
+
+<!-- company info -->
+<table class="coytable" border="0" width="100%">
+<tr valign="top" style="vertical-align: top">
+  <?scm (if (access? opt-logofile R_OK) (begin ?>
+    <td align="left">
+      <img align="left" src="<?scm:d opt-logofile ?>" alt="logo" class="logo"
+        <?scm (if opt-logo-width (begin ?>
+          style="width: <?scm:d opt-logo-width ?>"
+        <?scm )) ?>
+        >
+    </td>
+  <?scm )) ?>
+  <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>
+</tr>
+</table>
+<table border="0" width="100%">
+<tr valign="top">
+  <td align="left">
+    <?scm (if coycontact (begin ?>
+      <strong><?scm:d coycontact ?></strong><br>
+    <?scm )) ?>
+    <?scm (if coyaddr (begin ?>
+      <?scm:d (nl->br coyaddr) ?><br>
+    <?scm )) ?>
+    <?scm (if coyid (begin ?>
+      <strong><?scm:d coyid ?></strong><br>
+    <?scm )) ?>
+  </td>
+  <td align="right">
+    <table border="0">
+      <?scm (if coyphone (begin ?>
+        <tr>
+          <td align="right"><?scm:d (_ "Phone:") ?>&nbsp;</td>
+          <td align="right"><?scm:d coyphone ?></td>
+        </tr>
+      <?scm )) ?>
+      <?scm (if coyfax (begin ?>
+        <tr>
+          <td align="right"><?scm:d (_ "Fax:") ?>&nbsp;</td>
+          <td align="right"><?scm:d coyfax ?></td>
+        </tr>
+      <?scm )) ?>
+      <?scm (if coyemail (begin ?>
+        <tr>
+          <td align="right"><?scm:d (_ "Email:") ?>&nbsp;</td>
+          <td align="right"><?scm:d coyemail ?></td>
+        </tr>
+      <?scm )) ?>
+      <?scm (if coyurl (begin ?>
+        <tr>
+          <td align="right"><?scm:d (_ "Website:") ?>&nbsp;</td>
+          <td align="right"><?scm:d coyurl ?></td>
+        </tr>
+      <?scm )) ?>
+    </table>
+</tr>    
+</table>
+<hr>
+
+<table border="0" width="100%">
+<tr valign="top">
+  <!-- customer info -->
+  <td align="left">
+    <?scm (if (not (string=? billcontact "")) (begin ?>
+      <strong>Attn: <?scm:d billcontact ?></strong><br>
+    <?scm )) ?>
+    <?scm (if (not (string=? owneraddr "")) (begin ?>
+      <strong><?scm:d (nl->br owneraddr) ?></strong>
+    <?scm )) ?>
+  </td>
+  <!-- invoice number etc. -->
+  <td align="right">
+    <table border="0">
+      <tr>
+        <td align="right" class="invnum"><big><strong><?scm:d (nbsp (_ "Invoice number:")) ?></strong></big>&nbsp;</td>
+        <td align="right" class="invnum"><big><strong><?scm:d invoiceid ?></strong></big></td>
+      </tr>
+      <?scm (if (equal? postdate (cons 0 0)) (begin ?>
+        <tr>
+           <td colspan="2" align="right"><?scm:d (_ "Invoice in progress...") ?></td>
+        </tr>
+      <?scm ) (begin ?>
+        <tr>
+           <td align="right"><?scm:d (nbsp (_ "Invoice date:")) ?>&nbsp;</td>
+           <td align="right"><?scm:d (gnc-print-date postdate) ?></td>
+        </tr>
+        <tr>
+           <td align="right"><?scm:d (nbsp (_ "Due date:")) ?>&nbsp;</td>
+           <td align="right"><?scm:d (gnc-print-date duedate) ?></td>
+        </tr>
+      <?scm )) ?>
+      <?scm (if (not (string=? termsdesc "")) (begin ?>
+        <tr><td colspan="2" align="right"><?scm:d termsdesc ?></td></tr>
+      <?scm )) ?>
+    </table>
+  </td>
+</tr>
+<?scm (if (not (string=? billingid "")) (begin ?>
+  <tr>
+    <td>Your ref: <?scm:d billingid ?></td>
+  </tr>
+<?scm )) ?>
+</table>
+
+<!-- invoice lines table -->
+<p>
+<table border="1" width="100%" cellpadding="4" class="entries"> 
+  <thead>
+    <tr bgcolor="#ccc" valign="bottom">
+      <th align="center" ><?scm:d (_ "Date") ?></th>
+      <th align="left" width="80%"><?scm:d (_ "Description") ?></th>
+      <?scm (if units? (begin ?>
+        <th align="left"><?scm:d opt-units-heading ?></th>
+        <?scm (set! spancols1 (+ spancols1 1)) 
+              (set! spancols2 (+ spancols2 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 (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 (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 (if (and tax? taxtables?) (begin ?>
+        <th align="right"><?scm:d opt-net-price-heading ?></th>
+        <th align="right"><?scm:d opt-tax-rate-heading ?></th>
+        <th align="right"><?scm:d opt-tax-amount-heading ?></th>
+        <?scm (set! spancols1 (+ spancols1 3))
+              (set! spancols2 (+ spancols2 0)))) ?>
+      <th align="right"><?scm:d opt-total-price-heading ?></th>
+    </tr>
+  </thead>
+
+  <tbody> <!-- display invoice entry lines, keeping running totals -->
+    <?scm 
+      (let ((tax-total (gnc:make-commodity-collector))
+            (sub-total (gnc:make-commodity-collector))
+            (dsc-total (gnc:make-commodity-collector))
+            (inv-total (gnc:make-commodity-collector)))
+        (for-each ; entry in entries
+          (lambda (entry) 
+            (let ((qty       (gncEntryGetQuantity entry))
+                  (each      (gncEntryGetInvPrice entry)) 
+                  (action    (gncEntryGetAction entry)) 
+                  (rval      (gncEntryReturnValue entry #t)) 
+                  (rdiscval  (gncEntryReturnDiscountValue entry #t)) 
+                  (rtaxval   (gncEntryReturnTaxValue entry #t)) 
+                  (disc      (gncEntryGetInvDiscount entry))
+                  (disctype  (gncEntryGetInvDiscountType entry))
+                  (acc       (gncEntryGetInvAccount entry))
+                  (taxable   (gncEntryGetInvTaxable entry))
+                  (taxtable  (gncEntryGetInvTaxTable entry)))
+              (inv-total 'add currency rval)
+              (inv-total 'add currency rtaxval)
+              (tax-total 'add currency rtaxval)
+              (sub-total 'add currency rval)
+              (dsc-total 'add currency rdiscval)
+    ?>
+    <tr valign="top">
+      <td align="center"><?scm:d (gnc-print-date (gncEntryGetDate entry)) ?></td>
+      <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 )) ?>
+      <?scm (if (or units? qty?) (begin ?>
+        <td align="right"><?scm:d (fmtnumeric qty) ?></td>
+      <?scm )) ?>
+      <?scm (if (or units? qty? discount?) (begin ?>
+        <td align="right"><?scm:d (fmtmoney currency each) ?></td>
+      <?scm )) ?>
+      <?scm (if discount? (begin ?>
+        <?scm (if (equal? disctype GNC-AMT-TYPE-VALUE) (begin ?>
+          <td align="right"><?scm:d (gnc:monetary->string (gnc:make-gnc-monetary currency disc)) ?></td>
+        <?scm ) (begin ?>
+          <td align="right"><?scm:d (fmtnumeric disc) ?>%</td>
+        <?scm )) ?>
+        <td align="right"><?scm:d (fmtmoney currency rdiscval) ?></td>
+      <?scm )) ?>
+      <?scm (if (and tax? taxtables?) (begin ?>
+        <td align="right"><?scm:d (fmtmoney currency rval) ?></td>
+        <td align="right"><?scm (taxrate taxable taxtable currency) ?></td>  
+        <td align="right"><?scm:d (fmtmoney currency rtaxval) ?></td>
+      <?scm )) ?>
+      <!-- TO DO: need an option about whether to display the tax-inclusive total? -->
+      <td align="right"><?scm:d (fmtmoney currency (gnc-numeric-add rval rtaxval GNC-DENOM-AUTO GNC-RND-ROUND)) ?></td>
+    </tr>
+    <?scm )) entries) ?>
+
+    <!-- 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>
+        <?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>
+          <td>&nbsp;</td>
+          <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>
+      </tr>
+    <?scm )) ?>
+
+    <!-- payments -->
+    <?scm 
+      (if payments? 
+        (for-each
+          (lambda (split)  
+            (let ((t (xaccSplitGetParent split)))
+              (if (not (equal? t txn)) ; don't process the entry itself as a split
+                (let ((c (xaccTransGetCurrency t))
+                      (a (xaccSplitGetValue    split))) 
+                  (inv-total 'add c a) 
+    ?>
+    <tr valign="top">
+      <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> 
+      <td align="right"><?scm:d (fmtmoney c a) ?></td>
+    </tr>
+    <?scm )))) splits)) ?>
+
+    <!-- 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="right" class="total"><strong><?scm (display-comm-coll-total inv-total #f) ?></strong></td>
+    </tr>
+
+  </tbody>
+  <?scm ) ?> <!-- end of (let) surrounding table body -->
+</table>
+ 
+<p><?scm:d (nl->br notes) ?>
+<p><?scm:d (nl->br opt-extra-notes) ?>
+
+<?scm )) ; end of display-report function
+    
+  ; 'mainline' code: check for a valid invoice, then display the report 
+  (if (null? opt-invoice)
+    (begin
+      (display (_ "<h2>Tax Invoice</h2>"))
+      (display (_ "<p>No invoice has been selected -- please use the Options menu to select one.")))
+    (let* ((owner     (gncInvoiceGetOwner  opt-invoice))
+           (endowner  (gncOwnerGetEndOwner owner))
+           (ownertype (gncOwnerGetType     endowner)))
+      (if (not (eqv? ownertype GNC-OWNER-CUSTOMER))
+        (begin
+          (display (_ "<h2>Tax Invoice</h2>"))
+          (display (_ "<p>This report is designed for customer (sales) invoices only.\n"))
+          (display (_ "<p>Please use the Options menu to select an <em>Invoice</em>, not a Bill or Expense Voucher.")))
+        (display-report opt-invoice owner endowner ownertype))))
+
+?>
+</div>
+</body>
+</html>
+<?scm
+) ; end of enclosing let
+?>

Added: gnucash/trunk/src/business/business-reports/taxinvoice.scm
===================================================================
--- gnucash/trunk/src/business/business-reports/taxinvoice.scm	                        (rev 0)
+++ gnucash/trunk/src/business/business-reports/taxinvoice.scm	2010-02-03 21:01:18 UTC (rev 18609)
@@ -0,0 +1,270 @@
+
+;; $Author: chris $ $Date: 2009/07/29 09:31:44 $ $Revision: 1.33 $
+;;
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2 of the
+;; License, or (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+;; 02111-1307 USA
+
+; put the (define-module... back when installing as a 'proper' report
+; as opposed to referring to it from .gnucash/config.user
+; (see http://wiki.gnucash.org/wiki/Custom_Reports )
+(define-module (gnucash report taxinvoice))        
+
+(use-modules (gnucash main))
+(use-modules (gnucash gnc-module))        
+(use-modules (gnucash app-utils))
+(use-modules (gnucash business-utils))
+(gnc:module-load "gnucash/report/report-system" 0)
+(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/html" 0)
+(gnc:module-load "gnucash/engine" 0)
+
+(use-modules (gnucash report standard-reports))
+(use-modules (gnucash report business-reports))
+
+(use-modules (gnucash report eguile-utilities))
+(use-modules (gnucash report eguile-html-utilities))
+(use-modules (gnucash report eguile-gnc))
+
+(use-modules (srfi srfi-13)) ; for extra string functions
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Report-specific routines
+
+(define (taxrate taxable taxtable curr)
+  ;; Display the tax rate applicable to an invoice line.
+  ;; This may be e.g. "15%" or "£5.00" or "15% + £5.00" or "n/a"
+  ;; depending on how complicated the tax table is.
+  ;; (When called from within the eguile template, anything
+  ;; (display)ed becomes part of the HTML string.)
+  (if (or (not taxable) (eq? taxtable '()))
+    (display "&nbsp;")
+    (let* ((amttot  (gnc:make-commodity-collector))
+           (pctot   (gnc:make-numeric-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) 
+          (let ((tttype (gncTaxTableEntryGetType   entry))
+                (ttamt  (gncTaxTableEntryGetAmount entry)))
+            (if (equal? tttype GNC-AMT-TYPE-VALUE)
+              (begin
+                (set! amt? #t)
+                (amttot 'add curr ttamt))
+              (begin
+                (set! pc? #t)
+                (pctot 'add ttamt)))))
+        entries)
+      (if pc? (begin (display (fmtnumeric (pctot 'total #f))) (display "%")))
+      (if (and amt? pc?) (display " +&nbsp;"))        ; both - this seems unlikely in practice
+      (if amt?
+        (display-comm-coll-total amttot #f))
+      (if (and (not amt?) (not pc?)) (display (_ "n/a"))))))        ; neither
+
+(define (coy-info slots key)
+  ;; Extract a value from the company info key-value pairs
+  (kvp-frame-get-slot-path-gslist
+    slots 
+    (append gnc:*kvp-option-path* (list gnc:*business-label* key))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Define all the options
+
+; option pages
+(define headingpage  (N_ "Headings 1"))
+(define headingpage2 (N_ "Headings 2"))
+(define notespage    (N_ "Notes"))
+;(define filespage    (N_ "Files"))
+(define displaypage  (N_ "Display"))
+(define generalpage  gnc:pagename-general)
+; option names 
+(define optname-report-title   (N_ "Report title"))
+(define optname-invoice-number (N_ "Invoice number"))
+(define optname-template-file  (N_ "Template file"))
+(define optname-css-file       (N_ "CSS stylesheet file"))
+(define optname-heading-font   (N_ "Heading font"))
+(define optname-text-font      (N_ "Text font"))
+(define optname-logofile       (N_ "Logo filename"))
+(define optname-logo-width     (N_ "Logo width"))
+(define optname-units          (N_ "Units"))
+(define optname-qty            (N_ "Qty"))
+(define optname-unit-price     (N_ "Unit Price"))
+(define optname-disc-rate      (N_ "Discount Rate"))
+(define optname-disc-amount    (N_ "Discount Amount"))
+(define optname-net-price      (N_ "Net Price"))
+(define optname-tax-rate       (N_ "Tax Rate"))
+(define optname-tax-amount     (N_ "Tax Amount"))
+(define optname-total-price    (N_ "Total Price"))
+(define optname-subtotal       (N_ "Sub-total"))
+(define optname-amount-due     (N_ "Amount Due"))
+(define optname-payment-recd   (N_ "Payment rec'd..."))
+(define optname-extra-notes    (N_ "Extra notes"))
+
+; Choose only customer invoices
+; (This doesn't work very nicely -- all invoices and bills
+;  are offered for selection, but if a non-customer invoice
+;  is selected, the user is dumped back to viewing the
+;  previous invoice (or none) with no error message)
+(define (customers-only invoice)
+  (let* ((owner     (gncInvoiceGetOwner  invoice))
+         (endowner  (gncOwnerGetEndOwner owner))
+         (ownertype (gncOwnerGetType     endowner)))
+    ;(gnc:debug "ownertype is ")(gnc:debug ownertype)
+    (if (eqv? ownertype GNC-OWNER-CUSTOMER)
+      (list #t invoice)
+      (list #f invoice))))
+
+(define (options-generator)
+  ;; Options
+  (define report-options (gnc:new-options))
+  (define (add-option new-option)
+    (gnc:register-option report-options new-option))
+
+  (add-option
+    (gnc:make-invoice-option ; defined in gnucash/scm/business-options.scm
+      generalpage optname-invoice-number 
+      "a" "" (lambda () '()) 
+      #f))        ;customers-only)) ;-- see above
+
+  ;; 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.")
+    "taxinvoice.eguile.scm"))
+  (add-option (gnc:make-string-option displaypage optname-css-file "b" 
+    (N_ "The file name of the CSS stylesheet to use with this report.  This file should either be in your .gnucash directory, or else in its proper place within the GnuCash installation directories.") 
+    "taxinvoice.css"))
+  (add-option (gnc:make-font-option 
+                displaypage optname-heading-font "c" 
+                (N_ "Font to use for the main heading") "Sans Bold 18"))
+  (add-option (gnc:make-font-option 
+                displaypage optname-text-font "d" 
+                (N_ "Font to use for everything else") "Sans 10"))
+  (add-option (gnc:make-pixmap-option
+                displaypage optname-logofile "e" 
+                (N_ "Name of a file containing a logo to be used on the report") 
+                ""))
+  (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.") ""))
+
+  ;; Heading options
+  (add-option (gnc:make-string-option
+                ; page / name / orderkey / tooltip / default
+                headingpage optname-report-title "a" "" (N_ "Invoice")))
+  (add-option (gnc:make-string-option
+                headingpage optname-units "b" "" (N_ "Units")))
+  (add-option (gnc:make-string-option
+                headingpage optname-qty "c" "" (N_ "Qty")))
+  (add-option (gnc:make-string-option
+                headingpage optname-unit-price "d" "" (N_ "Unit Price")))
+  (add-option (gnc:make-string-option
+                headingpage optname-disc-rate "e" "" (N_ "Discount Rate")))
+  (add-option (gnc:make-string-option
+                headingpage optname-disc-amount "f" "" (N_ "Discount Amount")))
+  (add-option (gnc:make-string-option
+                headingpage optname-net-price "g" "" (N_ "Net Price")))
+  (add-option (gnc:make-string-option
+                headingpage optname-tax-rate "h" "" (N_ "Tax Rate")))
+  (add-option (gnc:make-string-option
+                headingpage optname-tax-amount "i" "" (N_ "Tax Amount")))
+  (add-option (gnc:make-string-option
+                headingpage optname-total-price "j" "" (N_ "Total Price")))
+  (add-option (gnc:make-string-option
+                headingpage2 optname-subtotal "a" "" (N_ "Sub-total")))
+  (add-option (gnc:make-string-option
+                headingpage2 optname-amount-due "b" "" (N_ "Amount Due")))
+  (add-option (gnc:make-string-option
+                headingpage2 optname-payment-recd "c" "" 
+                (N_ "Payment received, thank you")))
+
+  (add-option (gnc:make-text-option
+                notespage optname-extra-notes "a"
+                (N_ "Notes added at end of invoice -- may contain HTML markup") 
+                ""))
+                ;(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)")))
+
+  (gnc:options-set-default-section
+    report-options generalpage)
+
+  report-options)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Create the report
+
+(define (report-renderer report-obj)
+  ;; Create and return the report as either an HTML string 
+  ;; or an <html-document>
+  (define (opt-value section name)
+    ; wrapper for option routines
+    (define (get-opt section name)
+      (gnc:lookup-option (gnc:report-options report-obj) section name))
+    (gnc:option-value (get-opt section name)))
+
+  ; Get all the options
+  (let* ((document                  (gnc:make-html-document))
+         (opt-invoice               (opt-value generalpage  optname-invoice-number))
+         (opt-template-file         (find-file 
+                                      (opt-value displaypage optname-template-file)))
+         (opt-css-file              (find-file 
+                                      (opt-value displaypage optname-css-file)))
+         (opt-heading-font          (font-name-to-style-info 
+                                      (opt-value displaypage optname-heading-font)))
+         (opt-text-font             (font-name-to-style-info
+                                      (opt-value displaypage optname-text-font)))
+         (opt-logofile              (opt-value displaypage  optname-logofile)) 
+         (opt-logo-width            (opt-value displaypage  optname-logo-width)) 
+         (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))
+         (opt-unit-price-heading    (opt-value headingpage  optname-unit-price))
+         (opt-disc-rate-heading     (opt-value headingpage  optname-disc-rate))
+         (opt-disc-amount-heading   (opt-value headingpage  optname-disc-amount))
+         (opt-net-price-heading     (opt-value headingpage  optname-net-price))
+         (opt-tax-rate-heading      (opt-value headingpage  optname-tax-rate))
+         (opt-tax-amount-heading    (opt-value headingpage  optname-tax-amount))
+         (opt-total-price-heading   (opt-value headingpage  optname-total-price))
+         (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-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! html (eguile-file-to-string 
+                 opt-template-file
+                 (the-environment)))
+
+    (gnc:debug "taxinvoice.scm: css? is " css?)
+    (gnc:debug "taxinvoice.scm: defined is " (defined? 'gnc-html-engine-supports-css))
+    (gnc:debug "taxinvoice.scm - generated html:") (gnc:debug html)
+
+    (if css? ; return report as document or html, depending on version 
+      html 
+      (let ((document (gnc:make-html-document)))
+        (gnc:html-document-add-object! document html)
+        document))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Define the report
+
+(gnc:define-report
+  'version 1
+  'name (N_ "Tax Invoice")
+  'report-guid "0769e242be474010b4acf264a5512e6e"
+  'menu-name (N_ "Tax Invoice")
+  'menu-tip (N_ "Display a customer invoice with tax columns (using eguile template)")
+  'menu-path (list gnc:menuname-business-reports)
+  'options-generator options-generator
+  'renderer report-renderer)
+

Modified: gnucash/trunk/src/report/report-system/Makefile.am
===================================================================
--- gnucash/trunk/src/report/report-system/Makefile.am	2010-02-03 20:58:02 UTC (rev 18608)
+++ gnucash/trunk/src/report/report-system/Makefile.am	2010-02-03 21:01:18 UTC (rev 18609)
@@ -54,7 +54,9 @@
 gncscmmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash/report/
 gncscmmod_DATA = \
     report-system.scm \
-	eguile-gnc.scm
+	eguile-gnc.scm \
+	eguile-utilities.scm \
+	eguile-html-utilities.scm
 
 if GNUCASH_SEPARATE_BUILDDIR
 #For executing test cases

Added: gnucash/trunk/src/report/report-system/eguile-html-utilities.scm
===================================================================
--- gnucash/trunk/src/report/report-system/eguile-html-utilities.scm	                        (rev 0)
+++ gnucash/trunk/src/report/report-system/eguile-html-utilities.scm	2010-02-03 21:01:18 UTC (rev 18609)
@@ -0,0 +1,133 @@
+;; eguile-html-utilities.scm
+;; Useful HTML-related functions for eguile-based reports.
+;; See also eguile-utilities.scm
+;; Version 0.01
+;;
+;; (c) 2009 Chris Dennis chris at starsoftanalysis.co.uk
+;;
+;; $Author: chris $ $Date: 2009/07/27 15:51:02 $ $Revision: 1.28 $
+;;
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2 of the
+;; License, or (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+;; 02111-1307 USA
+
+(define-module (gnucash report eguile-html-utilities))
+
+; using all of these seems like overkill -- 
+; not sure which are really required
+(use-modules (gnucash main))
+(use-modules (gnucash gnc-module))        
+(use-modules (gnucash app-utils))
+(use-modules (gnucash business-utils))
+(gnc:module-load "gnucash/report/report-system" 0)
+(gnc:module-load "gnucash/business-utils" 0)
+(use-modules (gnucash report standard-reports))
+(use-modules (gnucash report business-reports))
+
+(use-modules (ice-9 regex))  ; for regular expressions
+(use-modules (srfi srfi-13)) ; for extra string functions
+
+(define-public (escape-html s1) 
+  ;; Convert string s1 to escape HTML special characters < > and &
+  ;; i.e. convert them to &lt; &gt; and &amp; respectively.
+  ;; Maybe there's a way to do this in one go... (but order is important)
+  (set! s1 (regexp-substitute/global #f "&" s1 'pre "&amp;" 'post))
+  (set! s1 (regexp-substitute/global #f "<" s1 'pre "&lt;" 'post))
+  (regexp-substitute/global #f ">" s1 'pre "&gt;" 'post))
+
+(define-public (nl->br str)
+  ;; Replace newlines with <br>
+  (regexp-substitute/global #f "\n" str 'pre "<br>" 'post))
+
+(define-public (nbsp str)
+  ;; Replace spaces with &nbsp; (non-breaking spaces)
+  ;; (yes, I know <nobr> is non-standard, but webkit splits e.g. "-£40.00" between
+  ;; the '-' and the '£' without it.)
+  (string-append 
+    "<nobr>" 
+    (regexp-substitute/global #f " " str 'pre "&nbsp;" 'post) 
+    "</nobr>"))
+
+(define-public (empty-cells n)
+  ;; Display n empty table cells
+  (display (string-repeat "<td class=\"empty\"></td>" n)))
+
+(define-public (indent-cells n)
+  ;; Display n empty table cells with width attribute for indenting
+  ;; (the &nbsp;s are just there in case CSS isn't working)
+  (display (string-repeat "<td min-width=\"32\" class=\"indent\">&nbsp;&nbsp;</td>" n)))
+
+(define-public (negstyle item)
+  ;; apply styling for negative amounts
+  (string-append "<span class=\"negative\">" item "</span>"))
+
+(define-public (foreignstyle item) 
+  ;; apply styling for amount in foreign currency
+  (if css?
+    (string-append "<span class=\"foreign\">" item "</span>"))
+    (string-append "<small><i>" item "</i></small>"))
+
+;; Convert any x into something printable as HTML
+(define-public (dump x) (escape-html (object->string x)))
+; ddump does the display as well -- for use in eguile reports
+; where anything 'display'ed becomes part of the report
+(define-public (ddump x) (display (dump x)))
+
+(define-public (fmtmoney curr amt)
+  ;; Format a monetary amount in the given currency as HTML
+  (nbsp (gnc:monetary->string (gnc:make-gnc-monetary curr amt)))) 
+
+(define-public (display-comm-coll-total comm-coll negative?)
+  ;; Display the total(s) of a commodity collector as HTML
+  (for-each
+    (lambda (pair)
+      (display (nbsp (gnc:monetary->string pair))))
+    (comm-coll 'format gnc:make-gnc-monetary negative?)))
+
+(define-public (font-name-to-style-info font-name)
+  ;;; Convert a font name as return by a font option to CSS format.
+  ;;; e.g. "URW Bookman L Bold Italic 12" becomes
+  ;;; "font-family: URW Bookman L; font-size: 12pt; font-style: italic; font-weight: bold"
+  (let* ((font-family "sans") ; defaults
+         (font-weight "normal")
+         (font-style  "normal")
+         (font-size   "medium")
+         (match "")
+         ; (thanks to Peter Brett for this regexp and the use of match:prefix)
+         (fontre (make-regexp "([[:space:]]+(bold|semi-bold|book|regular|medium|light))?([[:space:]]+(normal|roman|italic|oblique))?([[:space:]]+(condensed))?[[:space:]]+([[:digit:]]+)" regexp/icase))
+         (match (regexp-exec fontre font-name)))
+    (if match
+      (begin
+        ; font name parsed OK -- assemble the bits for CSS
+        (set! font-family (match:prefix match))
+        (if (match:substring match 2)
+          ; weight given -- some need translating
+          (let ((weight (match:substring match 2)))
+            (cond
+              ((string-ci=? weight "bold")      (set! font-weight "bold"))
+              ((string-ci=? weight "semi-bold") (set! font-weight "600"))
+              ((string-ci=? weight "light")     (set! font-weight "200")))))
+        (if (match:substring match 4)
+          ; style 
+          (let ((style (match:substring match 4)))
+            (cond
+              ((string-ci=? style "italic")  (set! font-style "italic"))
+              ((string-ci=? style "oblique") (set! font-style "oblique")))))
+        ; ('condensed' is ignored)
+        (if (match:substring match 7)
+          ; size is in points
+          (set! font-size (string-append (match:substring match 7) "pt")))))
+    ; construct the result (the order of these is important)
+    (string-append "font: " font-weight " " font-style " " font-size " \"" font-family "\";")))
+

Added: gnucash/trunk/src/report/report-system/eguile-utilities.scm
===================================================================
--- gnucash/trunk/src/report/report-system/eguile-utilities.scm	                        (rev 0)
+++ gnucash/trunk/src/report/report-system/eguile-utilities.scm	2010-02-03 21:01:18 UTC (rev 18609)
@@ -0,0 +1,98 @@
+;; eguile-utilities.scm
+;; Useful functions for eguile-based reports.
+;; See also eguile-html-utilities.scm
+;; Version 0.01
+;;
+;; (c) 2009 Chris Dennis chris at starsoftanalysis.co.uk
+;;
+;; $Author: chris $ $Date: 2009/07/27 15:51:02 $ $Revision: 1.28 $
+;;
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2 of the
+;; License, or (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+;; 02111-1307 USA
+
+(define-module (gnucash report eguile-utilities))
+
+; using all of these seems like overkill -- 
+; not sure which are really required
+(use-modules (gnucash main))
+(use-modules (gnucash gnc-module))        
+(use-modules (gnucash app-utils))
+(use-modules (gnucash business-utils))
+(gnc:module-load "gnucash/report/report-system" 0)
+(gnc:module-load "gnucash/business-utils" 0)
+(use-modules (gnucash report standard-reports))
+(use-modules (gnucash report business-reports))
+
+(use-modules (ice-9 slib))   ; for 'vicinity' functions
+;(use-modules (srfi srfi-13)) ; for extra string functions
+
+(define-public (fmtnumber n)
+  ;; Format a number (integer or real) into something printable
+  (number->string (if (integer? n) 
+                    (inexact->exact n) 
+                    n)))
+
+(define-public (fmtnumeric n)
+  ;; Format gnc-numeric n with as many decimal places as required
+  (fmtnumber (gnc-numeric-to-double n)))
+
+(define-public (gnc-monetary-neg? monetary)
+  ; return true if the monetary value is negative
+  (gnc-numeric-negative-p (gnc:gnc-monetary-amount monetary)))
+
+(define-public (string-repeat s n)
+  ;; return a string made of n copies of string s
+  ;; (there's probably a better way)
+  (let ((s2 ""))
+    (do ((i 1 (1+ i))) ((> i n))
+      (set! s2 (string-append s2 s)))
+    s2))
+
+;; 'Safe' versions of cdr and cadr that don't crash
+;; if the list is empty  (is there a better way?)
+(define-public (safe-cdr l)
+  (if (null? l)
+    '()
+    (cdr l)))
+(define-public (safe-cadr l)
+  (if (null? l)
+    '()
+    (if (null? (cdr l))
+      '()
+      (cadr l))))
+
+(define-public (find-file fname)
+  ;; Find the file 'fname', and return its full path.
+  ;; First look in the user's .gnucash directory.
+  ;; Then look in Gnucash's standard report directory.
+  ;; This is complicated because of the need to cater for
+  ;; various operating systems; so it takes a fairly heuristic,
+  ;; 'best guess' approach.
+  ;; If no file is found, returns just 'fname' for use in error messages.
+  ;; Note: this has been tested on Linux and Windows Vista so far...
+  (let* ((userdir (sub-vicinity (user-vicinity) ".gnucash"))
+         (sysdir  (sub-vicinity (sub-vicinity (user-vicinity) "gnucash") "report"))
+         (home (or (home-vicinity)
+                   (getenv "USERPROFILE")
+                   (user-vicinity)
+                   "")))
+    ; make sure there's a trailing delimiter
+    (set! home (sub-vicinity (user-vicinity) home))
+    (let ((home-template (in-vicinity (in-vicinity home userdir) fname)))
+      (if (access? home-template R_OK)
+        home-template
+        (or (%search-load-path (in-vicinity sysdir fname))
+            fname)))))
+  



More information about the gnucash-changes mailing list