mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
New code for #736
This commit is contained in:
parent
8f57222098
commit
b899628dbe
@ -250,6 +250,62 @@ class AccountController extends Controller
|
||||
return view('accounts.index', compact('what', 'subTitleIcon', 'subTitle', 'accounts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Account $account
|
||||
* @param string $moment
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function reconcile(Request $request, Account $account, string $moment = '')
|
||||
{
|
||||
if ($account->accountType->type === AccountType::INITIAL_BALANCE) {
|
||||
return $this->redirectToOriginalAccount($account);
|
||||
}
|
||||
/** @var CurrencyRepositoryInterface $currencyRepos */
|
||||
$currencyRepos = app(CurrencyRepositoryInterface::class);
|
||||
$currencyId = intval($account->getMeta('currency_id'));
|
||||
$currency = $currencyRepos->find($currencyId);
|
||||
if ($currencyId === 0) {
|
||||
$currency = app('amount')->getDefaultCurrency();
|
||||
}
|
||||
|
||||
// get start and end
|
||||
$range = Preferences::get('viewRange', '1M')->data;
|
||||
$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));
|
||||
$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));
|
||||
$startBalance = round(app('steam')->balance($account, $start), $currency->decimal_places);
|
||||
$endBalance = round(app('steam')->balance($account, $end), $currency->decimal_places);
|
||||
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
|
||||
$subTitle = trans('firefly.reconcile_account', ['account' => $account->name]);
|
||||
|
||||
if(strlen($moment) > 0 && $moment !== 'all') {
|
||||
$start = new Carbon($moment);
|
||||
$end = Navigation::endOfPeriod($start, $range);
|
||||
}
|
||||
|
||||
return view('accounts.reconcile', compact('account', 'currency', 'subTitleIcon', 'start', 'end', 'subTitle', 'startBalance', 'endBalance'));
|
||||
|
||||
// prep for "specific date" view.
|
||||
if (strlen($moment) > 0 && $moment !== 'all') {
|
||||
$start = new Carbon($moment);
|
||||
$end = Navigation::endOfPeriod($start, $range);
|
||||
}
|
||||
|
||||
// grab journals:
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);
|
||||
if (!is_null($start)) {
|
||||
$collector->setRange($start, $end);
|
||||
}
|
||||
$transactions = $collector->getPaginatedJournals();
|
||||
$transactions->setPath(route('accounts.show', [$account->id, $moment]));
|
||||
|
||||
return view(
|
||||
'accounts.show',
|
||||
compact('account', 'currency', 'moment', 'periods', 'subTitleIcon', 'transactions', 'subTitle', 'start', 'end', 'chartUri')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an account.
|
||||
|
8
public/js/ff/transactions/list.js
vendored
8
public/js/ff/transactions/list.js
vendored
@ -48,7 +48,7 @@ $(document).ready(function () {
|
||||
// click the delete button:
|
||||
$('.mass_delete').click(goToMassDelete);
|
||||
// click reconcile button
|
||||
$('.mass_reconcile').click(goToReconcile);
|
||||
// $('.mass_reconcile').click(goToReconcile);
|
||||
});
|
||||
|
||||
/**
|
||||
@ -226,6 +226,9 @@ function stopMassSelect() {
|
||||
// hide the stop button
|
||||
$('.mass_stop_select').hide();
|
||||
|
||||
// show reconcile account button, if present
|
||||
$('.mass_reconcile').show();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -253,5 +256,8 @@ function startMassSelect() {
|
||||
// show the stop button
|
||||
$('.mass_stop_select').show();
|
||||
|
||||
// hide reconcile account button, if present
|
||||
$('.mass_reconcile').hide();
|
||||
|
||||
return false;
|
||||
}
|
@ -589,6 +589,7 @@ return [
|
||||
'bill_is_active' => 'Bill is active',
|
||||
'bill_will_automatch' => 'Bill will automatically linked to matching transactions',
|
||||
'skips_over' => 'skips over',
|
||||
|
||||
// accounts:
|
||||
'details_for_asset' => 'Details for asset account ":name"',
|
||||
'details_for_expense' => 'Details for expense account ":name"',
|
||||
@ -617,6 +618,7 @@ return [
|
||||
'revenue_accounts' => 'Revenue accounts',
|
||||
'cash_accounts' => 'Cash accounts',
|
||||
'Cash account' => 'Cash account',
|
||||
'reconcile_account' => 'Reconcile account ":account"',
|
||||
'cash' => 'cash',
|
||||
'account_type' => 'Account type',
|
||||
'save_transactions_by_moving' => 'Save these transaction(s) by moving them to another account:',
|
||||
|
117
resources/views/accounts/reconcile.twig
Normal file
117
resources/views/accounts/reconcile.twig
Normal file
@ -0,0 +1,117 @@
|
||||
{% extends "./layout/default" %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, account, moment, start, end) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'reconcile_range'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="width:50%;">{{ 'start_balance'|_ }}</th>
|
||||
<th colspan="2">{{ 'end_balance'|_ }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width:25%;">
|
||||
{{ 'date'|_ }}
|
||||
</td>
|
||||
<td style="width:25%;">
|
||||
{{ 'balance'|_ }}
|
||||
</td>
|
||||
<td style="width:25%;">
|
||||
{{ 'date'|_ }}
|
||||
</td>
|
||||
<td style="width:25%;">
|
||||
{{ 'balance'|_ }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">
|
||||
<i class="fa fa-calendar"></i>
|
||||
</div>
|
||||
<input type="date" value="{{ start.format('Y-m-d') }}" name="start_date" class="form-control">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon non-selectable-currency-symbol">{{ currency.symbol }}</span>
|
||||
<input type="number" value="{{ startBalance }}" name="start_balance" class="form-control">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">
|
||||
<i class="fa fa-calendar"></i>
|
||||
</div>
|
||||
<input type="date" value="{{ end.format('Y-m-d') }}" name="end_date" class="form-control">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon non-selectable-currency-symbol">{{ currency.symbol }}</span>
|
||||
<input type="number" value="{{ endBalance }}" name="end_balance" class="form-control">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<a href="#" class="btn btn-default">
|
||||
{{ 'update'|_ }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 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">
|
||||
Do something
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
currencySymbol = "{{ currency.symbol }}";
|
||||
var accountID = {{ account.id }};
|
||||
</script>
|
||||
<script src="js/ff/accounts/reconcile.js?v={{ FF_VERSION }}" type="text/javascript"></script>
|
||||
{% endblock %}
|
@ -85,7 +85,7 @@
|
||||
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{% include 'list.journals' with {sorting:true, hideBills:true, hideBudgets: true, hideCategories: true} %}
|
||||
{% include 'list.journals' with {sorting:true, hideBills:true, hideBudgets: true, hideCategories: true, showReconcile: true} %}
|
||||
{% if periods.count > 0 %}
|
||||
<p>
|
||||
<i class="fa fa-calendar"></i>
|
||||
|
@ -19,8 +19,9 @@
|
||||
<tr>
|
||||
<td class="hidden-sm hidden-xs">
|
||||
<div class="btn-group btn-group-xs">
|
||||
<a class="btn btn-default btn-xs" href="{{ route('accounts.edit',account.id) }}"><i class="fa fa-fw fa-pencil"></i></a>
|
||||
<a class="btn btn-danger btn-xs" href="{{ route('accounts.delete',account.id) }}"><i class="fa fa-fw fa-trash-o"></i></a>
|
||||
<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>
|
||||
|
@ -36,7 +36,7 @@
|
||||
<div class="col-lg-8 col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="mass_button_options btn-group btn-group" style="display:none;">
|
||||
<a href="#" class="btn btn-default mass_edit"><i class="fa fa-fw fa-pencil"></i> <span>{{ 'edit'|_ }}</span></a>
|
||||
<a href="#" class="btn btn-default mass_reconcile"><i class="fa fa-fw fa-check"></i> <span>{{ 'reconcile_selected'|_ }} (<i class="fa fa-spinner fa-spin"></i>)</span></a>
|
||||
{#<a href="#" class="btn btn-default mass_reconcile"><i class="fa fa-fw fa-check"></i> <span>{{ 'reconcile_selected'|_ }} (<i class="fa fa-spinner fa-spin"></i>)</span></a>#}
|
||||
<a href="#" class="btn btn-danger mass_delete"><i class="fa fa-fw fa-trash"></i> <span>{{ 'delete'|_ }}</span></a>
|
||||
</div>
|
||||
|
||||
@ -47,6 +47,9 @@
|
||||
<a href="#" class="btn btn-default mass_select"><i class="fa fa-fw fa-check-square-o"></i> {{ 'select_transactions'|_ }}</a>
|
||||
<a href="#" class="btn btn-default mass_stop_select" style="display:none;"><i class="fa faw-fw fa-square-o"
|
||||
></i> {{ 'stop_selection'|_ }}</a>
|
||||
{% if showReconcile == true %}
|
||||
<a href="{{ route('accounts.reconcile', [account.id, moment]) }}" class="btn btn-info mass_reconcile"><i class="fa fa-fw fa-check"></i> {{ 'reconcile_this_account'|_ }}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -58,5 +61,5 @@
|
||||
<script type="text/javascript">
|
||||
var edit_selected_txt = "{{ 'edit'|_ }}";
|
||||
var delete_selected_txt = "{{ 'delete'|_ }}";
|
||||
var reconcile_selected_txt = "{{ 'reconcile_selected'|_ }}";
|
||||
{# var reconcile_selected_txt = "{{ 'reconcile_selected'|_ }}"; #}
|
||||
</script>
|
||||
|
@ -109,7 +109,7 @@
|
||||
<script type="text/javascript">
|
||||
var edit_selected_txt = "{{ 'edit'|_ }}";
|
||||
var delete_selected_txt = "{{ 'delete'|_ }}";
|
||||
var reconcile_selected_txt = "{{ 'reconcile_selected'|_ }}";
|
||||
{# var reconcile_selected_txt = "{{ 'reconcile_selected'|_ }}"; #}
|
||||
|
||||
var searchQuery = "{{ fullQuery|escape('js') }}";
|
||||
var searchUri = "{{ route('search.search') }}";
|
||||
|
@ -90,6 +90,7 @@ Route::group(
|
||||
Route::get('{what}', ['uses' => 'AccountController@index', 'as' => 'index'])->where('what', 'revenue|asset|expense');
|
||||
Route::get('create/{what}', ['uses' => 'AccountController@create', 'as' => 'create'])->where('what', 'revenue|asset|expense');
|
||||
Route::get('edit/{account}', ['uses' => 'AccountController@edit', 'as' => 'edit']);
|
||||
Route::get('reconcile/{account}/{moment?}', ['uses' => 'AccountController@reconcile', 'as' => 'reconcile']);
|
||||
Route::get('delete/{account}', ['uses' => 'AccountController@delete', 'as' => 'delete']);
|
||||
Route::get('show/{account}/{moment?}', ['uses' => 'AccountController@show', 'as' => 'show']);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user