mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 13:24:30 -04:00
If product key is blank remove column from PDF
This commit is contained in:
parent
f2d7a01f94
commit
1c47f4e03f
@ -30461,6 +30461,7 @@ function calculateAmounts(invoice) {
|
||||
var total = 0;
|
||||
var hasTaxes = false;
|
||||
var taxes = {};
|
||||
invoice.has_product_key = false;
|
||||
|
||||
// sum line item
|
||||
for (var i=0; i<invoice.invoice_items.length; i++) {
|
||||
@ -30476,6 +30477,12 @@ function calculateAmounts(invoice) {
|
||||
var taxRate = 0;
|
||||
var taxName = '';
|
||||
|
||||
if (item.product_key) {
|
||||
invoice.has_product_key = true;
|
||||
} else if (invoice.invoice_items.length == 1 && !item.qty) {
|
||||
invoice.has_product_key = true;
|
||||
}
|
||||
|
||||
// the object structure differs if it's read from the db or created by knockoutJS
|
||||
if (item.tax && parseFloat(item.tax.rate)) {
|
||||
taxRate = parseFloat(item.tax.rate);
|
||||
@ -31201,7 +31208,14 @@ NINJA.notesAndTerms = function(invoice)
|
||||
NINJA.invoiceColumns = function(invoice)
|
||||
{
|
||||
var account = invoice.account;
|
||||
var columns = ["15%", "*"];
|
||||
var columns = [];
|
||||
|
||||
if (invoice.has_product_key) {
|
||||
columns.push("15%");
|
||||
}
|
||||
|
||||
columns.push("*")
|
||||
|
||||
var count = 3;
|
||||
if (account.hide_quantity == '1') {
|
||||
count--;
|
||||
@ -31240,11 +31254,14 @@ NINJA.invoiceLines = function(invoice) {
|
||||
var hideQuantity = invoice.account.hide_quantity == '1';
|
||||
var showItemTaxes = invoice.account.show_item_taxes == '1';
|
||||
|
||||
var grid = [[
|
||||
{text: invoiceLabels.item, style: ['tableHeader', 'itemTableHeader']},
|
||||
{text: invoiceLabels.description, style: ['tableHeader', 'descriptionTableHeader']},
|
||||
{text: invoiceLabels.unit_cost, style: ['tableHeader', 'costTableHeader']}
|
||||
]];
|
||||
var grid = [[]];
|
||||
|
||||
if (invoice.has_product_key) {
|
||||
grid[0].push({text: invoiceLabels.item, style: ['tableHeader', 'itemTableHeader']});
|
||||
}
|
||||
|
||||
grid[0].push({text: invoiceLabels.description, style: ['tableHeader', 'descriptionTableHeader']});
|
||||
grid[0].push({text: invoiceLabels.unit_cost, style: ['tableHeader', 'costTableHeader']});
|
||||
|
||||
if (!hideQuantity) {
|
||||
grid[0].push({text: invoiceLabels.quantity, style: ['tableHeader', 'qtyTableHeader']});
|
||||
@ -31291,7 +31308,9 @@ NINJA.invoiceLines = function(invoice) {
|
||||
|
||||
rowStyle = (i % 2 == 0) ? 'odd' : 'even';
|
||||
|
||||
if (invoice.has_product_key) {
|
||||
row.push({style:["productKey", rowStyle], text:productKey || ' '}); // product key can be blank when selecting from a datalist
|
||||
}
|
||||
row.push({style:["notes", rowStyle], stack:[{text:notes || ' '}]});
|
||||
row.push({style:["cost", rowStyle], text:cost});
|
||||
if (!hideQuantity) {
|
||||
|
@ -259,7 +259,14 @@ NINJA.notesAndTerms = function(invoice)
|
||||
NINJA.invoiceColumns = function(invoice)
|
||||
{
|
||||
var account = invoice.account;
|
||||
var columns = ["15%", "*"];
|
||||
var columns = [];
|
||||
|
||||
if (invoice.has_product_key) {
|
||||
columns.push("15%");
|
||||
}
|
||||
|
||||
columns.push("*")
|
||||
|
||||
var count = 3;
|
||||
if (account.hide_quantity == '1') {
|
||||
count--;
|
||||
@ -298,11 +305,14 @@ NINJA.invoiceLines = function(invoice) {
|
||||
var hideQuantity = invoice.account.hide_quantity == '1';
|
||||
var showItemTaxes = invoice.account.show_item_taxes == '1';
|
||||
|
||||
var grid = [[
|
||||
{text: invoiceLabels.item, style: ['tableHeader', 'itemTableHeader']},
|
||||
{text: invoiceLabels.description, style: ['tableHeader', 'descriptionTableHeader']},
|
||||
{text: invoiceLabels.unit_cost, style: ['tableHeader', 'costTableHeader']}
|
||||
]];
|
||||
var grid = [[]];
|
||||
|
||||
if (invoice.has_product_key) {
|
||||
grid[0].push({text: invoiceLabels.item, style: ['tableHeader', 'itemTableHeader']});
|
||||
}
|
||||
|
||||
grid[0].push({text: invoiceLabels.description, style: ['tableHeader', 'descriptionTableHeader']});
|
||||
grid[0].push({text: invoiceLabels.unit_cost, style: ['tableHeader', 'costTableHeader']});
|
||||
|
||||
if (!hideQuantity) {
|
||||
grid[0].push({text: invoiceLabels.quantity, style: ['tableHeader', 'qtyTableHeader']});
|
||||
@ -349,7 +359,9 @@ NINJA.invoiceLines = function(invoice) {
|
||||
|
||||
rowStyle = (i % 2 == 0) ? 'odd' : 'even';
|
||||
|
||||
if (invoice.has_product_key) {
|
||||
row.push({style:["productKey", rowStyle], text:productKey || ' '}); // product key can be blank when selecting from a datalist
|
||||
}
|
||||
row.push({style:["notes", rowStyle], stack:[{text:notes || ' '}]});
|
||||
row.push({style:["cost", rowStyle], text:cost});
|
||||
if (!hideQuantity) {
|
||||
|
@ -589,6 +589,7 @@ function calculateAmounts(invoice) {
|
||||
var total = 0;
|
||||
var hasTaxes = false;
|
||||
var taxes = {};
|
||||
invoice.has_product_key = false;
|
||||
|
||||
// sum line item
|
||||
for (var i=0; i<invoice.invoice_items.length; i++) {
|
||||
@ -604,6 +605,12 @@ function calculateAmounts(invoice) {
|
||||
var taxRate = 0;
|
||||
var taxName = '';
|
||||
|
||||
if (item.product_key) {
|
||||
invoice.has_product_key = true;
|
||||
} else if (invoice.invoice_items.length == 1 && !item.qty) {
|
||||
invoice.has_product_key = true;
|
||||
}
|
||||
|
||||
// the object structure differs if it's read from the db or created by knockoutJS
|
||||
if (item.tax && parseFloat(item.tax.rate)) {
|
||||
taxRate = parseFloat(item.tax.rate);
|
||||
|
Loading…
x
Reference in New Issue
Block a user