Skip to content

Firefly III: a personal finances manager

Quick links.

James Cole301528e2d267
diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php
index 49cd67a7d1..e74c7c0e56 100644
--- a/app/Http/Controllers/ReportController.php
+++ b/app/Http/Controllers/ReportController.php
@@ -87,7 +87,7 @@ class ReportController extends Controller
foreach ($accounts as $account) {
$accountIds[] = $account->id;
}
- $accountIds = join(';', $accountIds);
+ $accountIds = join(',', $accountIds);
return view(
'reports.default.year',
@@ -127,7 +127,7 @@ class ReportController extends Controller
foreach ($accounts as $account) {
$accountIds[] = $account->id;
}
- $accountIds = join(';', $accountIds);
+ $accountIds = join(',', $accountIds);
// continue!
return view(
@@ -159,7 +159,7 @@ class ReportController extends Controller
foreach ($accounts as $account) {
$accountIds[] = $account->id;
}
- $accountIds = join(';', $accountIds);
+ $accountIds = join(',', $accountIds);
return view(
'reports.default.multi-year', compact('budgets', 'accounts', 'categories', 'start', 'end', 'accountIds', 'report_type')
diff --git a/app/Http/routes.php b/app/Http/routes.php
index 966b7bdaab..4599887047 100644
--- a/app/Http/routes.php
+++ b/app/Http/routes.php
@@ -35,7 +35,7 @@ Route::bind(
'accountList',
function ($value) {
if (Auth::check()) {
- $ids = explode(';', $value);
+ $ids = explode(',', $value);
/** @var \Illuminate\Support\Collection $object */
$object = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->where('account_types.editable', 1)
@@ -49,6 +49,24 @@ Route::bind(
throw new NotFoundHttpException;
}
);
+// budget list
+Route::bind(
+ 'budgetList',
+ function ($value) {
+ if (Auth::check()) {
+ $ids = explode(',', $value);
+ /** @var \Illuminate\Support\Collection $object */
+ $object = Budget::where('budgets.active', 1)
+ ->whereIn('budgets.id', $ids)
+ ->where('budgets.user_id', Auth::user()->id)
+ ->get(['budgets.*']);
+ if ($object->count() > 0) {
+ return $object;
+ }
+ }
+ throw new NotFoundHttpException;
+ }
+);
// Date
Route::bind(
@@ -357,8 +375,8 @@ Route::group(
Route::get('/chart/budget/frontpage', ['uses' => 'Chart\BudgetController@frontpage']);
// this chart is used in reports:
- Route::get('/chart/budget/year/{report_type}/{start_date}/{end_date}/{accountList}', ['uses' => 'Chart\BudgetController@year'])->where(['year' => '[0-9]{4}', 'shared' => 'shared']);
-
+ Route::get('/chart/budget/year/{report_type}/{start_date}/{end_date}/{accountList}', ['uses' => 'Chart\BudgetController@year']);
+ Route::get('/chart/budget/multi-year/{report_type}/{start_date}/{end_date}/{accountList}/{budgetList}', ['uses' => 'Chart\BudgetController@multiYear']);
Route::get('/chart/budget/{budget}/{limitrepetition}', ['uses' => 'Chart\BudgetController@budgetLimit']);
Route::get('/chart/budget/{budget}', ['uses' => 'Chart\BudgetController@budget']);
diff --git a/public/js/reports/default/multi-year.js b/public/js/reports/default/multi-year.js
index 95cff4f05e..904982dd4e 100644
--- a/public/js/reports/default/multi-year.js
+++ b/public/js/reports/default/multi-year.js
@@ -8,7 +8,6 @@ $(function () {
});
-
function drawChart() {
"use strict";
@@ -17,10 +16,30 @@ function drawChart() {
columnChart('chart/report/in-out-sum/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-sum-chart');
- $.each($('.account-chart'), function(i,v) {
+ $.each($('.account-chart'), function (i, v) {
var holder = $(v);
- console.log(holder.data('id'));
+ console.log('Will draw chart for account #' + holder.data('id'));
+ });
+
+ // draw budget chart based on selected budgets:
+ $('.budget-checkbox').on('change', updateBudgetChart);
+
+
+}
+
+function updateBudgetChart(e) {
+ console.log('will update budget chart.');
+ // get all budget ids:
+ var budgets = [];
+ $.each($('.budget-checkbox'), function (i, v) {
+ var current = $(v);
+ if (current.prop('checked')) {
+ budgets.push(current.val());
+ }
});
+ var budgetIds = budgets.join(',');
+ // draw chart. Redraw when exists? Not sure if we support that.
+ columnChart('chart/budget/multi-year/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds + '/' + budgetIds, 'budgets-chart');
}
\ No newline at end of file
diff --git a/public/js/reports/index.js b/public/js/reports/index.js
index 685ee559c9..6a961bd77a 100644
--- a/public/js/reports/index.js
+++ b/public/js/reports/index.js
@@ -64,7 +64,7 @@ function catchSubmit() {
$.each($('.account-checkbox'), function (i, v) {
var c = $(v);
if (c.prop('checked')) {
- url += c.val() + ';';
+ url += c.val() + ',';
accounts.push(c.val());
count++;
}
diff --git a/resources/lang/en/firefly.php b/resources/lang/en/firefly.php
index 7f3b0510f3..2382b55a20 100644
--- a/resources/lang/en/firefly.php
+++ b/resources/lang/en/firefly.php
@@ -374,8 +374,16 @@ return [
// 'reportForMonth' => 'Montly report for :month',
// 'reportForMonthShared' => 'Montly report for :month (including shared accounts)',
- 'report_default' => 'Default financial report for :start until :end',
-
+ 'report_default' => 'Default financial report for :start until :end',
+ 'quick_link_reports' => 'Quick links',
+ 'quick_link_default_report' => 'Default financial report',
+ 'report_this_month_shared' => 'Current month, all shared accounts',
+ 'report_this_month_non_shared' => 'Current month, all not-shared accounts',
+ 'report_this_year_shared' => 'Current year, all shared accounts',
+ 'report_this_year_non_shared' => 'Current year, all not-shared accounts',
+ 'report_all_time_shared' => 'All-time, all shared accounts',
+ 'report_all_time_non_shared' => 'All-time, all not-shared accounts',
+ 'reports_can_bookmark' => 'Remember that reports can be bookmarked.',
'incomeVsExpenses' => 'Income vs. expenses',
'accountBalances' => 'Account balances',
'balanceStartOfYear' => 'Balance at start of year',
diff --git a/resources/twig/reports/default/multi-year.twig b/resources/twig/reports/default/multi-year.twig
index 5a7939b048..491713e802 100644
--- a/resources/twig/reports/default/multi-year.twig
+++ b/resources/twig/reports/default/multi-year.twig
@@ -58,9 +58,12 @@
</div>
<div class="row">
<div class="col-lg-12">
+ <label class="checkbox-inline">
+ <input type="checkbox" class="budget-checkbox" name="budgets[]" value="0"> {{ 'noBudget'|_ }}
+ </label>
{% for budget in budgets %}
<label class="checkbox-inline">
- <input type="checkbox" name="budgets[]" value="{{ budget.id }}"> {{ budget.name }}
+ <input type="checkbox" class="budget-checkbox" name="budgets[]" value="{{ budget.id }}"> {{ budget.name }}
</label>
{% endfor %}
</div>
diff --git a/resources/twig/reports/index.twig b/resources/twig/reports/index.twig
index 591f30cdec..90abeff21f 100644
--- a/resources/twig/reports/index.twig
+++ b/resources/twig/reports/index.twig
@@ -82,6 +82,43 @@
</div>
</div>
</div>
+ <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
+ <div class="box">
+ <div class="box-header with-border">
+ <h3 class="box-title">{{ 'quick_link_reports'|_ }}</h3>
+ </div>
+ <div class="box-body">
+ <h4>{{ 'quick_link_default_report'|_ }}</h4>
+ <ul>
+ <li>
+ <a href="#">{{ 'report_this_month_shared'|_ }}</a>
+ </li>
+ <li>
+ <a href="#">{{ 'report_this_month_non_shared'|_ }}</a>
+ </li>
+ </ul>
+ <ul>
+ <li>
+ <a href="#">{{ 'report_this_year_shared'|_ }}</a>
+ </li>
+ <li>
+ <a href="#">{{ 'report_this_year_non_shared'|_ }}</a>
+ </li>
+ </ul>
+ <ul>
+ <li>
+ <a href="#">{{ 'report_all_time_shared'|_ }}</a>
+ </li>
+ <li>
+ <a href="#">{{ 'report_all_time_non_shared'|_ }}</a>
+ </li>
+ </ul>
+ <p>
+ <em>{{ 'reports_can_bookmark'|_ }}</em>
+ </p>
+ </div>
+ </div>
+ </div>
</div>
{% endblock %}