Commit 4920d01e by Alfiro Pratama

Excel Export

parent 6c0dbf84
...@@ -7,9 +7,9 @@ use App\Models\DaftarProposal; ...@@ -7,9 +7,9 @@ use App\Models\DaftarProposal;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Contracts\View\View; use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView; use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize; // use Maatwebsite\Excel\Concerns\ShouldAutoSize;
class DaftarProposalExport implements FromView,ShouldAutoSize class DaftarProposalExport implements FromView
{ {
/** /**
* @return \Illuminate\Support\Collection * @return \Illuminate\Support\Collection
...@@ -23,29 +23,33 @@ class DaftarProposalExport implements FromView,ShouldAutoSize ...@@ -23,29 +23,33 @@ class DaftarProposalExport implements FromView,ShouldAutoSize
public function view(): View public function view(): View
{ {
ini_set('memory_limit', '-1'); // ini_set('memory_limit', '-1');
$statement = " STATUS_HAPUS = '0' "; $statement = " STATUS_HAPUS = '0' ";
if($this->jenis != "0") if($this->jenis != "0")
{ {
$statement .= " AND jenis_id = '".$this->jenis."'"; $statement .= " AND jenis_id = '{$this->jenis}'";
} }
if($this->status != "0") if($this->status != "0")
{ {
// dikurang 1 karena di view mulai dari 0 sedangkan 0 itu menunggu persetujuan // dikurang 1 karena di view mulai dari 0 sedangkan 0 itu menunggu persetujuan
$status = $this->status - 1; $status = $this->status - 1;
$statement .= " AND STATUS_FINAL = '".$status."'"; $statement .= " AND STATUS_FINAL = '{$status}'";
} }
if($this->tahun != "0") if($this->tahun != "0")
{ {
$statement .= " AND PERIODE = '".$this->tahun."'"; $statement .= " AND PERIODE = '{$this->tahun}'";
} }
$data = DaftarProposal::with('rKelompokDetil') $data = DaftarProposal::with(['rKelompokDetil', 'reviewerProposal1', 'reviewerProposal2'])
->select("*") ->select("*")
->selectRaw(" round((ambil_jumlah_penilaian_seleksi(reviewer_proposal_id_1) + ambil_jumlah_penilaian_seleksi(reviewer_proposal_id_2 )) / 2, 2) as rata ")->whereRaw($statement)->get(); ->selectRaw(" round((ambil_jumlah_penilaian_seleksi(reviewer_proposal_id_1) + ambil_jumlah_penilaian_seleksi(reviewer_proposal_id_2 )) / 2, 2) as rata ")
// ->whereRaw($statement)
->get();
// dd($statement);
$result = []; $result = [];
$x =0; $x =0;
...@@ -103,8 +107,9 @@ class DaftarProposalExport implements FromView,ShouldAutoSize ...@@ -103,8 +107,9 @@ class DaftarProposalExport implements FromView,ShouldAutoSize
} }
$datas['list_proposal'] = $result; $datas['list_proposal'] = $result;
// dd($result);
$datas['jenis_monev'] = 'Seleksi Internal'; $datas['jenis_monev'] = 'Seleksi Internal';
return view('backend.operator.daftar_proposal.excel', $datas); return view('backend.operator.daftar_proposal.excel_new', $datas);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment