First attempt at audit report (uses lots of queries).

This commit is contained in:
James Cole
2016-04-08 14:50:18 +02:00
parent 8116644526
commit 33bf373151
8 changed files with 465 additions and 32 deletions

View File

@@ -1,6 +1,6 @@
{{ journals.render|raw }}
<table class="table table-hover {% if sorting %}sortable-table{% endif %}">
<table class="table table-hover table-compressed {% if sorting %}sortable-table{% endif %}">
<thead>
<tr class="ignore">
<th class="hidden-xs" colspan="2">&nbsp;</th>

View File

@@ -6,6 +6,28 @@
{% block content %}
<!-- options block -->
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'options'|_ }}</h3>
</div>
<div class="box-body">
<ul class="list-inline">
{% for hide in hideable %}
<li><input
{% if hide in defaultShow %}checked{% endif %}
type="checkbox" class="audit-option-checkbox" name="option[]" value="{{ hide }}" id="option_{{ hide }}" /> <label for="option_{{ hide }}" style="font-weight:normal;">{{ trans('list.'~hide) }}</label></li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
{% for account in accounts %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
@@ -13,31 +35,34 @@
<div class="box-header with-border">
<h3 class="box-title">{{ account.name }}</h3>
</div>
<div class="box-body">
{% if not auditData[account.id].exists %}
{% if not auditData[account.id].exists %}
<div class="box-body">
<em>
No activity was recorded
on account <a href="{{ route('accounts.show',account.id) }}"
title="{{ account.name }}">{{ account.name }}</a>
between
between
{{ start }} and
{{ end }}.
</em>
{% else %}
<p>
Account balance of <a href="{{ route('accounts.show',account.id) }}"
title="{{ account.name }}">{{ account.name }}</a>
at the end of {{ auditData[account.id].end }} was:
{{ auditData[account.id].endBalance|formatAmount }}
</p>
{% include 'list/journals-extended.twig' with {'journals': auditData[account.id].journals,'account':account} %}
<p>
Account balance of <a href="{{ route('accounts.show',account.id) }}" title="{{ account.name }}">{{ account.name }}</a>
at the end of {{ auditData[account.id].dayBefore }} was:
{{ auditData[account.id].dayBeforeBalance|formatAmount }}
</p>
{% endif %}
</div>
</div>
{% else %}
<div class="box-body table-responsive no-padding">
<p style="padding:10px;">
Account balance of <a href="{{ route('accounts.show',account.id) }}"
title="{{ account.name }}">{{ account.name }}</a>
at the end of {{ auditData[account.id].end }} was:
{{ auditData[account.id].endBalance|formatAmount }}
</p>
{% include 'reports/partials/journals-audit.twig' with {'journals': auditData[account.id].journals,'account':account} %}
<p style="padding:10px;">
Account balance of <a href="{{ route('accounts.show',account.id) }}" title="{{ account.name }}">{{ account.name }}</a>
at the end of {{ auditData[account.id].dayBefore }} was:
{{ auditData[account.id].dayBeforeBalance|formatAmount }}
</p>
</div>
{% endif %}
</div>
</div>
</div>
@@ -47,4 +72,8 @@
{% block styles %}
{% endblock %}
{% block scripts %}
<script type="text/javascript">
var hideable = {{ hideable|json_encode|raw }};
</script>
<script type="text/javascript" src="js/reports/audit/all.js"></script>
{% endblock %}

View File

@@ -0,0 +1,96 @@
{{ journals.render|raw }}
<table class="table table-hover table-compressed">
<thead>
<tr class="ignore">
<th class="hide-buttons">&nbsp;</th>
<th class="hide-icon">&nbsp;</th>
<th class="hide-description">{{ trans('list.description') }}</th>
<th class="hide-balance_before">{{ trans('list.balance_before') }}</th>
<th class="hide-amount">{{ trans('list.amount') }}</th>
<th class="hide-balance_after">{{ trans('list.balance_after') }}</th>
<th class="hide-date">{{ trans('list.date') }}</th>
<th class="hide-book_date">{{ trans('list.book_date') }}</th>
<th class="hide-process_date">{{ trans('list.process_date') }}</th>
<th class="hide-interest_date">{{ trans('list.interest_date') }}</th>
<th class="hide-from">{{ trans('list.from') }}</th>
<th class="hide-to">{{ trans('list.to') }}</th>
<th class="hide-budget"><i class="fa fa-tasks fa-fw" title="{{ trans('list.budget') }}"></i></th>
<th class="hide-category"><i class="fa fa-bar-chart fa-fw" title="{{ trans('list.category') }}"></i></th>
<th class="hide-bill">{{ trans('list.bill') }}</th>
<th class="hide-create_date">{{ trans('list.create_date') }}</th>
<th class="hide-update_date">{{ trans('list.update_date') }}</th>
</tr>
</thead>
<tbody>
{% for journal in journals %}
<tr data-date="{{ journal.date.format('Y-m-d') }}" data-id="{{ journal.id }}">
<td class="hide-buttons">
<div class="btn-group btn-group-xs">
<a href="{{ route('transactions.edit',journal.id) }}" class="btn btn-xs btn-default"><i class="fa fa-fw fa-pencil"></i></a>
<a href="{{ route('transactions.delete',journal.id) }}" class="btn btn-xs btn-danger"><i class="fa fa-fw fa-trash-o"></i></a></div></td>
<td class="hide-icon">{{ journal|typeIcon }}</td>
<td class="hide-description"><a href="{{ route('transactions.show',journal.id) }}" title="{{ journal.description }}">{{ journal.description }}</a></td>
<td class="hide-balance_before">{{ journal.before|formatAmount }}</td>
<td class="hide-amount">{{ journal|formatJournal }}</td>
<td class="hide-balance_after">{{ journal.after|formatAmount }}</td>
<td class="hide-date">{{ journal.date.formatLocalized(monthAndDayFormat) }}</td>
<td class="hide-book_date">{{ journal.book_date.formatLocalized(monthAndDayFormat) }}</td>
<td class="hide-process_date">{{ journal.process_date.formatLocalized(monthAndDayFormat) }}</td>
<td class="hide-interest_date">{{ journal.interest_date.formatLocalized(monthAndDayFormat) }}</td>
<td class="hide-from">
{% if journal.source_account_type == 'Cash account' %}
<span class="text-success">(cash)</span>
{% else %}
<a href="{{ route('accounts.show',journal.source_account_id) }}">{{ journal.source_account_name }}</a>
{% endif %}
</td>
<td class="hide-to">
{% if journal.destination_account_type == 'Cash account' %}
<span class="text-success">(cash)</span>
{% else %}
<a href="{{ route('accounts.show',journal.destination_account_id) }}">{{ journal.destination_account_name }}</a>
{% endif %}
</td>
{% if journal.budgets[0] %}
<td class="hide-budget"><a href="{{ route('budgets.show',journal.budgets[0].id) }}">{{ journal.budgets[0].name }}</a></td>
{% else %}
<td class="hide-budget"><em>{{ 'no_budget'|_ }}</em></td>
{% endif %}
{% if journal.categories[0] %}
<td class="hide-category"><a href="{{ route('categories.show',journal.categories[0].id) }}">{{ journal.categories[0].name }}</a></td>
{% else %}
<td class="hide-category"><em>{{ 'no_category'|_ }}</em></td>
{% endif %}
{% if journal.bill_id %}
<td class="hide-bill"><i class="fa fa-fw fa-rotate-right" title="{{ trans('list.bill') }}"></i>&nbsp;<a
href="{{ route('bills.show',journal.bill_id) }}">{{ journal.bill.name }}</a></td>
{% else %}
<td class="hide-bill">&nbsp;</td>
{% endif %}
<td class="hide-create_date">
{{ journal.created_at.formatLocalized(dateTimeFormat) }}
</td>
<td class="hide-update_date">
{{ journal.updated_at.formatLocalized(dateTimeFormat) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{{ journals.render|raw }}