From 4bb14cad73e17ff9e5d543b640dbfe5d8ba4c6a1 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 1 Apr 2015 19:45:13 +0200 Subject: [PATCH] Allow virtual balance to be ignored. --- app/Support/Steam.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Support/Steam.php b/app/Support/Steam.php index d8b42ed5b6..5bd043eefe 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -19,10 +19,11 @@ class Steam * * @param Account $account * @param Carbon $date + * @param bool $ignoreVirtualBalance * * @return float */ - public function balance(Account $account, Carbon $date = null) + public function balance(Account $account, Carbon $date = null, $ignoreVirtualBalance = false) { $date = is_null($date) ? Carbon::now() : $date; @@ -47,7 +48,9 @@ class Steam 'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id' )->where('transaction_journals.date', '<=', $date->format('Y-m-d'))->sum('transactions.amount') ); - $balance += floatval($account->virtual_balance); + if (!$ignoreVirtualBalance) { + $balance += floatval($account->virtual_balance); + } return $balance; }