This commit is contained in:
James Cole
2015-02-23 20:25:48 +01:00
parent 5a0a28a04c
commit 220d689f69
15 changed files with 1861 additions and 10 deletions

View File

@@ -0,0 +1,156 @@
@extends('layouts.default')
@section('content')
{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $date) }}
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<table class="table table-bordered table-striped">
<tr>
<th>Account</th>
<th>Start of month</th>
<th>Current balance</th>
<th>Spent</th>
</tr>
@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>{{Amount::format($account->startBalance - $account->endBalance,false)}}</td>
</tr>
@endforeach
</table>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<table class="table table-bordered table-striped">
<tr>
<th colspan="2">Budgets</th>
<?php
$accountSums = [];
?>
@foreach($accounts as $account)
<th><a href="{{route('accounts.show',$account->id)}}">{{{$account->name}}}</a></th>
<?php
$accountSums[$account->id] = 0;
?>
@endforeach
<th colspan="2">
Left in budget
</th>
</tr>
@foreach($budgets as $id => $budget)
<tr>
<td>{{{$budget['name']}}}
@if($id == 0)
<i class="fa fa-fw fa-question-circle" data-toggle="tooltip" data-placement="top" title="The calculation used here is slightly different from the row below. The numbers should match."></i>
@endif
</td>
<td>{{Amount::format($budget['amount'])}}</td>
<?php $spent = 0;?>
@foreach($accounts as $account)
@if(isset($account->budgetInformation[$id]))
<td>
@if($id == 0)
<a href="#">{{Amount::format($account->budgetInformation[$id]['amount'])}}</a>
@else
{{Amount::format($account->budgetInformation[$id]['amount'])}}
@endif
</td>
<?php
$spent += floatval($account->budgetInformation[$id]['amount']);
$accountSums[$account->id] += floatval($account->budgetInformation[$id]['amount']);
?>
@else
<td>{{Amount::format(0)}}</td>
@endif
@endforeach
<td>{{Amount::format($budget['amount'] + $budget['spent'])}}</td>
<td>{{Amount::format($budget['amount'] + $spent)}}</td>
</tr>
@endforeach
<tr>
<td colspan="2">Without budget
<i class="fa fa-fw fa-question-circle" data-toggle="tooltip" data-placement="top" title="The calculation used here is slightly different from the row above. The numbers should match."></i>
</td>
@foreach($accounts as $account)
@if(isset($account->budgetInformation[0]))
<td>
<a href="#">{{Amount::format($account->budgetInformation[0]['amount'])}}</a>
</td>
@else
<td>{{Amount::format(0)}}</td>
@endif
@endforeach
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2">Balanced by transfers</td>
@foreach($accounts as $account)
<td>
<a href="#">{{Amount::format($account->balancedAmount)}}</a>
</td>
@endforeach
<td colspan="2">&nbsp;</td>
</tr>
<!--
<tr>
<td colspan="2">Balancing transfers</td>
@foreach($accounts as $account)
<td>{{Amount::format(0)}}</td>
@endforeach
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2">Income</td>
@foreach($accounts as $account)
<td>{{Amount::format(0)}}</td>
@endforeach
<td colspan="2">&nbsp;</td>
</tr>
--->
<tr>
<td colspan="2">Left unbalanced</td>
@foreach($accounts as $account)
<?php
$accountSums[$account->id] += $account->balancedAmount;
?>
@if(isset($account->budgetInformation[0]))
<td>
<a href="#">{{Amount::format($account->budgetInformation[0]['amount'] + $account->balancedAmount)}}</a>
</td>
@else
<td>{{Amount::format(0)}}</td>
@endif
@endforeach
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><em>Sum</em></td>
@foreach($accounts as $account)
<td>{{Amount::format($accountSums[$account->id])}}</td>
@endforeach
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2">Expected balance</td>
@foreach($accounts as $account)
<td>{{Amount::format($account->startBalance + $accountSums[$account->id])}}</td>
@endforeach
<td colspan="2">&nbsp;</td>
</tr>
</table>
</div>
</div>
<!-- modal to show various budget information -->
<div class="modal fade" id="budgetModal">
</div>
@stop
@section('scripts')
{{HTML::script('assets/javascript/firefly/reports.js')}}
@stop

View File

@@ -0,0 +1,50 @@
@extends('layouts.default')
@section('content')
{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!}
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4">
<div class="panel panel-default">
<div class="panel-heading">
Yearly reports
</div>
<div class="panel-body">
<ul>
@foreach($years as $year)
<li><a href="{{route('reports.year',$year)}}">{{$year}}</a></li>
@endforeach
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4">
<div class="panel panel-default">
<div class="panel-heading">
Monthly reports
</div>
<div class="panel-body">
<ul>
@foreach($months as $month)
<li><a href="{{route('reports.month',[$month['year'],$month['month']])}}">{{$month['formatted']}}</a></li>
@endforeach
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4">
<div class="panel panel-default">
<div class="panel-heading">
Budget reports
</div>
<div class="panel-body">
<ul>
@foreach($months as $month)
<li><a href="{{route('reports.budget',[$month['year'],$month['month']])}}">{{$month['formatted']}}</a></li>
@endforeach
</ul>
</div>
</div>
</div>
</div>
@stop

