Skip to content

Firefly III: a personal finances manager

First full transaction list (again) and removed some google table references.

James Cole0530c0402cf5
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 8544c5fc99..8efebdd130 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -220,11 +220,17 @@ class AccountController extends BaseController
break;
}
+ // get a paginated view of all transactions for this account:
+ /** @var \FireflyIII\Database\Account $acct */
+ $acct = App::make('FireflyIII\Database\Account');
+
+ $journals = $acct->getTransactionJournals($account, 50);
+
//$data = $this->_accounts->show($account, 40);
- return View::make('accounts.show')->with('account', $account)->with(
+ return View::make('accounts.show',compact('account','subTitleIcon','journals'))->with('account', $account)->with(
'subTitle', 'Details for ' . strtolower($account->accountType->type) . ' "' . $account->name . '"'
- )->with(compact('subTitleIcon'));
+ );
}
/**
diff --git a/app/lib/FireflyIII/Database/Account.php b/app/lib/FireflyIII/Database/Account.php
index 74287f07c0..9c5c7cd894 100644
--- a/app/lib/FireflyIII/Database/Account.php
+++ b/app/lib/FireflyIII/Database/Account.php
@@ -483,5 +483,25 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
}
+ public function getTransactionJournals(\Account $account, $limit = 50)
+ {
+ $start = \Session::get('start');
+ $end = \Session::get('end');
+ $offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
+ $set = $this->getUser()->transactionJournals()->withRelevantData()->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
+ ->where('transactions.account_id', $account->id)->take($limit)->offset($offset)->before($end)->after($start)->orderBy('date', 'DESC')
+ ->get(['transaction_journals.*']);
+ $count = $this->getUser()->transactionJournals()->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
+ ->before($end)->after($start)->orderBy('date', 'DESC')->where('transactions.account_id', $account->id)->count();
+ $items = [];
+ foreach ($set as $entry) {
+ $items[] = $entry;
+ }
+
+ return \Paginator::make($items, $count, $limit);
+
+
+ }
+
}
\ No newline at end of file
diff --git a/app/models/TransactionJournal.php b/app/models/TransactionJournal.php
index fdc0ae6dab..94eb8318e6 100644
--- a/app/models/TransactionJournal.php
+++ b/app/models/TransactionJournal.php
@@ -213,7 +213,7 @@ class TransactionJournal extends Ardent
$q->orderBy('amount', 'ASC');
}, 'transactiontype', 'components' => function ($q) {
$q->orderBy('class');
- }, 'transactions.account.accounttype', 'recurringTransaction']
+ }, 'transactions.account.accounttype', 'recurringTransaction','budgets','categories']
);
}
diff --git a/app/views/accounts/show.blade.php b/app/views/accounts/show.blade.php
index 8d5842fd67..e96f37cd3b 100644
--- a/app/views/accounts/show.blade.php
+++ b/app/views/accounts/show.blade.php
@@ -48,7 +48,7 @@
<i class="fa fa-repeat fa-fw"></i> Transactions
</div>
<div class="panel-body">
- <div id="account-transactions"></div>
+ @include('list.journals-full')
</div>
</div>
</div>
diff --git a/app/views/list/journals-full.blade.php b/app/views/list/journals-full.blade.php
new file mode 100644
index 0000000000..c07e757bda
--- /dev/null
+++ b/app/views/list/journals-full.blade.php
@@ -0,0 +1,90 @@
+<table class="table table-striped table-bordered">
+ <tr>
+ <th>&nbsp;</th>
+ <th>&nbsp;</th>
+ <th>Description</th>
+ <th>Amount</th>
+ <th>Date</th>
+ <th>From</th>
+ <th>To</th>
+ <th><i class="fa fa-tasks fa-fw" title="Budget"></i></th>
+ <th><i class="fa fa-bar-chart fa-fw" title="Category"></i></th>
+ <th><i class="fa fa-fw fa-rotate-right" title="Recurring transaction"></i></th>
+ </tr>
+ @foreach($journals as $journal)
+ <tr>
+ <td>
+ <div class="btn-group btn-group-xs">
+ <a href="{{route('transactions.edit',$journal->id)}}" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-pencil"></span></a>
+ <a href="{{route('transactions.delete',$journal->id)}}" class="btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span></a>
+ </div>
+ </td>
+ <td>
+ @if($journal->transactiontype->type == 'Withdrawal')
+ <span class="glyphicon glyphicon-arrow-left" title="Withdrawal"></span>
+ @endif
+ @if($journal->transactiontype->type == 'Deposit')
+ <span class="glyphicon glyphicon-arrow-right" title="Deposit"></span>
+ @endif
+ @if($journal->transactiontype->type == 'Transfer')
+ <span class="glyphicon glyphicon-resize-full" title="Transfer"></span>
+ @endif
+ @if($journal->transactiontype->type == 'Opening balance')
+ <span class="glyphicon glyphicon-ban-circle" title="Opening balance"></span>
+ @endif
+ </td>
+ <td>
+ <a href="{{route('transactions.show',$journal->id)}}" title="{{{$journal->description}}}">{{{$journal->description}}}</a>
+ </td>
+ <td>
+ @if($journal->transactiontype->type == 'Withdrawal')
+ <span class="text-danger">{{mf($journal->transactions[1]->amount,false)}}</span>
+ @endif
+ @if($journal->transactiontype->type == 'Deposit')
+ <span class="text-success">{{mf($journal->transactions[1]->amount,false)}}</span>
+ @endif
+ @if($journal->transactiontype->type == 'Transfer')
+ <span class="text-info">{{mf($journal->transactions[1]->amount,false)}}</span>
+ @endif
+ </td>
+ <td>
+ {{$journal->date->format('j F Y')}}
+ </td>
+ <td>
+ @if($journal->transactions[0]->account->accounttype->description == 'Cash account')
+ <span class="text-success">(cash)</span>
+ @else
+ <a href="{{route('accounts.show',$journal->transactions[0]->account_id)}}">{{{$journal->transactions[0]->account->name}}}</a>
+ @endif
+ </td>
+ <td>
+ @if($journal->transactions[1]->account->accounttype->description == 'Cash account')
+ <span class="text-success">(cash)</span>
+ @else
+ <a href="{{route('accounts.show',$journal->transactions[1]->account_id)}}">{{{$journal->transactions[1]->account->name}}}</a>
+ @endif
+ </td>
+ <td>
+ <?php $budget = isset($journal->budgets[0]) ? $journal->budgets[0] : null; ?>
+ @if($budget)
+ <a href="{{route('budgets.show',$budget->id)}}">{{{$budget->name}}}</a>
+ @endif
+ </td>
+ <td>
+ <?php $category = isset($journal->categories[0]) ? $journal->categories[0] : null; ?>
+ @if($category)
+ <a href="{{route('categories.show',$category->id)}}">{{{$category->name}}}</a>
+ @endif
+ </td>
+ <td>
+ @if($journal->recurringTransaction)
+ <a href="{{route('recurring.show',$journal->recurring_transaction_id)}}">{{{$journal->recurringTransaction->name}}}</a>
+ @endif
+ </td>
+
+
+ </tr>
+ @endforeach
+</table>
+
+{{$journals->links()}}
\ No newline at end of file
diff --git a/public/assets/javascript/firefly/accounts.js b/public/assets/javascript/firefly/accounts.js
index 2387946845..31882b5442 100644
--- a/public/assets/javascript/firefly/accounts.js
+++ b/public/assets/javascript/firefly/accounts.js
@@ -8,13 +8,5 @@ $(function () {
googleSankeyChart('chart/sankey/' + accountID + '/out', 'account-out-sankey');
googleSankeyChart('chart/sankey/' + accountID + '/in', 'account-in-sankey');
}
- if (typeof(googleTable) == 'function') {
- if (typeof accountID != 'undefined') {
- googleTable('table/account/' + accountID + '/transactions', 'account-transactions');
- }
- if (typeof what != 'undefined') {
- googleTable('table/accounts/' + what, 'account-list');
- }
- }
});
\ No newline at end of file
diff --git a/public/assets/javascript/firefly/budgets.js b/public/assets/javascript/firefly/budgets.js
index d3aa69725c..027a892372 100644
--- a/public/assets/javascript/firefly/budgets.js
+++ b/public/assets/javascript/firefly/budgets.js
@@ -7,14 +7,8 @@ $(function () {
$('.updateIncome').on('click', updateIncome);
- if (typeof(googleTable) == 'function') {
- if (typeof componentID != 'undefined' && typeof repetitionID == 'undefined') {
- googleTable('table/component/' + componentID + '/0/transactions', 'transactions');
- googleColumnChart('chart/component/' + componentID + '/spending/' + year, 'componentOverview');
-
- } else if (typeof componentID != 'undefined' && typeof repetitionID != 'undefined') {
- googleTable('table/component/' + componentID + '/' + repetitionID + '/transactions', 'transactions');
- }
+ if (typeof componentID != 'undefined' && typeof repetitionID == 'undefined') {
+ googleColumnChart('chart/component/' + componentID + '/spending/' + year, 'componentOverview');
}
});