From f5872dd64fe9e150de56abbf1122a85702e1d514 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Fri, 10 Nov 2023 01:16:40 +0100 Subject: [PATCH] taxation modes, background stamping --- odtgen.sh | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/odtgen.sh b/odtgen.sh index d72faa4..8a8e796 100755 --- a/odtgen.sh +++ b/odtgen.sh @@ -5,7 +5,7 @@ html_content(){ taxtype nett tax gross date_due sender="$(HTML "$sender" |sed -E 's/ / • /g;')" - client="$(HTML "$client")" + client="$(HTML "$client" |sed -E ':A; /(.* ){6}/!{ s/$/\ \ /; bA; }')" read -r taxtype nett tax gross <<-EOF $(invoice_total "$id") @@ -32,18 +32,18 @@ html_content(){ a:visited { color: #800000; text-decoration: underline } -

+

${sender}

${client}

-

+

Rechnung SI $(date -d @${date} +%y) ${number}

-

+

+ $(date -d @${date} +%d.%m.%Y)

+

Sehr geehrte Damen und Herren,

-

- $(date -d @${date} +%d.%m.%Y)



@@ -113,6 +113,7 @@ html_content(){ ROW done) + $([ $taxtype != notax ] && cat <<-ROW


@@ -124,19 +125,24 @@ html_content(){

-

- ${vatrate}% - MwSt.

+

+ + $([ $taxtype = gross ] && printf "incl."; [ $taxtype = nett ] && printf "zzgl."; ) + ${vatrate}% MwSt.:

- ${tax} - €

+ + $([ $taxtype = gross ] && printf "$tax €";) +

- ${tax} - €

+ + $([ $taxtype = nett ] && printf "$tax €";) +

+ ROW + )


@@ -148,8 +154,8 @@ html_content(){

-

- Gesamtsumme

+

+ Gesamtsumme:


@@ -191,9 +197,12 @@ html_content(){

+ $([ $taxtype = notax ] && cat <<-EOF

Der Rechnungsbetrag ist nach § 4 Abs. 25 UStG umsatzsteuerfrei

+ EOF + ) EOF @@ -220,9 +229,11 @@ genhtml(){ } genpdf(){ - local id="$1" + local id="$1" tmp="tmp$(randomid)" genhtml "$id" lowriter --convert-to pdf --outdir "export/" "export/${id}.html" >/dev/null - rm "export/${id}.html" + pdftk "export/${id}.pdf" background $_DATA/Background.pdf output "export/${tmp}.pdf" + mv -- "export/${tmp}.pdf" "export/${id}.pdf" + rm -- "export/${id}.html" } -- 2.39.5