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 8cfc398c74..918b52d638 100644
--- a/app/views/recurring/show.blade.php
+++ b/app/views/recurring/show.blade.php
@@ -54,4 +54,43 @@
+
+
+
+
+
+ Connected transaction journals
+
+
+
+
+
+ Date |
+ Description |
+ Amount (€) |
+ From |
+ To |
+ Budget / category |
+ ID |
+
+
+
+
+
+
+
+
+@stop
+
+@section('scripts')
+
+{{HTML::script('assets/javascript/typeahead/bootstrap3-typeahead.min.js')}}
+{{HTML::script('assets/javascript/datatables/jquery.dataTables.min.js')}}
+{{HTML::script('assets/javascript/datatables/dataTables.bootstrap.js')}}
+{{HTML::script('assets/javascript/firefly/recurring.js')}}
+@stop
+@section('styles')
+{{HTML::style('assets/stylesheets/datatables/dataTables.bootstrap.css')}}
@stop
\ No newline at end of file
diff --git a/public/assets/javascript/firefly/recurring.js b/public/assets/javascript/firefly/recurring.js
index 7580654bcc..06aacad3f4 100644
--- a/public/assets/javascript/firefly/recurring.js
+++ b/public/assets/javascript/firefly/recurring.js
@@ -1,112 +1,204 @@
$(document).ready(function () {
- $('#recurringTable').DataTable(
- {
- serverSide: true,
- ajax: URL,
- paging: true,
- processing: true,
- order: [],
- "lengthMenu": [[50, 100, 250, -1], [50, 100, 250, "All"]],
- columns: [
+ if ($('#recurringTable').length > 0) {
+ $('#recurringTable').DataTable(
{
- name: 'name',
- data: 'name',
- searchable: true,
- title: 'Name',
- render: function (data) {
- return '' + data.name + '';
- }
- },
- {
- name: 'match',
- data: 'match',
- searchable: true,
- title: 'Matches on',
- render: function (data) {
- var str = '';
- for (x in data) {
- str += '' + data[x] + ' ';
- }
- return str;//return '' + data.name + '';
- }
- },
- {
- name: 'amount_min',
- data: 'amount_min',
- searchable: false,
- title: '→',
- render: function (data) {
- return '\u20AC ' + data.toFixed(2) + '';
- }
- },
- {
- name: 'amount_max',
- data: 'amount_max',
- searchable: false,
- title: '←',
- render: function (data) {
- return '\u20AC ' + data.toFixed(2) + '';
- }
+ serverSide: true,
+ ajax: URL,
+ paging: true,
+ processing: true,
+ order: [],
+ "lengthMenu": [[50, 100, 250, -1], [50, 100, 250, "All"]],
+ columns: [
+ {
+ name: 'name',
+ data: 'name',
+ searchable: true,
+ title: 'Name',
+ render: function (data) {
+ return '' + data.name + '';
+ }
+ },
+ {
+ name: 'match',
+ data: 'match',
+ searchable: true,
+ title: 'Matches on',
+ render: function (data) {
+ var str = '';
+ for (x in data) {
+ str += '' + data[x] + ' ';
+ }
+ return str;//return '' + data.name + '';
+ }
+ },
+ {
+ name: 'amount_min',
+ data: 'amount_min',
+ searchable: false,
+ title: '→',
+ render: function (data) {
+ return '\u20AC ' + data.toFixed(2) + '';
+ }
+ },
+ {
+ name: 'amount_max',
+ data: 'amount_max',
+ searchable: false,
+ title: '←',
+ render: function (data) {
+ return '\u20AC ' + data.toFixed(2) + '';
+ }
- },
- {
- name: 'date',
- data: 'date',
- title: 'Expected on',
- searchable: false
- },
+ },
+ {
+ name: 'date',
+ data: 'date',
+ title: 'Expected on',
+ searchable: false
+ },
- {
- name: 'active',
- data: 'active',
- searchable: false,
- sortable: false,
- render: function(data) {
- if(data == 1) {
- return '';
- } else {
- return '';
+ {
+ name: 'active',
+ data: 'active',
+ searchable: false,
+ sortable: false,
+ render: function (data) {
+ if (data == 1) {
+ return '';
+ } else {
+ return '';
+ }
+ },
+ title: 'Is active?'
+ },
+ {
+ name: 'automatch',
+ data: 'automatch',
+ sortable: false,
+ searchable: false,
+ render: function (data) {
+ if (data == 1) {
+ return '';
+ } else {
+ return '';
+ }
+ },
+ title: 'Automatch?'
+ },
+ {
+ name: 'repeat_freq',
+ data: 'repeat_freq',
+ searchable: false,
+ sortable: false,
+ title: 'Repeat frequency'
+ },
+ {
+ name: 'id',
+ data: 'id',
+ searchable: false,
+ sortable: false,
+ title: '',
+ render: function (data, type, full, meta) {
+ return '';
+ }
}
- },
- title: 'Is active?'
- },
- {
- name: 'automatch',
- data: 'automatch',
- sortable: false,
- searchable: false,
- render: function(data) {
- if(data == 1) {
- return '';
- } else {
- return '';
- }
- },
- title: 'Automatch?'
- },
- {
- name: 'repeat_freq',
- data: 'repeat_freq',
- searchable: false,
- sortable: false,
- title: 'Repeat frequency'
- },
- {
- name: 'id',
- data: 'id',
- searchable: false,
- sortable: false,
- title: '',
- render: function (data, type, full, meta) {
- return '';
- }
+ ]
}
- ]
+ );
}
- );
-});
\ No newline at end of file
+ if ($('#transactionTable').length > 0) {
+ $('#transactionTable').DataTable(
+ {
+ serverSide: true,
+ ajax: URL,
+ paging: true,
+ processing: true,
+ order: [],
+ "lengthMenu": [[50, 100, 250, -1], [50, 100, 250, "All"]],
+ columns: [
+ {
+ name: 'date',
+ data: 'date',
+ searchable: false
+ },
+ {
+ name: 'description',
+ data: 'description',
+ render: function (data, type, full, meta) {
+ icon = 'glyphicon-arrow-left';
+
+ return ' ' +
+ '' + data.description + '';
+ }
+ },
+ {
+ name: 'amount',
+ data: 'amount',
+ 'title': 'Amount (\u20AC)',
+ searchable: false,
+ render: function (data, type, full, meta) {
+ return '\u20AC ' + data.toFixed(2) + '';
+ }
+ },
+ {
+ name: 'from',
+ data: 'from',
+ searchable: false,
+ render: function (data, type, full, meta) {
+ return '' + data.name + '';
+ }
+ },
+ {
+ name: 'to',
+ data: 'to',
+ searchable: false,
+ render: function (data, type, full, meta) {
+ return '' + data.name + '';
+ }
+ },
+ {
+ name: 'components',
+ data: 'components',
+ searchable: true,
+ sortable: false,
+ title: '',
+ render: function (data, type, full, meta) {
+ var html = '';
+ if (data.budget_id > 0) {
+ html += ' ';
+ }
+ if (data.category_id > 0) {
+ html += ' ';
+ }
+ if (data.recurring_id > 0) {
+ html += ' ';
+ }
+ return html;
+ }
+ },
+ {
+ name: 'id',
+ data: 'id',
+ searchable: false,
+ sortable: false,
+ title: '',
+ render: function (data, type, full, meta) {
+ return '';
+ }
+ }
+ ]
+ }
+ );
+ }
+ }
+);
\ No newline at end of file