mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Support statement in additional designs
This commit is contained in:
parent
cb14c8d851
commit
deda434322
@ -213,6 +213,9 @@ trait PresentsInvoice
|
|||||||
'tax_quote',
|
'tax_quote',
|
||||||
'statement',
|
'statement',
|
||||||
'statement_date',
|
'statement_date',
|
||||||
|
'your_statement',
|
||||||
|
'statement_issued_to',
|
||||||
|
'statement_to',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -170,7 +170,7 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
|||||||
'notesAndTerms': NINJA.notesAndTerms(invoice),
|
'notesAndTerms': NINJA.notesAndTerms(invoice),
|
||||||
'subtotals': invoice.is_statement ? NINJA.statementSubtotals(invoice) : NINJA.subtotals(invoice),
|
'subtotals': invoice.is_statement ? NINJA.statementSubtotals(invoice) : NINJA.subtotals(invoice),
|
||||||
'subtotalsHeight': (NINJA.subtotals(invoice).length * 16) + 16,
|
'subtotalsHeight': (NINJA.subtotals(invoice).length * 16) + 16,
|
||||||
'subtotalsWithoutBalance': NINJA.subtotals(invoice, true),
|
'subtotalsWithoutBalance': invoice.is_statement ? [[]] : NINJA.subtotals(invoice, true),
|
||||||
'subtotalsBalance': NINJA.subtotalsBalance(invoice),
|
'subtotalsBalance': NINJA.subtotalsBalance(invoice),
|
||||||
'balanceDue': formatMoneyInvoice(invoice.balance_amount, invoice),
|
'balanceDue': formatMoneyInvoice(invoice.balance_amount, invoice),
|
||||||
'invoiceFooter': NINJA.invoiceFooter(invoice),
|
'invoiceFooter': NINJA.invoiceFooter(invoice),
|
||||||
@ -219,6 +219,15 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
|||||||
field = field.replace('invoice', 'quote');
|
field = field.replace('invoice', 'quote');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (invoice.is_statement) {
|
||||||
|
if (field == 'your_invoice') {
|
||||||
|
field = 'your_statement';
|
||||||
|
} else if (field == 'invoice_issued_to') {
|
||||||
|
field = 'statement_issued_to';
|
||||||
|
} else if (field == 'invoice_to') {
|
||||||
|
field = 'statement_to';
|
||||||
|
}
|
||||||
|
}
|
||||||
var label = invoiceLabels[field];
|
var label = invoiceLabels[field];
|
||||||
if (match.indexOf('UC') >= 0) {
|
if (match.indexOf('UC') >= 0) {
|
||||||
label = label.toUpperCase();
|
label = label.toUpperCase();
|
||||||
@ -289,7 +298,7 @@ NINJA.statementColumns = function(invoice)
|
|||||||
NINJA.statementLines = function(invoice)
|
NINJA.statementLines = function(invoice)
|
||||||
{
|
{
|
||||||
var grid = [[]];
|
var grid = [[]];
|
||||||
grid[0].push({text: invoiceLabels.invoice_number, style: ['tableHeader', 'invoiceNumberTableHeader']});
|
grid[0].push({text: invoiceLabels.invoice_number, style: ['tableHeader', 'itemTableHeader']});
|
||||||
grid[0].push({text: invoiceLabels.invoice_date, style: ['tableHeader', 'invoiceDateTableHeader']});
|
grid[0].push({text: invoiceLabels.invoice_date, style: ['tableHeader', 'invoiceDateTableHeader']});
|
||||||
grid[0].push({text: invoiceLabels.due_date, style: ['tableHeader', 'dueDateTableHeader']});
|
grid[0].push({text: invoiceLabels.due_date, style: ['tableHeader', 'dueDateTableHeader']});
|
||||||
grid[0].push({text: invoiceLabels.total, style: ['tableHeader', 'totalTableHeader']});
|
grid[0].push({text: invoiceLabels.total, style: ['tableHeader', 'totalTableHeader']});
|
||||||
@ -298,12 +307,13 @@ NINJA.statementLines = function(invoice)
|
|||||||
for (var i = 0; i < invoice.invoice_items.length; i++) {
|
for (var i = 0; i < invoice.invoice_items.length; i++) {
|
||||||
var item = invoice.invoice_items[i];
|
var item = invoice.invoice_items[i];
|
||||||
var row = [];
|
var row = [];
|
||||||
|
var rowStyle = (i % 2 == 0) ? 'odd' : 'even';
|
||||||
grid.push([
|
grid.push([
|
||||||
{text: item.invoice_number, style:['invoiceNumber']},
|
{text: item.invoice_number, style:['invoiceNumber', 'productKey', rowStyle]},
|
||||||
{text: item.invoice_date && item.invoice_date != '0000-00-00' ? moment(item.invoice_date).format(invoice.date_format) : ' ', style:['invoiceDate']},
|
{text: item.invoice_date && item.invoice_date != '0000-00-00' ? moment(item.invoice_date).format(invoice.date_format) : ' ', style:['invoiceDate', rowStyle]},
|
||||||
{text: item.due_date && item.due_date != '0000-00-00' ? moment(item.due_date).format(invoice.date_format) : ' ', style:['dueDate']},
|
{text: item.due_date && item.due_date != '0000-00-00' ? moment(item.due_date).format(invoice.date_format) : ' ', style:['dueDate', rowStyle]},
|
||||||
{text: formatMoneyInvoice(item.amount, invoice), style:['subtotals']},
|
{text: formatMoneyInvoice(item.amount, invoice), style:['subtotals', rowStyle]},
|
||||||
{text: formatMoneyInvoice(item.balance, invoice), style:['lineTotal']},
|
{text: formatMoneyInvoice(item.balance, invoice), style:['lineTotal', rowStyle]},
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2381,6 +2381,9 @@ $LANG = array(
|
|||||||
'profile' => 'Profile',
|
'profile' => 'Profile',
|
||||||
'payment_type_help' => 'Sets the default <b>payment type</b>.',
|
'payment_type_help' => 'Sets the default <b>payment type</b>.',
|
||||||
'industry_Construction' => 'Construction',
|
'industry_Construction' => 'Construction',
|
||||||
|
'your_statement' => 'Your Statement',
|
||||||
|
'statement_issued_to' => 'Statement issued to',
|
||||||
|
'statement_to' => 'Statement to',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -26,14 +26,15 @@
|
|||||||
invoice_settings:{{ Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS) ? 'true' : 'false' }}
|
invoice_settings:{{ Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS) ? 'true' : 'false' }}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
var invoiceDesignId = parseInt(invoice.invoice_design_id);
|
var invoiceDesignId = parseInt(invoice.invoice_design_id);
|
||||||
|
// We don't currently support the hipster design to be used as a statement
|
||||||
|
if (invoiceDesignId == 8) {
|
||||||
|
invoiceDesignId = 1;
|
||||||
|
}
|
||||||
var invoiceDesign = _.findWhere(invoiceDesigns, {id: invoiceDesignId});
|
var invoiceDesign = _.findWhere(invoiceDesigns, {id: invoiceDesignId});
|
||||||
if (!invoiceDesign) {
|
if (!invoiceDesign) {
|
||||||
invoiceDesign = invoiceDesigns[0];
|
invoiceDesign = invoiceDesigns[0];
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
var invoiceDesign = invoiceDesigns[0];
|
|
||||||
|
|
||||||
generatePDF(invoice, invoiceDesign.javascript, true, cb);
|
generatePDF(invoice, invoiceDesign.javascript, true, cb);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user