mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-29 02:11:12 -06:00
Allow virtual balance to be ignored.
This commit is contained in:
parent
7f5188f5a4
commit
4bb14cad73
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user