Fix balance display #9826

This commit is contained in:
James Cole 2025-02-12 11:53:51 +01:00
parent 295feedd77
commit a606315884
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
2 changed files with 14 additions and 10 deletions

View File

@ -121,12 +121,7 @@ class ShowController extends Controller
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector
->setAccounts(new Collection([$account]))
->setLimit($pageSize)
->setPage($page)->withAccountInformation()->withCategoryInformation()
->setRange($start, $end)
;
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page)->withAccountInformation()->withCategoryInformation()->setRange($start, $end);
// this search will not include transaction groups where this asset account (or liability)
// is just part of ONE of the journals. To force this:
@ -137,8 +132,13 @@ class ShowController extends Controller
$groups->setPath(route('accounts.show', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]));
$showAll = false;
// correct
Log::debug(sprintf('show: Call finalAccountBalance with date/time "%s"', $end->toIso8601String()));
$balances = Steam::filterAccountBalance(Steam::finalAccountBalance($account, $end), $account, $this->convertToNative, $accountCurrency);
$now = today()->endOfDay();
if($now->gt($end) || $now->lt($start)) {
$now = $end;
}
Log::debug(sprintf('show: Call finalAccountBalance with date/time "%s"', $now->toIso8601String()));
$balances = Steam::filterAccountBalance(Steam::finalAccountBalance($account, $now), $account, $this->convertToNative, $accountCurrency);
return view(
'accounts.show',

View File

@ -69,9 +69,13 @@
{% for key, balance in account.endBalances %}
<span title="{{ key }}">
{% if 'balance' == key %}
{{ formatAmountBySymbol(balance, account.currency.symbol, account.currency.decimal_places) }}
{% if not convertToNative %}
{{ formatAmountBySymbol(balance, account.currency.symbol, account.currency.decimal_places) }}
{% endif %}
{% elseif 'native_balance' == key %}
{{ formatAmountBySymbol(balance, defaultCurrency.symbol, defaultCurrency.decimal_places) }}
{% if convertToNative %}
{{ formatAmountBySymbol(balance, defaultCurrency.symbol, defaultCurrency.decimal_places) }}
{% endif %}
{% else %}
({{ formatAmountByCode(balance, key) }})
{% endif %}