mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-31 15:42:03 -04:00
Fix rounding
This commit is contained in:
parent
ceeb642995
commit
f1b883b54b
@ -670,7 +670,7 @@ function calculateAmounts(invoice) {
|
|||||||
// sum line item
|
// sum line item
|
||||||
for (var i=0; i<invoice.invoice_items.length; i++) {
|
for (var i=0; i<invoice.invoice_items.length; i++) {
|
||||||
var item = invoice.invoice_items[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);
|
lineTotal = roundToTwo(lineTotal);
|
||||||
if (lineTotal) {
|
if (lineTotal) {
|
||||||
total += lineTotal;
|
total += lineTotal;
|
||||||
@ -717,7 +717,7 @@ function calculateAmounts(invoice) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// calculate line item tax
|
// 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 (invoice.discount != 0) {
|
||||||
if (parseInt(invoice.is_amount_discount)) {
|
if (parseInt(invoice.is_amount_discount)) {
|
||||||
lineTotal -= roundToTwo((lineTotal/total) * invoice.discount);
|
lineTotal -= roundToTwo((lineTotal/total) * invoice.discount);
|
||||||
|
@ -879,9 +879,7 @@ function ItemModel(data) {
|
|||||||
this.totals = ko.observable();
|
this.totals = ko.observable();
|
||||||
|
|
||||||
this.totals.rawTotal = ko.computed(function() {
|
this.totals.rawTotal = ko.computed(function() {
|
||||||
var cost = roundSignificant(NINJA.parseFloat(self.cost()));
|
var value = roundSignificant(NINJA.parseFloat(self.cost()) * NINJA.parseFloat(self.qty()));
|
||||||
var qty = roundSignificant(NINJA.parseFloat(self.qty()));
|
|
||||||
var value = cost * qty;
|
|
||||||
return value ? roundToTwo(value) : 0;
|
return value ? roundToTwo(value) : 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user