Hide accounts with no activity.

This commit is contained in:
James Cole
2015-03-27 13:39:12 +01:00
parent f7969afc22
commit a663ddb0d9

View File

@@ -60,15 +60,13 @@
$accountSums = []; $accountSums = [];
?> ?>
@foreach($accounts as $account) @foreach($accounts as $account)
<th><a href="{{route('accounts.show',$account->id)}}">{{{$account->name}}}</a> @if($account->hide === false)
<th><a href="{{route('accounts.show',$account->id)}}">{{{$account->name}}}</a></th>
@if($account->hide === true)
<small>(hidden)</small>
@endif @endif
</th> <?php
<?php
$accountSums[$account->id] = 0; $accountSums[$account->id] = 0;
?> ?>
@endforeach @endforeach
<th colspan="2"> <th colspan="2">
Left in budget Left in budget
@@ -80,22 +78,24 @@
<td>{!! Amount::format($budget['amount']) !!}</td> <td>{!! Amount::format($budget['amount']) !!}</td>
<?php $spent = 0;?> <?php $spent = 0;?>
@foreach($accounts as $account) @foreach($accounts as $account)
@if(isset($account->budgetInformation[$id])) @if($account->hide === false)
<td> @if(isset($account->budgetInformation[$id]))
@if($id == 0) <td>
<a href="{{route('reports.no-budget',[$account, $year, $month])}}" class="openModal"> @if($id == 0)
{!! Amount::format($account->budgetInformation[$id]['amount']) !!} <a href="{{route('reports.no-budget',[$account, $year, $month])}}" class="openModal">
</a> {!! Amount::format($account->budgetInformation[$id]['amount']) !!}
@else </a>
{!! Amount::format($account->budgetInformation[$id]['amount']) !!} @else
@endif {!! Amount::format($account->budgetInformation[$id]['amount']) !!}
</td> @endif
<?php </td>
$spent += floatval($account->budgetInformation[$id]['amount']); <?php
$accountSums[$account->id] += floatval($account->budgetInformation[$id]['amount']); $spent += floatval($account->budgetInformation[$id]['amount']);
?> $accountSums[$account->id] += floatval($account->budgetInformation[$id]['amount']);
@else ?>
<td>{!! Amount::format(0) !!}</td> @else
<td>{!! Amount::format(0) !!}</td>
@endif
@endif @endif
@endforeach @endforeach
<td>{!! Amount::format($budget['amount'] + $budget['spent']) !!}</td> <td>{!! Amount::format($budget['amount'] + $budget['spent']) !!}</td>
@@ -105,9 +105,11 @@
<tr> <tr>
<td colspan="2">Balanced by transfers</td> <td colspan="2">Balanced by transfers</td>
@foreach($accounts as $account) @foreach($accounts as $account)
<td> @if($account->hide === false)
<a href="{{route('reports.balanced-transfers',[$account, $year, $month])}}" class="openModal">{!! Amount::format($account->balancedAmount) !!}</a> <td>
</td> <a href="{{route('reports.balanced-transfers',[$account, $year, $month])}}" class="openModal">{!! Amount::format($account->balancedAmount) !!}</a>
</td>
@endif
@endforeach @endforeach
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
</tr> </tr>
@@ -117,16 +119,18 @@
<?php <?php
$accountSums[$account->id] += $account->balancedAmount; $accountSums[$account->id] += $account->balancedAmount;
?> ?>
@if(isset($account->budgetInformation[0])) @if($account->hide === false)
<td> @if(isset($account->budgetInformation[0]))
@if($account->budgetInformation[0]['amount'] + $account->balancedAmount != 0.0) <td>
<a href="{{route('reports.left-unbalanced',[$account, $year, $month])}}" class="openModal">{!! Amount::format($account->budgetInformation[0]['amount'] + $account->balancedAmount) !!}</a> @if($account->budgetInformation[0]['amount'] + $account->balancedAmount != 0.0)
@else <a href="{{route('reports.left-unbalanced',[$account, $year, $month])}}" class="openModal">{!! Amount::format($account->budgetInformation[0]['amount'] + $account->balancedAmount) !!}</a>
{!! Amount::format($account->budgetInformation[0]['amount'] + $account->balancedAmount) !!} @else
@endif {!! Amount::format($account->budgetInformation[0]['amount'] + $account->balancedAmount) !!}
</td> @endif
@else </td>
<td>{!! Amount::format(0) !!}</td> @else
<td>{!! Amount::format(0) !!}</td>
@endif
@endif @endif
@endforeach @endforeach
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
@@ -134,14 +138,18 @@
<tr> <tr>
<td colspan="2"><em>Sum</em></td> <td colspan="2"><em>Sum</em></td>
@foreach($accounts as $account) @foreach($accounts as $account)
<td>{!! Amount::format($accountSums[$account->id]) !!}</td> @if($account->hide === false)
<td>{!! Amount::format($accountSums[$account->id]) !!}</td>
@endif
@endforeach @endforeach
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
</tr> </tr>
<tr> <tr>
<td colspan="2">Expected balance</td> <td colspan="2">Expected balance</td>
@foreach($accounts as $account) @foreach($accounts as $account)
<td>{!! Amount::format($account->startBalance + $accountSums[$account->id]) !!}</td> @if($account->hide === false)
<td>{!! Amount::format($account->startBalance + $accountSums[$account->id]) !!}</td>
@endif
@endforeach @endforeach
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
</tr> </tr>