mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +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) {
|
||||
if (! $invoice->is_recurring) {
|
||||
if (! $invoice->is_recurring && $invoice->amount >= 0) {
|
||||
$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),
|
||||
'invoiceFooter': NINJA.invoiceFooter(invoice),
|
||||
'invoiceNumber': invoice.invoice_number || ' ',
|
||||
'entityType': invoice.is_statement ? invoiceLabels.statement : invoice.is_quote ? invoiceLabels.quote : invoice.balance < 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(),
|
||||
'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_amount < 0 ? invoiceLabels.credit_note : invoiceLabels.invoice).toUpperCase(),
|
||||
'entityTaxType': invoice.is_statement ? invoiceLabels.statement : invoice.is_quote ? invoiceLabels.tax_quote : invoiceLabels.tax_invoice,
|
||||
'fontSize': NINJA.fontSize,
|
||||
'fontSizeLarger': NINJA.fontSize + 1,
|
||||
@ -249,7 +249,7 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
||||
} else if (field == 'invoice_to') {
|
||||
field = 'statement_to';
|
||||
}
|
||||
} else if (invoice.balance < 0) {
|
||||
} else if (invoice.balance_amount < 0) {
|
||||
if (field == 'your_invoice') {
|
||||
field = 'your_credit';
|
||||
} else if (field == 'invoice_issued_to') {
|
||||
@ -630,7 +630,7 @@ NINJA.subtotals = function(invoice, hideBalance)
|
||||
}
|
||||
|
||||
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']}]);
|
||||
}
|
||||
|
||||
@ -638,7 +638,7 @@ NINJA.subtotals = function(invoice, hideBalance)
|
||||
|
||||
if (!hideBalance || isPartial) {
|
||||
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'] }
|
||||
]);
|
||||
}
|
||||
@ -658,7 +658,7 @@ NINJA.subtotals = function(invoice, hideBalance)
|
||||
NINJA.subtotalsBalance = function(invoice) {
|
||||
var isPartial = NINJA.parseFloat(invoice.partial);
|
||||
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']}
|
||||
]];
|
||||
}
|
||||
@ -728,7 +728,7 @@ NINJA.renderInvoiceField = function(invoice, field) {
|
||||
return false;
|
||||
} else {
|
||||
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']}
|
||||
];
|
||||
}
|
||||
@ -739,7 +739,7 @@ NINJA.renderInvoiceField = function(invoice, field) {
|
||||
];
|
||||
} else if (field == 'invoice.invoice_date') {
|
||||
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}
|
||||
];
|
||||
} else if (field == 'invoice.due_date') {
|
||||
@ -767,7 +767,7 @@ NINJA.renderInvoiceField = function(invoice, field) {
|
||||
}
|
||||
} else if (field == 'invoice.balance_due') {
|
||||
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']}
|
||||
];
|
||||
} else if (field == invoice.partial_due) {
|
||||
|
@ -2445,6 +2445,7 @@ $LANG = array(
|
||||
'credit_to' => 'Credit to',
|
||||
'your_credit' => 'Your Credit',
|
||||
'credit_number' => 'Credit Number',
|
||||
'create_credit_note' => 'Create Credit Note',
|
||||
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user