View File

@@ -0,0 +1,235 @@
@extends('layouts.default')
@section('content')
{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $date) !!}
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Income</div>
<table class="table table-bordered">
<?php $tableSum = 0;?>
@foreach($income as $entry)
<tr>
<td>
@if($entry->encrypted === true)
<a href="{{route('transactions.show',$entry->id)}}" title="{{{Crypt::decrypt($entry->description)}}}">{{{Crypt::decrypt($entry->description)}}}</a>
@else
<a href="{{route('transactions.show',$entry->id)}}" title="{{{$entry->description}}}">{{{$entry->description}}}</a>
@endif
</td>
<td>
<?php $tableSum += floatval($entry->amount);?>
@if($entry->type == 'Withdrawal')
<span class="text-danger">{{Amount::format($entry->amount,false)}}</span>
@endif
@if($entry->type == 'Deposit')
<span class="text-success">{{Amount::format($entry->amount,false)}}</span>
@endif
@if($entry->type == 'Transfer')
<span class="text-info">{{Amount::format($entry->amount,false)}}</span>
@endif
</td>
<td>
{{$entry->date->format('j F Y')}}
</td>
<td>
<a href="{{route('accounts.show',$entry->account_id)}}">{{{$entry->name}}}</a>
</td>
</tr>
@endforeach
@if(isset($displaySum) && $displaySum === true)
<tr>
<td><em>Sum</em></td>
<td colspan="3">{!! Amount::format($tableSum) !!}</td>
</tr>
@endif
</table>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Expenses (top 10)</div>
<table class="table table-bordered">
<?php $sum = 0;?>
@foreach($expenses as $id => $expense)
<?php $sum += floatval($expense['amount']);?>
<tr>
@if($id > 0)
<td><a href="{{route('accounts.show',$id)}}">{{{$expense['name']}}}</a></td>
@else
<td><em>{{{$expense['name']}}}</em></td>
@endif
<td>{!! Amount::format($expense['amount']) !!}</td>
</tr>
@endforeach
<tr>
<td><em>Sum</em></td>
<td>{!! Amount::format($sum) !!}</td>
</tr>
</table>
</div>
</div>
<div class="col-lg-3 col-md-4 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Sums</div>
<?php
$in = 0;
foreach($income as $entry) {
$in += floatval($entry->transactions[1]->amount);
}
?>
<table class="table table-bordered">
<tr>
<td>In</td>
<td>{!! Amount::format($in) !!}</td>
</tr>
<tr>
<td>Out</td>
<td>{!! Amount::format($sum) !!}</td>
</tr>
<tr>
<td>Difference</td>
<td>{!! Amount::format($in - $sum) !!}</td>
</tr>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Budgets</div>
<table class="table table-bordered">
<tr>
<th>Budget</th>
<th>Envelope</th>
<th>Spent</th>
<th>Left</th>
</tr>
<?php
$sumSpent = 0;
$sumEnvelope = 0;
$sumLeft = 0;
?>
@foreach($budgets as $id => $budget)
<?php
$sumSpent += $budget['spent'];
$sumEnvelope += $budget['amount'];
$sumLeft += $budget['amount'] + $budget['spent'];
?>
<tr>
<td>
@if($id > 0)
<a href="{{route('budgets.show',$id)}}">{{{$budget['name']}}}</a>
@else
<em>{{{$budget['name']}}}</em>
@endif
</td>
<td>{!! Amount::format($budget['amount']) !!}</td>
<td>{!! Amount::format($budget['spent'],false) !!}</td>
<td>{!! Amount::format($budget['amount'] + $budget['spent']) !!}</td>
</tr>
@endforeach
<tr>
<td><em>Sum</em></td>
<td>{!! Amount::format($sumEnvelope) !!}</td>
<td>{!! Amount::format($sumSpent) !!}</td>
<td>{!! Amount::format($sumLeft) !!}</td>
</tr>
</table>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Categories</div>
<table class="table table-bordered">
<tr>
<th>Category</th>
<th>Spent</th>
</tr>
<?php $sum = 0;?>
@foreach($categories as $id => $category)
<?php $sum += floatval($category['amount']);?>
<tr>
<td>
@if($id > 0)
<a href="{{route('categories.show',$id)}}">{{{$category['name']}}}</a>
@else
<em>{{{$category['name']}}}</em>
@endif
</td>
<td>{!! Amount::format($category['amount'],false) !!}</td>
</tr>
@endforeach
<tr>
<td><em>Sum</em></td>
<td>{!! Amount::format($sum) !!}</td>
</tr>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Accounts</div>
<table class="table table-bordered">
<?php
$sumStart = 0;
$sumEnd = 0;
$sumDiff = 0;
?>
@foreach($accounts as $id => $account)
<?php
$sumStart += $account['startBalance'];
$sumEnd += $account['endBalance'];
$sumDiff += $account['difference'];
?>
<tr>
<td><a href="{{route('accounts.show',$id)}}">{{{$account['name']}}}</a></td>
<td>{!! Amount::format($account['startBalance']) !!}</td>
<td>{!! Amount::format($account['endBalance']) !!}</td>
<td>{!! Amount::format($account['difference']) !!}</td>
</tr>
@endforeach
<tr>
<td><em>Sum</em></td>
<td>{!! Amount::format($sumStart) !!}</td>
<td>{!! Amount::format($sumEnd) !!}</td>
<td>{!! Amount::format($sumDiff) !!}</td>
</tr>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Piggy banks</div>
<div class="panel-body">Body</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Repeated expenses</div>
<div class="panel-body">Body</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Bills</div>
<div class="panel-body">Body</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Outside of budgets</div>
<div class="panel-body">Body</div>
</div>
</div>
</div>
@stop

