Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
round subtotals to 0.01
  • Loading branch information
Andreas Müller committed Dec 28, 2021
commit 9413958e1998875a4bb5876ec346094d067c5e0f
9 changes: 4 additions & 5 deletions src/output/invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ class invoice extends Base {
this.invoiceVAT = this.config.get('invoiceVAT');
this.invoiceCurrencyMaxUnit = this.config.get('invoiceCurrencyMaxUnit');
this.totalhForInvoice = (this.spent-this.spentFree) / 3600.0;
this.totalForInvoiceExkl = this.totalhForInvoice * this.invoiceCurrencyPerHour;
this.totalForInvoiceMwst = this.totalForInvoiceExkl * this.invoiceVAT;
this.totalForInvoice = this.totalForInvoiceExkl + this.totalForInvoiceMwst;
// round
this.totalForInvoice = Math.round(this.totalForInvoice/this.invoiceCurrencyMaxUnit)*this.invoiceCurrencyMaxUnit;
// round subtotals to 0.01 and total to invoiceCurrencyMaxUnit.
this.totalForInvoiceExkl = Math.round(this.totalhForInvoice * this.invoiceCurrencyPerHour * 100) * 0.01;
this.totalForInvoiceMwst = Math.round(this.totalhForInvoice * this.invoiceCurrencyPerHour * this.invoiceVAT * 100) * 0.01;
this.totalForInvoice = Math.round((this.totalForInvoiceExkl + this.totalForInvoiceMwst)/this.invoiceCurrencyMaxUnit)*this.invoiceCurrencyMaxUnit;
}


Expand Down