mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Expanded account view.
This commit is contained in:
parent
edda470bf8
commit
08ca3c89d3
@ -36,14 +36,6 @@ class ReportHelper implements ReportHelperInterface
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Carbon
|
||||
*/
|
||||
public function firstDate()
|
||||
{
|
||||
return Session::get('first');
|
||||
}
|
||||
|
||||
/**
|
||||
* This method gets some kind of list for a monthly overview.
|
||||
*
|
||||
|
@ -14,11 +14,6 @@ interface ReportHelperInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return Carbon
|
||||
*/
|
||||
public function firstDate();
|
||||
|
||||
/**
|
||||
* @param Carbon $date
|
||||
*
|
||||
|
@ -12,6 +12,7 @@ use Input;
|
||||
use Redirect;
|
||||
use Session;
|
||||
use View;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class AccountController
|
||||
@ -124,6 +125,22 @@ class AccountController extends Controller
|
||||
}]
|
||||
)->accountTypeIn($types)->get(['accounts.*']);
|
||||
|
||||
// last activity:
|
||||
$accounts->each(
|
||||
function (Account $account) {
|
||||
$lastTransaction = $account->transactions()->leftJoin(
|
||||
'transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id'
|
||||
)->orderBy('transaction_journals.date', 'DESC')->first(['transactions.*', 'transaction_journals.date']);
|
||||
if ($lastTransaction) {
|
||||
$account->lastActivityDate = $lastTransaction->transactionjournal->date;
|
||||
} else {
|
||||
$account->lastActivityDate = null;
|
||||
}
|
||||
$account->startBalance = Steam::balance($account, Session::get('start'));
|
||||
$account->endBalance = Steam::balance($account, Session::get('end'));
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
return view('accounts.index', compact('what', 'subTitleIcon', 'subTitle', 'accounts'));
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ use FireflyIII\Models\Account;
|
||||
use Illuminate\Database\Query\JoinClause;
|
||||
use Steam;
|
||||
use View;
|
||||
|
||||
use Session;
|
||||
/**
|
||||
* Class ReportController
|
||||
*
|
||||
@ -115,7 +115,7 @@ class ReportController extends Controller
|
||||
*/
|
||||
public function index(ReportHelperInterface $helper)
|
||||
{
|
||||
$start = $helper->firstDate();
|
||||
$start = Session::get('first');
|
||||
$months = $helper->listOfMonths($start);
|
||||
$years = $helper->listOfYears($start);
|
||||
$title = 'Reports';
|
||||
|
@ -8,6 +8,7 @@
|
||||
<th>Current balance</th>
|
||||
<th>Active</th>
|
||||
<th>Last activity</th>
|
||||
<th>Balance difference between {{Session::get('start')->format('jS F Y')}} and {{Session::get('end')->format('jS F Y')}}</th>
|
||||
</tr>
|
||||
@foreach($accounts as $account)
|
||||
<tr>
|
||||
@ -42,6 +43,10 @@
|
||||
<em>Never</em>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{!! Amount::format($account->endBalance - $account->startBalance) !!}
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
|
Loading…
Reference in New Issue
Block a user