1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Working on reports

This commit is contained in:
Hillel Coren 2018-01-21 16:05:35 +02:00
parent 4750362961
commit 3d1f542a25
3 changed files with 67 additions and 6 deletions

View File

@ -10,7 +10,7 @@ class InvoiceReport extends AbstractReport
{
public function getColumns()
{
return [
$columns = [
'client',
'invoice_number',
'invoice_date',
@ -21,6 +21,17 @@ class InvoiceReport extends AbstractReport
'method',
'private_notes' => ['columnSelector-false'],
];
$account = auth()->user()->account;
if ($account->custom_invoice_text_label1) {
$columns[$account->custom_invoice_text_label1] = ['columnSelector-false', 'custom'];
}
if ($account->custom_invoice_text_label1) {
$columns[$account->custom_invoice_text_label1] = ['columnSelector-false', 'custom'];
}
return $columns;
}
public function run()
@ -65,7 +76,7 @@ class InvoiceReport extends AbstractReport
foreach ($client->invoices as $invoice) {
$payments = $invoice->payments->count() ? $invoice->payments : [false];
foreach ($payments as $payment) {
$this->data[] = [
$row = [
$this->isExport ? $client->getDisplayName() : $client->present()->link,
$this->isExport ? $invoice->invoice_number : $invoice->present()->link,
$invoice->present()->invoice_date,
@ -77,6 +88,15 @@ class InvoiceReport extends AbstractReport
$invoice->private_notes,
];
if ($account->custom_invoice_text_label1) {
$row[] = $invoice->custom_text_value1;
}
if ($account->custom_invoice_text_label2) {
$row[] = $invoice->custom_text_value2;
}
$this->data[] = $row;
$this->addToTotals($client->currency_id, 'paid', $payment ? $payment->getCompletedAmount() : 0);
}

View File

@ -10,7 +10,7 @@ class ProductReport extends AbstractReport
{
public function getColumns()
{
return [
$columns = [
'client',
'invoice_number',
'invoice_date',
@ -21,6 +21,17 @@ class ProductReport extends AbstractReport
//'tax_rate1',
//'tax_rate2',
];
$account = auth()->user()->account;
if ($account->custom_invoice_item_label1) {
$columns[$account->custom_invoice_item_label1] = ['columnSelector-false', 'custom'];
}
if ($account->custom_invoice_item_labe2) {
$columns[$account->custom_invoice_item_labe2] = ['columnSelector-false', 'custom'];
}
return $columns;
}
public function run()
@ -44,7 +55,7 @@ class ProductReport extends AbstractReport
foreach ($clients->get() as $client) {
foreach ($client->invoices as $invoice) {
foreach ($invoice->invoice_items as $item) {
$this->data[] = [
$row = [
$this->isExport ? $client->getDisplayName() : $client->present()->link,
$this->isExport ? $invoice->invoice_number : $invoice->present()->link,
$invoice->present()->invoice_date,
@ -53,6 +64,16 @@ class ProductReport extends AbstractReport
Utils::roundSignificant($item->qty, 0),
Utils::roundSignificant($item->cost, 2),
];
if ($account->custom_invoice_item_label1) {
$row[] = $item->custom_value1;
}
if ($account->custom_invoice_item_labe2) {
$row[] = $item->custom_value2;
}
$this->data[] = $row;
}
//$this->addToTotals($client->currency_id, 'paid', $payment ? $payment->getCompletedAmount() : 0);

View File

@ -10,7 +10,7 @@ class QuoteReport extends AbstractReport
{
public function getColumns()
{
return [
$columns = [
'client',
'quote_number',
'quote_date',
@ -18,6 +18,17 @@ class QuoteReport extends AbstractReport
'status',
'private_notes' => ['columnSelector-false'],
];
$account = auth()->user()->account;
if ($account->custom_invoice_text_label1) {
$columns[$account->custom_invoice_text_label1] = ['columnSelector-false', 'custom'];
}
if ($account->custom_invoice_text_label1) {
$columns[$account->custom_invoice_text_label1] = ['columnSelector-false', 'custom'];
}
return $columns;
}
public function run()
@ -56,7 +67,7 @@ class QuoteReport extends AbstractReport
foreach ($clients->get() as $client) {
foreach ($client->invoices as $invoice) {
$this->data[] = [
$row = [
$this->isExport ? $client->getDisplayName() : $client->present()->link,
$this->isExport ? $invoice->invoice_number : $invoice->present()->link,
$invoice->present()->invoice_date,
@ -65,6 +76,15 @@ class QuoteReport extends AbstractReport
$invoice->private_notes,
];
if ($account->custom_invoice_text_label1) {
$row[] = $invoice->custom_text_value1;
}
if ($account->custom_invoice_text_label2) {
$row[] = $invoice->custom_text_value2;
}
$this->data[] = $row;
$this->addToTotals($client->currency_id, 'amount', $invoice->amount);
}
}