reports not using the new export structure

This commit is contained in:
Denis Duliçi 2021-06-11 17:53:42 +03:00
parent 369ec5a2be
commit 562b1437f7
2 changed files with 7 additions and 3 deletions

View File

@ -16,7 +16,8 @@ use App\Traits\Charts;
use App\Traits\DateTime; use App\Traits\DateTime;
use App\Traits\SearchString; use App\Traits\SearchString;
use App\Utilities\Chartjs; use App\Utilities\Chartjs;
use Date; use App\Utilities\Date;
use App\Utilities\Export as ExportHelper;
use Illuminate\Support\Str; use Illuminate\Support\Str;
abstract class Report abstract class Report
@ -205,7 +206,7 @@ abstract class Report
public function export() public function export()
{ {
return \Excel::download(new Export($this->views['content'], $this), \Str::filename($this->model->name) . '.xlsx'); return ExportHelper::toExcel(new Export($this->views['content'], $this), $this->model->name);
} }
public function setColumnWidth() public function setColumnWidth()
@ -394,7 +395,7 @@ abstract class Report
$start = $quarter->getStartDate()->format($this->getQuarterlyDateFormat($this->year)); $start = $quarter->getStartDate()->format($this->getQuarterlyDateFormat($this->year));
$end = $quarter->getEndDate()->format($this->getQuarterlyDateFormat($this->year)); $end = $quarter->getEndDate()->format($this->getQuarterlyDateFormat($this->year));
$formatted_date = $start . '-' . $end; $formatted_date = $start . '-' . $end;
} }

View File

@ -3,12 +3,15 @@
namespace App\Exports\Common; namespace App\Exports\Common;
use Illuminate\Contracts\View\View; use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromView; use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize; use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithTitle; use Maatwebsite\Excel\Concerns\WithTitle;
class Reports implements FromView, ShouldAutoSize, WithTitle class Reports implements FromView, ShouldAutoSize, WithTitle
{ {
use Exportable;
protected $view; protected $view;
protected $class; protected $class;