]> git.plutz.net Git - invoices/blobdiff - odtgen.sh
support for fractional work hours
[invoices] / odtgen.sh
index 177065a9c9a0fd10f92cba31058aceacc51f1b98..1dfa5e87083d736bdc31035e19f81d7b14e12da0 100755 (executable)
--- a/odtgen.sh
+++ b/odtgen.sh
@@ -190,10 +190,16 @@ odt_content(){
                            <text:p text:style-name="P3">${work}</text:p>
                          </table:table-cell>
                          <table:table-cell table:style-name="Table1.2" office:value-type="string">
-                           <text:p text:style-name="P5">${hours}</text:p>
+                           <text:p text:style-name="P5">$( awk "BEGIN { 
+                                                                 if ( int(${hours}) == ${hours} ) 
+                                                                    printf \"%i\", ${hours};
+                                                                 else
+                                                                    printf \"%i:%i\", int(${hours}), int((${hours} - int(${hours})) * 60);
+                                                                 }"
+                                                           )</text:p>
                          </table:table-cell>
                          <table:table-cell table:style-name="Table1.2" office:value-type="string">
-                           <text:p text:style-name="P5">$((${hourly} * ${hours})) €</text:p>
+                           <text:p text:style-name="P5">$(awk "BEGIN { printf \"%.2f\", ${hourly} * ${hours}; }" ) €</text:p>
                          </table:table-cell>
                        </table:table-row>
                        TROW