mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-05-04 13:16:31 +00:00
Fix for #2451
This commit is contained in:
@@ -84,10 +84,12 @@ class BudgetReportHelper implements BudgetReportHelperInterface
|
||||
// get multi currency expenses first:
|
||||
$budgetLimits = $this->repository->getBudgetLimits($budget, $start, $end);
|
||||
$expenses = $this->repository->spentInPeriodMc(new Collection([$budget]), $accounts, $start, $end);
|
||||
$defaultCurrency = app('amount')->getDefaultCurrencyByUser($budget->user);
|
||||
if (0 === count($expenses)) {
|
||||
// list the budget limits, basic amounts.
|
||||
/** @var BudgetLimit $limit */
|
||||
foreach ($budgetLimits as $limit) {
|
||||
$currency = $limit->transactionCurrency ?? $defaultCurrency;
|
||||
$row = [
|
||||
'limit_id' => $limit->id,
|
||||
'start_date' => $limit->start_date,
|
||||
@@ -96,11 +98,11 @@ class BudgetReportHelper implements BudgetReportHelperInterface
|
||||
'spent' => '0',
|
||||
'left' => $limit->amount,
|
||||
'overspent' => null,
|
||||
'currency_id' => $limit->transactionCurrency->id,
|
||||
'currency_code' => $limit->transactionCurrency->code,
|
||||
'currency_name' => $limit->transactionCurrency->name,
|
||||
'currency_symbol' => $limit->transactionCurrency->symbol,
|
||||
'currency_decimal_places' => $limit->transactionCurrency->decimal_places,
|
||||
'currency_id' => $currency->id,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_name' => $currency->name,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_decimal_places' => $currency\->decimal_places,
|
||||
];
|
||||
|
||||
$entry['rows'][] = $row;
|
||||
@@ -187,6 +189,7 @@ class BudgetReportHelper implements BudgetReportHelperInterface
|
||||
$array['sums'][$currencyId]['overspent'] = bcadd($array['sums'][$currencyId]['overspent'], $row['overspent'] ?? '0');
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user