mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Working on statements
This commit is contained in:
parent
898a64288c
commit
dca32edfea
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Jobs\Client;
|
||||
|
||||
use Utils;
|
||||
use App\Models\InvoiceItem;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
@ -25,12 +26,14 @@ class GenerateStatementData
|
||||
{
|
||||
$client = $this->client;
|
||||
$client->load('contacts');
|
||||
|
||||
$account = $client->account;
|
||||
$account->load(['date_format', 'datetime_format']);
|
||||
|
||||
$invoice = new Invoice();
|
||||
$invoice->invoice_date = Utils::today();
|
||||
$invoice->account = $account;
|
||||
$invoice->client = $client;
|
||||
$invoice->date_format = $account->date_format ? $account->date_format->format_moment : 'MMM D, YYYY';
|
||||
|
||||
$invoice->invoice_items = $this->getInvoices();
|
||||
|
||||
@ -39,6 +42,8 @@ class GenerateStatementData
|
||||
$invoice->invoice_items = $invoice->invoice_items->merge($payments);
|
||||
}
|
||||
|
||||
$invoice->hidePrivateFields();
|
||||
|
||||
return json_encode($invoice);
|
||||
}
|
||||
|
||||
@ -100,6 +105,7 @@ class GenerateStatementData
|
||||
$payments = Payment::with('invoice', 'payment_type')
|
||||
->withArchived()
|
||||
->whereClientId($this->client->id)
|
||||
//->excludeFailed()
|
||||
->where('payment_date', '>=', $this->options['start_date'])
|
||||
->where('payment_date', '<=', $this->options['end_date']);
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -538,8 +538,8 @@ NINJA.statementInvoices = function(invoice) {
|
||||
var rowStyle = (counter++ % 2 == 0) ? 'odd' : 'even';
|
||||
grid.push([
|
||||
{text: item.product_key, style:['invoiceNumber', 'productKey', rowStyle]},
|
||||
{text: item.custom_value1 && item.custom_value1 != '0000-00-00' ? moment(item.custom_value1).format(invoice.date_format) : ' ', style:['invoiceDate', rowStyle]},
|
||||
{text: item.custom_value2 && item.custom_value2 != '0000-00-00' ? moment(item.custom_value2).format(invoice.date_format) : ' ', style:['dueDate', rowStyle]},
|
||||
{text: item.custom_value1 && item.custom_value1 != '0000-00-00' ? moment(item.custom_value1).format(invoice.account.date_format ? invoice.account.date_format.format_moment : 'MMM D, YYYY') : ' ', style:['invoiceDate', rowStyle]},
|
||||
{text: item.custom_value2 && item.custom_value2 != '0000-00-00' ? moment(item.custom_value2).format(invoice.account.date_format ? invoice.account.date_format.format_moment : 'MMM D, YYYY') : ' ', style:['dueDate', rowStyle]},
|
||||
{text: formatMoneyInvoice(item.notes, invoice), style:['subtotals', rowStyle]},
|
||||
{text: formatMoneyInvoice(item.cost, invoice), style:['lineTotal', rowStyle]},
|
||||
]);
|
||||
@ -566,7 +566,7 @@ NINJA.statementPayments = function(invoice) {
|
||||
var rowStyle = (counter++ % 2 == 0) ? 'odd' : 'even';
|
||||
grid.push([
|
||||
{text: item.product_key, style:['invoiceNumber', 'productKey', rowStyle]},
|
||||
{text: item.custom_value1 && item.custom_value1 != '0000-00-00' ? moment(item.custom_value1).format(invoice.date_format) : ' ', style:['invoiceDate', rowStyle]},
|
||||
{text: item.custom_value1 && item.custom_value1 != '0000-00-00' ? moment(item.custom_value1).format(invoice.account.date_format ? invoice.account.date_format.format_moment : 'MMM D, YYYY') : ' ', style:['invoiceDate', rowStyle]},
|
||||
{text: item.custom_value2 ? item.custom_value2 : ' ', style:['dueDate', rowStyle]},
|
||||
//{text: item.transaction_reference, style:['subtotals', rowStyle]},
|
||||
{text: formatMoneyInvoice(item.cost, invoice), style:['lineTotal', rowStyle]},
|
||||
|
Loading…
Reference in New Issue
Block a user