mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-20 11:48:27 -06:00
Fix some bugs in multi-currency reports.
This commit is contained in:
parent
01876be152
commit
30fc56a0d7
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user