Deciding to use Hugo for invoicing, I planned out how I wanted it. But the invoice archetype is holding me up, let’s see if talking it out helps.
Basically, I want to create a new invoice and have it loaded with a bunch of info for me, including a sequential/unique ID.
I figure I’d use something like:
title: UUID; no one ever sees this
date: on creation, use to determine pay-by date
client: taxonomy of clients (meaning they need to be entered, first)
Oh yeah: Archetypes | Hugo
The default archetype is:
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
That take the name of the file created and transforms it. I’ll probably write a small bash script that runs the hugo
command and pass it a date, epoch, or UUID as the name, and then I can go from there.
Okay, invoices have tables of services, ne? I mean, they don’t have to, but I often have multiple line items, each with their own cost and quantity. I rarely charge by hour, but I do charge by multiple months: “Monthly hosting $X, for 3 months.”
Additionally, I’d like to use the database of text information that is my invoices and create reports for myself. That means including the invoice fees in front matter or related data.
I’m using YAML, which contains nested values. I’m wondering if I can utilize that to fill in certain details. Something like:
fee:
description: Monthly Hosting
cost: 50
quantity: 3
I’ll be editing these in nvim, so loading 3 or 4 fee blocks in the archetype and then deleting the ones I don’t need will probably work. Then I can do the math and build the table in the relevant template.
Okay, there are some presumptions, let’s see how it works…