mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix empty pop-ups in report.
This commit is contained in:
parent
e4e0e21293
commit
2fc09ff9d7
@ -13,6 +13,7 @@ namespace FireflyIII\Http\Controllers\Popup;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Collection\BalanceLine;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
@ -184,7 +185,7 @@ class ReportController extends Controller
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$crud = app('FireflyIII\Crud\Account\AccountCrudInterface');
|
||||
$crud = app(AccountCrudInterface::class);
|
||||
$account = $crud->find(intval($attributes['accountId']));
|
||||
$types = [TransactionType::WITHDRAWAL, TransactionType::TRANSFER];
|
||||
$journals = $repository->journalsInPeriod($attributes['accounts'], $types, $attributes['startDate'], $attributes['endDate']);
|
||||
@ -192,7 +193,8 @@ class ReportController extends Controller
|
||||
// filter for transfers and withdrawals TO the given $account
|
||||
$journals = $journals->filter(
|
||||
function (TransactionJournal $journal) use ($account) {
|
||||
if ($journal->destination_account_id === $account->id) {
|
||||
$destinations = TransactionJournal::destinationAccountList($journal)->pluck('id')->toArray();
|
||||
if (in_array($account->id, $destinations)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -187,8 +187,9 @@ class ReportController extends Controller
|
||||
$transactionAmount = $journal->source_amount;
|
||||
|
||||
// get currently relevant transaction:
|
||||
if (intval($journal->destination_account_id) === $account->id) {
|
||||
$transactionAmount = $journal->destination_amount;
|
||||
$destinations = TransactionJournal::destinationAccountList($journal)->pluck('id')->toArray();
|
||||
if (in_array($account->id, $destinations)) {
|
||||
$transactionAmount = TransactionJournal::amountPositive($journal);
|
||||
}
|
||||
$newBalance = bcadd($startBalance, $transactionAmount);
|
||||
$journal->after = $newBalance;
|
||||
|
Loading…
Reference in New Issue
Block a user