mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 13:04:30 -04:00
Corrected rounding issue if qty or cost had greater than 2 precision
This commit is contained in:
parent
e91c832cc2
commit
0ebf08c53d
@ -264,8 +264,8 @@ class InvoiceRepository
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$invoiceItemCost = Utils::parseFloat($item['cost']);
|
$invoiceItemCost = round(Utils::parseFloat($item['cost']), 2);
|
||||||
$invoiceItemQty = Utils::parseFloat($item['qty']);
|
$invoiceItemQty = round(Utils::parseFloat($item['qty']), 2);
|
||||||
$invoiceItemTaxRate = 0;
|
$invoiceItemTaxRate = 0;
|
||||||
|
|
||||||
if (isset($item['tax_rate']) && Utils::parseFloat($item['tax_rate']) > 0) {
|
if (isset($item['tax_rate']) && Utils::parseFloat($item['tax_rate']) > 0) {
|
||||||
|
@ -1517,8 +1517,8 @@
|
|||||||
this.totals = ko.observable();
|
this.totals = ko.observable();
|
||||||
|
|
||||||
this.totals.rawTotal = ko.computed(function() {
|
this.totals.rawTotal = ko.computed(function() {
|
||||||
var cost = NINJA.parseFloat(self.cost());
|
var cost = roundToTwo(NINJA.parseFloat(self.cost()));
|
||||||
var qty = NINJA.parseFloat(self.qty());
|
var qty = roundToTwo(NINJA.parseFloat(self.qty()));
|
||||||
var taxRate = NINJA.parseFloat(self.tax_rate());
|
var taxRate = NINJA.parseFloat(self.tax_rate());
|
||||||
var value = cost * qty;
|
var value = cost * qty;
|
||||||
if (taxRate > 0) {
|
if (taxRate > 0) {
|
||||||
|
@ -71,6 +71,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>{{ Button::success_submit(trans('texts.lets_go'), array('class' => 'btn-lg'))->block() }}</p>
|
<p>{{ Button::success_submit(trans('texts.lets_go'), array('class' => 'btn-lg'))->block() }}</p>
|
||||||
|
|
||||||
<p class="link">
|
<p class="link">
|
||||||
{{ link_to('forgot_password', trans('texts.forgot_password')) }}
|
{{ link_to('forgot_password', trans('texts.forgot_password')) }}
|
||||||
</p>
|
</p>
|
||||||
|
@ -32436,7 +32436,7 @@ function calculateAmounts(invoice) {
|
|||||||
tax = parseFloat(item.tax_rate);
|
tax = parseFloat(item.tax_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
var lineTotal = NINJA.parseFloat(item.cost) * NINJA.parseFloat(item.qty);
|
var lineTotal = roundToTwo(NINJA.parseFloat(item.cost)) * roundToTwo(NINJA.parseFloat(item.qty));
|
||||||
if (tax) {
|
if (tax) {
|
||||||
lineTotal += roundToTwo(lineTotal * tax / 100);
|
lineTotal += roundToTwo(lineTotal * tax / 100);
|
||||||
}
|
}
|
||||||
@ -32552,7 +32552,7 @@ function displayInvoiceItems(doc, invoice, layout) {
|
|||||||
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 cost = formatMoney(item.cost, currencyId, true);
|
var cost = formatMoney(item.cost, currencyId, true);
|
||||||
var qty = NINJA.parseFloat(item.qty) ? NINJA.parseFloat(item.qty) + '' : '';
|
var qty = NINJA.parseFloat(item.qty) ? roundToTwo(NINJA.parseFloat(item.qty)) + '' : '';
|
||||||
var notes = item.notes;
|
var notes = item.notes;
|
||||||
var productKey = item.product_key;
|
var productKey = item.product_key;
|
||||||
var tax = 0;
|
var tax = 0;
|
||||||
@ -32593,7 +32593,7 @@ function displayInvoiceItems(doc, invoice, layout) {
|
|||||||
productKey = processVariables(productKey);
|
productKey = processVariables(productKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
var lineTotal = NINJA.parseFloat(item.cost) * NINJA.parseFloat(item.qty);
|
var lineTotal = roundToTwo(NINJA.parseFloat(item.cost)) * roundToTwo(NINJA.parseFloat(item.qty));
|
||||||
if (tax) {
|
if (tax) {
|
||||||
lineTotal += lineTotal * tax / 100;
|
lineTotal += lineTotal * tax / 100;
|
||||||
}
|
}
|
||||||
|
@ -913,7 +913,7 @@ function calculateAmounts(invoice) {
|
|||||||
tax = parseFloat(item.tax_rate);
|
tax = parseFloat(item.tax_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
var lineTotal = NINJA.parseFloat(item.cost) * NINJA.parseFloat(item.qty);
|
var lineTotal = roundToTwo(NINJA.parseFloat(item.cost)) * roundToTwo(NINJA.parseFloat(item.qty));
|
||||||
if (tax) {
|
if (tax) {
|
||||||
lineTotal += roundToTwo(lineTotal * tax / 100);
|
lineTotal += roundToTwo(lineTotal * tax / 100);
|
||||||
}
|
}
|
||||||
@ -1029,7 +1029,7 @@ function displayInvoiceItems(doc, invoice, layout) {
|
|||||||
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 cost = formatMoney(item.cost, currencyId, true);
|
var cost = formatMoney(item.cost, currencyId, true);
|
||||||
var qty = NINJA.parseFloat(item.qty) ? NINJA.parseFloat(item.qty) + '' : '';
|
var qty = NINJA.parseFloat(item.qty) ? roundToTwo(NINJA.parseFloat(item.qty)) + '' : '';
|
||||||
var notes = item.notes;
|
var notes = item.notes;
|
||||||
var productKey = item.product_key;
|
var productKey = item.product_key;
|
||||||
var tax = 0;
|
var tax = 0;
|
||||||
@ -1070,7 +1070,7 @@ function displayInvoiceItems(doc, invoice, layout) {
|
|||||||
productKey = processVariables(productKey);
|
productKey = processVariables(productKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
var lineTotal = NINJA.parseFloat(item.cost) * NINJA.parseFloat(item.qty);
|
var lineTotal = roundToTwo(NINJA.parseFloat(item.cost)) * roundToTwo(NINJA.parseFloat(item.qty));
|
||||||
if (tax) {
|
if (tax) {
|
||||||
lineTotal += lineTotal * tax / 100;
|
lineTotal += lineTotal * tax / 100;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user