Skip to content

Commit 1e224bb

Browse files
authored
fix: default fee/penalty (#2)
1 parent 9116a8f commit 1e224bb

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

_extensions/invoice/_extension.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: Invoice (Typst)
22
author: Mickaël Canouil
3-
version: 1.0.0
3+
version: 1.2.0
44
quarto-required: ">=1.4.0"
55
contributes:
66
formats:

_extensions/invoice/typst-template.typ

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@
4343
body
4444
) = {
4545
let issued = parse-date(invoice.at("issued"))
46+
if "penalty" in invoice and invoice != none {
47+
let penalty = invoice.at("penalty", default: "€40")
48+
} else {
49+
let penalty = "€40"
50+
}
51+
if "fee" in invoice and invoice != none {
52+
let fee = invoice.at("fee", default: 2.28)
53+
} else {
54+
let fee = 2.28
55+
}
56+
4657
set document(
4758
title: "Invoice " + invoice.at("number").replace("\\", "") + " - " + recipient.at("name").replace("\\", ""),
4859
author: sender.at("name").replace("\\", ""),
@@ -197,9 +208,9 @@
197208
+ ". The invoice must be paid under "
198209
+ count-days(issued, parse-date(invoice.at("due")))
199210
+ " day(s), otherwise you will have to pay a late fee of "
200-
+ invoice.at("fee", default:"2.28")
211+
+ str(fee)
201212
+ " % and a "
202-
+ invoice.at("penalty", default:"€40")
213+
+ str(penalty)
203214
+ " penalty for recovery costs. "
204215
+ "No discount will be granted for early settlement."
205216
)

0 commit comments

Comments
 (0)