From 678e504c48c96d76c38c35bbf677d6c2d3550cf9 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 10 Mar 2015 20:26:52 +0100 Subject: [PATCH] Fix charts to match report. --- app/Http/Controllers/GoogleChartController.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/GoogleChartController.php b/app/Http/Controllers/GoogleChartController.php index 82662550ca..6431b4a2be 100644 --- a/app/Http/Controllers/GoogleChartController.php +++ b/app/Http/Controllers/GoogleChartController.php @@ -560,6 +560,9 @@ class GoogleChartController extends Controller $chart->addColumn('Income', 'number'); $chart->addColumn('Expenses', 'number'); + $pref = Preferences::get('showSharedReports', false); + $showSharedReports = $pref->data; + // get report query interface. $end = clone $start; @@ -568,14 +571,14 @@ class GoogleChartController extends Controller $currentEnd = clone $start; $currentEnd->endOfMonth(); // total income: - $income = $query->incomeByPeriod($start, $currentEnd); + $income = $query->incomeByPeriod($start, $currentEnd, $showSharedReports); $incomeSum = 0; foreach ($income as $entry) { $incomeSum += floatval($entry->amount); } // total expenses: - $expense = $query->journalsByExpenseAccount($start, $currentEnd); + $expense = $query->journalsByExpenseAccount($start, $currentEnd, $showSharedReports); $expenseSum = 0; foreach ($expense as $entry) { $expenseSum += floatval($entry->amount); @@ -609,6 +612,9 @@ class GoogleChartController extends Controller $chart->addColumn('Income', 'number'); $chart->addColumn('Expenses', 'number'); + $pref = Preferences::get('showSharedReports', false); + $showSharedReports = $pref->data; + $income = 0; $expense = 0; $count = 0; @@ -619,14 +625,14 @@ class GoogleChartController extends Controller $currentEnd = clone $start; $currentEnd->endOfMonth(); // total income: - $incomeResult = $query->incomeByPeriod($start, $currentEnd); + $incomeResult = $query->incomeByPeriod($start, $currentEnd, $showSharedReports); $incomeSum = 0; foreach ($incomeResult as $entry) { $incomeSum += floatval($entry->amount); } // total expenses: - $expenseResult = $query->journalsByExpenseAccount($start, $currentEnd); + $expenseResult = $query->journalsByExpenseAccount($start, $currentEnd, $showSharedReports); $expenseSum = 0; foreach ($expenseResult as $entry) { $expenseSum += floatval($entry->amount);