mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Hide accounts with no activity during a year.
This commit is contained in:
parent
7f5a55dffb
commit
45bced7b34
@ -51,12 +51,12 @@ class ReportHelper implements ReportHelperInterface
|
||||
$end->endOfMonth();
|
||||
// all budgets
|
||||
$set = Auth::user()->budgets()
|
||||
->leftJoin(
|
||||
'budget_limits', function (JoinClause $join) use ($date) {
|
||||
$join->on('budget_limits.budget_id', '=', 'budgets.id')->where('budget_limits.startdate', '=', $date->format('Y-m-d'));
|
||||
}
|
||||
)
|
||||
->get(['budgets.*', 'budget_limits.amount as amount']);
|
||||
->leftJoin(
|
||||
'budget_limits', function (JoinClause $join) use ($date) {
|
||||
$join->on('budget_limits.budget_id', '=', 'budgets.id')->where('budget_limits.startdate', '=', $date->format('Y-m-d'));
|
||||
}
|
||||
)
|
||||
->get(['budgets.*', 'budget_limits.amount as amount']);
|
||||
|
||||
|
||||
$budgets = $this->_helper->makeArray($set);
|
||||
@ -141,23 +141,26 @@ class ReportHelper implements ReportHelperInterface
|
||||
}
|
||||
|
||||
$accounts = Auth::user()->accounts()->accountTypeIn(['Default account', 'Asset account'])->orderBy('accounts.name', 'ASC')->get(['accounts.*'])
|
||||
->filter(
|
||||
function (Account $account) use ($sharedAccounts) {
|
||||
if (!in_array($account->id, $sharedAccounts)) {
|
||||
return $account;
|
||||
}
|
||||
->filter(
|
||||
function (Account $account) use ($sharedAccounts) {
|
||||
if (!in_array($account->id, $sharedAccounts)) {
|
||||
return $account;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
);
|
||||
return null;
|
||||
}
|
||||
);
|
||||
$report = [];
|
||||
$start->startOfYear()->subDay();
|
||||
$end->endOfYear();
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
$report[] = [
|
||||
'start' => Steam::balance($account, $start),
|
||||
'end' => Steam::balance($account, $end),
|
||||
$startBalance = Steam::balance($account, $start);
|
||||
$endBalance = Steam::balance($account, $end);
|
||||
$report[] = [
|
||||
'start' => $startBalance,
|
||||
'end' => $endBalance,
|
||||
'hide' => ($startBalance == 0 && $endBalance == 0),
|
||||
'account' => $account,
|
||||
'shared' => $account->accountRole == 'sharedAsset'
|
||||
];
|
||||
|
@ -13,6 +13,7 @@ use Preferences;
|
||||
use Session;
|
||||
use Steam;
|
||||
use View;
|
||||
use FireflyIII\Models\Preference;
|
||||
|
||||
/**
|
||||
* Class ReportController
|
||||
@ -367,7 +368,7 @@ class ReportController extends Controller
|
||||
} catch (Exception $e) {
|
||||
return view('error')->with('message', 'Invalid date.');
|
||||
}
|
||||
|
||||
/** @var Preference $pref */
|
||||
$pref = Preferences::get('showSharedReports', false);
|
||||
$showSharedReports = $pref->data;
|
||||
$date = new Carbon('01-01-' . $year);
|
||||
|
@ -54,17 +54,20 @@
|
||||
$end += $balance['end'];
|
||||
$diff += ($balance['end']-$balance['start']);
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{route('accounts.show',$balance['account']->id)}}">{{{$balance['account']->name}}}</a>
|
||||
@if($balance['shared'])
|
||||
<small><em>shared</em></small>
|
||||
@endif
|
||||
</td>
|
||||
<td>{!! Amount::format($balance['start']) !!}</td>
|
||||
<td>{!! Amount::format($balance['end']) !!}</td>
|
||||
<td>{!! Amount::format($balance['end']-$balance['start']) !!}</td>
|
||||
</tr>
|
||||
@if($balance['hide'] === false)
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{route('accounts.show',$balance['account']->id)}}">{{{$balance['account']->name}}}</a>
|
||||
@if($balance['shared'])
|
||||
<small><em>shared</em></small>
|
||||
@endif
|
||||
|
||||
</td>
|
||||
<td>{!! Amount::format($balance['start']) !!}</td>
|
||||
<td>{!! Amount::format($balance['end']) !!}</td>
|
||||
<td>{!! Amount::format($balance['end']-$balance['start']) !!}</td>
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
<tr>
|
||||
<td><em>Sum of sums</em></td>
|
||||
|
Loading…
Reference in New Issue
Block a user