background

Niko's Project Corner

Finnish Invoice Template

Description A well-structured and re-usable LaTeX template for invoices.
Languages LaTeX
Tags GitHub
En­trepreneur­ship
Duration Spring 2016
Modified 7th August 2016
GitHub nikonyrh/finnish-invoice-template
thumbnail

Af­ter fin­ish­ing a paid pro­ject, ide­ally a for­mal look­ing in­voice would be sent to the client. I know there are many com­mer­cial prod­ucts avail­able, but I couldn't find a good open source al­ter­na­tive es­pe­cially with the stan­dard Finnish for­mat­ting. I was happy to find jheusala/finnish-in­voice-tem­plate from GitHub which had all of the tricky LaTeX stuff done.

The tem­plate us­age is very sim­ple and min­imizes rep­eti­tion when stor­ing and ref­er­enc­ing in­for­ma­tion on the com­pany and the client. There is a one file for each com­pany and one for each client. Each in­voice.tex file must start by im­port­ing the in­voice_header.tex file, which con­sists mostly of usep­ack­age dec­la­ra­tions. Next com­pany and client files are im­ported, and other in­voice de­tails are de­fined. Header can be seen in the Fig­ure 1. Sam­ple com­pany in­for­ma­tion:

  • \newcommand{\CompanyName}{Yritys ABC}
  • \newcommand{\CompanyStreetAddress}{Osoite 123 A 4}
  • \newcommand{\CompanyPostcode}{12345}
  • \newcommand{\CompanyCity}{Kaupunki 1}
  • \newcommand{\CompanyWebsite}{https://example.com}
  • \newcommand{\CompanyEmail}{email@example.com}
  • \newcommand{\CompanyPhone}{040-1234567}
  • \newcommand{\CompanyId}{5555555-5}
  • \newcommand{\CompanyBank}{Pankki}
  • \newcommand{\CompanyIBAN}{FI56 1111 2222 3333 44}
  • \newcommand{\CompanyBIC}{NDEAFIHH}

And sam­ple client in­for­ma­tion:

  • \newcommand{\ClientNumber}{101}
  • \newcommand{\ClientName}{Asiakas XYZ}
  • \newcommand{\ClientAddress}{Osoite 234 B 5}
  • \newcommand{\ClientPostcode}{23456}
  • \newcommand{\ClientCity}{Kaupunki 2}
header
Figure 1: Header part of the in­voice.

At the mo­ment it is still quite ver­bose to de­fine in­di­vid­ual in­voice rows, and hav­ing to do all tax and to­tal cal­cu­la­tions man­ually. Un­for­tu­nately this is also very er­ror prone, so per­haps a sim­ple Python script should be writ­ten to gen­er­ate the in­voice file based on most prim­itive facts. There is also an em­bed­ded two-line Python script to cal­cu­late the in­voice's ref­er­ence id's check digit.

Af­ter all de­tails have been de­scribed the 250 lines long in­voice_body.text is im­ported. It is just slightly mod­ified ver­sion of the orig­inal jheusala/finnish-in­voice-tem­plate/in­voice.tex. The main dif­fer­ence is that it only con­tains in­for­ma­tion on the for­mat­ting of the doc­ument, and all in­for­ma­tion on the com­pany, client and the in­voice is read via pre-de­fined com­mands. The re­sult is shown in Fig­ure 2.

breakdown
Figure 2: Break­down part of the in­voice.

Main in­for­ma­tion is listed in the footer, as shown in Fig­ure 3. On the top it lists com­pany de­tails such as street ad­dress, web ad­dress and email ad­dress. Next are IBAN and BIC num­bers of the com­pany's bank ac­count, nat­urally it is cru­cial to have the cor­rect in­for­ma­tion here or it would be a huge in­con­ve­nience to both par­ties. In the mid­dle left the name and ad­dress of the com­pany and client are shown, and on the right the client's id and in­voice's id is shown. Fi­nally on the bot­tom right the in­voice's ref­er­ence id, due date and to­tal amount to be paid are shown. The full sam­ple doc­ument can be found from GitHub.

footer
Figure 3: Footer part of the in­voice.

The orig­inal tem­plate used code128 to cre­ate a bar­code to the footer as well, but I didn't get it to work on Win­dows TeX­works so I had to dis­able it for now. I'm not sure if those are widely used nowa­days, maybe not by Finnish in­di­vid­uals but by larger com­pa­nies.


Related blog posts:

BenchmarkTaxiridesEsSql
CljTaxirides
CljMustache
CljHyphenation
NginxBridge