mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix #2328
This commit is contained in:
parent
04bf92d946
commit
4bd8e1b11e
@ -172,6 +172,7 @@ class ReportController extends Controller
|
||||
$carbon = new Carbon($date);
|
||||
$label = $carbon->formatLocalized($format);
|
||||
$earned = $chartData[0]['entries'][$label] ?? '0';
|
||||
$amount = bcmul($amount, '-1');
|
||||
$chartData[0]['entries'][$label] = bcadd($earned, $amount);
|
||||
}
|
||||
foreach ($source['spent'] as $date => $amount) {
|
||||
@ -223,6 +224,7 @@ class ReportController extends Controller
|
||||
'count_spent' => 0,
|
||||
];
|
||||
foreach ($source['earned'] as $amount) {
|
||||
$amount = bcmul($amount,'-1');
|
||||
$numbers['sum_earned'] = bcadd($amount, $numbers['sum_earned']);
|
||||
++$numbers['count_earned'];
|
||||
}
|
||||
|
@ -102,6 +102,18 @@ class BudgetController extends Controller
|
||||
$data = $repository->getBudgetPeriodReport($budgets, $accounts, $start, $end);
|
||||
$data[0] = $repository->getNoBudgetPeriodReport($accounts, $start, $end); // append report data for "no budget"
|
||||
$report = $this->filterPeriodReport($data);
|
||||
|
||||
// depending on the carbon format (a reliable way to determine the general date difference)
|
||||
// change the "listOfPeriods" call so the entire period gets included correctly.
|
||||
$range = app('navigation')->preferredCarbonFormat($start, $end);
|
||||
|
||||
if ('Y' === $range) {
|
||||
$start->startOfYear();
|
||||
}
|
||||
if ('Y-m' === $range) {
|
||||
$start->startOfMonth();
|
||||
}
|
||||
|
||||
$periods = app('navigation')->listOfPeriods($start, $end);
|
||||
try {
|
||||
$result = view('reports.partials.budget-period', compact('report', 'periods'))->render();
|
||||
|
@ -64,6 +64,18 @@ class CategoryController extends Controller
|
||||
$data = $repository->periodExpenses($categories, $accounts, $start, $end);
|
||||
$data[0] = $repository->periodExpensesNoCategory($accounts, $start, $end);
|
||||
$report = $this->filterPeriodReport($data);
|
||||
|
||||
// depending on the carbon format (a reliable way to determine the general date difference)
|
||||
// change the "listOfPeriods" call so the entire period gets included correctly.
|
||||
$range = app('navigation')->preferredCarbonFormat($start, $end);
|
||||
|
||||
if ('Y' === $range) {
|
||||
$start->startOfYear();
|
||||
}
|
||||
if ('Y-m' === $range) {
|
||||
$start->startOfMonth();
|
||||
}
|
||||
|
||||
$periods = app('navigation')->listOfPeriods($start, $end);
|
||||
try {
|
||||
$result = view('reports.partials.category-period', compact('report', 'periods'))->render();
|
||||
@ -106,6 +118,18 @@ class CategoryController extends Controller
|
||||
$data = $repository->periodIncome($categories, $accounts, $start, $end);
|
||||
$data[0] = $repository->periodIncomeNoCategory($accounts, $start, $end);
|
||||
$report = $this->filterPeriodReport($data);
|
||||
|
||||
// depending on the carbon format (a reliable way to determine the general date difference)
|
||||
// change the "listOfPeriods" call so the entire period gets included correctly.
|
||||
$range = app('navigation')->preferredCarbonFormat($start, $end);
|
||||
|
||||
if ('Y' === $range) {
|
||||
$start->startOfYear();
|
||||
}
|
||||
if ('Y-m' === $range) {
|
||||
$start->startOfMonth();
|
||||
}
|
||||
|
||||
$periods = app('navigation')->listOfPeriods($start, $end);
|
||||
try {
|
||||
$result = view('reports.partials.category-period', compact('report', 'periods'))->render();
|
||||
|
Loading…
Reference in New Issue
Block a user