mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix #2590
This commit is contained in:
parent
88f8dc469b
commit
793af1991c
@ -119,15 +119,11 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
$collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end)->withAccountInformation()
|
||||
->withBudgetInformation()->withCategoryInformation()->withBillInformation();
|
||||
$journals = $collector->getExtractedJournals();
|
||||
$journals = array_reverse($journals, true);
|
||||
|
||||
$journals = array_reverse($journals, true);
|
||||
$dayBeforeBalance = app('steam')->balance($account, $date);
|
||||
$startBalance = $dayBeforeBalance;
|
||||
$currency = $accountRepository->getAccountCurrency($account);
|
||||
|
||||
if (null === $currency) {
|
||||
throw new FireflyException('Unexpected NULL value in account currency preference.'); // @codeCoverageIgnore
|
||||
}
|
||||
$defaultCurrency = app('amount')->getDefaultCurrencyByUser($account->user);
|
||||
$currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
|
||||
|
||||
foreach ($journals as $index => $journal) {
|
||||
$journals[$index]['balance_before'] = $startBalance;
|
||||
@ -140,6 +136,9 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
if ($currency->id === $journal['foreign_currency_id']) {
|
||||
$transactionAmount = $journal['foreign_amount'];
|
||||
if ($account->id === $journal['destination_account_id']) {
|
||||
$transactionAmount = app('steam')->positive($journal['foreign_amount']);
|
||||
}
|
||||
}
|
||||
|
||||
$newBalance = bcadd($startBalance, $transactionAmount);
|
||||
@ -158,6 +157,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
$return = [
|
||||
'journals' => $journals,
|
||||
'currency' => $currency,
|
||||
'exists' => count($journals) > 0,
|
||||
'end' => $this->end->formatLocalized((string)trans('config.month_and_day')),
|
||||
'endBalance' => app('steam')->balance($account, $this->end),
|
||||
|
@ -77,21 +77,38 @@
|
||||
</td>
|
||||
|
||||
<td class="hide-balance_before" style="text-align: right;">
|
||||
{{ formatAmountBySymbol(journal.balance_before, journal.currency_symbol, journal.currency_decimal_places) }}
|
||||
{{ formatAmountBySymbol(journal.balance_before, auditData[account.id].currency.symbol, auditData[account.id].currency.decimal_places) }}
|
||||
</td>
|
||||
<td class="hide-amount" style="text-align: right;">
|
||||
{% if account.id == journal.destination_account_id and journal.transaction_type_type == 'Opening balance' %}
|
||||
{{ formatAmountBySymbol(journal.amount*-1, journal.currency_symbol, journal.currency_decimal_places) }}
|
||||
{% elseif account.id == journal.destination_account_id and journal.transaction_type_type == 'Deposit' %}
|
||||
{{ formatAmountBySymbol(journal.amount*-1, journal.currency_symbol, journal.currency_decimal_places) }}
|
||||
{% else %}
|
||||
{{ formatAmountBySymbol(journal.amount, journal.currency_symbol, journal.currency_decimal_places) }}
|
||||
|
||||
{% if auditData[account.id].currency.id == journal.currency_id %}
|
||||
{% if account.id == journal.destination_account_id and journal.transaction_type_type == 'Opening balance' %}
|
||||
{{ formatAmountBySymbol(journal.amount*-1, journal.currency_symbol, journal.currency_decimal_places) }}
|
||||
{% elseif account.id == journal.destination_account_id and journal.transaction_type_type == 'Deposit' %}
|
||||
{{ formatAmountBySymbol(journal.amount*-1, journal.currency_symbol, journal.currency_decimal_places) }}
|
||||
{% elseif account.id == journal.destination_account_id and journal.transaction_type_type == 'Transfer' %}
|
||||
{{ formatAmountBySymbol(journal.amount*-1, journal.currency_symbol, journal.currency_decimal_places) }}
|
||||
{% else %}
|
||||
{{ formatAmountBySymbol(journal.amount, journal.currency_symbol, journal.currency_decimal_places) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if auditData[account.id].currency.id == journal.foreign_currency_id %}
|
||||
{% if account.id == journal.destination_account_id and journal.transaction_type_type == 'Opening balance' %}
|
||||
{{ formatAmountBySymbol(journal.foreign_amount*-1, journal.foreign_currency_symbol, journal.foreign_currency_decimal_places) }}
|
||||
{% elseif account.id == journal.destination_account_id and journal.transaction_type_type == 'Deposit' %}
|
||||
{{ formatAmountBySymbol(journal.foreign_amount*-1, journal.foreign_currency_symbol, journal.foreign_currency_decimal_places) }}
|
||||
{% elseif account.id == journal.destination_account_id and journal.transaction_type_type == 'Transfer' %}
|
||||
{{ formatAmountBySymbol(journal.foreign_amount*-1, journal.foreign_currency_symbol, journal.foreign_currency_decimal_places) }}
|
||||
{% else %}
|
||||
{{ formatAmountBySymbol(journal.foreign_amount, journal.foreign_currency_symbol, journal.foreign_currency_decimal_places) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
</td>
|
||||
|
||||
<td class="hide-balance_after" style="text-align: right;">
|
||||
{{ formatAmountBySymbol(journal.balance_after, journal.currency_symbol, journal.currency_decimal_places) }}
|
||||
{{ formatAmountBySymbol(journal.balance_after, auditData[account.id].currency.symbol, auditData[account.id].currency.decimal_places) }}
|
||||
</td>
|
||||
|
||||
<td class="hide-date">{{ journal.date.formatLocalized(monthAndDayFormat) }}</td>
|
||||
|
Loading…
Reference in New Issue
Block a user