From 8bc3d6c93756f73724663995aa72f7c4a7c6e726 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 20 Jul 2016 20:48:56 +0300 Subject: [PATCH] Ensure 0% taxes are shown --- resources/assets/js/pdfmake-ninja.js | 4 ++-- resources/assets/js/script.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/assets/js/pdfmake-ninja.js b/resources/assets/js/pdfmake-ninja.js index 4da7a5d56675..1af1cf482560 100644 --- a/resources/assets/js/pdfmake-ninja.js +++ b/resources/assets/js/pdfmake-ninja.js @@ -502,11 +502,11 @@ NINJA.subtotals = function(invoice, hideBalance) } } - if (invoice.tax_amount1) { + if (invoice.tax_name1) { 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 (invoice.tax_amount2) { + if (invoice.tax_name2) { 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']}]); } diff --git a/resources/assets/js/script.js b/resources/assets/js/script.js index 348df2c05fe5..aab4531977c0 100644 --- a/resources/assets/js/script.js +++ b/resources/assets/js/script.js @@ -651,12 +651,12 @@ function calculateAmounts(invoice) { invoice.has_product_key = true; } - if (item.tax_rate1 && parseFloat(item.tax_rate1)) { + if (item.tax_name1) { taxRate1 = parseFloat(item.tax_rate1); taxName1 = item.tax_name1; } - if (item.tax_rate2 && parseFloat(item.tax_rate2)) { + if (item.tax_name2) { taxRate2 = parseFloat(item.tax_rate2); taxName2 = item.tax_name2; } @@ -672,7 +672,7 @@ function calculateAmounts(invoice) { } var taxAmount1 = roundToTwo(lineTotal * taxRate1 / 100); - if (taxAmount1) { + if (taxName1) { var key = taxName1 + taxRate1; if (taxes.hasOwnProperty(key)) { taxes[key].amount += taxAmount1; @@ -682,7 +682,7 @@ function calculateAmounts(invoice) { } var taxAmount2 = roundToTwo(lineTotal * taxRate2 / 100); - if (taxAmount2) { + if (taxName2) { var key = taxName2 + taxRate2; if (taxes.hasOwnProperty(key)) { taxes[key].amount += taxAmount2;