Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
New chart for budgets.
James Cole9adbbd872c61
diff --git a/app/controllers/GoogleChartController.php b/app/controllers/GoogleChartController.phpindex 61c520089b..15651be465 100644--- a/app/controllers/GoogleChartController.php+++ b/app/controllers/GoogleChartController.php@@ -445,6 +445,32 @@ class GoogleChartController extends BaseController}+ public function budgetLimitSpending(\Budget $budget, \LimitRepetition $repetition) {+ $start = clone $repetition->startdate;+ $end = $repetition->enddate;++ /** @var \Grumpydictator\Gchart\GChart $chart */+ $chart = App::make('gchart');+ $chart->addColumn('Day', 'date');+ $chart->addColumn('Left', 'number');+++ $amount = $repetition->amount;++ while($start <= $end) {+ /*+ * Sum of expenses on this day:+ */+ $sum = floatval($budget->transactionjournals()->lessThan(0)->transactionTypes(['Withdrawal'])->onDate($start)->sum('amount'));+ $amount += $sum;+ $chart->addRow(clone $start, $amount);+ $start->addDay();+ }+ $chart->generate();+ return Response::json($chart->getData());++ }+/*** @return \Illuminate\Http\JsonResponse* @throws \FireflyIII\Exception\FireflyException@@ -525,7 +551,6 @@ class GoogleChartController extends BaseController$chart->addRow('Paid: ' . join(', ', $paid['items']), $paid['amount']);$chart->generate();-return Response::json($chart->getData());}diff --git a/app/routes.php b/app/routes.phpindex 7441f93923..0f39b634aa 100644--- a/app/routes.php+++ b/app/routes.php@@ -155,21 +155,11 @@ Route::group(Route::get('/chart/reports/income-expenses/{year}', ['uses' => 'GoogleChartController@yearInExp']);Route::get('/chart/reports/income-expenses-sum/{year}', ['uses' => 'GoogleChartController@yearInExpSum']);Route::get('/chart/reports/budgets/{year}', ['uses' => 'GoogleChartController@budgetsReportChart']);+ Route::get('/chart/budget/{budget}/{limitrepetition}', ['uses' => 'GoogleChartController@budgetLimitSpending']);// google chart for components (categories + budgets combined)Route::get('/chart/component/{component}/spending/{year}', ['uses' => 'GoogleChartController@componentsAndSpending']);- // google table controller- #Route::get('/table/account/{account}/transactions', ['uses' => 'GoogleTableController@transactionsByAccount']);- #Route::get('/table/accounts/{what}', ['uses' => 'GoogleTableController@accountList']);- #Route::get('/table/categories', ['uses' => 'GoogleTableController@categoryList']);- #Route::get('/table/recurring', ['uses' => 'GoogleTableController@recurringList']);- #Route::get('/table/recurring/{recurring}/transactions', ['uses' => 'GoogleTableController@transactionsByRecurring']);- #Route::get('/table/transactions/{what}', ['uses' => 'GoogleTableController@transactionsList'])->where(['what' => 'expenses|revenue|withdrawal|deposit|transfer|transfers']);- // google table for components (categories + budgets)- #Route::get('/table/component/{component}/{limitrepetition}/transactions', ['uses' => 'GoogleTableController@transactionsByComponent']);--// home controllerRoute::get('/', ['uses' => 'HomeController@index', 'as' => 'index']);Route::get('/flush', ['uses' => 'HomeController@flush', 'as' => 'flush']); # even though nothing is cached.diff --git a/public/assets/javascript/firefly/budgets.js b/public/assets/javascript/firefly/budgets.jsindex 027a892372..f31d78b637 100644--- a/public/assets/javascript/firefly/budgets.js+++ b/public/assets/javascript/firefly/budgets.js@@ -10,6 +10,9 @@ $(function () {if (typeof componentID != 'undefined' && typeof repetitionID == 'undefined') {googleColumnChart('chart/component/' + componentID + '/spending/' + year, 'componentOverview');}+ if (typeof componentID != 'undefined' && typeof repetitionID != 'undefined') {+ googleLineChart('chart/budget/' + componentID + '/' + repetitionID, 'componentOverview');+ }});