View File

@@ -0,0 +1,170 @@
@extends('layouts.default')
@section('content')
{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $date) !!}
<div class="row">
<div class="col-lg-10 col-md-8 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
Income vs. expenses
</div>
<div class="panel-body">
<div id="income-expenses-chart"></div>
</div>
</div>
</div>
<div class="col-lg-2 col-md-4 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
Income vs. expenses
</div>
<div class="panel-body">
<div id="income-expenses-sum-chart"></div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
Account balance
</div>
<table class="table table-bordered table-striped">
<?php
$start = 0;
$end = 0;
$diff = 0;
?>
@foreach($balances as $balance)
<?php
$start += $balance['start'];
$end += $balance['end'];
$diff += ($balance['end']-$balance['start']);
?>
<tr>
<td>
<a href="{{route('accounts.show',$balance['account']->id)}}">{{{$balance['account']->name}}}</a>
@if($balance['shared'])
<small><em>shared</em></small>
@endif
</td>
<td>{!! Amount::format($balance['start']) !!}</td>
<td>{!! Amount::format($balance['end']) !!}</td>
<td>{!! Amount::format($balance['end']-$balance['start']) !!}</td>
</tr>
@endforeach
<tr>
<td><em>Sum of sums</em></td>
<td>{!! Amount::format($start) !!}</td>
<td>{!! Amount::format($end) !!}</td>
<td>{!! Amount::format($diff) !!}</td>
</tr>
</table>
</div>
<div class="panel panel-default">
<div class="panel-heading">
Income vs. expense
</div>
<?php
$incomeSum = 0;
$expenseSum = 0;
foreach($groupedIncomes as $income) {
$incomeSum += floatval($income->amount);
}
foreach($groupedExpenses as $exp) {
$expenseSum += floatval($exp['amount']);
}
$incomeSum = floatval($incomeSum*-1);
?>
<table class="table table-bordered table-striped">
<tr>
<td>In</td>
<td>{!! Amount::format($incomeSum) !!}</td>
</tr>
<tr>
<td>Out</td>
<td>{!! Amount::format($expenseSum*-1) !!}</td>
</tr>
<tr>
<td>Difference</td>
<td>{!! Amount::format($incomeSum - $expenseSum) !!}</td>
</tr>
</table>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="panel panel-default">
<div class="panel-heading">
Income
</div>
<table class="table">
<?php $sum = 0;?>
@foreach($groupedIncomes as $income)
<?php $sum += floatval($income->amount)*-1;?>
<tr>
<td><a href="{{route('accounts.show',$income->account_id)}}">{{{$income->name}}}</a></td>
<td>{!! Amount::format(floatval($income->amount)*-1) !!}</td>
</tr>
@endforeach
<tr>
<td><em>Sum</em></td>
<td>{!! Amount::format($sum) !!}</td>
</tr>
</table>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="panel panel-default">
<div class="panel-heading">
Expenses
</div>
<table class="table">
<?php $sum = 0;?>
@foreach($groupedExpenses as $id => $expense)
<tr>
<td><a href="{{route('accounts.show',$id)}}">{{{$expense['name']}}}</a></td>
<td>{!! Amount::format(floatval($expense['amount'])*-1) !!}</td>
</tr>
<?php $sum += floatval($expense['amount'])*-1;?>
@endforeach
<tr>
<td><em>Sum</em></td>
<td>{!! Amount::format($sum) !!}</td>
</tr>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
Budgets
</div>
<div class="panel-body">
<div id="budgets"></div>
</div>
</div>
</div>
</div>
@stop
@section('scripts')
<!-- load the libraries and scripts necessary for Google Charts: -->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="js/gcharts.options.js"></script>
<script type="text/javascript" src="js/gcharts.js"></script>
<script type="text/javascript">
var year = '{{$year}}';
var currencyCode = '{{Amount::getCurrencyCode()}}';
</script>
<script type="text/javascript" src="js/reports.js"></script>
@stop