This is CLInvoice. This software is meant to generate invoices from a simple text file, a latex template, and a config file.
- use simple input files (text based)
- be scriptable
- generate pdf invoices
CLI uses a .clinvoice
configuration file. A configuration file looks like
this:
[heading]
# here is a comment
a-variable = value
another-variable = something else
CLI will first read a global configuration file in $HOME/.cliinvoice
and
then the one in the current directory. This allows the global file to be used
to define information about the contractor, while the local one being used to
define information about the project.
Here is an example of a system config file:
[issuer]
company = BURN-E
address = 1 Main Ave | Ottawa, ON, K2C 4E6 | Canada
phone = 613-282-7102
[pdf]
# rendering is done by calling this program, substituting %s for
# 'pdf.output' (see below)
build = latex %s
Here is what you'd find in a project config file:
[client]
care-of = Shelby Forthright
company = Buy N Large
address = 1 Buy n Large Plaza, BnL Ave. | Largefield, NJ, 08012 | USA
phone = 201-555-0001
[contract]
hourly-rate = 50
tax = HST 13%
[default]
generator = pdf
[generator "latex"]
# template file to read in to generate output
template = bnl-template.tex
# output to generate, witht he following substitutions:
# %% - a literal %
# %# - sequence number
# %Y - year
# %m - last month in invoice
# %d - last day in invoice
output = bnl-%Y%m%d-%#.tex
[generator "txt"]
template = bnl-template.txt
output = bnl-%Y%m%d-%#.txt
[generator "pdf"]
template = bnl-template.tex
output = bnl-%Y%m%d-%#.tex
But it doesn't matter how the configuration is split, or if it's split at all.
Invoices are built from a LaTeX template file, which must contain fields
surrounded by %{
and %}
that will be replaced by CLI.
CLI project are backed by GIT. To initialize a new project run:
$ cli init
This will create a new project, with an empty config file, and a template.
For each invoice, CLI will use a data file, *.cli
, to read in the invoice
information. Raw data files look like this:
2010.11.01
2h = meeting with SUPPLY-R
6h = repair lamp spire
2010.11.01
10:30-12:30 = meeting with SUPPLY-R
13:00-19:00 = repair lamp spire
The above example shows two encoding formats for the same information. Multiple entries per day are optional, and will be merged into a single line in the output pdf.
Once the configuration, template, and raw data file are setup the invoice pdf can be generated by running:
$ cli generate -t pdf -s 4 2010.11
This will check for November 2010 entries in *.cli
files and generate a pdf
invoice. Given the above config, and assuming that this is the first invoice,
it will be stored in bnl-20101130-1.pdf
.
-
Tell CLI that invoice is submitted to client:
$ cli submit 2010.11
... will build the invoice if needed, and mark it as submitted.
-
Check what invoices are outstanding:
$ cli log --late 2010.10 $3569.01 (45 days late) 2010.11 $2412.45 (14 days late) Total: $5981.46
-
When the client covers the invoice:
$ cli paid 2010.11
-
Getting info on all invoices
$ cli log 2010.08 $2569.01 (paid 2010.09.30) 2010.09 $3526.41 (paid 2010.10.30) 2010.10 $3569.01 (45 days late) 2010.11 $2412.45 (14 days late)