Files
confirms/app/Controllers/Results/M409.php
2025-12-23 17:42:15 +09:00

75 lines
1.9 KiB
PHP

<?php
namespace App\Controllers\results;
use App\Controllers\BaseController;
use App\Models\results\M409Model;
class M409 extends BaseController
{
private $model;
public function __construct()
{
$this->model = new M409Model();
}
public function stats(): string
{
$codes = $this->model->getCodeList(['VRFCREQ_WAY', 'CP_ID']);
$CODE_VRFCREQ_WAY = convertArrayToHashTable($codes['VRFCREQ_WAY'], 'cd', 'cd_nm', []);
$CODE_CP_ID = convertArrayToHashTable($codes['CP_ID'], 'cd', 'cd_nm', []);
return view("pages/results/m409/stats", [
'code_vrfcreq_way' => $CODE_VRFCREQ_WAY,
'code_cp_id' => $CODE_CP_ID,
]);
}
public function getResultList()
{
$data = [
'sdate' => $this->request->getGet('sdate'),
'edate' => $this->request->getGet('edate'),
'vrfcreq_way' => $this->request->getGet('vrfcreq_way'),
'cp_id' => $this->request->getGet('cp_id'),
];
$totalCount = $this->model->getTotalCount($data);
$datas = $this->model->getResultList($data);
return $this->response->setJSON(body: [
'recordsTotal' => $totalCount,
'recordsFiltered' => $totalCount,
'data' => $datas,
]);
}
// 엑셀 다운로드
public function excel()
{
try {
$data = [
'sdate' => $this->request->getGet('sdate'),
'edate' => $this->request->getGet('edate'),
'vrfcreq_way' => $this->request->getGet('vrfcreq_way'),
'cp_id' => $this->request->getGet('cp_id'),
];
$datas = $this->model->getExcelList($data);
return $this->response->setJSON(body: [
'data' => $datas,
]);
} catch (\Exception $e) {
$e->getPrevious()->getTraceAsString();
}
}
}