Skip to content

semla/PTA-invoice-typst

Repository files navigation

PTA Typst Invoice

Invoice for use with PTA software like hledger and Tackler.

Background

When trying out plain text accounting (PTA), I needed a way to create pdf invoices. I stumbled on Typst and here is the result.

For PTA I currently use hledger. My plan is to switch to Tackler due to its journal data auditing features, which allows it to cryptographically prove the data has not changed. But for now the Tackler features for this invoice may not be quite up to date.

The address placement hopefully fits a C5 envelope with an h2 "window". So far I haven’t had to print the invoice so it is not tested.

PTA

Read more about PTA - Plain Text Accounting.

Data

The invoice reads from .toml and .json / csv files:
  • clients.toml

  • static_data.toml

  • 2 json / csv files containing the balance and register, the path and file names and are specified in static_data.toml. If the file is a csv it is inferred it is exported from Hledger with a similar command to the one below. If json, Tackler.

  • VAT: with Tackler the accounts in the exported register can be used. With Hledger you can set the hledger_account_name_for_vat which adds the hledger_vat_text.

CSV from Hledger

Generate the csv with something like:

Register export (revenue only - for invoice line items):
hledger register -f div/.hledger.example.journal --invert date:2025-03-03 desc:x revenue -O csv > exported-from-pta/register-exp-hledger.csv

Balance export (revenue + VAT - for invoice totals):
hledger balance -f div/.hledger.example.journal --invert date:2025-03-03 desc:x revenue liabilities:vat:sales -O csv > exported-from-pta/balance-exp-hledger.csv

The register export contains only revenue accounts for detailed line items, while the balance export includes revenue and VAT accounts. The CSV total row provides the invoice total.

JSON from Tackler

Generate the json with something like:
tackler --config journal/conf/tackler.toml --output.dir . --output.prefix report

PDF

Create pdf with:
typst compile invoice-01.typ

Preview


resume

Disclaimer

The invoice may not fullfill legal requirements for your country.
It is also a work in progress.

About

Simple invoice for plain text accounting software

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages