Revamp multi-account report.

This commit is contained in:
James Cole
2019-09-03 22:35:41 +02:00
parent 4743230136
commit 47de2fec28
29 changed files with 2286 additions and 628 deletions

View File

@@ -403,6 +403,29 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* Both source AND destination must be in this list of accounts.
*
* @param Collection $accounts
*
* @return GroupCollectorInterface
*/
public function setBothAccounts(Collection $accounts): GroupCollectorInterface
{
if ($accounts->count() > 0) {
$accountIds = $accounts->pluck('id')->toArray();
$this->query->where(
static function (EloquentBuilder $query) use ($accountIds) {
$query->whereIn('source.account_id', $accountIds);
$query->whereIn('destination.account_id', $accountIds);
}
);
app('log')->debug(sprintf('GroupCollector: setBothAccounts: %s', implode(', ', $accountIds)));
}
return $this;
}
/**
* Limit the search to a specific budget.
*
@@ -499,7 +522,7 @@ class GroupCollector implements GroupCollectorInterface
$accountIds = $accounts->pluck('id')->toArray();
$this->query->whereIn('destination.account_id', $accountIds);
app('log')->debug(sprintf('GroupCollector: setSourceAccounts: %s', implode(', ', $accountIds)));
app('log')->debug(sprintf('GroupCollector: setDestinationAccounts: %s', implode(', ', $accountIds)));
}
return $this;
@@ -894,7 +917,7 @@ class GroupCollector implements GroupCollectorInterface
}
/**
* @param array $existingJournal
* @param array $existingJournal
* @param TransactionJournal $newJournal
*
* @return array