컨트롤러수정
This commit is contained in:
98
app/Controllers/Results/Dept.php
Normal file
98
app/Controllers/Results/Dept.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
namespace App\Controllers\results;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\results\DeptModel;
|
||||
|
||||
class Dept extends BaseController
|
||||
{
|
||||
private $deptModel;
|
||||
private $schDateGb = ''; // 일자구분
|
||||
private $sdate = ''; // 시작일자
|
||||
private $edate = ''; // 종료일자
|
||||
|
||||
private $bonbu = ''; // 본부
|
||||
private $dept_sq = ''; // 팀
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->deptModel = new DeptModel();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function lists(): string
|
||||
{
|
||||
|
||||
|
||||
$this->schDateGb = $this->request->getPost('schDateGb') ?? '1';
|
||||
|
||||
$this->sdate = $this->request->getPost('sdate');
|
||||
if (empty($this->sdate)) {
|
||||
$this->sdate = date('Y-m-01'); // 이번달 1일
|
||||
}
|
||||
|
||||
$this->edate = $this->request->getPost('edate');
|
||||
if (empty($this->edate)) {
|
||||
$this->edate = date('Y-m-t'); // 이번달 말일
|
||||
}
|
||||
|
||||
$this->bonbu = $this->request->getPost('bonbu');
|
||||
if (empty($this->bonbu)) {
|
||||
$this->bonbu = '';
|
||||
}
|
||||
|
||||
$this->dept_sq = $this->request->getPost('dept_sq');
|
||||
if (empty($this->dept_sq)) {
|
||||
$this->dept_sq = '';
|
||||
}
|
||||
|
||||
$data = [
|
||||
'schDateGb' => $this->schDateGb,
|
||||
'sdate' => $this->sdate,
|
||||
'edate' => $this->edate,
|
||||
'bonbu' => $this->bonbu,
|
||||
'dept_sq' => $this->dept_sq,
|
||||
];
|
||||
|
||||
$bonbu = $this->deptModel->getBonbuList();
|
||||
$team = $this->deptModel->getTeamList();
|
||||
|
||||
$res = $this->deptModel->st_d01($data);
|
||||
|
||||
return view("pages/results/dept/stats_d01", [
|
||||
'pBonbu' => $this->bonbu,
|
||||
'pDeptSq' => $this->dept_sq,
|
||||
'schDateGb' => $this->schDateGb,
|
||||
'sdate' => $this->sdate,
|
||||
'edate' => $this->edate,
|
||||
'bonbu' => $bonbu,
|
||||
'team' => $team,
|
||||
'st_list' => $res,
|
||||
]);
|
||||
}
|
||||
|
||||
// 엑셀 다운로드
|
||||
public function excel()
|
||||
{
|
||||
$data = [
|
||||
'schDateGb' => $this->request->getGet('schDateGb'),
|
||||
'sdate' => $this->request->getGet('sdate'),
|
||||
'edate' => $this->request->getGet('edate'),
|
||||
'bonbu' => $this->request->getGet('bonbu'),
|
||||
'dept_sq' => $this->request->getGet('dept_sq'),
|
||||
];
|
||||
|
||||
|
||||
$res = $this->deptModel->getExcelList($data);
|
||||
|
||||
return $this->response->setJSON(body: [
|
||||
'data' => $res,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user