shithub: rech


branches: front

Clone

clone: git://shithub.us/sirjofri/rech gits://shithub.us/sirjofri/rech
push: hjgit://shithub.us/sirjofri/rech

Last commit

3b8c26ce – sirjofri <sirjofri@sirjofri.de> authored on 2025/08/30 05:17
extracts pdf building to separate script

About

MKFILE RULES

- all: test and build everything
- test: run some tests
- invoices: build invoices
- balance: generate balance.pdf


FOLDERS

- /bin contains helper scripts that don't fit into the mkfile
- /lib contains additional template files for use in other scripts
- /client contains all clients and their information
- /invoice contains all invoices
- /template contains all invoice templates

The mkfile is used to generate the invoice PDF files (and later more)

bin/mkinvoice generates a new invoice folder with stub files.


FOLDERS IN DETAIL

The invoice files are:
----------------------

- client: name of the client (matches folder in /client)
- data.tsv: invoice positions
- date: date of the invoice (unix timestamp)
- msg: (optional) letter message. If this does not exist, it uses the client/msg instead, if that doesn't exist, template/name.msg
- template: name of the template file to use (matches file in /template)

Generated files:

- invoice-ID.pdf: resulting PDF file
- md5sum: sum of relevant files. This sum is also set as the ID in the PDF file

Additional files (TBD):

- paid: contains infos about payment
- history: list of events that happened around this invoice (storno, ...)
- those files should influence the calculation, e. g. for payment warnings


The template files are:
-----------------------

- name: actual letter template
- name.msg: default message for that template
- name.sed: string replace sed functions for "variables"


The client files are:
---------------------

- addr: address lines for that client
- msg: (optional) letter message. If this does not exist, it uses the template/name.msg. Can be overridden by a invoice/msg file.
- vcard.vcf: vcard file with contact info (TBD)


INDIVIDUAL INVOICE FILES


The message file (msg):
-----------------------

- troff format
- First line is the subject (paragraph)
- \*(iv  (string register) is the invoice ID/number
- .IV  (macro) prints the invoice positions (values)
- These macros can also be used in template files


The invoice data.tsv file:
--------------------------

- tab separated values
- lines that start with '#' are comments
- fields: amount, price, VAT/Tax, name/description


The client/addr file:
---------------------

- troff format, no fill (newlines are newlines)
- Address like on an envelope


BALANCE GENERATION

balance collects all the data in the invoice, in, and out folders.

- invoice  → self-explanatory
- in       → other sources of income, e.g. from stores
- out      → purchases, etc.

It uses the following additional files for generation:

- lib/balance_hdr.ms → header troff source (optional)
- lib/balance_ftr.ms → footer troff source (optional)
- lib/balance.sed → sed string replacements of troff source

Use the balance.sed file to also manage category names and so on.