@@ -21,11 +21,18 @@ class invoice extends Base {
2121 this . invoiceCurrencyPerHour = this . config . get ( 'invoiceCurrencyPerHour' ) ;
2222 this . invoiceVAT = this . config . get ( 'invoiceVAT' ) ;
2323 this . invoicePositionText = this . config . get ( 'invoicePositionText' ) ;
24+ this . invoicePositionExtraText = this . config . get ( 'invoicePositionExtraText' ) ;
25+ this . invoicePositionExtraValue = parseFloat ( this . config . get ( 'invoicePositionExtraValue' ) ) ;
26+ if ( ! this . invoicePositionExtraValue > 0 ) {
27+ this . invoicePositionExtraValue = 0.0 ;
28+ }
2429 this . invoiceCurrencyMaxUnit = this . config . get ( 'invoiceCurrencyMaxUnit' ) ;
25- this . totalhForInvoice = ( this . spent - this . spentFree ) / 3600.0 ;
30+ this . totalhForInvoice = ( this . spent - this . spentFree - ( this . spentHalfPrice * 0.5 ) ) / 3600.0 ;
2631 // round subtotals to 0.01 and total to invoiceCurrencyMaxUnit.
27- this . totalForInvoiceExkl = Math . round ( this . totalhForInvoice * this . invoiceCurrencyPerHour * 100 ) * 0.01 ;
28- this . totalForInvoiceMwst = Math . round ( this . totalhForInvoice * this . invoiceCurrencyPerHour * this . invoiceVAT * 100 ) * 0.01 ;
32+ let invoiceTotal = this . totalhForInvoice * this . invoiceCurrencyPerHour + this . invoicePositionExtraValue ;
33+ this . totalForInvoiceH = Math . round ( this . totalhForInvoice * this . invoiceCurrencyPerHour * 100 ) * 0.01 ;
34+ this . totalForInvoiceExkl = Math . round ( invoiceTotal * 100 ) * 0.01 ;
35+ this . totalForInvoiceMwst = Math . round ( invoiceTotal * this . invoiceVAT * 100 ) * 0.01 ;
2936 this . totalForInvoice = Math . round ( ( this . totalForInvoiceExkl + this . totalForInvoiceMwst ) / this . invoiceCurrencyMaxUnit ) * this . invoiceCurrencyMaxUnit ;
3037 }
3138
@@ -124,6 +131,11 @@ class invoice extends Base {
124131 svg . instance . viewBox ( 0 , 0 , 740 , 420 )
125132 svg . instance . height ( "" ) ;
126133 svg . instance . width ( "" ) ;
134+ let extra = "" ;
135+ if ( this . invoicePositionExtraValue > 0 ) {
136+ extra = `<div class="positionDesc">${ this . invoicePositionExtraText } </div>
137+ <div class="positionValue">${ this . invoiceCurrency } ${ this . invoicePositionExtraValue . toFixed ( 2 ) } </div>` ;
138+ }
127139
128140 this . out +=
129141`<div class="senderBox">${ from } </div>
@@ -140,7 +152,8 @@ ${opening}
140152
141153<div class="positionBox">
142154<div class="positionDesc">${ this . invoicePositionText } (${ this . totalhForInvoice . toFixed ( 2 ) } Stunden zu ${ this . invoiceCurrencyPerHour } ${ this . invoiceCurrency } )</div>
143- <div class="positionValue">${ this . invoiceCurrency } ${ this . totalForInvoiceExkl . toFixed ( 2 ) } </div>
155+ <div class="positionValue">${ this . invoiceCurrency } ${ this . totalForInvoiceH . toFixed ( 2 ) } </div>
156+ ${ extra }
144157<div class="positionDesc">MWST (${ this . invoiceVAT * 100 } %)</div>
145158<div class="positionValue">${ this . invoiceCurrency } ${ this . totalForInvoiceMwst . toFixed ( 2 ) } </div>
146159<div class="positionDescTot">Rechnungsbetrag inkl. MWST</div>
0 commit comments