Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix balance display #9826
James Colea606315884cb
diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.phpindex 28d6bdcf3f..a7cea70afb 100644--- a/app/Http/Controllers/Account/ShowController.php+++ b/app/Http/Controllers/Account/ShowController.php@@ -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',diff --git a/resources/views/list/accounts.twig b/resources/views/list/accounts.twigindex 7dfe78ed67..a95c0799bc 100644--- a/resources/views/list/accounts.twig+++ b/resources/views/list/accounts.twig@@ -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 %}