Show zero rate taxes on PDF

This commit is contained in:
Hillel Coren 2017-10-18 12:19:10 +03:00
parent bc8e21153d
commit f34cc7ef4e
4 changed files with 12 additions and 12 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

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

View File

@ -729,12 +729,12 @@ function calculateAmounts(invoice) {
} }
} }
if (parseFloat(item.tax_rate1) != 0) { if (parseFloat(item.tax_rate1) != 0 || item.tax_name1) {
taxRate1 = parseFloat(item.tax_rate1); taxRate1 = parseFloat(item.tax_rate1);
taxName1 = item.tax_name1; taxName1 = item.tax_name1;
} }
if (parseFloat(item.tax_rate2) != 0) { if (parseFloat(item.tax_rate2) != 0 || item.tax_name2) {
taxRate2 = parseFloat(item.tax_rate2); taxRate2 = parseFloat(item.tax_rate2);
taxName2 = item.tax_name2; taxName2 = item.tax_name2;
} }
@ -750,7 +750,7 @@ function calculateAmounts(invoice) {
} }
var taxAmount1 = roundToTwo(lineTotal * taxRate1 / 100); var taxAmount1 = roundToTwo(lineTotal * taxRate1 / 100);
if (taxAmount1 != 0) { if (taxAmount1 != 0 || taxName1) {
var key = taxName1 + taxRate1; var key = taxName1 + taxRate1;
if (taxes.hasOwnProperty(key)) { if (taxes.hasOwnProperty(key)) {
taxes[key].amount += taxAmount1; taxes[key].amount += taxAmount1;
@ -760,7 +760,7 @@ function calculateAmounts(invoice) {
} }
var taxAmount2 = roundToTwo(lineTotal * taxRate2 / 100); var taxAmount2 = roundToTwo(lineTotal * taxRate2 / 100);
if (taxAmount2 != 0) { if (taxAmount2 != 0 || taxName2) {
var key = taxName2 + taxRate2; var key = taxName2 + taxRate2;
if (taxes.hasOwnProperty(key)) { if (taxes.hasOwnProperty(key)) {
taxes[key].amount += taxAmount2; taxes[key].amount += taxAmount2;