From c78c66715775d222278b2151ec484a9c6ff68030 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 1 Jan 2020 19:55:02 +0100 Subject: [PATCH] Reformat if-statement. --- app/Http/Controllers/Chart/ReportController.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php index 0eecf68f5d..0aef1aa8c9 100644 --- a/app/Http/Controllers/Chart/ReportController.php +++ b/app/Http/Controllers/Chart/ReportController.php @@ -186,10 +186,19 @@ class ReportController extends Controller // in our outgoing? $key = 'spent'; $amount = app('steam')->positive($journal['amount']); - if (TransactionType::DEPOSIT === $journal['transaction_type_type'] || ((TransactionType::TRANSFER === $journal['transaction_type_type'] - || TransactionType::OPENING_BALANCE === $journal['transaction_type_type']) - && in_array($journal['destination_account_id'], $ids, true) - )) { + + if ( + TransactionType::DEPOSIT === $journal['transaction_type_type'] + || // deposit = incoming + // transfer or opening balance, and these accounts are the destination. + ( + ( + TransactionType::TRANSFER === $journal['transaction_type_type'] + || TransactionType::OPENING_BALANCE === $journal['transaction_type_type'] + ) + && in_array($journal['destination_account_id'], $ids, true) + ) + ) { $key = 'earned'; } $data[$currencyId][$period][$key] = bcadd($data[$currencyId][$period][$key], $amount);