mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Fix rounding
This commit is contained in:
parent
ceeb642995
commit
f1b883b54b
@ -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);
|
||||
|
@ -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;
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user