And optimised another chart. Amounts are slightly different. Will investigate

This commit is contained in:
James Cole 2015-12-31 08:31:28 +01:00
parent aac5c2b13c
commit 25747fbcf2
2 changed files with 3 additions and 3 deletions

View File

@ -313,7 +313,7 @@ class ReportQuery implements ReportQueryInterface
->get(
[
DB::Raw('DATE_FORMAT(`transaction_journals`.`date`,"%Y-%m") AS `dateFormatted`'),
DB::Raw('SUM(`t_from`.`amount`) AS `sum`')
DB::Raw('SUM(`t_to`.`amount`) AS `sum`')
]
);
$array = [];

View File

@ -66,7 +66,7 @@ class ReportController extends Controller
while ($start < $end) {
$incomeSum = $this->pluckFromArray($start->year, $earnedArray);
$expenseSum = $this->pluckFromArray($start->year, $spentArray);
$expenseSum = $this->pluckFromArray($start->year, $spentArray) * -1;
$entries->push([clone $start, $incomeSum, $expenseSum]);
$start->addYear();
@ -82,7 +82,7 @@ class ReportController extends Controller
// total income and total expenses:
$date = $start->format('Y-m');
$incomeSum = isset($earnedArray[$date]) ? $earnedArray[$date] : 0;
$expenseSum = isset($spentArray[$date]) ? $spentArray[$date] : 0;
$expenseSum = isset($spentArray[$date]) ? ($spentArray[$date]*-1) : 0;
$entries->push([clone $start, $incomeSum, $expenseSum]);
$start->addMonth();