Update code for reconciliation.

This commit is contained in:
James Cole
2017-11-22 16:54:49 +01:00
parent 4b87e5be55
commit 69bb76b6fe
10 changed files with 196 additions and 54 deletions

View File

@@ -647,6 +647,18 @@ return [
'select_more_than_one_budget' => 'Please select more than one budget',
'select_more_than_one_tag' => 'Please select more than one tag',
'account_default_currency' => 'If you select another currency, new transactions from this account will have this currency pre-selected.',
'reconcile_has_more' => 'Your Firefly III ledger has more money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".',
'reconcile_has_less' => 'Your Firefly III ledger has less money in it than your bank claims you should have. There are several options. Please choose what to do. Then, press "Confirm reconciliation".',
'reconcile_is_equal' => 'Your Firefly III ledger and your bank statements match. There is nothing to do. Please press "Confirm reconciliation" to confirm your input.',
'create_pos_reconcile_transaction' => 'Clear the selected transactions, and create a correction adding :amount to this asset account.',
'create_neg_reconcile_transaction' => 'Clear the selected transactions, and create a correction removing :amount from this asset account.',
'reconcile_do_nothing' => 'Clear the selected transactions, but do not correct.',
'reconcile_go_back' => 'You can always edit or delete a correction later.',
'confirm_reconciliation' => 'Confirm reconciliation',
'submitted_start_balance' => 'Submitted start balance',
'selected_transactions' => 'Selected transactions (:count)',
'already_cleared_transactions' => 'Already cleared transactions (:count)',
'submitted_end_balance' => 'Submitted end balance',
// categories:
'new_category' => 'New category',

View File

@@ -7,7 +7,7 @@
{% block content %}
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'reconcile_range'|_ }}</h3>
@@ -89,32 +89,17 @@
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'reconcile_options'|_ }}</h3>
</div>
<div class="box-body no-padding">
<table class="table table-hover">
<thead>
<tr>
<th style="width:50%;">{{ 'difference'|_ }}</th>
<th>{{ 'actions'|_ }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p class="lead" id="difference"></p>
</td>
<td>
<div class="btn-group">
<button class="btn btn-default store_reconcile" disabled><i class="fa fa-fw fa-check"></i> {{ 'store_reconcile'|_ }}</button>
</div>
</td>
</tr>
</tbody>
</table>
<div class="box-body">
<p class="lead" id="difference"></p>
<div class="btn-group">
<button class="btn btn-default store_reconcile" disabled><i class="fa fa-fw fa-check"></i> {{ 'store_reconcile'|_ }}</button>
</div>
</div>
</div>
</div>

View File

@@ -1,4 +1,4 @@
<div class="modal-dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span>&times;</span><span class="sr-only">{{ 'close'|_ }}</span>
@@ -7,31 +7,90 @@
</h4>
</div>
<form style="display: inline;" id="income" action="some route" method="POST">
<form style="display: inline;" class="form-horizontal" id="income" action="{{ route }}" method="POST">
<div class="modal-body">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<input type="hidden" name="start" value="{{ start.format('Y-m-d') }}"/>
<input type="hidden" name="end" value="{{ end.format('Y-m-d') }}"/>
<input type="hidden" name="startBalance" value="{{ startBalance }}"/>
<input type="hidden" name="endBalance" value="{{ endBalance }}"/>
{% for id in transactionIds %}
<input type="hidden" name="transactions[]" value="{{ id }}" />
{% endfor %}
You have selected X transactions. Total value X. Difference is zero
reconcile will go ahead. (so no popup actually)
<table class="table table-striped table-bordered">
<tr>
<td>{{ 'submitted_start_balance'|_ }} (date)</td>
<td>{{ startBalance|formatAmount }}</td>
</tr>
<tr>
<td>{{ trans('firefly.selected_transactions', {count: transactionIds|length}) }}</td>
<td>{{ amount|formatAmount }}</td>
</tr>
<tr>
<td>{{ trans('firefly.already_cleared_transactions', {count: clearedIds|length}) }}</td>
<td>{{ clearedAmount|formatAmount }}</td>
</tr>
<tr>
<td>{{ 'submitted_end_balance'|_ }} (date)</td>
<td>{{ endBalance|formatAmount }}</td>
</tr>
{% set diff = (startBalance - endBalance) + clearedAmount + amount %}
<tr>
<td>{{ 'difference'|_ }}</td>
<td>{{ diff|formatAmount }}</td>
</tr>
</table>
<p>
{% if diff > 0 %}
{{ 'reconcile_has_more'|_ }}
{% endif %}
{% if diff < 0 %}
{{ 'reconcile_has_less'|_ }}
{% endif %}
</p>
{% if diff == 0 %}
<p>
{{ 'reconcile_is_equal'|_ }}
</p>
<input type="hidden" name="reconcile" value="nothing">
{% endif %}
{% if diff != 0 %}
<div class="form-group">
<div class="col-lg-12">
<div class="radio">
<label>
Difference is X or -X. X = you have too much money in Firefly III register. -X = you are missing amount X
in your Firefly III register.
Please correct this first, or allow firefly to create a reconcilliation transaction. You can always edit or delete this later:
[X] Create a reconciling withdrawal for amount X
[X] Create a reconciling deposit for amount X.
<div class="input-group">
<div class="input-group-addon">{{ getCurrencySymbol()|raw }}</div>
<input step="any" class="form-control" id="amount" value="{{ available }}" autocomplete="off" name="amount" type="number"/>
<input type="radio" name="reconcile" value="create">
{% if diff > 0 %}
{{ trans('firefly.create_neg_reconcile_transaction', {amount: (diff*-1)|formatAmount})|raw }}
{% endif %}
{% if diff < 0 %}
{{ trans('firefly.create_pos_reconcile_transaction', {amount: (diff*-1)|formatAmount})|raw }}
{% endif %}
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-12">
<div class="radio">
<label>
<input type="radio" checked name="reconcile" value="nothing"> {{ 'reconcile_do_nothing'|_ }}
</label>
</div>
</div>
</div>
<p>
{{ 'reconcile_go_back'|_ }}
</p>
{% endif %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ 'close'|_ }}</button>
<button type="submit" class="btn btn-primary">{{ 'update_amount'|_ }}</button>
<button type="submit" class="btn btn-primary">{{ 'confirm_reconciliation'|_ }}</button>
</div>
</form>
</div>

