mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Various code cleanup.
This commit is contained in:
@@ -25,6 +25,8 @@ namespace FireflyIII\Generator\Report\Account;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@@ -44,7 +46,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
* Generate the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@@ -52,11 +53,17 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
$expenseIds = implode(',', $this->expense->pluck('id')->toArray());
|
||||
$reportType = 'account';
|
||||
$preferredPeriod = $this->preferredPeriod();
|
||||
try {
|
||||
$result = view(
|
||||
'reports.account.report',
|
||||
compact('accountIds', 'reportType', 'expenseIds', 'preferredPeriod')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return view(
|
||||
'reports.account.report',
|
||||
compact('accountIds', 'reportType', 'expenseIds', 'preferredPeriod')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -34,6 +34,8 @@ use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@@ -52,7 +54,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@@ -78,10 +79,16 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
'internal_reference', 'notes',
|
||||
'create_date', 'update_date',
|
||||
];
|
||||
try {
|
||||
$result = view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))
|
||||
->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts)
|
||||
->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.audit.report: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))
|
||||
->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts)
|
||||
->render();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -35,6 +35,7 @@ use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@@ -64,7 +65,6 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
* Generates the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@@ -77,11 +77,17 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
$topExpenses = $this->getTopExpenses();
|
||||
|
||||
// render!
|
||||
return view('reports.budget.month', compact('accountIds', 'budgetIds', 'accountSummary', 'budgetSummary', 'averageExpenses', 'topExpenses'))
|
||||
try {
|
||||
$result= view('reports.budget.month', compact('accountIds', 'budgetIds', 'accountSummary', 'budgetSummary', 'averageExpenses', 'topExpenses'))
|
||||
->with('start', $this->start)->with('end', $this->end)
|
||||
->with('budgets', $this->budgets)
|
||||
->with('accounts', $this->accounts)
|
||||
->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -36,6 +36,7 @@ use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@@ -68,7 +69,6 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
* Generates the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@@ -85,24 +85,23 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
$topIncome = $this->getTopIncome();
|
||||
|
||||
// render!
|
||||
return view(
|
||||
'reports.category.month',
|
||||
compact(
|
||||
'accountIds',
|
||||
'categoryIds',
|
||||
'topIncome',
|
||||
'reportType',
|
||||
'accountSummary',
|
||||
'categorySummary',
|
||||
'averageExpenses',
|
||||
'averageIncome',
|
||||
'topExpenses'
|
||||
try {
|
||||
return view(
|
||||
'reports.category.month', compact(
|
||||
'accountIds', 'categoryIds', 'topIncome', 'reportType', 'accountSummary', 'categorySummary', 'averageExpenses',
|
||||
'averageIncome', 'topExpenses'
|
||||
)
|
||||
)
|
||||
)
|
||||
->with('start', $this->start)->with('end', $this->end)
|
||||
->with('categories', $this->categories)
|
||||
->with('accounts', $this->accounts)
|
||||
->render();
|
||||
->with('start', $this->start)->with('end', $this->end)
|
||||
->with('categories', $this->categories)
|
||||
->with('accounts', $this->accounts)
|
||||
->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.category.month: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -26,6 +26,8 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@@ -43,7 +45,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
* Generates the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@@ -53,11 +54,17 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
|
||||
$reportType = 'default';
|
||||
|
||||
// continue!
|
||||
return view(
|
||||
'reports.default.month',
|
||||
compact('bills', 'accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
try {
|
||||
return view(
|
||||
'reports.default.month',
|
||||
compact('bills', 'accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.default.month: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -25,6 +25,8 @@ namespace FireflyIII\Generator\Report\Standard;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@@ -42,7 +44,6 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||
* Generates the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@@ -50,11 +51,17 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
|
||||
$reportType = 'default';
|
||||
|
||||
// continue!
|
||||
return view(
|
||||
'reports.default.multi-year',
|
||||
compact('accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
try {
|
||||
return view(
|
||||
'reports.default.multi-year',
|
||||
compact('accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.default.multi-year: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -25,6 +25,8 @@ namespace FireflyIII\Generator\Report\Standard;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@@ -42,7 +44,6 @@ class YearReportGenerator implements ReportGeneratorInterface
|
||||
* Generates the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@@ -50,13 +51,20 @@ class YearReportGenerator implements ReportGeneratorInterface
|
||||
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
|
||||
$reportType = 'default';
|
||||
|
||||
// continue!
|
||||
return view(
|
||||
'reports.default.year',
|
||||
compact('accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
try {
|
||||
$result = view(
|
||||
'reports.default.year',
|
||||
compact('accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the accounts.
|
||||
*
|
||||
|
@@ -38,6 +38,7 @@ use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@@ -70,7 +71,6 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
* Generate the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@@ -87,20 +87,18 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
$topIncome = $this->getTopIncome();
|
||||
|
||||
// render!
|
||||
return view(
|
||||
'reports.tag.month',
|
||||
compact(
|
||||
'accountIds',
|
||||
'tagTags',
|
||||
'reportType',
|
||||
'accountSummary',
|
||||
'tagSummary',
|
||||
'averageExpenses',
|
||||
'averageIncome',
|
||||
'topIncome',
|
||||
'topExpenses'
|
||||
try {
|
||||
$result = view(
|
||||
'reports.tag.month', compact(
|
||||
'accountIds', 'tagTags', 'reportType', 'accountSummary', 'tagSummary', 'averageExpenses', 'averageIncome', 'topIncome', 'topExpenses'
|
||||
)
|
||||
)->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render();
|
||||
)->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.tag.month: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user