larzinvoice
Build and format invoices from Money line items.
Add line items by description/quantity/unit price, set a tax rate, and render() gives a real formatted invoice (via the table package) with subtotal/tax/total - or to_json() for the same data as a real JSON document. Every amount is the language's exact Money type throughout.
larzscript pkg install invoice
What you get
- Line items by desc/qty/unit price, real Money throughout
- render() - a formatted invoice via the table package
- to_json() - the same data as a real JSON document
- subtotal()/tax()/total() computed on demand
Try it
import "invoice" as invoice
let inv = invoice.new("INV-001", "Acme Co")
invoice.add(inv, "Widget", 3, $9.99)
invoice.set_tax_rate(inv, 0.08)
print(invoice.render(inv))Output
Invoice INV-001 - Acme Co | Item | Qty | Unit | Amount | |--------|-----|-------|--------| | Widget | 3 | $9.99 | $29.97 | Subtotal: $29.97 Tax: $2.40 Total: $32.37
Why it's in the Larz Stack
larzinvoice is a real Larzscript package (larzscript pkg install invoice) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.