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

Adding charts to reports

This commit is contained in:
Hillel Coren 2018-02-28 10:12:23 +02:00
parent 5066a95da0
commit 238618a1c3
2 changed files with 13 additions and 1 deletions

View File

@ -7,6 +7,7 @@ use Auth;
use DateInterval;
use DatePeriod;
use stdClass;
use App\Models\Client;
class AbstractReport
{
@ -154,7 +155,9 @@ class AbstractReport
if ($subgroup == 'user') {
return $entity->user->getDisplayName();
} elseif ($subgroup == 'client') {
if ($entity->client) {
if ($entity instanceof Client) {
return $entity->getDisplayName();
} elseif ($entity->client) {
return $entity->client->getDisplayName();
} else {
return trans('texts.unset');

View File

@ -24,6 +24,7 @@ class AgingReport extends AbstractReport
public function run()
{
$account = Auth::user()->account;
$subgroup = $this->options['subgroup'];
$clients = Client::scope()
->orderBy('name')
@ -56,6 +57,14 @@ class AgingReport extends AbstractReport
//$this->addToTotals($client->currency_id, 'paid', $payment ? $payment->getCompletedAmount() : 0);
//$this->addToTotals($client->currency_id, 'amount', $invoice->amount);
//$this->addToTotals($client->currency_id, 'balance', $invoice->balance);
if ($subgroup == 'age') {
$dimension = trans('texts.' .$invoice->present()->ageGroup);
} else {
$dimension = $this->getDimension($client);
}
$this->addChartData($dimension, $invoice->invoice_date, $invoice->balance);
}
}
}