mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-13 16:00:13 +00:00
Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
* 'develop' of https://github.com/JC5/firefly-iii: Fixed the other chart too. Trying to fix chart. New code. Debug.
This commit is contained in:
@@ -43,7 +43,7 @@ class ChartJsReportChartGenerator implements ReportChartGenerator
|
|||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
$data['labels'][] = $entry[0]->formatLocalized($format);
|
$data['labels'][] = $entry[0]->formatLocalized($format);
|
||||||
$data['datasets'][0]['data'][] = round($entry[1], 2);
|
$data['datasets'][0]['data'][] = round($entry[1], 2);
|
||||||
$data['datasets'][1]['data'][] = round(($entry[2] * -1), 2);
|
$data['datasets'][1]['data'][] = round($entry[2], 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
@@ -74,9 +74,9 @@ class ChartJsReportChartGenerator implements ReportChartGenerator
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
$data['datasets'][0]['data'][] = round($income, 2);
|
$data['datasets'][0]['data'][] = round($income, 2);
|
||||||
$data['datasets'][1]['data'][] = round( ($expense * -1), 2);
|
$data['datasets'][1]['data'][] = round( $expense, 2);
|
||||||
$data['datasets'][0]['data'][] = round(($income / $count), 2);
|
$data['datasets'][0]['data'][] = round(($income / $count), 2);
|
||||||
$data['datasets'][1]['data'][] = round(( ($expense*-1) / $count), 2);
|
$data['datasets'][1]['data'][] = round(( $expense / $count), 2);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,7 @@ use FireflyIII\Http\Controllers\Controller;
|
|||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Response;
|
use Response;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ReportController
|
* Class ReportController
|
||||||
@@ -62,8 +63,8 @@ class ReportController extends Controller
|
|||||||
$month = clone $start;
|
$month = clone $start;
|
||||||
$month->endOfMonth();
|
$month->endOfMonth();
|
||||||
// total income and total expenses:
|
// total income and total expenses:
|
||||||
$incomeSum = $query->incomeInPeriodCorrected($start, $month, $shared)->sum('amount');
|
$incomeSum = $query->incomeInPeriodCorrected($start, $month, $shared)->sum('amount_positive');
|
||||||
$expenseSum = $query->expenseInPeriodCorrected($start, $month, $shared)->sum('amount');
|
$expenseSum = $query->expenseInPeriodCorrected($start, $month, $shared)->sum('amount_positive');
|
||||||
|
|
||||||
$entries->push([clone $start, $incomeSum, $expenseSum]);
|
$entries->push([clone $start, $incomeSum, $expenseSum]);
|
||||||
$start->addMonth();
|
$start->addMonth();
|
||||||
@@ -110,8 +111,18 @@ class ReportController extends Controller
|
|||||||
$month = clone $start;
|
$month = clone $start;
|
||||||
$month->endOfMonth();
|
$month->endOfMonth();
|
||||||
// total income and total expenses:
|
// total income and total expenses:
|
||||||
$income = bcadd($income, $query->incomeInPeriodCorrected($start, $month, $shared)->sum('amount'));
|
$currentIncome = $query->incomeInPeriodCorrected($start, $month, $shared)->sum('amount_positive');
|
||||||
$expense = bcadd($expense, $query->expenseInPeriodCorrected($start, $month, $shared)->sum('amount'));
|
$currentExpense = $query->expenseInPeriodCorrected($start, $month, $shared)->sum('amount_positive');
|
||||||
|
|
||||||
|
Log::debug('Date ['.$month->format('M Y').']: income = ['.$income.' + '.$currentIncome.'], out = ['.$expense.' + '.$currentExpense.']');
|
||||||
|
|
||||||
|
$income = bcadd($income, $currentIncome);
|
||||||
|
$expense = bcadd($expense, $currentExpense);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$count++;
|
$count++;
|
||||||
$start->addMonth();
|
$start->addMonth();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user