Fix amount formatting #1356

This commit is contained in:
Hillel Coren 2017-02-21 13:31:51 +02:00
parent d42fe69238
commit dba28c0ead
4 changed files with 21 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -462,7 +462,7 @@ NINJA.invoiceLines = function(invoice) {
}
if (!hideQuantity) {
row.push({style:["cost", rowStyle], text:cost});
row.push({style:["quantity", rowStyle], text:qty || ' '});
row.push({style:["quantity", rowStyle], text:formatAmount(qty, invoice.client.currency_id) || ' '});
}
if (showItemTaxes) {
var str = ' ';

View File

@ -63,6 +63,24 @@
return formatMoney(value, currencyId, countryId, decorator)
}
function formatAmount(value, currencyId) {
if (!currencyId) {
currencyId = {{ Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY) }};
}
var currency = currencyMap[currencyId];
var decimal = currency.decimal_separator;
value = NINJA.parseFloat(value) + '';
if (decimal == '.') {
return value;
} else {
return value.replace('.', decimal);
}
}
function formatMoney(value, currencyId, countryId, decorator) {
value = NINJA.parseFloat(value);