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

Add outstanding as optional invoice field

This commit is contained in:
Hillel Coren 2017-04-26 09:28:40 +03:00
parent b0d491ed7f
commit 801b80c767
5 changed files with 15 additions and 2 deletions

View File

@ -546,6 +546,7 @@ class AccountController extends BaseController
$client->postal_code = '10000';
$client->work_phone = '(212) 555-0000';
$client->work_email = 'sample@example.com';
$client->balance = 100;
$invoice->invoice_number = '0000';
$invoice->invoice_date = Utils::fromSqlDate(date('Y-m-d'));

View File

@ -95,6 +95,7 @@ trait PresentsInvoice
'invoice.invoice_total',
'invoice.balance_due',
'invoice.partial_due',
'invoice.outstanding',
'invoice.custom_text_value1',
'invoice.custom_text_value2',
'.blank',
@ -237,6 +238,7 @@ trait PresentsInvoice
'your_credit',
'work_phone',
'invoice_total',
'outstanding',
];
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

View File

@ -746,6 +746,7 @@ NINJA.accountAddress = function(invoice) {
NINJA.renderInvoiceField = function(invoice, field) {
var account = invoice.account;
var client = invoice.client;
if (field == 'invoice.invoice_number') {
if (invoice.is_statement) {
@ -812,6 +813,15 @@ NINJA.renderInvoiceField = function(invoice, field) {
{text: formatMoneyInvoice(invoice.amount, invoice), style: ['invoiceTotal']}
];
}
} else if (field == 'invoice.outstanding') {
if (invoice.is_statement || invoice.is_quote) {
return false;
} else {
return [
{text: invoiceLabels.outstanding, style: ['invoiceOutstandingLabel']},
{text: formatMoneyInvoice(client.balance, invoice), style: ['outstanding']}
];
}
} else if (field == '.blank') {
return [{text: ' '}, {text: ' '}];
}