mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Support higher precision for unit cost and quantity
This commit is contained in:
parent
7a4a5d51f3
commit
db714a17ac
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -495,7 +495,7 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
|
|||||||
var row = [];
|
var row = [];
|
||||||
var item = invoice.invoice_items[i];
|
var item = invoice.invoice_items[i];
|
||||||
var cost = formatMoneyInvoice(item.cost, invoice, 'none', getPrecision(item.cost));
|
var cost = formatMoneyInvoice(item.cost, invoice, 'none', getPrecision(item.cost));
|
||||||
var qty = NINJA.parseFloat(item.qty) ? roundToTwo(NINJA.parseFloat(item.qty)) + '' : '';
|
var qty = NINJA.parseFloat(item.qty) ? roundSignificant(NINJA.parseFloat(item.qty)) + '' : '';
|
||||||
var notes = item.notes;
|
var notes = item.notes;
|
||||||
var productKey = item.product_key;
|
var productKey = item.product_key;
|
||||||
var tax1 = '';
|
var tax1 = '';
|
||||||
@ -565,7 +565,7 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
|
|||||||
}
|
}
|
||||||
if (!hideQuantity) {
|
if (!hideQuantity) {
|
||||||
row.push({style:["cost", rowStyle], text:cost});
|
row.push({style:["cost", rowStyle], text:cost});
|
||||||
row.push({style:["quantity", rowStyle], text:formatAmount(qty, invoice.client.currency_id) || ' '});
|
row.push({style:["quantity", rowStyle], text:formatAmount(qty, invoice.client.currency_id, getPrecision(qty)) || ' '});
|
||||||
}
|
}
|
||||||
if (showItemTaxes) {
|
if (showItemTaxes) {
|
||||||
var str = ' ';
|
var str = ' ';
|
||||||
|
@ -63,16 +63,23 @@
|
|||||||
return formatMoney(value, currencyId, countryId, decorator, precision)
|
return formatMoney(value, currencyId, countryId, decorator, precision)
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatAmount(value, currencyId) {
|
function formatAmount(value, currencyId, precision) {
|
||||||
|
if (!value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
if (!currencyId) {
|
if (!currencyId) {
|
||||||
currencyId = {{ Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY) }};
|
currencyId = {{ Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY) }};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!precision) {
|
||||||
|
precision = 2;
|
||||||
|
}
|
||||||
|
|
||||||
var currency = currencyMap[currencyId];
|
var currency = currencyMap[currencyId];
|
||||||
var decimal = currency.decimal_separator;
|
var decimal = currency.decimal_separator;
|
||||||
|
|
||||||
value = NINJA.parseFloat(value) + '';
|
value = roundToPrecision(NINJA.parseFloat(value), precision) + '';
|
||||||
|
|
||||||
if (decimal == '.') {
|
if (decimal == '.') {
|
||||||
return value;
|
return value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user