1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Fix rounding

This commit is contained in:
Hillel Coren 2017-11-01 13:50:31 +02:00
parent ceeb642995
commit f1b883b54b
2 changed files with 3 additions and 5 deletions

View File

@ -670,7 +670,7 @@ function calculateAmounts(invoice) {
// sum line item
for (var i=0; i<invoice.invoice_items.length; i++) {
var item = invoice.invoice_items[i];
var lineTotal = invoice.is_statement ? roundToTwo(NINJA.parseFloat(item.balance)) : roundSignificant(NINJA.parseFloat(item.cost)) * roundSignificant(NINJA.parseFloat(item.qty));
var lineTotal = invoice.is_statement ? roundToTwo(NINJA.parseFloat(item.balance)) : roundSignificant(NINJA.parseFloat(item.cost) * NINJA.parseFloat(item.qty));
lineTotal = roundToTwo(lineTotal);
if (lineTotal) {
total += lineTotal;
@ -717,7 +717,7 @@ function calculateAmounts(invoice) {
}
// calculate line item tax
var lineTotal = roundToFour(NINJA.parseFloat(item.cost)) * roundToFour(NINJA.parseFloat(item.qty));
var lineTotal = roundSignificant(NINJA.parseFloat(item.cost) * NINJA.parseFloat(item.qty));
if (invoice.discount != 0) {
if (parseInt(invoice.is_amount_discount)) {
lineTotal -= roundToTwo((lineTotal/total) * invoice.discount);

View File

@ -879,9 +879,7 @@ function ItemModel(data) {
this.totals = ko.observable();
this.totals.rawTotal = ko.computed(function() {
var cost = roundSignificant(NINJA.parseFloat(self.cost()));
var qty = roundSignificant(NINJA.parseFloat(self.qty()));
var value = cost * qty;
var value = roundSignificant(NINJA.parseFloat(self.cost()) * NINJA.parseFloat(self.qty()));
return value ? roundToTwo(value) : 0;
});