Skip to content

Firefly III: a personal finances manager

Fix monthly report.

James Cole42b8b49ed7a6
diff --git a/app/Http/Controllers/Report/BalanceController.php b/app/Http/Controllers/Report/BalanceController.php
index 63fada0b43..5c46b25b57 100644
--- a/app/Http/Controllers/Report/BalanceController.php
+++ b/app/Http/Controllers/Report/BalanceController.php
@@ -140,7 +140,7 @@ final class BalanceController extends Controller
} catch (Throwable $e) {
Log::error(sprintf('Could not render reports.partials.balance: %s', $e->getMessage()));
Log::error($e->getTraceAsString());
- $result = 'Could not render view.';
+ $result = sprintf('Could not render view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
diff --git a/resources/views/reports/partials/balance.blade.php b/resources/views/reports/partials/balance.blade.php
index 87e87714e3..daf4146091 100644
--- a/resources/views/reports/partials/balance.blade.php
+++ b/resources/views/reports/partials/balance.blade.php
@@ -3,44 +3,44 @@
<tr>
<th>{{ __('firefly.budgets') }}</th>
@foreach($report['accounts'] as $account)
- {% if account.sum != 0 %}
- <th class="text-right hidden-xs"><a href="{{ route('accounts.show',$account['id']) }}"
- title="{{ $account['iban']|default($account['name']) }}">{{ $account['name'] }}</a></th>
+ @if($account['sum'] !== 0)
+ <th class="text-right hidden-xs"><a href="{{ route('accounts.show',$account['id']) }}" title="{{ $account['iban'] }}">{{ $account['name'] }}</a></th>
@endif
@endforeach
<th class="text-end">{{ __('firefly.sum') }}</th>
</tr>
</thead>
<tbody>
-
- {% for budget in report.budgets %}
- {% if budget.spent|length > 0 %}
+ @foreach($report['budgets'] as $budget)
+ @if($budget['spent'] > 0)
<tr>
<td>
- <a href="{{ route('budgets.show', [budget.budget_id]) }}">{{ budget.budget_name }}</a>
+ <a href="{{ route('budgets.show', [$budget['budget_id']]) }}">{{ $budget['budget_name'] }}</a>
</td>
@foreach($report['accounts'] as $account)
- {% if budget.spent[$account->id] %}
+ @if(array_key_exists($account['id'], $budget['spent']))
<td class="text-end">
- {!! format_amount_by_symbol(budget.spent[$account->id].spent, budget.spent[$account->id].currency_symbol, budget.spent[$account->id].currency_decimal_places) }}
+ {!! format_amount_by_symbol($budget['spent'][$account['id']]['spent'], $budget['spent'][$account['id']]['currency_symbol'], $budget['spent'][$account['id']]['currency_decimal_places']) !!}
<span data-location="budget-entry"
- data-budget-id="{{ budget.budget_id }}"
+ data-budget-id="{{ $budget['budget_id'] }}"
data-account-id="{{ $account['id'] }}"
- data-currency-id="{{ budget.spent[$account->id].currency_id }}"
- class="fa fa-info-circle text-muted firefly-info-button"></span>
+ data-currency-id="{{ $budget['spent'][$account['id']]['currency_id'] }}"
+ class="bi bi-info-circle text-muted firefly-info-button"></span>
</td>
@else
- {% if report.accounts[$account->id].sum != 0 %}
+ @if($report['accounts'][$account['id']]['sum'] != 0)
<td>&nbsp;</td>
@endif
@endif
@endforeach
<td class="text-end">
- {% for sum in report.sums[budget.budget_id] %}
- {!! format_amount_by_symbol(sum.sum, sum.currency_symbol, sum.currency_decimal_places) }}
+ @if(array_key_exists($budget['budget_id'], $report['sums']))
+ @foreach($report['sums'][$budget['budget_id']] as $sum)
+ {!! format_amount_by_symbol($sum['sum'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}
<br/>
@endforeach
+ @endif
</td>
</tr>
@endif
@@ -50,9 +50,9 @@
<tr>
<td><em>{{ __('firefly.sum') }}</em></td>
@foreach($report['accounts'] as $account)
- {% if account.sum != 0 %}
+ @if($account['sum'] !== 0)
<td class="text-end">
- {!! format_amount_by_symbol(account.sum, account.currency_symbol, account.currency_decimal_places) }}
+ {!! format_amount_by_symbol($account['sum'], $account['currency_symbol'], $account['currency_decimal_places']) !!}
</td>
@endif
@endforeach
diff --git a/resources/views/reports/partials/bills.blade.php b/resources/views/reports/partials/bills.blade.php
index c6b02efd52..9324ac8b86 100644
--- a/resources/views/reports/partials/bills.blade.php
+++ b/resources/views/reports/partials/bills.blade.php
@@ -48,41 +48,5 @@
</tr>
@endif
@endforeach
-
-
- @foreach($bills->getBills() as $line)
- <tr>
- <td data-value="{{ $line->getBill()->name }}">
- <a href="{{ route('subscriptions.show',$line->getBill()->id) }}">{{ $line->getBill()->name }}</a>
- <small class="text-muted"><br/>
- {{ trans('firefly.bill_expected_between', ['start' => $line->getPayDate()->isoFormat($monthAndDayFormat), 'end' => $line->getEndOfPayDate()->isoFormat($monthAndDayFormat)]) }}
- </small>
- </td>
- <td class="text-right hidden-xs" data-value="{{ $line->getMin() }}">{!! format_amount_by_currency($line->getCurrency(), $line->getMin()) !!}</td>
- <td class="text-right hidden-xs" data-value="{{ $line->getMax() }}">{!! format_amount_by_currency($line->getCurrency(), $line->getMax()) !!}</td>
-
- {{-- if bill is hit, show hit amount --}}
- @if($line->isHit())
- <td data-value="{{ $line->getAmount() }}" class="text-end">
- <a href="{{ route('transactions.show', $line->getTransactionJournalId()) }}">
- {!! format_amount_by_currency($line->getCurrency(), $line->getAmount()) !!}
- </a>
- </td>
- @endif
- {{-- if not but is active, show "not yet charged --}}
- @if(!$line->isHit() && $line->isActive())
- <td data-value="0" class="bg-success">{{ __('firefly.notCharged') }}</td>
- @endif
- @if(!$line->isActive() && !$line->isHit())
- <td data-value="-1">&nbsp;</td>
- @endif
- <td data-value="{{ ($line->getMax() - $line->getAmount()) }}" class="text-right hidden-xs">
- @if($line->isHit())
- {!! format_amount_by_currency($line->getCurrency(), ($line->getMax() + $line->getAmount())) !!}
- @endif
- </td>
- </tr>
-
- @endforeach
</tbody>
</table>
diff --git a/resources/views/reports/partials/budgets.blade.php b/resources/views/reports/partials/budgets.blade.php
index a015b9f83b..5af3952bfa 100644
--- a/resources/views/reports/partials/budgets.blade.php
+++ b/resources/views/reports/partials/budgets.blade.php
@@ -3,79 +3,79 @@
<tr>
<th data-defaultsign="az">{{ __('firefly.budget') }}</th>
<th data-defaultsign="month" class="hidden-xs">{{ __('firefly.date') }}</th>
- <th data-defaultsign="_19" class="text-right hidden-xs">{{ 'budgeted'|_ }}</th>
+ <th data-defaultsign="_19" class="text-right hidden-xs">{{ __('firefly.budgeted') }}</th>
<th data-defaultsign="_19" class="hidden-xs">{{ trans('list.percentage') }}</th>
<th data-defaultsign="_19" class="text-end">{{ __('firefly.spent') }}</th>
<th data-defaultsign="_19" class="hidden-xs">{{ trans('list.percentage') }}</th>
<th data-defaultsort="disabled" class="hidden-xs">&nbsp;</th>
- <th data-defaultsign="_19" class="text-right hidden-xs">{{ 'left'|_ }}</th>
- <th data-defaultsign="_19" class="text-end">{{ 'overspent'|_ }}</th>
+ <th data-defaultsign="_19" class="text-right hidden-xs">{{ __('firefly.left') }}</th>
+ <th data-defaultsign="_19" class="text-end">{{ __('firefly.overspent') }}</th>
</tr>
</thead>
<tbody>
- {% for budget in report.budgets %}
- {% for budget_limit in budget.budget_limits %}
+ @foreach($report['budgets'] as $budget)
+ @foreach($budget['budget_limits'] as $budgetLimit)
<tr>
- {% if budget.no_budget %}
+ @if($budget['no_budget'])
<td data-value="zzz">
- <em>{{ 'no_budget'|_ }} ({{ budget_limit.currency_name }})</em>
+ <em>{{ __('firefly.no_budget') }} ({{ $budgetLimit['currency_name'] }})</em>
</td>
@else
- <td data-value="{{ budget.budget_name }}">
- <a href="{{ route('budgets.show', [budget.budget_id]) }}">{{ budget.budget_name }}</a>
+ <td data-value="{{ $budget['budget_name'] }}">
+ <a href="{{ route('budgets.show', [$budget['budget_id']]) }}">{{ $budget['budget_name'] }}</a>
</td>
@endif
<!-- date, hidden on mobile -->
- <td class="hidden-xs" data-value="{{ budget_limit.start_date.format('Y-m-d')|default('0000-00-00') }}">
- {% if null != budget_limit.budget_limit_id %}
- <a href="{{ route('budgets.show.limit', [budget.budget_id, budget_limit.budget_limit_id]) }}">
- {{ budget_limit.start_date.isoFormat($monthAndDayFormat) }}
+ <td class="hidden-xs" data-value="{{ $budgetLimit['start_date']->format('Y-m-d') }}">
+ @if(null !== $budgetLimit['budget_limit_id'])
+ <a href="{{ route('budgets.show.limit', [$budget['budget_id'], $budgetLimit['budget_limit_id']]) }}">
+ {{ $budgetLimit['start_date']->isoFormat($monthAndDayFormat) }}
&mdash;
- {{ budget_limit.end_date.isoFormat($monthAndDayFormat) }}
+ {{ $budgetLimit['end_date']->isoFormat($monthAndDayFormat) }}
</a>
@endif
</td>
<!-- budgeted, hidden on mobile -->
- <td data-value="{{ budget_limit.budgeted|default(0) }}" class="text-right hidden-xs">
- {% if null != budget_limit.budgeted %}
- {!! format_amount_by_symbol(budget_limit.budgeted, budget_limit.currency_symbol, budget_limit.currency_decimal_places) }}
+ <td data-value="{{ $budgetLimit['budgeted'] }}" class="text-right hidden-xs">
+ @if(null !== $budgetLimit['budgeted'])
+ {!! format_amount_by_symbol($budgetLimit['budgeted'], $budgetLimit['currency_symbol'], $budgetLimit['currency_decimal_places']) !!}
@endif
</td>
<!-- percentage, hidden -->
- <td data-value="{{ budget_limit.budgeted_pct|default(0) }}" class="hidden-xs">
- {{ budget_limit.budgeted_pct }}%
+ <td data-value="{{ $budgetLimit['budgeted_pct'] }}" class="hidden-xs">
+ {{ $budgetLimit['budgeted_pct'] }}%
</td>
<!-- spent, visible on mobile -->
- <td data-value="{{ budget_limit.spent|default(0) }}" class="text-end">
- {!! format_amount_by_symbol(budget_limit.spent, budget_limit.currency_symbol, budget_limit.currency_decimal_places) }}
+ <td data-value="{{ $budgetLimit['spent'] }}" class="text-end">
+ {!! format_amount_by_symbol($budgetLimit['spent'], $budgetLimit['currency_symbol'], $budgetLimit['currency_decimal_places']) !!}
</td>
<!-- percentage, hidden -->
- <td data-value="{{ budget_limit.spent_pct|default(0) }}" class="hidden-xs">
- {{ budget_limit.spent_pct }}%
+ <td data-value="{{ $budgetLimit['spent_pct'] }}" class="hidden-xs">
+ {{ $budgetLimit['spent_pct'] }}%
</td>
<!-- info button, not visible on mobile -->
<td class="hidden-xs">
- {% if budget_limit.spent != 0 %}
- <span class="fa text-muted fa-info-circle firefly-info-button"
- data-location="budget-spent-amount" data-currency-id="{{ budget_limit.currency_id }}" data-budget-id="{% if '' == budget.budget_id %}0@else{{ budget.budget_id }}@endif"></span>
+ @if($budgetLimit['spent'] != 0)
+ <span class="bi bi-info-circle text-muted firefly-info-button"
+ data-location="budget-spent-amount" data-currency-id="{{ $budgetLimit['currency_id'] }}" data-budget-id=" @if('' === $budget['budget_id'])@else{{ $budget['budget_id'] }}@endif"></span>
@endif
</td>
<!-- left, hidden on mobile -->
- <td data-value="{{ budget_limit.left|default(0) }}" class="text-right hidden-xs">
- {% if null != budget_limit.left %}
- {!! format_amount_by_symbol(budget_limit.left, budget_limit.currency_symbol, budget_limit.currency_decimal_places) }}
+ <td data-value="{{ $budgetLimit['left'] }}" class="text-right hidden-xs">
+ @if(null !== $budgetLimit['left'])
+ {!! format_amount_by_symbol($budgetLimit['left'], $budgetLimit['currency_symbol'], $budgetLimit['currency_decimal_places']) !!}
@endif
</td>
<!-- overspent, visible. -->
- <td data-value="{{ budget_limit.overspent|default(0) }}" class="text-end">
- {% if null != budget_limit.overspent %}
- {!! format_amount_by_symbol(budget_limit.overspent, budget_limit.currency_symbol, budget_limit.currency_decimal_places) }}
+ <td data-value="{{ $budgetLimit['overspent'] }}" class="text-end">
+ @if(null !== $budgetLimit['overspent'])
+ {!! format_amount_by_symbol($budgetLimit['overspent'], $budgetLimit['currency_symbol'], $budgetLimit['currency_decimal_places']) !!}
@endif
</td>
</tr>
@@ -83,17 +83,16 @@
@endforeach
</tbody>
<tfoot>
- {% for sum in report.sums %}
+ @foreach($report['sums'] as $sum)
<tr>
- <td colspan="2"><em>{{ __('firefly.sum') }} ({{ sum.currency_name }})</em></td>
- <td class="text-end">{!! format_amount_by_symbol(sum.budgeted, sum.currency_symbol, sum.currency_decimal_places) }}</td>
+ <td colspan="2"><em>{{ __('firefly.sum') }} ({{ $sum['currency_name'] }})</em></td>
+ <td class="text-end">{!! format_amount_by_symbol($sum['budgeted'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}</td>
<td>&nbsp;</td>
- <td class="text-end">{!! format_amount_by_symbol(sum.spent, sum.currency_symbol, sum.currency_decimal_places) }}</td>
+ <td class="text-end">{!! format_amount_by_symbol($sum['spent'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
- <td class="text-end">{!! format_amount_by_symbol(sum.left, sum.currency_symbol, sum.currency_decimal_places) }}</td>
- <td class="text-end">{!! format_amount_by_symbol(sum.overspent, sum.currency_symbol, sum.currency_decimal_places) }}</td>
-
+ <td class="text-end">{!! format_amount_by_symbol($sum['left'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}</td>
+ <td class="text-end">{!! format_amount_by_symbol($sum['overspent'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}</td>
</tr>
@endforeach
</tfoot>
diff --git a/resources/views/reports/partials/categories.blade.php b/resources/views/reports/partials/categories.blade.php
index 00911d2399..0339401f3f 100644
--- a/resources/views/reports/partials/categories.blade.php
+++ b/resources/views/reports/partials/categories.blade.php
@@ -9,44 +9,44 @@
</tr>
</thead>
<tbody>
- {% for category in report.categories %}
+ @foreach($report['categories'] as $category)
@if($loop->index > $listLength)
<tr class="overListLength">
@else
<tr>
@endif
- <td data-value="{{ category.title }}">
- <a href="{{ route('categories.show', category.id) }}">{{ category.title }}</a>
+ <td data-value="{{ $category['title'] }}">
+ <a href="{{ route('categories.show', $category['id']) }}">{{ $category['title'] }}</a>
</td>
- <td data-value="{{ category.spent }}" class="text-end">{!! format_amount_by_symbol(category.spent, category.currency_symbol, category.currency_decimal_places, true) }}</td>
- <td data-value="{{ category.earned }}" class="text-end">{!! format_amount_by_symbol(category.earned, category.currency_symbol, category.currency_decimal_places, true) }}</td>
- <td data-value="{{ category.sum }}" class="text-end">{!! format_amount_by_symbol(category.sum, category.currency_symbol, category.currency_decimal_places, true) }}</td>
+ <td data-value="{{ $category['spent'] }}" class="text-end">{!! format_amount_by_symbol($category['spent'], $category['currency_symbol'], $category['currency_decimal_places'], true) !!}</td>
+ <td data-value="{{ $category['earned'] }}" class="text-end">{!! format_amount_by_symbol($category['earned'], $category['currency_symbol'], $category['currency_decimal_places'], true) !!}</td>
+ <td data-value="{{ $category['sum'] }}" class="text-end">{!! format_amount_by_symbol($category['sum'], $category['currency_symbol'], $category['currency_decimal_places'], true) !!}</td>
<td class="twenty-px">
- <span class="fa fa-info-circle text-muted firefly-info-button" data-location="category-entry" data-category-id="{{ category.id }}" data-currency-id="{{ category.currency_id }}"
+ <span class="bi bi-info-circle text-muted firefly-info-button" data-location="category-entry" data-category-id="{{ $category['id'] }}" data-currency-id="{{ $category['currency_id'] }}"
></span>
</td>
</tr>
@endforeach
</tbody>
<tfoot>
- {% if report.categories|length > listLength %}
+ @if(count($report['categories']) > $listLength)
<tr>
<td colspan="4" class="active">
<a href="#" class="listLengthTrigger">{{ trans('firefly.show_full_list',['number' => $incomeTopLength]) }}</a>
</td>
</tr>
@endif
- {% for sum in report.sums %}
+ @foreach($report['sums'] as $sum)
<tr>
- <td><em>{{ __('firefly.sum') }} ({{ sum.currency_name }})</em></td>
+ <td><em>{{ __('firefly.sum') }} ({{ $sum['currency_name'] }})</em></td>
<td class="text-end">
- {!! format_amount_by_symbol(sum.spent, sum.currency_symbol, sum.currency_decimal_places) }}
+ {!! format_amount_by_symbol($sum['spent'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}
</td>
<td class="text-end">
- {!! format_amount_by_symbol(sum.earned, sum.currency_symbol, sum.currency_decimal_places) }}
+ {!! format_amount_by_symbol($sum['earned'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}
</td>
<td class="text-end">
- {!! format_amount_by_symbol(sum.sum, sum.currency_symbol, sum.currency_decimal_places) }}
+ {!! format_amount_by_symbol($sum['sum'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}
</td>
</tr>
@endforeach
diff --git a/resources/views/transactions/mass/edit.blade.php b/resources/views/transactions/mass/edit.blade.php
index 9767c2af81..ed8afa49ac 100644
--- a/resources/views/transactions/mass/edit.blade.php
+++ b/resources/views/transactions/mass/edit.blade.php
@@ -156,9 +156,9 @@
<td>
{% if journal.transaction_type_type == 'Withdrawal' %}
<select class="form-control input-sm" name="budget_id[{{ journal.transaction_journal_id }}]">
- <option value="0" label="({{ 'no_budget'|_ }})"
+ <option value="0" label="({{ __('firefly.no_budget') }})"
{% if journal.budget_id == 0 %}selected="selected"@endif
- >{{ 'no_budget'|_ }}
+ >{{ __('firefly.no_budget') }}
</option>
{% for budget in budgets %}
<option value="{{ budget.id }}"{% if budget.id == journal.budget_id %} selected="selected"@endif