Chart cleanup

This commit is contained in:
Sander Dorigo
2014-11-02 21:24:50 +01:00
parent ef39f31ea1
commit 03729aa5ae
4 changed files with 30 additions and 12 deletions

View File

@@ -231,8 +231,7 @@ class GoogleChartController extends BaseController
/** @var \TransactionJournal $journal */
foreach ($journals as $journal) {
if ($journal->transactionType->type == 'Withdrawal') {
$amount = floatval($journal->transactions[1]->amount);
$amount = $amount < 0 ? $amount * -1 : $amount;
$amount = $journal->getAmount();
$category = $journal->categories()->first();
if (!is_null($category)) {
if (isset($data[$category->name])) {
@@ -321,8 +320,7 @@ class GoogleChartController extends BaseController
$unpaid['items'][] = $entry->name;
$unpaid['amount'] += (($entry->amount_max + $entry->amount_min) / 2);
} else {
$amount = floatval($journal->transactions[0]->amount);
$amount = $amount < 0 ? $amount * -1 : $amount;
$amount = $journal->getAmount();
$paid['items'][] = $journal->description;
$paid['amount'] += $amount;
}