Skip to content

Firefly III: a personal finances manager

Add balance #2933

James Cole56700ef98406
diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php
index f45f37e419..cbe3d80d8d 100644
--- a/app/Http/Controllers/Account/ShowController.php
+++ b/app/Http/Controllers/Account/ShowController.php
@@ -123,12 +123,13 @@ class ShowController extends Controller
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('accounts.show', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]));
$showAll = false;
+ $balance = app('steam')->balance($account, $end);
return view(
'accounts.show',
compact(
'account', 'showAll', 'objectType', 'currency', 'today', 'periods', 'subTitleIcon', 'groups', 'subTitle', 'start', 'end',
- 'chartUri', 'location'
+ 'chartUri', 'location','balance'
)
);
}
@@ -147,6 +148,7 @@ class ShowController extends Controller
return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
}
+
$location = $this->repository->getLocation($account);
$isLiability = $this->repository->isLiability($account);
$objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
@@ -166,12 +168,13 @@ class ShowController extends Controller
$groups->setPath(route('accounts.show.all', [$account->id]));
$chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
$showAll = true;
+ $balance = app('steam')->balance($account, $end);
return view(
'accounts.show',
compact(
'account', 'showAll', 'location', 'objectType', 'isLiability', 'currency', 'today',
- 'chartUri', 'periods', 'subTitleIcon', 'groups', 'subTitle', 'start', 'end'
+ 'chartUri', 'periods', 'subTitleIcon', 'groups', 'subTitle', 'start', 'end', 'balance'
)
);
}
diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php
index 2591bcde27..d812cd7bbc 100644
--- a/resources/lang/en_US/firefly.php
+++ b/resources/lang/en_US/firefly.php
@@ -138,7 +138,7 @@ return [
'budget_in_period' => 'All transactions for budget ":name" between :start and :end in :currency',
'chart_budget_in_period' => 'Chart for all transactions for budget ":name" between :start and :end in :currency',
'chart_budget_in_period_only_currency' => 'The amount you budgeted was in :currency, so this chart will only show transactions in :currency.',
- 'chart_account_in_period' => 'Chart for all transactions for account ":name" between :start and :end',
+ 'chart_account_in_period' => 'Chart for all transactions for account ":name" (:balance) between :start and :end',
'chart_category_in_period' => 'Chart for all transactions for category ":name" between :start and :end',
'chart_category_all' => 'Chart for all transactions for category ":name"',
'clone_withdrawal' => 'Clone this withdrawal',
diff --git a/resources/views/v1/accounts/show.twig b/resources/views/v1/accounts/show.twig
index d8757863ad..5acff5f48b 100644
--- a/resources/views/v1/accounts/show.twig
+++ b/resources/views/v1/accounts/show.twig
@@ -11,7 +11,9 @@
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">
- {{ trans('firefly.chart_account_in_period', {name: account.name, start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat) }) }}
+ {{ trans('firefly.chart_account_in_period', {
+ balance: formatAmountBySymbol(balance, currency.symbol, currency.decimal_places, true),
+ name: account.name, start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat) })|raw }}
</h3>
<div class="box-tools pull-right">
<div class="btn-group">
@@ -87,18 +89,18 @@
{% endif %}
<div class="row">
+ {% if(location) %}
<div class="col-lg-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'location'|_ }}</h3>
</div>
<div class="box-body">
- {% if(location) %}
- <div id="location_map" style="width:100%;height:300px;"></div>
- {% endif %}
+ <div id="location_map" style="width:100%;height:300px;"></div>
</div>
</div>
</div>
+ {% endif %}
{% if account.notes.count == 1 %}
<div class="col-lg-6">
<div class="box">
@@ -117,7 +119,7 @@
<div class="{% if periods|length > 0 %}col-lg-10 col-md-8 col-sm-12{% else %}col-lg-12 col-md-12 col-sm-12{% endif %}">
<div class="box">
<div class="box-header with-border">
- <h3 class="box-title">{{ 'transactions'|_ }}</h3>
+ <h3 class="box-title">{{ 'transactions'|_ }} ({{ formatAmountBySymbol(balance, currency.symbol, currency.decimal_places, true)|raw }})</h3>
</div>
<div class="box-body">
{% if account.accountType.type == 'Asset account' %}