Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Include "no budget" thing for issue #152
James Cole189d969ee642
diff --git a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.phpindex 45f5447dc9..7129260109 100644--- a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php+++ b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php@@ -159,6 +159,9 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterfaceforeach ($budgets as $budget) {$data['labels'][] = $budget->name;}+ // also add "no budget"+ $data['labels'][] = strval(trans('firefly.no_budget'));+/** @var array $entry */foreach ($entries as $entry) {$array = [diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.phpindex 54dd637839..a02a94a1da 100644--- a/app/Http/Controllers/Chart/BudgetController.php+++ b/app/Http/Controllers/Chart/BudgetController.php@@ -310,7 +310,7 @@ class BudgetController extends Controller$cache->addProperty('budget');$cache->addProperty('year');if ($cache->has()) {- return Response::json($cache->get()); // @codeCoverageIgnore+ //return Response::json($cache->get()); // @codeCoverageIgnore}$budgetInformation = $repository->getBudgetsAndExpensesPerMonth($accounts, $start, $end);@@ -321,7 +321,6 @@ class BudgetController extends Controllerforeach ($budgetInformation as $row) {$budgets->push($row['budget']);}-while ($start < $end) {// month is the current end of the period:$month = clone $start;@@ -329,6 +328,9 @@ class BudgetController extends Controller$row = [clone $start];$dateFormatted = $start->format('Y-m');+ //echo $start,' '.$month.'<br>';++// each budget, check if there is an entry for this month:/** @var array $row */foreach ($budgetInformation as $budgetRow) {@@ -338,10 +340,13 @@ class BudgetController extends Controller}$row[] = $spent;}++ // add "no budget" thing.+ $row[] = round(bcmul($repository->getWithoutBudgetSum($accounts, $start, $month), '-1'), 4);+$entries->push($row);$start->endOfMonth()->addDay();}-$data = $this->generator->year($budgets, $entries);$cache->store($data);