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")
a:visited { color: #800000; text-decoration: underline }
</style>
</head>
- <body lang="de-DE" link="#000080" vlink="#800000" dir="ltr"><p align="left" style="line-height: 100%; margin-top: 1.5cm; background: transparent">
+ <body lang="de-DE" link="#000080" vlink="#800000" dir="ltr"><p align="left" style="line-height: 100%; margin-top: 2cm; background: transparent">
<font color="#000000"><font face="Cabin"><font size="1" style="font-size: 8pt"><b>${sender}</b></font></font></font></p>
<p align="left" style="font-weight: normal; line-height: 100%; margin-top: 0.2cm; background: transparent">
<font color="#000000"><font face="Cabin"><font size="2" style="font-size: 11pt">${client}</font></font></font></p>
- <p align="left" style="line-height: 100%; margin-top: 3.3cm; background: transparent; page-break-before: auto; page-break-after: auto">
+ <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-top: 0.9cm; background: transparent; page-break-before: auto; page-break-after: auto">
+ <p align="left" style="font-weight: normal; line-height: 100%; margin-left: 12.375cm; 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">
<font color="#000000"><font face="Cabin"><font size="2" style="font-size: 11pt">Sehr
geehrte Damen und Herren,</font></font></font></p>
- <p align="right" style="font-weight: normal; line-height: 100%; margin-right: 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><br/>
<br/>
</tr>
ROW
done)
+ $([ $taxtype != notax ] && cat <<-ROW
<tr valign="top">
<td width="9%" style="border: none; padding: 0cm"><p align="right">
<br/>
</p>
</td>
- <td width="60%" style="border: none; padding: 0cm"><p align="left" style="font-weight: normal">
- <font face="Cabin"><font size="2" style="font-size: 11pt">${vatrate}%
- MwSt.</font></font></p>
+ <td width="60%" style="border: none; padding: 0cm"><p align="right" style="font-weight: normal">
+ <font face="Cabin"><font size="2" style="font-size: 11pt">
+ $([ $taxtype = gross ] && printf "incl."; [ $taxtype = nett ] && printf "zzgl."; )
+ ${vatrate}% MwSt.:</font></font></p>
</td>
<td width="15%" style="border: none; padding: 0cm"><p align="right">
- <font face="Cabin"><font size="2" style="font-size: 11pt">${tax}
- €</font></font></p>
+ <font face="Cabin"><font size="2" style="font-size: 11pt">
+ $([ $taxtype = gross ] && printf "$tax €";)
+ </font></font></p>
</td>
<td width="15%" style="border: none; padding: 0cm"><p align="right">
- <font face="Cabin"><font size="2" style="font-size: 11pt">${tax}
- €</font></font></p>
+ <font face="Cabin"><font size="2" style="font-size: 11pt">
+ $([ $taxtype = nett ] && printf "$tax €";)
+ </font></font></p>
</td>
</tr>
+ ROW
+ )
<tr valign="top">
<td width="9%" style="border: none; padding: 0cm"><p align="right">
<br/>
</p>
</td>
- <td width="60%" style="border: none; padding: 0cm"><p align="left">
- <font face="Cabin"><font size="2" style="font-size: 11pt"><b>Gesamtsumme</b></font></font></p>
+ <td width="60%" style="border: none; padding: 0cm"><p align="right">
+ <font face="Cabin"><font size="2" style="font-size: 11pt"><b>Gesamtsumme:</b></font></font></p>
</td>
<td width="15%" style="border: none; padding: 0cm"><p align="right">
<br/>
<br/>
</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>
+ EOF
+ )
</body>
</html>
EOF
}
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"
}