Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Show everything on demand.
James Cole5a505c84696e
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.phpindex ec775e50de..68f81e7a32 100644--- a/app/controllers/AccountController.php+++ b/app/controllers/AccountController.php@@ -241,8 +241,12 @@ class AccountController extends BaseController// 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, 10);+ if (Input::get('showAll') == 'true') {++ $journals = $acct->getAllTransactionJournals($account, 10);+ } else {+ $journals = $acct->getTransactionJournals($account, 10);+ }//$data = $this->_accounts->show($account, 40);diff --git a/app/lib/FireflyIII/Database/Account.php b/app/lib/FireflyIII/Database/Account.phpindex cde242e623..0bca22a5e4 100644--- a/app/lib/FireflyIII/Database/Account.php+++ b/app/lib/FireflyIII/Database/Account.php@@ -445,6 +445,26 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface}+ public function getAllTransactionJournals(\Account $account, $limit = 50)+ {+ $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)->orderBy('date', 'DESC')->get(+ ['transaction_journals.*']+ );+ $count = $this->getUser()->transactionJournals()->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')+ ->orderBy('date', 'DESC')->where('transactions.account_id', $account->id)->count();+ $items = [];+ foreach ($set as $entry) {+ $items[] = $entry;+ }++ return \Paginator::make($items, $count, $limit);+++ }+public function getTransactionJournals(\Account $account, $limit = 50){$start = \Session::get('start');@@ -476,11 +496,12 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface*/public function getTransactionJournalsInRange(\Account $account, Carbon $start, Carbon $end){- $set = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->withRelevantData()->leftJoin(+ $set = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->withRelevantData()->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.account_id', $account->id)->before($end)->after($start)->orderBy('date', 'DESC')->get(['transaction_journals.*']);+return $set;}diff --git a/app/views/accounts/show.blade.php b/app/views/accounts/show.blade.phpindex e96f37cd3b..ca7c1dd86d 100644--- a/app/views/accounts/show.blade.php+++ b/app/views/accounts/show.blade.php@@ -14,6 +14,20 @@<div class="col-lg-4 col-md-6 col-sm-12"><!-- time based navigation -->@include('partials.date_nav')+ <div class="panel panel-default">+ <div class="panel-heading">+ <i class="fa fa-clock-o fa-fw"></i> View options for {{{$account->name}}}+ </div>+ <div class="panel-body">+ <p>+ @if(Input::get('showAll') == 'true')+ <a href="{{route('accounts.show',$account->id)}}" class="btn btn-default">Stick to date-range</a>+ @else+ <a href="{{route('accounts.show',$account->id)}}?showAll=true" class="btn btn-default">Show all transactions</a>+ @endif+ </p>+ </div>+ </div></div></div>