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