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