mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-27 17:31:09 -06:00
Sharper spent in period. [skip ci]
This commit is contained in:
parent
a5d5f86aed
commit
c4818334e7
@ -118,8 +118,8 @@ class ReportController extends Controller
|
||||
while ($currentStart <= $end) {
|
||||
$currentEnd = Navigation::endOfPeriod($currentStart, '1M');
|
||||
$date = $currentStart->format('Y-m');
|
||||
$spent = $repository->expensesInPeriod($accounts, $currentStart, $currentEnd);
|
||||
$earned = $repository->incomesInPeriod($accounts, $currentStart, $currentEnd);
|
||||
$spent = $repository->spentInPeriod($accounts, $currentStart, $currentEnd);
|
||||
$earned = $repository->earnedInPeriod($accounts, $currentStart, $currentEnd);
|
||||
$spentArray[$date] = bcmul($spent, '-1');
|
||||
$earnedArray[$date] = $earned;
|
||||
$currentStart = Navigation::addPeriod($currentStart, '1M', 0);
|
||||
|
@ -127,6 +127,8 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')->where('destination.amount', '>', 0);
|
||||
}
|
||||
);
|
||||
|
||||
// should this not be a XOR query?
|
||||
$query->whereIn('destination.account_id', $accountIds);
|
||||
|
||||
}
|
||||
@ -559,7 +561,13 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')->where('source.amount', '<', 0);
|
||||
}
|
||||
);
|
||||
$query->leftJoin(
|
||||
'transactions as destination', function (JoinClause $join) {
|
||||
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')->where('destination.amount', '>', 0);
|
||||
}
|
||||
);
|
||||
$query->whereIn('source.account_id', $accountIds);
|
||||
$query->whereNotIn('destination.account_id', $accountIds);
|
||||
|
||||
}
|
||||
// remove group by
|
||||
|
Loading…
Reference in New Issue
Block a user