mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fixed all problems related to strict types.
This commit is contained in:
@@ -39,7 +39,7 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
|
||||
'label' => trans('firefly.unpaid'),
|
||||
],
|
||||
[
|
||||
'value' => round($paid * -1, 2), // paid is negative, must be positive.
|
||||
'value' => round(bcmul($paid, '-1'), 2), // paid is negative, must be positive.
|
||||
'color' => 'rgba(0, 141, 76, 0.7)',
|
||||
'highlight' => 'rgba(0, 141, 76, 0.9)',
|
||||
'label' => trans('firefly.paid'),
|
||||
@@ -57,6 +57,7 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
|
||||
*/
|
||||
public function single(Bill $bill, Collection $entries)
|
||||
{
|
||||
bcscale(2);
|
||||
$format = (string)trans('config.month');
|
||||
$data = [
|
||||
'count' => 3,
|
||||
@@ -74,7 +75,7 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
|
||||
/*
|
||||
* journalAmount has been collected in BillRepository::getJournals
|
||||
*/
|
||||
$actualAmount[] = round(($entry->journalAmount * -1), 2);
|
||||
$actualAmount[] = round(bcmul($entry->journalAmount, '-1'), 2);
|
||||
}
|
||||
|
||||
$data['datasets'][] = [
|
||||
|
@@ -68,6 +68,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
|
||||
*/
|
||||
public function frontpage(Collection $entries)
|
||||
{
|
||||
bcscale(2);
|
||||
$data = [
|
||||
'count' => 0,
|
||||
'labels' => [],
|
||||
@@ -84,8 +85,8 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
|
||||
foreach ($filtered as $entry) {
|
||||
$data['labels'][] = $entry[0];
|
||||
$left[] = round($entry[1], 2);
|
||||
$spent[] = round($entry[2] * -1, 2); // spent is coming in negative, must be positive
|
||||
$overspent[] = round($entry[3] * -1, 2); // same
|
||||
$spent[] = round(bcmul($entry[2],'-1'), 2); // spent is coming in negative, must be positive
|
||||
$overspent[] = round(bcmul($entry[3],'-1'), 2); // same
|
||||
}
|
||||
|
||||
$data['datasets'][] = [
|
||||
|
@@ -39,11 +39,11 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
||||
|
||||
foreach ($entries as $entry) {
|
||||
$data['labels'][] = $entry[1];
|
||||
$spent = round($entry[2], 2);
|
||||
$earned = round($entry[3], 2);
|
||||
$spent = $entry[2];
|
||||
$earned = $entry[3];
|
||||
|
||||
$data['datasets'][0]['data'][] = $spent == 0 ? null : $spent * -1;
|
||||
$data['datasets'][1]['data'][] = $earned == 0 ? null : $earned;
|
||||
$data['datasets'][0]['data'][] = bccomp($spent, '0') === 0 ? null : bcmul($spent, '-1');
|
||||
$data['datasets'][1]['data'][] = bccomp($earned, '0') === 0 ? null : $earned;
|
||||
}
|
||||
|
||||
return $data;
|
||||
@@ -89,6 +89,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
||||
*/
|
||||
public function frontpage(Collection $entries)
|
||||
{
|
||||
bcscale(2);
|
||||
$data = [
|
||||
'count' => 1,
|
||||
'labels' => [],
|
||||
@@ -102,7 +103,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
||||
foreach ($entries as $entry) {
|
||||
if ($entry->spent != 0) {
|
||||
$data['labels'][] = $entry->name;
|
||||
$data['datasets'][0]['data'][] = round(($entry->spent * -1), 2);
|
||||
$data['datasets'][0]['data'][] = round(bcmul($entry->spent, '-1'), 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user