firefly-iii/resources/views/reports/budget.blade.php

171 lines
7.5 KiB
PHP
Raw Normal View History

2015-02-23 13:25:48 -06:00
@extends('layouts.default')
@section('content')
2015-02-23 14:19:16 -06:00
{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $date) !!}
2015-03-10 11:26:31 -05:00
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<p>
<a href="#" class="btn btn-default" id="includeShared" style="display:none;">
<i class="state-icon glyphicon glyphicon-unchecked"></i>
Include shared asset accounts</a>
</p>
</div>
</div>
2015-02-23 13:25:48 -06:00
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
2015-03-10 11:26:31 -05:00
<div class="panel panel-default">
<div class="panel-heading">
2015-03-14 11:21:43 -05:00
<i class="fa fa-fw fa-credit-card"></i>
2015-03-10 11:26:31 -05:00
Accounts
</div>
<table class="table table-bordered table-striped">
2015-02-23 13:25:48 -06:00
<tr>
2015-03-10 11:26:31 -05:00
<th>Account</th>
<th>Start of month</th>
<th>Current balance</th>
<th>Spent</th>
<th>Earned</th>
2015-02-23 13:25:48 -06:00
</tr>
2015-03-10 11:26:31 -05:00
@foreach($accounts as $account)
<tr>
<td><a href="{{route('accounts.show',$account->id)}}">{{{$account->name}}}</a></td>
<td>{!! Amount::format($account->startBalance) !!}</td>
<td>{!! Amount::format($account->endBalance) !!}</td>
<td>
@if($account->startBalance - $account->endBalance >= 0)
{!! Amount::format($account->startBalance - $account->endBalance) !!}
@endif
</td>
<td>
@if($account->startBalance - $account->endBalance < 0)
{!! Amount::format(($account->startBalance - $account->endBalance)*-1) !!}
@endif
</td>
</tr>
@endforeach
</table>
</div>
2015-02-23 13:25:48 -06:00
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
2015-03-10 11:26:31 -05:00
<div class="panel panel-default">
<div class="panel-heading">
2015-03-14 11:21:43 -05:00
<i class="fa fa-tasks fa-fw"></i>
2015-03-10 11:26:31 -05:00
Budgets
</div>
<table class="table table-bordered table-striped">
<tr>
<th colspan="2">Budgets</th>
2015-02-23 13:25:48 -06:00
<?php
2015-03-10 11:26:31 -05:00
$accountSums = [];
2015-02-23 13:25:48 -06:00
?>
2015-03-10 11:26:31 -05:00
@foreach($accounts as $account)
2015-03-27 07:39:12 -05:00
@if($account->hide === false)
<th><a href="{{route('accounts.show',$account->id)}}">{{{$account->name}}}</a></th>
@endif
2015-03-27 07:39:12 -05:00
<?php
2015-03-10 11:26:31 -05:00
$accountSums[$account->id] = 0;
2015-02-23 13:25:48 -06:00
?>
2015-03-27 07:39:12 -05:00
2015-03-10 11:26:31 -05:00
@endforeach
<th colspan="2">
Left in budget
</th>
</tr>
@foreach($budgets as $id => $budget)
<tr>
<td>{{{$budget['name']}}}</td>
<td>{!! Amount::format($budget['queryAmount']) !!}</td>
2015-03-10 11:26:31 -05:00
<?php $spent = 0;?>
@foreach($accounts as $account)
2015-03-27 07:39:12 -05:00
@if($account->hide === false)
@if(isset($account->budgetInformation[$id]))
<td>
@if($id == 0)
<a href="{{route('reports.no-budget',[$account, $year, $month])}}" class="openModal">
{!! Amount::format($account->budgetInformation[$id]['queryAmount']) !!}
2015-03-27 07:39:12 -05:00
</a>
@else
{!! Amount::format($account->budgetInformation[$id]['queryAmount']) !!}
2015-03-27 07:39:12 -05:00
@endif
</td>
<?php
$spent += floatval($account->budgetInformation[$id]['queryAmount']);
$accountSums[$account->id] += floatval($account->budgetInformation[$id]['queryAmount']);
2015-03-27 07:39:12 -05:00
?>
@else
<td>{!! Amount::format(0) !!}</td>
@endif
2015-03-10 11:26:31 -05:00
@endif
@endforeach
<td>{!! Amount::format($budget['queryAmount'] + $budget['spent']) !!}</td>
<td>{!! Amount::format($budget['queryAmount'] + $spent) !!}</td>
2015-03-10 11:26:31 -05:00
</tr>
2015-02-23 13:25:48 -06:00
@endforeach
2015-03-10 11:26:31 -05:00
<tr>
<td colspan="2">Balanced by transfers</td>
@foreach($accounts as $account)
2015-03-27 07:39:12 -05:00
@if($account->hide === false)
<td>
<a href="{{route('reports.balanced-transfers',[$account, $year, $month])}}" class="openModal">{!! Amount::format($account->balancedAmount) !!}</a>
</td>
@endif
2015-03-10 11:26:31 -05:00
@endforeach
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2">Left unbalanced</td>
@foreach($accounts as $account)
<?php
$accountSums[$account->id] += $account->balancedAmount;
?>
2015-03-27 07:39:12 -05:00
@if($account->hide === false)
@if(isset($account->budgetInformation[0]))
<td>
@if($account->budgetInformation[0]['queryAmount'] + $account->balancedAmount != 0.0)
<a href="{{route('reports.left-unbalanced',[$account, $year, $month])}}" class="openModal">{!! Amount::format($account->budgetInformation[0]['queryAmount'] + $account->balancedAmount) !!}</a>
2015-03-27 07:39:12 -05:00
@else
{!! Amount::format($account->budgetInformation[0]['queryAmount'] + $account->balancedAmount) !!}
2015-03-27 07:39:12 -05:00
@endif
</td>
@else
<td>{!! Amount::format(0) !!}</td>
@endif
2015-03-10 11:26:31 -05:00
@endif
@endforeach
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><em>Sum</em></td>
@foreach($accounts as $account)
2015-03-27 07:39:12 -05:00
@if($account->hide === false)
<td>{!! Amount::format($accountSums[$account->id]) !!}</td>
@endif
2015-03-10 11:26:31 -05:00
@endforeach
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2">Expected balance</td>
@foreach($accounts as $account)
2015-03-27 07:39:12 -05:00
@if($account->hide === false)
<td>{!! Amount::format($account->startBalance + $accountSums[$account->id]) !!}</td>
@endif
2015-03-10 11:26:31 -05:00
@endforeach
<td colspan="2">&nbsp;</td>
</tr>
2015-02-23 13:25:48 -06:00
2015-03-10 11:26:31 -05:00
</table>
</div>
2015-02-23 13:25:48 -06:00
</div>
</div>
<!-- modal to show various budget information -->
<div class="modal fade" id="budgetModal">
</div>
@stop
@section('scripts')
2015-02-23 14:19:16 -06:00
<script type="text/javascript" src="js/reports.js"></script>
2015-02-23 13:25:48 -06:00
@stop