data = $data; $this->dateRange = $dateRange; $this->user = $user; $this->profitTypeData = $profitTypeData; $this->reportName = $reportName; } public function sheets(): array { $sheets = [ new StatisticsMainDataExport('Сводка', $this->reportName, $this->data, $this->dateRange, $this->user), ]; // Лист с разбивкой по типам оплаты — только для роли "Экономист" if ($this->user->isEconomist()) { $sheets[] = new StatisticsEconomistData( 'По источникам доходов', $this->reportName, $this->profitTypeData['data'] ?? [], $this->dateRange, $this->user, $this->profitTypeData['grandTotals'] ?? [], $this->profitTypeData['profitTypes'] ?? [], ); } return $sheets; } }