New stuff for report.

This commit is contained in:
James Cole
2017-12-10 08:56:20 +01:00
parent 089214709f
commit 2a87add745
8 changed files with 127 additions and 319 deletions

View File

@@ -47,13 +47,14 @@ class MonthReportGenerator implements ReportGeneratorInterface
*/
public function generate(): string
{
$accountIds = join(',', $this->accounts->pluck('id')->toArray());
$expenseIds = join(',', $this->expense->pluck('id')->toArray());
$reportType = 'account';
$accountIds = join(',', $this->accounts->pluck('id')->toArray());
$expenseIds = join(',', $this->expense->pluck('id')->toArray());
$reportType = 'account';
$preferredPeriod = $this->preferredPeriod();
return view(
'reports.account.report',
compact('accountIds', 'reportType','expenseIds')
compact('accountIds', 'reportType', 'expenseIds', 'preferredPeriod')
)->with('start', $this->start)->with('end', $this->end)->render();
}
@@ -134,4 +135,12 @@ class MonthReportGenerator implements ReportGeneratorInterface
{
return $this;
}
/**
* @return string
*/
protected function preferredPeriod(): string
{
return 'day';
}
}

View File

@@ -28,4 +28,11 @@ namespace FireflyIII\Generator\Report\Account;
class MultiYearReportGenerator extends MonthReportGenerator
{
// Doesn't do anything different.
/**
* @return string
*/
protected function preferredPeriod(): string {
return 'year';
}
}

View File

@@ -28,4 +28,11 @@ namespace FireflyIII\Generator\Report\Account;
class YearReportGenerator extends MonthReportGenerator
{
// Doesn't do anything different.
/**
* @return string
*/
protected function preferredPeriod(): string {
return 'month';
}
}

View File

@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Report;
use FireflyIII\Http\Controllers\Controller;
/**
* Class ExpenseController
*/
class ExpenseController extends Controller
{
}