free form vatfree field
authorPaul Hänsch <paul@plutz.net>
Wed, 29 Nov 2023 10:47:48 +0000 (11:47 +0100)
committerPaul Hänsch <paul@plutz.net>
Wed, 29 Nov 2023 10:47:48 +0000 (11:47 +0100)
invoices.css
invoices.sh
odtgen.sh

index de229a33f4c668cb3023fd25e5ac497d2912ec02..c7b2cc9d8bfe92c6741f64fd6f5b7fe4cd438e43 100755 (executable)
@@ -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;
index b0d15396f9a3ed3be5ee1bc694062d22aa47c6ce..072b5b7f9d5414effdaefd5ec2f1b0ca739e5b6d 100755 (executable)
@@ -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" "smallbusiness" #vatsb $([ "${vat#vat=}" = smallbusiness ] && printf checked) ]
          [label for=vatsb Small business exemption from VAT]
-         -->
          [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"
index 8a8e7969fa12e4d45e6557e26036ebc720473161..9e60106d913de4df7bc8422332703075549e582f 100755 (executable)
--- a/odtgen.sh
+++ b/odtgen.sh
@@ -39,11 +39,11 @@ html_content(){
        <p align="left" style="line-height: 100%; margin-top: 1.1cm; background: transparent; page-break-before: auto; page-break-after: auto">
        <font color="#000000"><font face="Cabin"><font size="3" style="font-size: 12pt"><b>Rechnung
        SI $(date -d @${date} +%y) ${number}</b></font></font></font></p>
-       <p align="left" style="font-weight: normal; line-height: 100%; margin-left: 12.375cm; background: transparent; page-break-before: auto; page-break-after: auto">
+       <p align="left" style="font-weight: normal; line-height: 100%; margin-left: 12.375cm; margin-top: 2cm; background: transparent; page-break-before: auto; page-break-after: auto">
        <font color="#000000"><font face="Cabin"><font size="2" style="font-size: 10pt">$(date -d @${date} +%d.%m.%Y)</font></font></font></p>
-       <p align="left" style="font-weight: normal; line-height: 100%; margin-top: 2.5cm; background: transparent; page-break-before: auto; page-break-after: auto">
+       <p align="left" style="font-weight: normal; line-height: 100%; margin-top: .5cm; background: transparent; page-break-before: auto; page-break-after: auto">
        <font color="#000000"><font face="Cabin"><font size="2" style="font-size: 11pt">Sehr
-       geehrte Damen und Herren,</font></font></font></p>
+       geehrte Damen und Herren,<br />Liebe Alle*,</font></font></font></p>
        <p><br/>
        <br/>
        
@@ -199,8 +199,7 @@ html_content(){
        </p>
        $([ $taxtype = notax ] && cat <<-EOF
        <p style="font-weight: normal; line-height: 100%"><a name="__DdeLink__15_3552620450"></a>
-       <font face="Cabin"><font size="2" style="font-size: 9pt"><i>Der
-       Rechnungsbetrag ist nach § 4 Abs. 25 UStG umsatzsteuerfrei</i></font></font></p>
+       <font face="Cabin"><font size="2" style="font-size: 9pt"><i>${novatreason}</i></font></font></p>
        EOF
        )
        </body>
@@ -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"
 }