mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Working on credit notes
This commit is contained in:
parent
aa709a47dd
commit
7f038809fd
@ -1497,7 +1497,7 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
}
|
}
|
||||||
|
|
||||||
Invoice::creating(function ($invoice) {
|
Invoice::creating(function ($invoice) {
|
||||||
if (! $invoice->is_recurring) {
|
if (! $invoice->is_recurring && $invoice->amount >= 0) {
|
||||||
$invoice->account->incrementCounter($invoice);
|
$invoice->account->incrementCounter($invoice);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -197,8 +197,8 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
|||||||
'balanceDue': formatMoneyInvoice(invoice.balance_amount, invoice),
|
'balanceDue': formatMoneyInvoice(invoice.balance_amount, invoice),
|
||||||
'invoiceFooter': NINJA.invoiceFooter(invoice),
|
'invoiceFooter': NINJA.invoiceFooter(invoice),
|
||||||
'invoiceNumber': invoice.invoice_number || ' ',
|
'invoiceNumber': invoice.invoice_number || ' ',
|
||||||
'entityType': invoice.is_statement ? invoiceLabels.statement : invoice.is_quote ? invoiceLabels.quote : invoice.balance < 0 ? invoiceLabels.credit_note : invoiceLabels.invoice,
|
'entityType': invoice.is_statement ? invoiceLabels.statement : invoice.is_quote ? invoiceLabels.quote : invoice.balance_amount < 0 ? invoiceLabels.credit_note : invoiceLabels.invoice,
|
||||||
'entityTypeUC': (invoice.is_statement ? invoiceLabels.statement : invoice.is_quote ? invoiceLabels.quote : invoice.balance < 0 ? invoiceLabels.credit_note : invoiceLabels.invoice).toUpperCase(),
|
'entityTypeUC': (invoice.is_statement ? invoiceLabels.statement : invoice.is_quote ? invoiceLabels.quote : invoice.balance_amount < 0 ? invoiceLabels.credit_note : invoiceLabels.invoice).toUpperCase(),
|
||||||
'entityTaxType': invoice.is_statement ? invoiceLabels.statement : invoice.is_quote ? invoiceLabels.tax_quote : invoiceLabels.tax_invoice,
|
'entityTaxType': invoice.is_statement ? invoiceLabels.statement : invoice.is_quote ? invoiceLabels.tax_quote : invoiceLabels.tax_invoice,
|
||||||
'fontSize': NINJA.fontSize,
|
'fontSize': NINJA.fontSize,
|
||||||
'fontSizeLarger': NINJA.fontSize + 1,
|
'fontSizeLarger': NINJA.fontSize + 1,
|
||||||
@ -249,7 +249,7 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
|||||||
} else if (field == 'invoice_to') {
|
} else if (field == 'invoice_to') {
|
||||||
field = 'statement_to';
|
field = 'statement_to';
|
||||||
}
|
}
|
||||||
} else if (invoice.balance < 0) {
|
} else if (invoice.balance_amount < 0) {
|
||||||
if (field == 'your_invoice') {
|
if (field == 'your_invoice') {
|
||||||
field = 'your_credit';
|
field = 'your_credit';
|
||||||
} else if (field == 'invoice_issued_to') {
|
} else if (field == 'invoice_issued_to') {
|
||||||
@ -630,7 +630,7 @@ NINJA.subtotals = function(invoice, hideBalance)
|
|||||||
}
|
}
|
||||||
|
|
||||||
var paid = invoice.amount - invoice.balance;
|
var paid = invoice.amount - invoice.balance;
|
||||||
if (!invoice.is_quote && invoice.balance >= 0 && (invoice.account.hide_paid_to_date != '1' || paid)) {
|
if (!invoice.is_quote && invoice.balance_amount >= 0 && (invoice.account.hide_paid_to_date != '1' || paid)) {
|
||||||
data.push([{text:invoiceLabels.paid_to_date, style: ['subtotalsLabel', 'paidToDateLabel']}, {text:formatMoneyInvoice(paid, invoice), style: ['subtotals', 'paidToDate']}]);
|
data.push([{text:invoiceLabels.paid_to_date, style: ['subtotalsLabel', 'paidToDateLabel']}, {text:formatMoneyInvoice(paid, invoice), style: ['subtotals', 'paidToDate']}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,7 +638,7 @@ NINJA.subtotals = function(invoice, hideBalance)
|
|||||||
|
|
||||||
if (!hideBalance || isPartial) {
|
if (!hideBalance || isPartial) {
|
||||||
data.push([
|
data.push([
|
||||||
{ text: invoice.is_quote || invoice.balance < 0 ? invoiceLabels.total : invoiceLabels.balance_due, style: ['subtotalsLabel', isPartial ? '' : 'balanceDueLabel'] },
|
{ text: invoice.is_quote || invoice.balance_amount < 0 ? invoiceLabels.total : invoiceLabels.balance_due, style: ['subtotalsLabel', isPartial ? '' : 'balanceDueLabel'] },
|
||||||
{ text: formatMoneyInvoice(invoice.total_amount, invoice), style: ['subtotals', isPartial ? '' : 'balanceDue'] }
|
{ text: formatMoneyInvoice(invoice.total_amount, invoice), style: ['subtotals', isPartial ? '' : 'balanceDue'] }
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -658,7 +658,7 @@ NINJA.subtotals = function(invoice, hideBalance)
|
|||||||
NINJA.subtotalsBalance = function(invoice) {
|
NINJA.subtotalsBalance = function(invoice) {
|
||||||
var isPartial = NINJA.parseFloat(invoice.partial);
|
var isPartial = NINJA.parseFloat(invoice.partial);
|
||||||
return [[
|
return [[
|
||||||
{text: isPartial ? invoiceLabels.partial_due : (invoice.is_quote || invoice.balance < 0 ? invoiceLabels.total : invoiceLabels.balance_due), style:['subtotalsLabel', 'balanceDueLabel']},
|
{text: isPartial ? invoiceLabels.partial_due : (invoice.is_quote || invoice.balance_amount < 0 ? invoiceLabels.total : invoiceLabels.balance_due), style:['subtotalsLabel', 'balanceDueLabel']},
|
||||||
{text: formatMoneyInvoice(invoice.balance_amount, invoice), style:['subtotals', 'balanceDue']}
|
{text: formatMoneyInvoice(invoice.balance_amount, invoice), style:['subtotals', 'balanceDue']}
|
||||||
]];
|
]];
|
||||||
}
|
}
|
||||||
@ -728,7 +728,7 @@ NINJA.renderInvoiceField = function(invoice, field) {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return [
|
return [
|
||||||
{text: (invoice.is_quote ? invoiceLabels.quote_number : invoice.balance < 0 ? invoiceLabels.credit_number : invoiceLabels.invoice_number), style: ['invoiceNumberLabel']},
|
{text: (invoice.is_quote ? invoiceLabels.quote_number : invoice.balance_amount < 0 ? invoiceLabels.credit_number : invoiceLabels.invoice_number), style: ['invoiceNumberLabel']},
|
||||||
{text: invoice.invoice_number, style: ['invoiceNumber']}
|
{text: invoice.invoice_number, style: ['invoiceNumber']}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -739,7 +739,7 @@ NINJA.renderInvoiceField = function(invoice, field) {
|
|||||||
];
|
];
|
||||||
} else if (field == 'invoice.invoice_date') {
|
} else if (field == 'invoice.invoice_date') {
|
||||||
return [
|
return [
|
||||||
{text: (invoice.is_statement ? invoiceLabels.statement_date : invoice.is_quote ? invoiceLabels.quote_date : invoice.balance < 0 ? invoiceLabels.credit_date : invoiceLabels.invoice_date)},
|
{text: (invoice.is_statement ? invoiceLabels.statement_date : invoice.is_quote ? invoiceLabels.quote_date : invoice.balance_amount < 0 ? invoiceLabels.credit_date : invoiceLabels.invoice_date)},
|
||||||
{text: invoice.invoice_date}
|
{text: invoice.invoice_date}
|
||||||
];
|
];
|
||||||
} else if (field == 'invoice.due_date') {
|
} else if (field == 'invoice.due_date') {
|
||||||
@ -767,7 +767,7 @@ NINJA.renderInvoiceField = function(invoice, field) {
|
|||||||
}
|
}
|
||||||
} else if (field == 'invoice.balance_due') {
|
} else if (field == 'invoice.balance_due') {
|
||||||
return [
|
return [
|
||||||
{text: invoice.is_quote || invoice.balance < 0 ? invoiceLabels.total : invoiceLabels.balance_due, style: ['invoiceDetailBalanceDueLabel']},
|
{text: invoice.is_quote || invoice.balance_amount < 0 ? invoiceLabels.total : invoiceLabels.balance_due, style: ['invoiceDetailBalanceDueLabel']},
|
||||||
{text: formatMoneyInvoice(invoice.total_amount, invoice), style: ['invoiceDetailBalanceDue']}
|
{text: formatMoneyInvoice(invoice.total_amount, invoice), style: ['invoiceDetailBalanceDue']}
|
||||||
];
|
];
|
||||||
} else if (field == invoice.partial_due) {
|
} else if (field == invoice.partial_due) {
|
||||||
|
@ -2445,6 +2445,7 @@ $LANG = array(
|
|||||||
'credit_to' => 'Credit to',
|
'credit_to' => 'Credit to',
|
||||||
'your_credit' => 'Your Credit',
|
'your_credit' => 'Your Credit',
|
||||||
'credit_number' => 'Credit Number',
|
'credit_number' => 'Credit Number',
|
||||||
|
'create_credit_note' => 'Create Credit Note',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user