GNOME Bugzilla – Bug 574582
eguile-like template processor for easier report writing
Last modified: 2018-06-29 22:19:12 UTC
Using a template processor like eguile would make it easier to write new GnuCash reports.
Created attachment 130302 [details] GnuCash-specific version of eguile.scm This is my version of Neale Pickett's eguile.scm. It allows GnuCash reports to be created that get most of their HTML from a template file with embedded Guile code that supplies values and iterates over loops (e.g. invoice entries). I will attach a sample report soon.
Created attachment 130305 [details] Tax invoice using eguile-gnc via template taxinvoice.eguile.scm
Created attachment 130306 [details] eguile-gnc template for use with taxinvoice.scm
To try out the report, you need to put eguile-gnc.scm into the same folder as invoice.scm (on my system that's /usr/share/gnucash/guile-modules/gnucash/report/eguile-gnc.scm). Install taxinvoice.scm in the usual way (see http://wiki.gnucash.org/wiki/Custom_Reports). Put taxinvoice.eguile.scm in the same place, but note that it's location is an option in taxinvoice.scm -- it can be changed either in the source code, or from the report's option menu. I'm not convinced that this is the best way to include the file name for the template -- suggestions for improvements are welcome. The report should then show up in 'Sample & Custom' report sub-menu. I've developed this on Ubuntu Intrepid, using the SVN Trunk version of GnuCash, with Guile 1.6. taxinvoice.scm includes code to display individual taxes on a per-entry basis, i.e. on each line of the invoice. This relies on a fix to the Swig encoding that is currently in the pipeline as bug #573645, but it includes a work-around so that it simply misses out the extra columns if that fix hasn't been applied. Please give it a go and let me know how you get on.
Created attachment 130661 [details] Sample invoice I've attached a PDF file of a sample invoice created using eguile and the taxinvoice.scm report.
Created attachment 131565 [details] GnuCash-specific version of eguile.scm - amended Corrections: added 'use-modules' and 'export' lines.
Created attachment 131566 [details] Tax invoice report using eguile-gnc - amended Corrections -- added 'use-modules' lines.
Created attachment 135413 [details] Tax invoice report using eguile-gnc - amended New improved version.
Created attachment 135414 [details] Tax invoice report template - amended New improved version.
Created attachment 135415 [details] Sample invoice New improved version.
Created attachment 137040 [details] GnuCash-specific version of eguile.scm - amended New version with better error reporting.
Created attachment 137041 [details] Balance sheet report using eguile Uses template balsheet-eg.eguile.scm and CSS stylesheet balsheet-eg.css
Created attachment 137042 [details] Balance sheet report -- template file For use with balsheet-eg.scm
Created attachment 137043 [details] Balance sheet report -- CSS file For use with balsheet-eg.scm
Created attachment 137044 [details] Balance sheet report -- sample output Sample output from balsheet-eg.scm
Comment on attachment 137040 [details] GnuCash-specific version of eguile.scm - amended eguile.scm committed as r18150
Created attachment 137664 [details] Balance sheet report using eguile - corrected
Created attachment 137674 [details] Balance sheet report using eguile - correction no. 2
The core component eguile-gnc.scm has been commited as r18151. Sample reports are now available on the wiki at http://wiki.gnucash.org/wiki/Custom_Reports_Using_Eguile So this bug is effectively fixed.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=574582. Please update any external references or bookmarks.