. */ declare(strict_types=1); namespace FireflyIII\Generator\Report\Standard; use Carbon\Carbon; use FireflyIII\Generator\Report\ReportGeneratorInterface; use FireflyIII\Helpers\Report\ReportHelperInterface; use Illuminate\Support\Collection; /** * Class MonthReportGenerator. */ class MonthReportGenerator implements ReportGeneratorInterface { /** @var Collection */ private $accounts; /** @var Carbon */ private $end; /** @var Carbon */ private $start; /** * @return string */ public function generate(): string { /** @var ReportHelperInterface $helper */ $helper = app(ReportHelperInterface::class); $bills = $helper->getBillReport($this->start, $this->end, $this->accounts); $accountIds = join(',', $this->accounts->pluck('id')->toArray()); $reportType = 'default'; // continue! return view( 'reports.default.month', compact('bills', 'accountIds', 'reportType') )->with('start', $this->start)->with('end', $this->end)->render(); } /** * @param Collection $accounts * * @return ReportGeneratorInterface */ public function setAccounts(Collection $accounts): ReportGeneratorInterface { $this->accounts = $accounts; return $this; } /** * @param Collection $budgets * * @return ReportGeneratorInterface */ public function setBudgets(Collection $budgets): ReportGeneratorInterface { return $this; } /** * @param Collection $categories * * @return ReportGeneratorInterface */ public function setCategories(Collection $categories): ReportGeneratorInterface { return $this; } /** * @param Carbon $date * * @return ReportGeneratorInterface */ public function setEndDate(Carbon $date): ReportGeneratorInterface { $this->end = $date; return $this; } /** * @param Carbon $date * * @return ReportGeneratorInterface */ public function setStartDate(Carbon $date): ReportGeneratorInterface { $this->start = $date; return $this; } /** * @param Collection $tags * * @return ReportGeneratorInterface */ public function setTags(Collection $tags): ReportGeneratorInterface { return $this; } }