Working on product fields

This commit is contained in:
Hillel Coren 2017-10-29 23:08:56 +02:00
parent ccd1b8afde
commit 8c22ce5f5c
5 changed files with 32 additions and 50 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

@ -460,7 +460,7 @@ NINJA.invoiceColumns = function(invoice, design, isTasks)
columns.push(width)
}
console.log(columns);
//console.log(columns);
return columns;
}
@ -556,8 +556,6 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
}
} else if (field == 'tax' && ! invoice.has_item_taxes) {
continue;
} else if (field == 'product_key' && ! invoice.has_product_key) {
continue;
} else if (field == 'unit_cost' || field == 'rate' || field == 'hours') {
headerStyles.push('cost');
}
@ -644,8 +642,6 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
continue;
} else if (field == 'tax' && ! invoice.has_item_taxes) {
continue;
} else if (field == 'product_key' && ! invoice.has_product_key) {
continue;
}
if (field == 'item' || field == 'service') {
@ -654,10 +650,10 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
} else if (field == 'description') {
value = item.notes;
} else if (field == 'unit_cost' || field == 'rate') {
value = item.cost;
value = cost;
styles.push('cost');
} else if (field == 'quantity' || field == 'hours') {
value = formatAmount(item.qty, invoice.client.currency_id, getPrecision(item.qty));
value = qty;
if (field == 'hours') {
styles.push('cost');
}
@ -688,7 +684,7 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
grid.push(row);
}
console.log(JSON.stringify(grid));
//console.log(JSON.stringify(grid));
return NINJA.prepareDataTable(grid, 'invoiceItems');
}

View File

@ -672,15 +672,9 @@ function calculateAmounts(invoice) {
var total = 0;
var hasTaxes = false;
var taxes = {};
invoice.has_product_key = false;
invoice.has_custom_item_value1 = false;
invoice.has_custom_item_value2 = false;
// Bold designs currently breaks w/o the product column
if (invoice.invoice_design_id == 2) {
invoice.has_product_key = true;
}
var hasStandard = false;
var hasTask = false;
@ -713,12 +707,6 @@ function calculateAmounts(invoice) {
var taxRate2 = 0;
var taxName2 = '';
if (item.product_key) {
invoice.has_product_key = true;
} else if (invoice.invoice_items.length == 1 && !item.qty) {
invoice.has_product_key = true;
}
if (invoice.features.invoice_settings) {
if (item.custom_value1) {
invoice.has_custom_item_value1 = true;

View File

@ -107,9 +107,8 @@
var needsRefresh = false;
function refreshPDF(force) {
//try {
try {
return getPDFString(refreshPDFCB, force);
/*
} catch (exception) {
@if (Utils::isTravis())
var message = exception.message || '';
@ -131,7 +130,6 @@
}
@endif
}
*/
}
function refreshPDFCB(string) {