mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-03 12:47:17 -06:00
Fix query.
This commit is contained in:
parent
9bd1503cb4
commit
a985e09282
@ -288,7 +288,6 @@ class ReportQuery implements ReportQueryInterface
|
||||
// OR is a transfer from NOT a shared account to a shared account.
|
||||
|
||||
|
||||
|
||||
$query->where(
|
||||
function (Builder $query) {
|
||||
$query->where(
|
||||
@ -367,28 +366,20 @@ class ReportQuery implements ReportQueryInterface
|
||||
|
||||
$query = $this->queryJournalsWithTransactions($start, $end);
|
||||
|
||||
// withdrawals from any account are an expense.
|
||||
// transfers away, to an account not in the list, are an expense.
|
||||
|
||||
$query->where(
|
||||
function (Builder $query) {
|
||||
function (Builder $query) use ($ids) {
|
||||
$query->where(
|
||||
function (Builder $q) { // only get withdrawals from any account:
|
||||
function (Builder $q) {
|
||||
$q->where('transaction_types.type', TransactionType::WITHDRAWAL);
|
||||
//$q->where('acm_from.data', '!=', '"sharedAsset"');
|
||||
}
|
||||
);
|
||||
$query->orWhere(
|
||||
function (Builder $q) { // and transfers from a shared account to a not-shared account.
|
||||
function (Builder $q) use ($ids) {
|
||||
$q->where('transaction_types.type', TransactionType::TRANSFER);
|
||||
$q->where('acm_to.data', '=', '"sharedAsset"');
|
||||
$q->where('acm_from.data', '!=', '"sharedAsset"');
|
||||
}
|
||||
);
|
||||
// OR transfers from a NOT shared account to a shared account.
|
||||
$query->orWhere(
|
||||
function (Builder $q) { // and transfers from a shared account to a not-shared account.
|
||||
$q->where('transaction_types.type', TransactionType::TRANSFER);
|
||||
$q->where('acm_to.data', '!=', '"sharedAsset"');
|
||||
$q->where('acm_from.data', '=', '"sharedAsset"');
|
||||
$q->whereNotIn('ac_to.id', $ids);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user