X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=odtgen.sh;h=1dfa5e87083d736bdc31035e19f81d7b14e12da0;hb=8383d6e4dee56e69569f930e9e5d374ae0bdedcc;hp=c0f244825b74fad45a4d4e490c11cee03e5181ef;hpb=1d50621aa549b7a5c673a72de1dc74f368a5c58a;p=invoices
diff --git a/odtgen.sh b/odtgen.sh
index c0f2448..1dfa5e8 100755
--- a/odtgen.sh
+++ b/odtgen.sh
@@ -12,7 +12,7 @@ odt_manifest(){
}
odt_stylesheet(){
- local iban="$2" bic="$3"
+ local iban="$1" bic="$2"
cat <<-EOF
@@ -46,8 +46,8 @@ odt_stylesheet(){
Bankverbindung - IBAN:
- ${iban} |
- BIC:
+ ${iban}
+ | BIC:
${bic}
@@ -69,16 +69,19 @@ odt_content(){
-
+
-
+
-
+
-
-
+
+
+
+
+
@@ -92,6 +95,10 @@ odt_content(){
+
+
+
+
@@ -127,16 +134,16 @@ odt_content(){
$(HTML "$sender" |sed -r 's;(
\;)?
\;;;g')$(HTML "$sender" |sed -r 's;(
\;)?
\;|(?[Dd]\;)??[aA]\;|\r?$;;g')
$(HTML "$client" |sed -r 's;(
\;)?
\;;;g')$(HTML "$client" |sed -r 's;(
\;)?
\;|(?[Dd]\;)??[aA]\;|\r?$;;g')
- Rechnung ${issuance}
+ Rechnung ${number}
@@ -152,8 +159,8 @@ odt_content(){
-
-
+
+
@@ -171,22 +178,28 @@ odt_content(){
$(sed 1d "invoices/$id" |while read -r time work hours; do
- time="$(UNSTRING "${time#time=}")"
- work="$(UNSTRING "${work#work=}")"
+ time="$(UNSTRING "${time#time=}" |sed 's;\r;;g')"
+ work="$(UNSTRING "${work#work=}" |sed 's;\r;;g')"
hours="$(UNSTRING "${hours#hours=}")"
cat <<-TROW
- ${time}
+ ${time}
- ${item}
+ ${work}
- ${hours}
+ $( awk "BEGIN {
+ if ( int(${hours}) == ${hours} )
+ printf \"%i\", ${hours};
+ else
+ printf \"%i:%i\", int(${hours}), int((${hours} - int(${hours})) * 60);
+ }"
+ )
- $((${hourly} * ${hours})) â¬
+ $(awk "BEGIN { printf \"%.2f\", ${hourly} * ${hours}; }" ) â¬
TROW
@@ -286,7 +299,7 @@ genodt(){
genpdf(){
local id="$1"
genodt "$id"
- writer --convert-to pdf --outdir "export/" "export/${id}.odt" >/dev/null
+ lowriter --convert-to pdf --outdir "export/" "export/${id}.odt" >/dev/null
rm "export/${id}.odt"
}