From 20859c4783cb11a5815e98ae1eb00ecd8b96ea75 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 29 Nov 2023 11:47:48 +0100 Subject: [PATCH] free form vatfree field --- invoices.css | 6 +++++- invoices.sh | 21 +++++++++++++++------ odtgen.sh | 12 ++++++------ 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/invoices.css b/invoices.css index de229a3..c7b2cc9 100755 --- a/invoices.css +++ b/invoices.css @@ -223,11 +223,15 @@ form input[type=number] { height: 4.625em; } +.invoice form label[for=vatfree], .invoice form label[for=vatsb], .invoice form label[for=vatyw] { display: block; text-align: left; - margin-top: 2em; + -margin-top: 2em; +} +.invoice form label[for=vatfree] input { + width: 32em; } .invoice form label[for=vatrate] { display: block; diff --git a/invoices.sh b/invoices.sh index b0d1539..072b5b7 100755 --- a/invoices.sh +++ b/invoices.sh @@ -92,10 +92,10 @@ list_invoice(){ edit_invoice(){ local id="$1" sender client date number vat vatrate caddress hourly \ - taxtype nett tax gross status + taxtype nett tax gross status novatreason if [ -f "invoices/$id" ]; then - read -r sender client date number vat vatrate hourly status x<<-EOF + read -r sender client date number vat vatrate hourly status novatreason x<<-EOF $(sed q "invoices/$id") EOF fi @@ -126,12 +126,15 @@ edit_invoice(){ && hourly="${hourly#hourly=}" \ || hourly="${chourly}" + novatreason="$(UNSTRING "${novatreason#novatreason=}")" + tid="$(transid "invoices/$id")" read -r taxtype nett tax gross x<<-EOF $(invoice_total "$id") EOF + cat <<-EOF [form method="POST" action="/update_invoice" [hidden "id" "$(HTML "$id")"] @@ -189,9 +192,11 @@ $({ sed 1d "invoices/$id"; printf 'time= work= hours=\n'; } \ [radio "vat" "youthwork" #vatyw $([ "${vat#vat=}" = youthwork ] && printf checked) ] [label for=vatyw Umsatzsteuerbefreiung für Jugendhilfe, §4 Abs. 25 UStG.] + --> + [radio "vat" "novat" #vatfree $([ "${vat#vat=}" = novat ] && printf checked) ] + [label for=vatfree [input type="text" name=novatreason value="${novatreason:-"Der Rechnungsbetrag ist nach §4 Abs. 25 UStG. umsatzsteuerfrei"}"]] [radio "vat" "nett" #vatnett $([ "${vat#vat=}" = nett ] && printf checked)] [label for=vatnett Netto] [radio "vat" "gross" #vatgross $([ "${vat#vat=}" = gross ] && printf checked)] @@ -260,6 +265,7 @@ invoice_total(){ update_invoice(){ local id="$(POST id |checkid)" extra=0 tid tid="$(transid invoices/$id)" + printf "Update\n" >&2 if [ "$(POST update)" = "$tid" ] || [ "$(POST genpdf)" = "$tid" ]; then mkdir -p invoices @@ -268,14 +274,15 @@ update_invoice(){ [ "$n" -gt "$extra" ] && extra="$n" done - { printf 'sender=%s client=%s date=%s number=%s vat=%s vatrate=%s hourly=%s status=%s\n' \ + { printf 'sender=%s client=%s date=%s number=%s vat=%s vatrate=%s hourly=%s status=%s novatreason=%s\n' \ "$(POST sender)" "$(POST client)" \ "$(date -d "$(POST date)" +%s)" \ "$(POST number |STRING)" \ - "$(POST vat |grep -m1 -xE 'smallbusiness|youthwork|gross|nett')" \ + "$(POST vat |grep -m1 -xE 'smallbusiness|youthwork|gross|nett|novat')" \ "$(POST vatrate |grep -m1 -xE '[0-9]+')" \ "$(POST hourly |grep -m1 -xE '[0-9]+')" \ - "$(POST status |grep -m1 -xE 'open|sent|resent|paid|cancelled')" + "$(POST status |grep -m1 -xE 'open|sent|resent|paid|cancelled')" \ + "$(POST novatreason |STRING)" for n in $(seq 1 $extra); do printf 'time=%s work=%s hours=%s pcs=%s ppp=%s\n' \ "$(POST time $n |STRING)" "$(POST work $n |STRING)" \ @@ -289,6 +296,8 @@ update_invoice(){ git add "invoices/$id" git commit -m 'Update invoice info for "'"$(POST number)"'"' -- "invoices/$id" } >/dev/null + else + printf "TID mismatch\n" >&2 fi if [ "$(POST genpdf)" ]; then read -r sender client date x<"invoices/$id" diff --git a/odtgen.sh b/odtgen.sh index 8a8e796..9e60106 100755 --- a/odtgen.sh +++ b/odtgen.sh @@ -39,11 +39,11 @@ html_content(){

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

-

+

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

-

+

Sehr - geehrte Damen und Herren,

+ geehrte Damen und Herren,
Liebe Alle*,



@@ -199,8 +199,7 @@ html_content(){

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

- Der - Rechnungsbetrag ist nach § 4 Abs. 25 UStG umsatzsteuerfrei

+ ${novatreason}

EOF ) @@ -212,7 +211,7 @@ genhtml(){ local id="$1" mkdir -p "export/" - read -r sender client date number vat vatrate hourly x<<-EOF + read -r sender client date number vat vatrate hourly status novatreason x<<-EOF $(sed q "invoices/$id") EOF read -r sender iban bic x<"senders/${sender#sender=}" @@ -225,6 +224,7 @@ genhtml(){ "$(UNSTRING "${number#number=}")" \ "${vat#vat=}" "${vatrate#vatrate=}" \ "${hourly#hourly=}" \ + "$(UNSTRING "${novatreason#novatreason=}")" \ >"export/$id.html" } -- 2.39.5