X-Git-Url: http://git.plutz.net/?p=invoices;a=blobdiff_plain;f=odtgen.sh;h=5efbcc2887dfb70a346cd1871f5a8dfa07fe79f9;hp=c0f244825b74fad45a4d4e490c11cee03e5181ef;hb=HEAD;hpb=1d50621aa549b7a5c673a72de1dc74f368a5c58a diff --git a/odtgen.sh b/odtgen.sh index c0f2448..abed2db 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 -r 's;( \;)? \;|(�?[Dd]\;)?�?[aA]\;|\r?$;;g')" + work="$(UNSTRING "${work#work=}" |sed -r 's;( \;)? \;|(�?[Dd]\;)?�?[aA]\;|\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" }