From f7969afc22b71656c764c3e44ee104ff6e449412 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 27 Mar 2015 13:36:33 +0100 Subject: [PATCH] Hide accounts with no activity in budget report. --- app/Http/Controllers/ReportController.php | 6 +++++- resources/views/reports/budget.blade.php | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 7c239116b2..4b027e64a9 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -69,12 +69,16 @@ class ReportController extends Controller $budgets = $query->getBudgetSummary($account, $start, $end); $balancedAmount = $query->balancedTransactionsSum($account, $start, $end); $array = []; + $hide = true; foreach ($budgets as $budget) { $id = intval($budget->id); $data = $budget->toArray(); $array[$id] = $data; + if (floatval($data['amount']) != 0) { + $hide = false; + } } - + $account->hide = $hide; $account->budgetInformation = $array; $account->balancedAmount = $balancedAmount; diff --git a/resources/views/reports/budget.blade.php b/resources/views/reports/budget.blade.php index 55e9ae73db..617fcd02a7 100644 --- a/resources/views/reports/budget.blade.php +++ b/resources/views/reports/budget.blade.php @@ -60,7 +60,12 @@ $accountSums = []; ?> @foreach($accounts as $account) - {{{$account->name}}} + {{{$account->name}}} + + @if($account->hide === true) + (hidden) + @endif + id] = 0; ?>