1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Work on product fields

This commit is contained in:
Hillel Coren 2017-10-30 11:56:10 +02:00
parent 509a59d5d4
commit 5e7f6a029b

View File

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