/** * Shows the overview for a bill. The min/max amount and matched journals. * * @param BillRepositoryInterface $repository * @param Bill $bill * * @return \Symfony\Component\HttpFoundation\Response */ public function single(BillRepositoryInterface $repository, Bill $bill) { $cache = new CacheProperties(); $cache->addProperty('single'); $cache->addProperty('bill'); $cache->addProperty($bill->id); if ($cache->has()) { return Response::json($cache->get()); } // get first transaction or today for start: $results = $repository->getJournals($bill, 1, 200); // resort: $results = $results->sortBy(function (TransactionJournal $journal) { return $journal->date->format('U'); }); $data = $this->generator->single($bill, $results); $cache->store($data); return Response::json($data); }
/** * @param BillRepositoryInterface $repository * @param Bill $bill * * @return \Illuminate\View\View */ public function show(BillRepositoryInterface $repository, Bill $bill) { $journals = $repository->getJournals($bill); $bill->nextExpectedMatch = $repository->nextExpectedMatch($bill); $hideBill = true; $subTitle = e($bill->name); return view('bills.show', compact('journals', 'hideBill', 'bill', 'subTitle')); }
/** * Shows the overview for a bill. The min/max amount and matched journals. * * @param BillRepositoryInterface $repository * @param Bill $bill * * @return \Symfony\Component\HttpFoundation\Response */ public function single(BillRepositoryInterface $repository, Bill $bill) { $cache = new CacheProperties(); $cache->addProperty('single'); $cache->addProperty('bill'); $cache->addProperty($bill->id); if ($cache->has()) { return Response::json($cache->get()); // @codeCoverageIgnore } // get first transaction or today for start: $results = $repository->getJournals($bill); $data = $this->generator->single($bill, $results); $cache->store($data); return Response::json($data); }
/** * @param BillRepositoryInterface $repository * @param Bill $bill * * @return View */ public function show(BillRepositoryInterface $repository, Bill $bill) { /** @var Carbon $date */ $date = session('start'); $year = $date->year; $page = intval(Input::get('page')) == 0 ? 1 : intval(Input::get('page')); $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); $journals = $repository->getJournals($bill, $page, $pageSize); $yearAverage = $repository->getYearAverage($bill, $date); $overallAverage = $repository->getOverallAverage($bill); $journals->setPath('/bills/show/' . $bill->id); $bill->nextExpectedMatch = $repository->nextExpectedMatch($bill); $hideBill = true; $subTitle = e($bill->name); return view('bills.show', compact('journals', 'yearAverage', 'overallAverage', 'year', 'hideBill', 'bill', 'subTitle')); }