1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Fix: NaN% taxes on PDF

This commit is contained in:
Hillel Coren 2017-08-11 13:56:00 +03:00
parent a6635c2ffb
commit f7d0ef71ec
4 changed files with 7 additions and 7 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

@ -675,11 +675,11 @@ NINJA.subtotals = function(invoice, hideBalance)
}
}
if (parseFloat(invoice.tax_rate1) != 0) {
if (parseFloat(invoice.tax_rate1 || 0) != 0) {
var taxStr = invoice.tax_name1 + ' ' + (invoice.tax_rate1*1).toString() + '%';
data.push([{text: taxStr, style: ['subtotalsLabel', 'tax1Label']}, {text: formatMoneyInvoice(invoice.tax_amount1, invoice), style: ['subtotals', 'tax1']}]);
}
if (parseFloat(invoice.tax_rate2) != 0) {
if (parseFloat(invoice.tax_rate2 || 0) != 0) {
var taxStr = invoice.tax_name2 + ' ' + (invoice.tax_rate2*1).toString() + '%';
data.push([{text: taxStr, style: ['subtotalsLabel', 'tax2Label']}, {text: formatMoneyInvoice(invoice.tax_amount2, invoice), style: ['subtotals', 'tax2']}]);
}

View File

@ -764,10 +764,10 @@ function calculateAmounts(invoice) {
taxRate1 = 0;
taxRate2 = 0;
if (parseFloat(invoice.tax_rate1) != 0) {
if (parseFloat(invoice.tax_rate1 || 0) != 0) {
taxRate1 = parseFloat(invoice.tax_rate1);
}
if (parseFloat(invoice.tax_rate2) != 0) {
if (parseFloat(invoice.tax_rate2 || 0) != 0) {
taxRate2 = parseFloat(invoice.tax_rate2);
}
taxAmount1 = roundToTwo(total * taxRate1 / 100);