mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on product fields
This commit is contained in:
parent
ccd1b8afde
commit
8c22ce5f5c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,15 +672,9 @@ function calculateAmounts(invoice) {
|
|||||||
var total = 0;
|
var total = 0;
|
||||||
var hasTaxes = false;
|
var hasTaxes = false;
|
||||||
var taxes = {};
|
var taxes = {};
|
||||||
invoice.has_product_key = false;
|
|
||||||
invoice.has_custom_item_value1 = false;
|
invoice.has_custom_item_value1 = false;
|
||||||
invoice.has_custom_item_value2 = 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 hasStandard = false;
|
||||||
var hasTask = false;
|
var hasTask = false;
|
||||||
|
|
||||||
@ -713,12 +707,6 @@ function calculateAmounts(invoice) {
|
|||||||
var taxRate2 = 0;
|
var taxRate2 = 0;
|
||||||
var taxName2 = '';
|
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 (invoice.features.invoice_settings) {
|
||||||
if (item.custom_value1) {
|
if (item.custom_value1) {
|
||||||
invoice.has_custom_item_value1 = true;
|
invoice.has_custom_item_value1 = true;
|
||||||
|
@ -107,9 +107,8 @@
|
|||||||
var needsRefresh = false;
|
var needsRefresh = false;
|
||||||
|
|
||||||
function refreshPDF(force) {
|
function refreshPDF(force) {
|
||||||
//try {
|
try {
|
||||||
return getPDFString(refreshPDFCB, force);
|
return getPDFString(refreshPDFCB, force);
|
||||||
/*
|
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
@if (Utils::isTravis())
|
@if (Utils::isTravis())
|
||||||
var message = exception.message || '';
|
var message = exception.message || '';
|
||||||
@ -131,7 +130,6 @@
|
|||||||
}
|
}
|
||||||
@endif
|
@endif
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshPDFCB(string) {
|
function refreshPDFCB(string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user