diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 4fba001c4b..3136edf3ae 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -290,7 +290,7 @@ class CategoryController extends Controller /** @var JournalCollectorInterface $collector */ $collector = app(JournalCollectorInterface::class); $collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withOpposingAccount() - ->setCategory($category)->withBudgetInformation()->withCategoryInformation(); + ->setCategory($category)->withBudgetInformation()->withCategoryInformation()->disableInternalFilter(); $journals = $collector->getPaginatedJournals(); $journals->setPath('categories/show/' . $category->id); $count = $journals->getCollection()->count(); @@ -479,13 +479,22 @@ class CategoryController extends Controller $earned = $repository->earnedInPeriod(new Collection([$category]), $accounts, $end, $currentEnd); $dateStr = $end->format('Y-m-d'); $dateName = Navigation::periodShow($end, $range); + + // amount transferred + /** @var JournalCollectorInterface $collector */ + $collector = app(JournalCollectorInterface::class); + $collector->setAllAssetAccounts()->setRange($end, $currentEnd)->setCategory($category) + ->withOpposingAccount()->setTypes([TransactionType::TRANSFER])->disableInternalFilter(); + $transferred = Steam::positive($collector->getJournals()->sum('transaction_amount')); + $entries->push( [ - 'string' => $dateStr, - 'name' => $dateName, - 'spent' => $spent, - 'earned' => $earned, - 'date' => clone $end, + 'string' => $dateStr, + 'name' => $dateName, + 'spent' => $spent, + 'earned' => $earned, + 'transferred' => $transferred, + 'date' => clone $end, ] ); $end = Navigation::subtractPeriod($end, $range, 1); diff --git a/resources/views/categories/show.twig b/resources/views/categories/show.twig index 24d490fb72..4f02a75416 100644 --- a/resources/views/categories/show.twig +++ b/resources/views/categories/show.twig @@ -109,6 +109,10 @@ {{ 'earned'|_ }} {{ period.earned|formatAmount }} + + {{ 'transferred'|_ }} + {{ period.transferred|formatAmountPlain }} +