reportService = $reportService; $this->exportService = $exportService; } protected function initializeDefaultFilters(): void { if (empty($this->getFilterState('trialBalanceType'))) { $this->setFilterState('trialBalanceType', 'regular'); } } public function getTable(): array { return [ Column::make('account_code') ->label('Account Code') ->toggleable() ->alignment(Alignment::Center), Column::make('account_name') ->label('Account') ->alignment(Alignment::Left), Column::make('debit_balance') ->label('Debit') ->alignment(Alignment::Right), Column::make('credit_balance') ->label('Credit') ->alignment(Alignment::Right), ]; } public function filtersForm(Form $form): Form { return $form ->columns(4) ->schema([ Select::make('trialBalanceType') ->label('Trial Balance Type') ->options([ 'regular' => 'Regular', 'postClosing' => 'Post-Closing', ]) ->selectablePlaceholder(false), DateRangeSelect::make('dateRange') ->label('As of Date') ->selectablePlaceholder(false) ->endDateField('asOfDate'), $this->getAsOfDateFormComponent(), ]); } protected function buildReport(array $columns): ReportDTO { return $this->reportService->buildTrialBalanceReport($this->getFilterState('trialBalanceType'), $this->getFormattedAsOfDate(), $columns); } protected function getTransformer(ReportDTO $reportDTO): ExportableReport { return new TrialBalanceReportTransformer($reportDTO); } public function exportCSV(): StreamedResponse { return $this->exportService->exportToCsv($this->company, $this->report, $this->getFilterState('startDate'), $this->getFilterState('endDate')); } public function exportPDF(): StreamedResponse { return $this->exportService->exportToPdf($this->company, $this->report, $this->getFilterState('startDate'), $this->getFilterState('endDate')); } }