Skip to content

Firefly III: a personal finances manager

First code for multi year budget chart.

James Cole0303b45707c9
diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php
index 55cc8ef56d..3288fa4525 100644
--- a/app/Http/Controllers/Chart/BudgetController.php
+++ b/app/Http/Controllers/Chart/BudgetController.php
@@ -35,6 +35,35 @@ class BudgetController extends Controller
$this->generator = app('FireflyIII\Generator\Chart\Budget\BudgetChartGenerator');
}
+ /**
+ * @param BudgetRepositoryInterface $repository
+ * @param $report_type
+ * @param Carbon $start
+ * @param Carbon $end
+ * @param Collection $accounts
+ * @param Collection $budgets
+ */
+ public function multiYear(BudgetRepositoryInterface $repository, $report_type, Carbon $start, Carbon $end, Collection $accounts, Collection $budgets)
+ {
+ $currentStart = clone $start;
+
+ while($currentStart < $end) {
+ $currentEnd = clone $currentStart;
+ $currentEnd->endOfYear();
+
+ //echo 'now for '.$currentStart->format('Ymd').' to '.$currentEnd->format('Ymd').'<br>';
+ //epository->balanceInPeriod()
+
+ // do something for all budgets.
+
+ // jump to next year.
+ $currentStart = clone $currentEnd;
+ $currentStart->addDay();
+
+ }
+
+ }
+
/**
* @param BudgetRepositoryInterface $repository
* @param Budget $budget