Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix some bugs in multi-currency reports.
James Cole30fc56a0d7c2
diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.phpindex 86e0373509..8e7650b943 100644--- a/app/Http/Controllers/Chart/BudgetController.php+++ b/app/Http/Controllers/Chart/BudgetController.php@@ -408,7 +408,7 @@ class BudgetController extends Controller$cache->addProperty($currency->id);$cache->addProperty('chart.budget.period');if ($cache->has()) {- return response()->json($cache->get()); // @codeCoverageIgnore+ // return response()->json($cache->get()); // @codeCoverageIgnore}$titleFormat = app('navigation')->preferredCarbonLocalizedFormat($start, $end);$preferredRange = app('navigation')->preferredRangeFormat($start, $end);@@ -427,16 +427,17 @@ class BudgetController extends Controller],];-$currentStart = clone $start;while ($currentStart <= $end) {+ $currentStart= app('navigation')->startOfPeriod($currentStart, $preferredRange);$title = $currentStart->formatLocalized($titleFormat);$currentEnd = app('navigation')->endOfPeriod($currentStart, $preferredRange);// default limit is no limit:$chartData[0]['entries'][$title] = 0;- $chartData[1]['entries'][$title] = 0;+ // default spent is not spent at all.+ $chartData[1]['entries'][$title] = 0;// get budget limit in this period for this currency.$limit = $this->blRepository->find($budget, $currency, $currentStart, $currentEnd);@@ -449,7 +450,8 @@ class BudgetController extends Controller$amount = app('steam')->positive($sum[$currency->id]['sum'] ?? '0');$chartData[0]['entries'][$title] = round($amount, $currency->decimal_places);- $currentStart = app('navigation')->addPeriod($currentStart, $preferredRange, 0);+ $currentStart = clone $currentEnd;+ $currentStart->addDay()->startOfDay();}$data = $this->generator->multiSet($chartData);diff --git a/app/Http/Controllers/Report/BudgetController.php b/app/Http/Controllers/Report/BudgetController.phpindex 0d6b2b7c83..7768551901 100644--- a/app/Http/Controllers/Report/BudgetController.php+++ b/app/Http/Controllers/Report/BudgetController.php@@ -112,8 +112,11 @@ class BudgetController extends Controller$periods = app('navigation')->listOfPeriods($start, $end);$keyFormat = app('navigation')->preferredCarbonFormat($start, $end);++// list expenses for budgets in account(s)$expenses = $opsRepository->listExpenses($start, $end, $accounts);+$report = [];foreach ($expenses as $currency) {foreach ($currency['budgets'] as $budget) {diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.phpindex e7de2fe04e..69b62eea62 100644--- a/app/Repositories/Budget/OperationsRepository.php+++ b/app/Repositories/Budget/OperationsRepository.php@@ -222,7 +222,7 @@ class OperationsRepository implements OperationsRepositoryInterface// catch "no category" entries.if (0 === $budgetId) {- $budgetName = (string)trans('firefly.no_budget');+ continue;}// info about the currency: