Fixed a bug where incoming transactions would not be properly filtered in several reports.

This commit is contained in:
James Cole
2016-10-01 09:37:18 +02:00
parent 0fdaac53d0
commit b494be228b
2 changed files with 20 additions and 17 deletions

View File

@@ -189,22 +189,22 @@ class BillRepository implements BillRepositoryInterface
'bills.active',
'bills.name_encrypted',
'bills.match_encrypted'];
$ids = $accounts->pluck('id')->toArray();
$set = $this->user->bills()
->leftJoin(
'transaction_journals', function (JoinClause $join) {
$join->on('transaction_journals.bill_id', '=', 'bills.id')->whereNull('transaction_journals.deleted_at');
}
)
->leftJoin(
'transactions', function (JoinClause $join) {
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0);
}
)
->whereIn('transactions.account_id', $ids)
->whereNull('transaction_journals.deleted_at')
->groupBy($fields)
->get($fields);
$ids = $accounts->pluck('id')->toArray();
$set = $this->user->bills()
->leftJoin(
'transaction_journals', function (JoinClause $join) {
$join->on('transaction_journals.bill_id', '=', 'bills.id')->whereNull('transaction_journals.deleted_at');
}
)
->leftJoin(
'transactions', function (JoinClause $join) {
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0);
}
)
->whereIn('transactions.account_id', $ids)
->whereNull('transaction_journals.deleted_at')
->groupBy($fields)
->get($fields);
$set = $set->sortBy(
function (Bill $bill) {