diff --git a/app/controllers/JsonController.php b/app/controllers/JsonController.php index 39dd28369d..671e771b95 100644 --- a/app/controllers/JsonController.php +++ b/app/controllers/JsonController.php @@ -19,7 +19,6 @@ class JsonController extends BaseController $this->helper = $helper; - } /** @@ -97,11 +96,32 @@ class JsonController extends BaseController return Response::json($resultSet); } + /** + * + */ + public function recurringjournals(RecurringTransaction $recurringTransaction) + { + $parameters = $this->helper->dataTableParameters(); + $parameters['transactionTypes'] = ['Withdrawal']; + $parameters['amount'] = 'negative'; + + $query = $this->helper->journalQuery($parameters); + + $query->where('recurring_transaction_id', $recurringTransaction->id); + $resultSet = $this->helper->journalDataset($parameters, $query); + + + /* + * Build return data: + */ + return Response::json($resultSet); + } + public function recurring() { $parameters = $this->helper->dataTableParameters(); - $query = $this->helper->recurringTransactionsQuery($parameters); - $resultSet = $this->helper->recurringTransactionsDataset($parameters, $query); + $query = $this->helper->recurringTransactionsQuery($parameters); + $resultSet = $this->helper->recurringTransactionsDataset($parameters, $query); return Response::json($resultSet); } diff --git a/app/routes.php b/app/routes.php index 920b590251..da830e8729 100644 --- a/app/routes.php +++ b/app/routes.php @@ -187,6 +187,7 @@ Route::group(['before' => 'auth'], function () { Route::get('/json/revenue', ['uses' => 'JsonController@revenue', 'as' => 'json.revenue']); Route::get('/json/transfers', ['uses' => 'JsonController@transfers', 'as' => 'json.transfers']); Route::get('/json/recurring', ['uses' => 'JsonController@recurring', 'as' => 'json.recurring']); + Route::get('/json/recurringjournals/{recurring}', ['uses' => 'JsonController@recurringjournals', 'as' => 'json.recurringjournals']); // limit controller: Route::get('/budgets/limits/create/{budget?}',['uses' => 'LimitController@create','as' => 'budgets.limits.create']); diff --git a/app/views/recurring/show.blade.php b/app/views/recurring/show.blade.php index 48f68e5c65..918b52d638 100644 --- a/app/views/recurring/show.blade.php +++ b/app/views/recurring/show.blade.php @@ -1,68 +1,96 @@ @extends('layouts.default') @section('content')
Use recurring transactions to track repeated withdrawals
--
- ++ Matching on + @foreach(explode(' ',$recurring->match) as $word) + {{{$word}}} + @endforeach + between {{mf($recurring->amount_min)}} and {{mf($recurring->amount_max)}}. + Repeats {{$recurring->repeat_freq}}. | + +|
Next reminder | +TODO TODO | +
Matches on: | -- @foreach(explode(' ',$recurring->match) as $word) - {{{$word}}} - @endforeach - | -
Between | -{{mf($recurring->amount_min)}} – {{mf($recurring->amount_max)}} | -
Repeats | -{{ucfirst($recurring->repeat_freq)}} | -
Next reminder | -{{$recurring->next()->format('d-m-Y')}} | -
Will be auto-matched | -- @if($recurring->automatch) - - @else - - @endif - | -
Is active | - -- @if($recurring->active) - - @else - - @endif - | -
Date | +Description | +Amount (€) | +From | +To | +Budget / category | +ID | +
---|