Created
July 13, 2024 09:15
-
-
Save AdrienHorgnies/21e3bcb9390d543b27b99af602358760 to your computer and use it in GitHub Desktop.
An invoice template using Typst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Draft": true, | |
"Number": "123456789", | |
"IssuedOn": "01/01/1970", | |
"Due": "15/01/1970", | |
"Introduction": "Please receive this invoice with joy and cheerfulness.", | |
"Issuer": { | |
"Name": "Big D Energy", | |
"Address": "Rue de la Gaufre 777\n1234 Ville", | |
"Country": "Belgique", | |
"VAT": "BE0123.456.789" | |
}, | |
"Recipient": { | |
"Name": "Average Customer", | |
"BoxName": "Tall Building", | |
"Address": "3rd floor Tower\nGym street\n4321 Town", | |
"Country": "United Kingdom", | |
"VAT": "GB9876543210" | |
}, | |
"Items": [ | |
{ | |
"Name": "Water", | |
"Price": "0.80 €", | |
"VatRate": "12 %", | |
"Quantity": "1000", | |
"Unit": "liter", | |
"Total": "800.00 €" | |
}, | |
{ | |
"Name": "Energy Drink", | |
"Price": "10.00 €", | |
"VatRate": "12 %", | |
"Quantity": "50", | |
"Unit": "liter", | |
"Total": "500.00 €" | |
}, | |
{ | |
"Name": "White Sugar", | |
"Price": "1.00 €", | |
"VatRate": "12 %", | |
"Quantity": "100", | |
"Unit": "kg", | |
"Total": "100.00 €" | |
}, | |
{ | |
"Name": "Brown Bar", | |
"Price": "5.00 €", | |
"VatRate": "21 %", | |
"Quantity": "120", | |
"Unit": "piece", | |
"Total": "600.00 €" | |
} | |
], | |
"TotalNoVat": "2000.00 €", | |
"VatComputations": [ | |
{ | |
"Base": "1400.00 €", | |
"VatRate": "12 %", | |
"Vat": "168.00 €" | |
}, | |
{ | |
"Base": "600.00 €", | |
"VatRate": "21 %", | |
"Vat": "126.00 €" | |
} | |
], | |
"TotalOnlyVat": "294.00 €", | |
"Payment": { | |
"Total": "2294.00 €", | |
"Iban": "BE12 1234 1234 1234", | |
"Bic": "ABCDEF", | |
"Message": "+++123/1234/12345+++", | |
"Comment": "Late payments make me angry, I have anger management issues and I'm very muscular." | |
}, | |
"Attachments": [ | |
{ | |
"Filename": "terms-of-services.pdf", | |
"Checksum": "SHA256:b174e8d142b2f0a8a40d9227b9a5fa01786ed57ff2df5399294a9163c2e57b31" | |
} | |
], | |
"Footer": { | |
"Website": "www.bigdenergy.com", | |
"Mail": "accounting@bigdenergy.com", | |
"PrettyTel": "+32 (0) 123 45 67 89", | |
"Tel": "+32123456789" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#let data = json(sys.inputs.data) | |
#set text(font: "Noto Sans") | |
#let bg | |
#if data.Draft { | |
bg = rotate(24deg, text(72pt, fill: rgb("FFCBC4"))[*DRAFT*]) | |
} else { | |
bg = [] | |
} | |
#set page( | |
background: bg, | |
footer: context[ | |
#set text(9pt) | |
#grid( | |
columns: (1fr, 1fr, 1fr), | |
align: center, | |
link("https://" + data.Footer.Website)[ #data.Footer.Website], | |
link("mailto:" + data.Footer.Mail)[ #data.Footer.Mail], | |
link("tel:" + data.Footer.Tel)[ #data.Footer.PrettyTel], | |
) | |
#set align(right) | |
#counter(page).display("1 of 1", both: true,) | |
] | |
) | |
#show heading: set text(size: 18pt) | |
= Invoice \##data.Number | |
#align(right)[ | |
Issued on #data.IssuedOn \ | |
*Due #data.Due* | |
] | |
#v(1em) | |
#grid( | |
columns: (1fr, 1fr), | |
align(left)[ | |
*#data.Issuer.Name* \ | |
#if "BoxName" in data.Issuer.keys() [ | |
#data.Issuer.BoxName \ | |
] | |
#data.Issuer.Address \ | |
#data.Issuer.Country \ | |
#data.Issuer.VAT | |
], | |
align(left)[ | |
*#data.Recipient.Name* \ | |
#if "BoxName" in data.Recipient.keys() [ | |
#data.Recipient.BoxName \ | |
] | |
#data.Recipient.Address \ | |
#data.Recipient.Country \ | |
#data.Recipient.VAT | |
] | |
) | |
#v(8pt) | |
#data.Introduction | |
#show heading: set text(size: 14pt) | |
== Items | |
#set table( | |
stroke: none | |
) | |
#table( | |
columns: (1fr, auto, auto, auto, auto, auto), | |
[Item], [Price excl. VAT], [VAT %], [Quantity], [Unit], [Total excl. VAT], | |
table.hline(), | |
..for (Name, Price, VatRate, Quantity, Unit, Total) in data.Items {( | |
Name, | |
align(right)[#Price], | |
align(right)[#VatRate], | |
align(right)[#Quantity], | |
align(right)[#Unit], | |
align(right)[#Total] | |
)}, | |
table.hline(), | |
table.cell(colspan: 5, [Total]), align(right)[#data.TotalNoVat] | |
) | |
== VAT | |
#table( | |
columns: 3, | |
[Base], [VAT %], [VAT], | |
table.hline(), | |
..for (Base, VatRate, Vat) in data.VatComputations {( | |
align(right)[#Base], | |
align(right)[#VatRate], | |
align(right)[#Vat] | |
)}, | |
table.hline(), | |
table.cell(colspan: 2, [Total]), align(right)[#data.TotalOnlyVat] | |
) | |
#if data.Issuer.Country != data.Recipient.Country [ | |
Article 39 - Export de biens \ | |
Article 39 - Export de services | |
] | |
== Payment Information | |
#v(.5em) | |
#table( | |
columns: 2, | |
stroke: 1pt, | |
align(left)[Amount], align(center)[#data.Payment.Total], | |
align(left)[IBAN], align(center)[#data.Payment.Iban], | |
align(left)[BIC], align(center)[#data.Payment.Bic], | |
align(left)[Message], align(center)[#data.Payment.Message] | |
) | |
#data.Payment.Comment | |
== Attachments | |
#context[ | |
#set text(font: "Noto Mono", size: 9pt) | |
#table( | |
columns: 2, | |
..for (Filename, Checksum) in data.Attachments {( | |
table.cell(rowspan: 2)[-], | |
Filename, | |
Checksum, | |
)} | |
) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment