Finished category report.

This commit is contained in:
James Cole
2016-11-17 20:02:55 +01:00
parent 13b96f6136
commit 5088df103f
9 changed files with 367 additions and 199 deletions

View File

@@ -16,31 +16,27 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th>{{ 'name'|_ }}</th>
<th>{{ 'earned'|_ }}</th>
<th>{{ 'spent'|_ }}</th>
<th data-defaultsign="az">{{ 'name'|_ }}</th>
<th data-defaultsign="_19">{{ 'earned'|_ }}</th>
<th data-defaultsign="_19">{{ 'spent'|_ }}</th>
</tr>
</thead>
<tbody>
{% for account in accounts %}
<tr>
<td>
<td data-value="{{ account.name }}">
<a href="{{ route('accounts.show', account.id) }}" title="{{ account.name }}">{{ account.name }}</a>
</td>
<td>
{% if accountSummary[account.id] %}
{{ accountSummary[account.id].earned|formatAmount }}
{% else %}
{{ 0|formatAmount }}
{% endif %}
</td>
<td>
{% if accountSummary[account.id] %}
{{ accountSummary[account.id].spent|formatAmount }}
{% else %}
{{ 0|formatAmount }}
{% endif %}
</td>
{% if accountSummary[account.id] %}
<td data-value="{{ accountSummary[account.id].earned }}">{{ accountSummary[account.id].earned|formatAmount }}</td>
{% else %}
<td data-value="0">{{ 0|formatAmount }}</td>
{% endif %}
{% if accountSummary[account.id] %}
<td data-value="{{ accountSummary[account.id].spent }}">{{ accountSummary[account.id].spent|formatAmount }}</td>
{% else %}
<td data-value="0">{{ 0|formatAmount }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
@@ -56,31 +52,27 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th>{{ 'name'|_ }}</th>
<th>{{ 'earned'|_ }}</th>
<th>{{ 'spent'|_ }}</th>
<th data-defaultsign="az">{{ 'name'|_ }}</th>
<th data-defaultsign="_19">{{ 'earned'|_ }}</th>
<th data-defaultsign="_19">{{ 'spent'|_ }}</th>
</tr>
</thead>
<tbody>
{% for category in categories %}
<tr>
<td>
<td data-value="{{ category.name }}">
<a href="{{ route('categories.show', category.id) }}" title="{{ category.name }}">{{ category.name }}</a>
</td>
<td>
{% if categorySummary[category.id] %}
{{ categorySummary[category.id].earned|formatAmount }}
{% else %}
{{ 0|formatAmount }}
{% endif %}
</td>
<td>
{% if categorySummary[category.id] %}
{{ categorySummary[category.id].spent|formatAmount }}
{% else %}
{{ 0|formatAmount }}
{% endif %}
</td>
{% if categorySummary[category.id] %}
<td data-value="{{ categorySummary[category.id].earned }}">{{ categorySummary[category.id].earned|formatAmount }}</td>
{% else %}
<td data-value="0">{{ 0|formatAmount }}</td>
{% endif %}
{% if categorySummary[category.id] %}
<td data-value="{{ categorySummary[category.id].spent }}">{{ categorySummary[category.id].spent|formatAmount }}</td>
{% else %}
<td data-value="0">{{ 0|formatAmount }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
@@ -162,12 +154,6 @@
</div>
</div>
</div>
{#
big chart here
Show income / expenses per period. Differs per report: month = per day, year = per month, multi-year = per year.
In a bar chart, possibly grouped by expense/revenue account.
#}
<div class="row">
<div class="col-lg-6">
<div class="box">
@@ -178,9 +164,10 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th>{{ 'account'|_ }}</th>
<th>{{ 'spent_average'|_ }}</th>
<th>{{ 'transaction_count'|_ }}</th>
<th data-defaultsign="az">{{ 'account'|_ }}</th>
<th data-defaultsign="_19">{{ 'spent_average'|_ }}</th>
<th data-defaultsign="_19">{{ 'total'|_ }}</th>
<th data-defaultsign="_19">{{ 'transaction_count'|_ }}</th>
</tr>
</thead>
<tbody>
@@ -189,10 +176,13 @@
<td data-value="{{ row.name }}">
<a href="{{ route('accounts.show', row.id) }}">{{ row.name }}</a>
</td>
<td>
<td data-value="{{ row.average }}">
{{ row.average|formatAmount }}
</td>
<td>
<td data-value="{{ row.sum }}">
{{ row.sum|formatAmount }}
</td>
<td data-value="{{ row.count }}">
{{ row.count }}
</td>
</tr>
@@ -203,69 +193,175 @@
</div>
</div>
<div class="col-lg-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'expenses'|_ }} ({{ trans('firefly.topX', {number: 10}) }})</h3>
{% if topExpenses.count > 0 %}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'expenses'|_ }} ({{ trans('firefly.topX', {number: listLength}) }})</h3>
</div>
<div class="box-body">
<table class="table table-hover sortable">
<thead>
<tr>
<th data-defaultsort="disabled">{{ 'description'|_ }}</th>
<th data-defaultsign="month">{{ 'date'|_ }}</th>
<th data-defaultsign="az">{{ 'account'|_ }}</th>
<th data-defaultsign="_19">{{ 'amount'|_ }}</th>
</tr>
</thead>
<tbody>
{% for row in topExpenses %}
{% if loop.index > listLength %}
<tr class="overListLength">
{% else %}
<tr>
{% endif %}
<td data-sortable="false">
<a href="{{ route('transactions.show', row.journal_id) }}">
{% if row.transaction_description|length > 0 %}
{{ row.transaction_description }} ({{ row.description }})
{% else %}
{{ row.description }}
{% endif %}
</a>
</td>
<td data-value="{{ row.date.format('Y-m-d') }}">
{{ row.date.formatLocalized(monthAndDayFormat) }}
</td>
<td data-value="{{ row.opposing_account_name }}">
<a href="{{ route('accounts.show', row.opposing_account_id) }}">
{{ row.opposing_account_name }}
</a>
</td>
<td data-value="{{ row.transaction_amount }}">
{{ row.transaction_amount|formatAmount }}
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
{% if topExpenses.count > listLength %}
<tr>
<td colspan="3" class="active">
<a href="#" class="listLengthTrigger">{{ trans('firefly.show_full_list',{number:incomeTopLength}) }}</a>
</td>
</tr>
{% endif %}
</tfoot>
</table>
</div>
</div>
<div class="box-body">
</div>
</div>
{% endif %}
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'average_income_per_account'|_ }}</h3>
</div>
<div class="box-body">
{% if averageIncome|length > 0 %}
<div class="col-lg-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'average_income_per_account'|_ }}</h3>
</div>
<div class="box-body">
<table class="table table-hover sortable">
<thead>
<tr>
<th data-defaultsign="az">{{ 'account'|_ }}</th>
<th data-defaultsign="_19">{{ 'income_average'|_ }}</th>
<th data-defaultsign="_19">{{ 'total'|_ }}</th>
<th data-defaultsign="_19">{{ 'transaction_count'|_ }}</th>
</tr>
</thead>
<tbody>
{% for row in averageIncome %}
<tr>
<td data-value="{{ row.name }}">
<a href="{{ route('accounts.show', row.id) }}">{{ row.name }}</a>
</td>
<td>
{{ row.average|formatAmount }}
</td>
<td>
{{ row.sum|formatAmount }}
</td>
<td>
{{ row.count }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endif %}
<div class="col-lg-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'income'|_ }} ({{ trans('firefly.topX', {number: 10}) }})</h3>
{% if topIncome.count > 0 %}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'income'|_ }} ({{ trans('firefly.topX', {number: listLength}) }})</h3>
</div>
<div class="box-body">
<table class="table table-hover sortable">
<thead>
<tr>
<th data-defaultsort="disabled">{{ 'description'|_ }}</th>
<th>{{ 'date'|_ }}</th>
<th data-defaultsign="az">{{ 'account'|_ }}</th>
<th>{{ 'amount'|_ }}</th>
</tr>
</thead>
<tbody>
{% for row in topIncome %}
{% if loop.index > listLength %}
<tr class="overListLength">
{% else %}
<tr>
{% endif %}
<td>
<a href="{{ route('transactions.show', row.journal_id) }}">
{% if row.transaction_description|length > 0 %}
{{ row.transaction_description }} ({{ row.description }})
{% else %}
{{ row.description }}
{% endif %}
</a>
</td>
<td>
{{ row.date.formatLocalized(monthAndDayFormat) }}
</td>
<td>
<a href="{{ route('accounts.show', row.opposing_account_id) }}">
{{ row.opposing_account_name }}
</a>
</td>
<td>
{{ row.transaction_amount|formatAmount }}
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
{% if topIncome.count > listLength %}
<tr>
<td colspan="3" class="active">
<a href="#" class="listLengthTrigger">{{ trans('firefly.show_full_list',{number:incomeTopLength}) }}</a>
</td>
</tr>
{% endif %}
</tfoot>
</table>
</div>
</div>
<div class="box-body">
</div>
</div>
{% endif %}
</div>
</div>
<div class="row">
<div class="col-lg-3">
List of spending (withdrawals) by account, if relevant. Grouped:<br>
BC: 456
AH: 123
order by size
</div>
<div class="col-lg-3">
List of spending (withdrawals) by transaction, if relevant. Not grouped<br>
more groceries: 456
groceries: 123
ordered by size. top x list?
</div>
<div class="col-lg-6">
Same but for income
</div>
</div>
{% endblock %}
{% block scripts %}
<script type="text/javascript" src="js/lib/Chart.bundle.min.js"></script>
<script type="text/javascript" src="js/ff/charts.defaults.js"></script>
<script type="text/javascript" src="js/ff/charts.js"></script>
<script type="text/javascript" src="js/lib/bootstrap-sortable.js"></script>
<script type="text/javascript">
// to report another URL:
@@ -273,8 +369,6 @@
var endDate = '{{ end.format('Ymd') }}';
var accountIds = '{{ accountIds }}';
var categoryIds = '{{ categoryIds }}';
</script>
@@ -284,4 +378,5 @@
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="css/bootstrap-sortable.css" type="text/css" media="all"/>
{% endblock %}