Announcing GIP: GnuCash Invoice Printer

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Announcing GIP: GnuCash Invoice Printer

Ian Smith-Heisters
In the proud tradition of gcinvoice and gc2latex, I've written yet
another way of exporting your GnuCash invoices.

= GIP: Gnucash Invoice Printer

Author::      Ian Smith-Heisters <[hidden email]>
Copyright::   Copyright (c) 2008 Ian Smith-Heisters
License::     GPLv3

== Commandline Usage

  ./gip.rb -h

If you're getting errors compiling the tex file, you might want to output just
the tex file to debug it.

  ./gip.rb -d ~/accounts/gnucash_data -i FOO-1 -t example.tex.erb -f tex
  pdflatex FOO-1.tex FOO-1.pdf

is equivalent to

  ./gip.rb -d ~/accounts/gnucash_data -i FOO-1 -t example.tex.erb

except that it might provide some useful debug information that would otherwise
be swallowed by Ruby.

== Installation

  gem install xmlsimple getopt-declare rtex --include-dependencies
  git git://

== Templates

=== LaTeX

The LaTeX templating engine is basically ye olde ERB, so you'll be wanting to
do stuff like

  <%= %>

You might want to take a look at the rtex documentation, in particular the +l+
method, which will escape LaTeX special characters.

  <%= l entry.description %>

For a full reference of which instance variables are available to your template,
see <tt>Invoice#with_template_variables</tt>. For a full reference of what
methods you can call on them, consult the source or RDoc output.

=== CSV

The CSV templates are just ruby files with a CSV generator object made
available in <tt>@csv</tt>, along with the usual instance variables from
<tt>Invoice#with_template_variables</tt>. See Ruby stdlib CSV documentation for
more details.

== Library Usage

You can also use GIP as a Ruby library if you're wanting to get down and dirty.
Since I wanted it all in one file until I package it up in a gem, you have to
do a little hack so that the require call doesn't fuck with your program:

  ENV['GIP_DONT_RUN'] = '1'
  require 'gip'

If you were to not set GIP_DONT_RUN, or set it to something other than '1', your
program will abort looking for commandline arguments. Of course the following
bash command is equivalent to the above Ruby:

  GIP_DONT_RUN=1 ruby -rgip -e '...'
gnucash-user mailing list
[hidden email]
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.