View File

@@ -84,6 +84,7 @@
<td>
{% if transaction.reconciled %}
{{ transaction|transactionReconciled }}
<input type="hidden" name="cleared[]" class="cleared" data-id="{{ transaction.id }}" value="{{ transaction.transaction_amount }}">
{% else %}
<input type="checkbox" name="reconciled[]"
data-younger="{% if transaction.date > end %}true{% else %}false{% endif %}"

View File

@@ -18,11 +18,7 @@
{% for account in accounts %}
<tr>
<td class="hidden-sm hidden-xs">
<div class="btn-group btn-group-xs">
<a class="btn btn-default btn-xs" title="{{ 'edit'|_ }}" href="{{ route('accounts.edit',account.id) }}"><i class="fa fa-fw fa-pencil"></i></a>
<a class="btn btn-default btn-xs" title="{{ 'reconcile'|_ }}" href="{{ route('accounts.reconcile',account.id) }}"><i class="fa fa-fw fa-check"></i></a>
<a class="btn btn-danger btn-xs" title="{{ 'delete'|_ }}" href="{{ route('accounts.delete',account.id) }}"><i class="fa fa-fw fa-trash-o"></i></a>
</div>
<div class="btn-group btn-group-xs edit_tr_buttons"><a class="btn btn-default btn-xs" title="{{ 'edit'|_ }}" href="{{ route('accounts.edit',account.id) }}"><i class="fa fa-fw fa-pencil"></i></a><a class="btn btn-default btn-xs" title="{{ 'reconcile'|_ }}" href="{{ route('accounts.reconcile',account.id) }}"><i class="fa fa-fw fa-check"></i></a><a class="btn btn-danger btn-xs" title="{{ 'delete'|_ }}" href="{{ route('accounts.delete',account.id) }}"><i class="fa fa-fw fa-trash-o"></i></a></div>
</td>
<td data-value="{{ account.name }}"><a href="{{ route('accounts.show',account.id) }}">{{ account.name }}</a></td>
{% if what == "asset" %}