mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 17:14:28 -04:00
Bug fixes
This commit is contained in:
parent
3688669963
commit
04679b41ce
@ -1504,7 +1504,7 @@
|
||||
for (var i=0; i<model.invoice().invoice_items().length; i++) {
|
||||
var item = model.invoice().invoice_items()[i];
|
||||
item.tax(model.getTaxRate(item.tax_name(), item.tax_rate()));
|
||||
item.cost(NINJA.parseFloat(item.cost()) > 0 ? formatMoney(item.cost(), model.invoice().client().currency_id(), true) : '');
|
||||
item.cost(NINJA.parseFloat(item.cost()) > 0 ? roundToTwo(item.cost(), true) : '');
|
||||
}
|
||||
onTaxRateChange();
|
||||
|
||||
|
@ -39226,7 +39226,7 @@ function calculateAmounts(invoice) {
|
||||
total = parseFloat(total) + parseFloat(tax);
|
||||
}
|
||||
|
||||
invoice.balance_amount = roundToTwo(total) - roundToTwo(invoice.amount) - roundToTwo(invoice.balance);
|
||||
invoice.balance_amount = roundToTwo(total) - (roundToTwo(invoice.amount) - roundToTwo(invoice.balance));
|
||||
invoice.tax_amount = tax;
|
||||
invoice.discount_amount = discount;
|
||||
invoice.has_taxes = hasTaxes;
|
||||
@ -39463,6 +39463,7 @@ function toggleDatePicker(field) {
|
||||
$('#'+field).datepicker('show');
|
||||
}
|
||||
|
||||
function roundToTwo(num) {
|
||||
return +(Math.round(num + "e+2") + "e-2");
|
||||
function roundToTwo(num, toString) {
|
||||
var val = +(Math.round(num + "e+2") + "e-2");
|
||||
return toString ? val.toFixed(2) : val;
|
||||
}
|
||||
|
@ -1510,7 +1510,7 @@ function calculateAmounts(invoice) {
|
||||
total = parseFloat(total) + parseFloat(tax);
|
||||
}
|
||||
|
||||
invoice.balance_amount = roundToTwo(total) - roundToTwo(invoice.amount) - roundToTwo(invoice.balance);
|
||||
invoice.balance_amount = roundToTwo(total) - (roundToTwo(invoice.amount) - roundToTwo(invoice.balance));
|
||||
invoice.tax_amount = tax;
|
||||
invoice.discount_amount = discount;
|
||||
invoice.has_taxes = hasTaxes;
|
||||
@ -1747,6 +1747,7 @@ function toggleDatePicker(field) {
|
||||
$('#'+field).datepicker('show');
|
||||
}
|
||||
|
||||
function roundToTwo(num) {
|
||||
return +(Math.round(num + "e+2") + "e-2");
|
||||
function roundToTwo(num, toString) {
|
||||
var val = +(Math.round(num + "e+2") + "e-2");
|
||||
return toString ? val.toFixed(2) : val;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user