평면도관리 추가
Reviewed-on: http://192.168.10.243:3000/owrainfo/confirms/pulls/28
This commit was merged in pull request #28.
This commit is contained in:
@@ -113,6 +113,17 @@ $routes->group('', ['namespace' => 'App\Controllers\Article'], static function (
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* 아파트 평면도
|
||||
*/
|
||||
$routes->group('article/ground_ctn', static function ($routes) {
|
||||
$routes->get('lists', 'GroundCnt::lists');
|
||||
$routes->get('detail/(:num)', 'GroundCnt::detail/$1');
|
||||
|
||||
$routes->get('getResultList', 'GroundCnt::getResultList');
|
||||
$routes->get('excel', 'GroundCnt::excel');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
134
app/Controllers/Article/GroundCnt.php
Normal file
134
app/Controllers/Article/GroundCnt.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
namespace App\Controllers\Article;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\article\GroundCntModel;
|
||||
use App\Models\common\CodeModel;
|
||||
|
||||
class GroundCnt extends BaseController
|
||||
{
|
||||
|
||||
private $model, $codeModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new GroundCntModel();
|
||||
$this->codeModel = new CodeModel();
|
||||
}
|
||||
|
||||
public function lists(): string
|
||||
{
|
||||
|
||||
$codes = $this->codeModel->getCodeLists(['NHN_DEAL_TYPE', 'CP_ID', 'ARTICLE_TYPE', 'VRFCREQ_WAY', 'STEP_VERIFICATION']); // 코드조회
|
||||
$sido = $this->model->getAreaList(); // 지역조회
|
||||
$bonbu = $this->model->getBonbuList();
|
||||
$team = $this->model->getTeamList();
|
||||
$user = $this->model->getUserList();
|
||||
|
||||
$this->data['sido'] = $sido;
|
||||
$this->data['bonbu'] = $bonbu;
|
||||
$this->data['team'] = $team;
|
||||
$this->data['user'] = $user;
|
||||
$this->data['codes'] = $codes;
|
||||
|
||||
return view("pages/article/ground/lists", $this->data);
|
||||
}
|
||||
|
||||
public function getResultList()
|
||||
{
|
||||
$start = (int) $this->request->getGet('start') ?: 0;
|
||||
$end = (int) $this->request->getGet('length') ?: 10;
|
||||
|
||||
$data = [
|
||||
'rcpt_atclno' => $this->request->getGet('rcpt_atclno'), // 매물ID
|
||||
'schDateGb' => $this->request->getGet('schDateGb'), // 일자유형
|
||||
'sdate' => $this->request->getGet('sdate'), // 시작일
|
||||
'edate' => $this->request->getGet('edate'), // 종료일
|
||||
|
||||
'bonbu' => $this->request->getGet('bonbu'), // 본부
|
||||
'team' => $this->request->getGet('team'), // 팀
|
||||
'user' => $this->request->getGet('user'), // 담당자
|
||||
|
||||
'sido' => $this->request->getGet('sido'), // 시도
|
||||
'gugun' => $this->request->getGet('gugun'), // 시군구
|
||||
'dong' => $this->request->getGet('dong'), // 읍면동
|
||||
|
||||
'rcpt_stat1' => $this->request->getGet('rcpt_stat1'), // 상태1
|
||||
'rcpt_stat2' => $this->request->getGet('rcpt_stat2'), // 상태2
|
||||
'rcpt_stat3' => $this->request->getGet('rcpt_stat3'), // 상태3
|
||||
|
||||
'rcpt_product_info1' => $this->request->getGet('rcpt_product_info1'), // 거래구분
|
||||
'exp_movie_yn' => $this->request->getGet('exp_movie_yn'), // 동영상촬영여부
|
||||
'conf_img_yn' => $this->request->getGet('conf_img_yn'), // 홍보확인서여부
|
||||
'parcel_out_yn' => $this->request->getGet('parcel_out_yn'), // 분양권
|
||||
'rcpt_cpid' => $this->request->getGet('rcpt_cpid'), // CPID
|
||||
'rcpt_product' => $this->request->getGet('rcpt_product'), // 매물종류
|
||||
'exp_spc_yn' => $this->request->getGet('exp_spc_yn'), // 면적확인
|
||||
'check_list_img_yn' => $this->request->getGet('check_list_img_yn'), // 체크리스트
|
||||
'ground_plan_yn' => $this->request->getGet('ground_plan_yn'), // 평면도유무
|
||||
'ground_plan' => $this->request->getGet('ground_plan'), // 평면도요청
|
||||
|
||||
'srchType' => $this->request->getGet('srchType'), // 검색유형
|
||||
'srchTxt' => $this->request->getGet('srchTxt'), // 검색어
|
||||
];
|
||||
|
||||
$totalCount = $this->model->getTotalCount($data);
|
||||
|
||||
$datas = $this->model->getResultList($start, $end, $data);
|
||||
|
||||
return $this->response->setJSON(body: [
|
||||
'recordsTotal' => $totalCount,
|
||||
'recordsFiltered' => $totalCount,
|
||||
'data' => $datas,
|
||||
]);
|
||||
}
|
||||
|
||||
// 엑셀 다운로드
|
||||
public function excel()
|
||||
{
|
||||
try {
|
||||
|
||||
$data = [
|
||||
'rcpt_atclno' => $this->request->getGet('rcpt_atclno'), // 매물ID
|
||||
'schDateGb' => $this->request->getGet('schDateGb'), // 일자유형
|
||||
'sdate' => $this->request->getGet('sdate'), // 시작일
|
||||
'edate' => $this->request->getGet('edate'), // 종료일
|
||||
|
||||
'bonbu' => $this->request->getGet('bonbu'), // 본부
|
||||
'team' => $this->request->getGet('team'), // 팀
|
||||
'user' => $this->request->getGet('user'), // 담당자
|
||||
|
||||
'sido' => $this->request->getGet('sido'), // 시도
|
||||
'gugun' => $this->request->getGet('gugun'), // 시군구
|
||||
'dong' => $this->request->getGet('dong'), // 읍면동
|
||||
|
||||
'rcpt_stat1' => $this->request->getGet('rcpt_stat1'), // 상태1
|
||||
'rcpt_stat2' => $this->request->getGet('rcpt_stat2'), // 상태2
|
||||
'rcpt_stat3' => $this->request->getGet('rcpt_stat3'), // 상태3
|
||||
|
||||
'rcpt_product_info1' => $this->request->getGet('rcpt_product_info1'), // 거래구분
|
||||
'exp_movie_yn' => $this->request->getGet('exp_movie_yn'), // 동영상촬영여부
|
||||
'conf_img_yn' => $this->request->getGet('conf_img_yn'), // 홍보확인서여부
|
||||
'parcel_out_yn' => $this->request->getGet('parcel_out_yn'), // 분양권
|
||||
'rcpt_cpid' => $this->request->getGet('rcpt_cpid'), // CPID
|
||||
'rcpt_product' => $this->request->getGet('rcpt_product'), // 매물종류
|
||||
'exp_spc_yn' => $this->request->getGet('exp_spc_yn'), // 면적확인
|
||||
'check_list_img_yn' => $this->request->getGet('check_list_img_yn'), // 체크리스트
|
||||
'ground_plan_yn' => $this->request->getGet('ground_plan_yn'), // 평면도유무
|
||||
'ground_plan' => $this->request->getGet('ground_plan'), // 평면도요청
|
||||
|
||||
'srchType' => $this->request->getGet('srchType'), // 검색유형
|
||||
'srchTxt' => $this->request->getGet('srchTxt'), // 검색어
|
||||
];
|
||||
|
||||
$datas = $this->model->getExcelList($data);
|
||||
|
||||
return $this->response->setJSON(body: [
|
||||
'data' => $datas,
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$e->getPrevious()->getTraceAsString();
|
||||
}
|
||||
}
|
||||
}
|
||||
878
app/Models/article/GroundCntModel.php
Normal file
878
app/Models/article/GroundCntModel.php
Normal file
@@ -0,0 +1,878 @@
|
||||
<?php
|
||||
namespace App\Models\article;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class GroundCntModel extends Model
|
||||
{
|
||||
// 지역 목록 조회
|
||||
public function getAreaList($sido = '', $gugun = '')
|
||||
{
|
||||
|
||||
if (!empty($gugun)) {
|
||||
$gugun = substr($gugun, '0', '5');
|
||||
|
||||
$sql = "SELECT a.region_cd, TRIM(REPLACE(a.region_nm, b.region_nm, '')) region_nm" .
|
||||
" FROM region_codes a" .
|
||||
" LEFT JOIN region_codes b ON b.region_cd = CONCAT(SUBSTR(a.region_cd,1,5),'00000')" .
|
||||
" WHERE a.region_cd LIKE concat(?, '%')" .
|
||||
" AND a.region_cd NOT LIKE '%00000'" .
|
||||
" AND a.region_cd LIKE '%00'" .
|
||||
" AND a.use_yn = 'Y'" .
|
||||
" ORDER BY a.region_nm ASC";
|
||||
|
||||
$query = $this->db->query($sql, [$gugun]);
|
||||
|
||||
} else if (!empty($sido)) {
|
||||
$chk_sido = substr($sido, '0', '2');
|
||||
|
||||
if ($chk_sido === '36') {
|
||||
$sido = substr($sido, '0', '4');
|
||||
$sql = "SELECT a.region_cd, TRIM(REPLACE(a.region_nm, b.region_nm, '')) region_nm " .
|
||||
"FROM region_codes a " .
|
||||
"LEFT JOIN region_codes b ON b.region_cd = CONCAT(SUBSTR(a.region_cd,1,4),'000000') " .
|
||||
"WHERE a.region_cd LIKE concat(?, '%') " .
|
||||
"AND a.region_cd NOT LIKE '%000000' " .
|
||||
"AND a.region_cd LIKE '%00' " .
|
||||
"AND a.use_yn = 'Y' " .
|
||||
"AND EXISTS (SELECT 'x' FROM region_codes c WHERE c.region_cd LIKE CONCAT(SUBSTR(a.region_cd,1,5),'%') AND c.region_cd > CONCAT(SUBSTR(a.region_cd,1,5),'00000')) " .
|
||||
"ORDER BY a.region_nm ASC";
|
||||
} else {
|
||||
$sido = substr($sido, '0', '2');
|
||||
$sql = "SELECT a.region_cd, TRIM(REPLACE(a.region_nm, b.region_nm, '')) region_nm" .
|
||||
" FROM region_codes a" .
|
||||
" LEFT JOIN region_codes b ON b.region_cd = CONCAT(SUBSTR(a.region_cd,1,2),'00000000')" .
|
||||
" WHERE a.region_cd LIKE concat(?, '%')" .
|
||||
" AND a.region_cd NOT LIKE '%00000000'" .
|
||||
" AND a.region_cd LIKE '%00000'" .
|
||||
" AND a.use_yn = 'Y'" .
|
||||
" AND EXISTS (SELECT 'x' FROM region_codes c WHERE c.region_cd LIKE CONCAT(SUBSTR(a.region_cd,1,5),'%') AND c.region_cd > CONCAT(SUBSTR(a.region_cd,1,5),'00000'))" .
|
||||
" ORDER BY a.region_nm ASC";
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql, [$sido]);
|
||||
} else {
|
||||
$sql = "SELECT a.region_cd, a.region_nm " .
|
||||
"FROM region_codes a " .
|
||||
"WHERE (a.region_cd LIKE '%00000000' " .
|
||||
"AND a.use_yn = 'Y') " .
|
||||
"OR region_cd = 3611000000;";
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
}
|
||||
|
||||
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
// 소속본부조회
|
||||
public function getBonbuList()
|
||||
{
|
||||
$sql = "SELECT dept_sq, pdept_sq, dept_nm, dept_desc, dept_head, use_yn, depth, insert_tm, insert_usr, update_tm, update_usr, lft, rgt" .
|
||||
" FROM departments" .
|
||||
" WHERE depth = 1" .
|
||||
" AND use_yn = 'Y'" .
|
||||
" ORDER BY lft";
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
// 소속팀 조회
|
||||
public function getTeamList()
|
||||
{
|
||||
$sql = "SELECT dept_sq, pdept_sq, dept_nm" .
|
||||
" FROM departments" .
|
||||
" WHERE depth = 2" .
|
||||
" AND use_yn = 'Y'" .
|
||||
" ORDER BY dept_nm";
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
// 유저 조회
|
||||
public function getUserList()
|
||||
{
|
||||
$sql = "SELECT
|
||||
a.usr_sq, a.usr_id, a.usr_nm, a.dept_sq
|
||||
FROM users a
|
||||
WHERE
|
||||
a.usr_level IN ('3','4','40','5','50','6','60','61','62','7','8','70')
|
||||
AND a.use_yn = 'Y'
|
||||
AND EXISTS (
|
||||
SELECT 'x' FROM departments a1 INNER JOIN departments a2 ON a2.lft BETWEEN a1.lft AND a1.rgt AND a2.use_yn = 'Y'
|
||||
WHERE 1=1 AND a2.dept_sq = a.dept_sq AND a1.use_yn = 'Y'
|
||||
)
|
||||
ORDER BY a.usr_level DESC, a.usr_nm ASC ";
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 부서검색(상세)
|
||||
*/
|
||||
public function getDeptDetail($dept_sq)
|
||||
{
|
||||
$sql = "SELECT dept_sq, pdept_sq, dept_nm, dept_desc, dept_head, use_yn, depth, insert_tm, insert_usr, update_tm, update_usr, lft, rgt" .
|
||||
" FROM departments" .
|
||||
" WHERE dept_sq = ?";
|
||||
|
||||
$data = [$dept_sq];
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row = $query->getRowArray();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* 하위 부서 검색
|
||||
*/
|
||||
public function getChildDept($dept)
|
||||
{
|
||||
$sql = "SELECT dept_sq, pdept_sq, dept_nm, dept_desc, dept_head, use_yn, depth, insert_tm, insert_usr, update_tm, update_usr, lft, rgt" .
|
||||
" FROM departments" .
|
||||
" WHERE lft >= ?" .
|
||||
" AND rgt <= ?" .
|
||||
" ORDER BY lft ASC";
|
||||
|
||||
$data = [$dept['lft'], $dept['rgt']];
|
||||
$query = $this->db->query($sql, $data);
|
||||
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
|
||||
public function getTotalCount($data)
|
||||
{
|
||||
$usr_sq = session('usr_sq');
|
||||
$usr_level = session('usr_level');
|
||||
$dept_sq = session('dept_sq');
|
||||
|
||||
$builder = $this->db->table('receipt a');
|
||||
|
||||
$builder->select("COUNT(*) AS cnt");
|
||||
|
||||
$builder->join('result b', 'b.rcpt_sq = a.rcpt_sq', 'left outer');
|
||||
$builder->join('region_codes c', 'a.rcpt_dong = c.region_cd');
|
||||
$builder->join('departments d', 'b.dept_sq = d.dept_sq', 'left outer');
|
||||
$builder->join('users u', 'b.usr_sq = u.usr_sq', 'left outer');
|
||||
$builder->join('result_imgs e', "e.rsrv_sq = b.rsrv_sq AND e.img_type = 'I1' AND e.use_yn = 'Y'", 'left outer');
|
||||
$builder->join('result_imgs f', "f.rsrv_sq = b.rsrv_sq AND e.img_type = 'I5' AND e.use_yn = 'Y'", 'left outer');
|
||||
|
||||
$login_dept_info = $this->getDeptDetail($dept_sq); // 로그인 사용자 소속부서정보
|
||||
$child_dept = []; // 하위조직 목록
|
||||
if (strcmp($usr_level, '40') == 0) {
|
||||
$child = $this->getChildDept($login_dept_info);
|
||||
if (!empty($child)) {
|
||||
foreach ($child as $child) {
|
||||
$child_dept[] = $child['dept_sq'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((int) $usr_level >= 4 && $usr_level != '45') {
|
||||
if (!empty($child_dept)) {
|
||||
$builder->whereIn('b.dept_sq', $child_dept);
|
||||
} else {
|
||||
$builder->where('b.usr_sq', $usr_sq);
|
||||
}
|
||||
}
|
||||
|
||||
$builder->where('a.rcpt_tm >= DATE_ADD(CURDATE(), INTERVAL -3 MONTH)', null, false);
|
||||
$builder->where('b.use_yn', 'Y');
|
||||
$builder->where('f.img_path IS NOT NULL', null, false);
|
||||
|
||||
|
||||
if (!empty($data['rcpt_atclno'])) {
|
||||
$builder->where('a.rcpt_atclno', $data['rcpt_atclno']);
|
||||
} else {
|
||||
if ($data['schDateGb'] == '1') {
|
||||
$builder->where('a.rcpt_tm >=', $data['sdate'] . ' 00:00:00');
|
||||
$builder->where('a.rcpt_tm <=', $data['edate'] . ' 23:59:59');
|
||||
} else if ($data['schDateGb'] == '2') {
|
||||
$builder->where('b.rsrv_date >=', $data['sdate'] . ' 00:00:00');
|
||||
$builder->where('b.rsrv_date <=', $data['edate'] . ' 23:59:59');
|
||||
}
|
||||
|
||||
// 지역
|
||||
if (!empty($data['dong'])) {
|
||||
$builder->where('a.rcpt_dong', $data['dong']);
|
||||
} else {
|
||||
if (!empty($data['gugun'])) {
|
||||
$builder->like('a.rcpt_gugun', substr($data['gugun'], 0, 5), 'after');
|
||||
} else {
|
||||
if (!empty($data['sido'])) {
|
||||
$builder->like('a.rcpt_gugun', substr($data['sido'], 0, 2), 'after');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 관할조직
|
||||
if (!empty($data['bonbu'])) {
|
||||
$builder->where('d.pdept_sq', $data['bonbu']);
|
||||
}
|
||||
|
||||
if (!empty($data['team'])) {
|
||||
$builder->where('d.dept_sq', $data['team']);
|
||||
}
|
||||
|
||||
if (!empty($data['user'])) {
|
||||
$builder->where('d.usr_sq', $data['user']);
|
||||
}
|
||||
|
||||
// 거래구분
|
||||
if (!empty($data['rcpt_product_info1'])) {
|
||||
$builder->where('a.rcpt_product_info1', $data['rcpt_product_info1']);
|
||||
}
|
||||
|
||||
// 현재상태
|
||||
if (!empty($data['rcpt_stat1'])) {
|
||||
$builder->like('a.rcpt_stat', $data['rcpt_stat1'], 'after');
|
||||
}
|
||||
|
||||
if (!empty($data['rcpt_stat2'])) {
|
||||
$builder->like('a.rcpt_stat', $data['rcpt_stat2'], 'after');
|
||||
}
|
||||
|
||||
if (!empty($data['rcpt_stat3'])) {
|
||||
$builder->where('a.rcpt_stat', $data['rcpt_stat3']);
|
||||
}
|
||||
|
||||
// 중개사명
|
||||
if (!empty($data['agent_nm'])) {
|
||||
$builder->like('a.agent_nm', $data['agent_nm'], 'both');
|
||||
}
|
||||
|
||||
// 동영상촬영여부
|
||||
if (!empty($data['exp_movie_yn'])) {
|
||||
$builder->where('a.exp_movie_yn', $data['exp_movie_yn']);
|
||||
}
|
||||
|
||||
// 홍보확인서여부
|
||||
if ($data['conf_img_yn'] == 'Y') {
|
||||
$builder->where('e.rsrv_sq IS NOT NULL', null, false);
|
||||
} else if ($data['conf_img_yn'] == 'N') {
|
||||
$builder->where('e.rsrv_sq IS NULL', null, false);
|
||||
}
|
||||
|
||||
// 분양권
|
||||
if ($data['parcel_out_yn'] == 'Y') {
|
||||
$builder->where('a.parcel_out_yn', 'Y');
|
||||
} else if ($data['parcel_out_yn'] == 'N') {
|
||||
$builder->where('a.parcel_out_yn', 'N');
|
||||
}
|
||||
|
||||
// CP ID
|
||||
if (!empty($data['rcpt_cpid'])) {
|
||||
if (strcmp($data['rcpt_cpid'], 'naver') == 0) {
|
||||
$builder->where('a.rcpt_cpid =', '');
|
||||
} else if (strcmp($data['rcpt_cpid'], 'cleancente') == 0) {
|
||||
$builder->where("a.rcpt_cpid !=", "");
|
||||
} else {
|
||||
$builder->where('a.rcpt_cpid', $data['rcpt_cpid']);
|
||||
}
|
||||
}
|
||||
|
||||
// 매물종류
|
||||
if (!empty($data['rcpt_product'])) {
|
||||
$builder->where('a.parcel_out_yn', $data['rcpt_product']);
|
||||
}
|
||||
|
||||
// 면적확인
|
||||
if ($data['exp_spc_yn'] == 'Y') {
|
||||
$builder->where('a.parcel_out_yn', 'Y');
|
||||
} else if ($data['exp_spc_yn'] == 'N') {
|
||||
$builder->where('a.parcel_out_yn', 'N');
|
||||
}
|
||||
|
||||
// 체크리스트
|
||||
if ($data['check_list_img_yn'] == 'Y') {
|
||||
$builder->where('a.check_list_img_yn', 'Y');
|
||||
} else if ($data['check_list_img_yn'] == 'N') {
|
||||
$builder->where('a.check_list_img_yn', 'N');
|
||||
}
|
||||
|
||||
// 평면도유무
|
||||
if ($data['ground_plan_yn'] == 'Y') {
|
||||
$builder->where('exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', NULL, FALSE);
|
||||
} else if ($data['ground_plan_yn'] == 'N') {
|
||||
$builder->where('not exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', NULL, FALSE);
|
||||
}
|
||||
|
||||
// 평면도요청
|
||||
if (!empty($data['ground_plan'])) {
|
||||
$builder->where('a.ground_plan', $data['ground_plan']);
|
||||
}
|
||||
|
||||
if (!empty($data['srchTxt'])) {
|
||||
// 중개사
|
||||
if ($data['srchType'] == '1') {
|
||||
$builder->groupStart()
|
||||
->like('a.agent_nm', $data['srchTxt'])
|
||||
->orLike('a.sellr_nm', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
// 주소
|
||||
} else if ($data['srchType'] == '2') {
|
||||
$builder->groupStart()
|
||||
->like('a.rcpt_dtl_addr', $data['srchTxt'])
|
||||
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
|
||||
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
// 사업자번호
|
||||
} else if ($data['srchType'] == '3') {
|
||||
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
|
||||
} else {
|
||||
$builder->groupStart()
|
||||
->like('a.agent_nm', $data['srchTxt'])
|
||||
->orLike('a.sellr_nm', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
$builder->groupStart()
|
||||
->like('a.rcpt_dtl_addr', $data['srchTxt'])
|
||||
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
|
||||
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$row = $builder->get()->getRowArray();
|
||||
return (int) ($row['cnt'] ?? 0);
|
||||
|
||||
}
|
||||
|
||||
public function getResultList($start, $end, $data)
|
||||
{
|
||||
$usr_sq = session('usr_sq');
|
||||
$usr_level = session('usr_level');
|
||||
$dept_sq = session('dept_sq');
|
||||
|
||||
$builder = $this->db->table('receipt a');
|
||||
|
||||
$builder->select("a.rcpt_sq
|
||||
,a.excls_spc
|
||||
,a.comp_sq
|
||||
,a.rcpt_floor
|
||||
,a.rcpt_floor2
|
||||
,a.rcpt_rating
|
||||
,a.rcpt_key
|
||||
,a.rcpt_atclno
|
||||
,a.rcpt_type
|
||||
,a.rcpt_product
|
||||
,a.rcpt_product_nm
|
||||
,a.rcpt_product_area
|
||||
,a.rcpt_product_price
|
||||
,a.rcpt_deal_type
|
||||
,a.rcpt_product_info1
|
||||
,a.rcpt_product_info2
|
||||
,a.rcpt_product_info3
|
||||
,a.rcpt_product_info4
|
||||
,a.rcpt_product_info5
|
||||
,a.rcpt_office
|
||||
,(CASE WHEN a.rcpt_agent IS NULL THEN 'N' ELSE 'Y' END) as rcpt_agent
|
||||
,a.rcpt_sido
|
||||
,a.rcpt_gugun
|
||||
,a.rcpt_dong
|
||||
,a.rcpt_bunji
|
||||
,a.rcpt_ho
|
||||
,a.rcpt_tm
|
||||
,a.rcpt_stat
|
||||
,a.rcpt_x
|
||||
,a.rcpt_y
|
||||
,a.rcpt_exps_type
|
||||
,a.cust_nm
|
||||
,a.cust_tel1
|
||||
,a.cust_tel2
|
||||
,a.rcpt_hscp_nm
|
||||
,a.cust_zip
|
||||
,a.cust_addr1
|
||||
,a.cust_addr2
|
||||
,a.remark
|
||||
,a.rcpt_cpid
|
||||
,a.agent_id
|
||||
,a.agent_nm
|
||||
,a.agent_head
|
||||
,a.agent_head_tel
|
||||
,a.agent_contact
|
||||
,a.agent_contact_tel
|
||||
,a.agent_fax
|
||||
,DATE_FORMAT(COALESCE(b.rsrv_date, a.rsrv_date), '%Y-%m-%d') AS rsrv_date
|
||||
,COALESCE(b.rsrv_tm_ap, a.rsrv_tm_ap) as rsrv_tm_ap
|
||||
,a.insert_usr
|
||||
,a.insert_tm
|
||||
,a.update_usr
|
||||
,a.update_tm
|
||||
,a.svc_type1
|
||||
,a.svc_type2
|
||||
,a.reconf_yn
|
||||
,b.rsrv_sq
|
||||
,b.dept_sq
|
||||
,b.usr_sq
|
||||
,b.rsrv_tm_hour
|
||||
,b.result_cd1
|
||||
,b.result_cd2
|
||||
,b.result_cd3
|
||||
,get_code_name('RECEIPT_STATUS1', b.result_cd1) AS result_cd1_nm
|
||||
,get_code_name('RECEIPT_STATUS2', b.result_cd2) AS result_cd2_nm
|
||||
,get_code_name('RECEIPT_STATUS3', b.result_cd3) AS result_cd3_nm
|
||||
,b.result_msg
|
||||
,b.photo_save_dt
|
||||
,b.rsrv_delay_dt
|
||||
,b.rsrv_cplt_dt
|
||||
,b.check_dt
|
||||
,b.check_cplt_dt
|
||||
,get_code_name('RECEIPT_STATUS1', substring(a.rcpt_stat, 1, 2)) AS rcpt_stat_nm
|
||||
,c.region_nm as addr
|
||||
,a.rcpt_dtl_addr
|
||||
,a.rcpt_jibun_addr
|
||||
,a.rcpt_etc_addr
|
||||
,d.pdept_sq
|
||||
,d.dept_nm
|
||||
,u.usr_nm
|
||||
,a.rcpt_exps_type
|
||||
,a.exp_photo_yn
|
||||
,a.exp_movie_yn
|
||||
,a.ground_plan
|
||||
,f.img_path
|
||||
,f.img_filenm
|
||||
,f.img_hannm
|
||||
,f.img_sq
|
||||
,f.cloud_upload_yn
|
||||
,( SELECT usr_nm FROM users WHERE users.usr_sq = f.insert_usr ) AS upload_usr_nm
|
||||
,CASE (SELECT COUNT(1) FROM result_imgs WHERE rsrv_sq=b.rsrv_sq AND img_type = 'I1' AND use_yn = 'Y') WHEN 0 THEN 'N' ELSE 'Y' END conf_img_yn
|
||||
,CASE (SELECT COUNT(1) FROM result_imgs WHERE rsrv_sq=b.rsrv_sq AND img_type = 'I5' AND use_yn = 'Y') WHEN 0 THEN 'N' ELSE 'Y' END ground_plan_yn");
|
||||
|
||||
$builder->join('result b', 'b.rcpt_sq = a.rcpt_sq', 'left outer');
|
||||
$builder->join('region_codes c', 'a.rcpt_dong = c.region_cd');
|
||||
$builder->join('departments d', 'b.dept_sq = d.dept_sq', 'left outer');
|
||||
$builder->join('users u', 'b.usr_sq = u.usr_sq', 'left outer');
|
||||
$builder->join('result_imgs e', "e.rsrv_sq = b.rsrv_sq AND e.img_type = 'I1' AND e.use_yn = 'Y'", 'left outer');
|
||||
$builder->join('result_imgs f', "f.rsrv_sq = b.rsrv_sq AND e.img_type = 'I5' AND e.use_yn = 'Y'", 'left outer');
|
||||
|
||||
$login_dept_info = $this->getDeptDetail($dept_sq); // 로그인 사용자 소속부서정보
|
||||
$child_dept = []; // 하위조직 목록
|
||||
if (strcmp($usr_level, '40') == 0) {
|
||||
$child = $this->getChildDept($login_dept_info);
|
||||
if (!empty($child)) {
|
||||
foreach ($child as $child) {
|
||||
$child_dept[] = $child['dept_sq'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((int) $usr_level >= 4 && $usr_level != '45') {
|
||||
if (!empty($child_dept)) {
|
||||
$builder->whereIn('b.dept_sq', $child_dept);
|
||||
} else {
|
||||
$builder->where('b.usr_sq', $usr_sq);
|
||||
}
|
||||
}
|
||||
|
||||
$builder->where('a.rcpt_tm >= DATE_ADD(CURDATE(), INTERVAL -3 MONTH)', null, false);
|
||||
$builder->where('b.use_yn', 'Y');
|
||||
$builder->where('f.img_path IS NOT NULL', null, false);
|
||||
|
||||
if (!empty($data['rcpt_atclno'])) {
|
||||
$builder->where('a.rcpt_atclno', $data['rcpt_atclno']);
|
||||
} else {
|
||||
if ($data['schDateGb'] == '1') {
|
||||
$builder->where('a.rcpt_tm >=', $data['sdate'] . ' 00:00:00');
|
||||
$builder->where('a.rcpt_tm <=', $data['edate'] . ' 23:59:59');
|
||||
} else if ($data['schDateGb'] == '2') {
|
||||
$builder->where('b.rsrv_date >=', $data['sdate'] . ' 00:00:00');
|
||||
$builder->where('b.rsrv_date <=', $data['edate'] . ' 23:59:59');
|
||||
}
|
||||
|
||||
// 지역
|
||||
if (!empty($data['dong'])) {
|
||||
$builder->where('a.rcpt_dong', $data['dong']);
|
||||
} else {
|
||||
if (!empty($data['gugun'])) {
|
||||
$builder->like('a.rcpt_gugun', substr($data['gugun'], 0, 5), 'after');
|
||||
} else {
|
||||
if (!empty($data['sido'])) {
|
||||
$builder->like('a.rcpt_gugun', substr($data['sido'], 0, 2), 'after');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 관할조직
|
||||
if (!empty($data['bonbu'])) {
|
||||
$builder->where('d.pdept_sq', $data['bonbu']);
|
||||
}
|
||||
|
||||
if (!empty($data['team'])) {
|
||||
$builder->where('d.dept_sq', $data['team']);
|
||||
}
|
||||
|
||||
if (!empty($data['user'])) {
|
||||
$builder->where('d.usr_sq', $data['user']);
|
||||
}
|
||||
|
||||
// 거래구분
|
||||
if (!empty($data['rcpt_product_info1'])) {
|
||||
$builder->where('a.rcpt_product_info1', $data['rcpt_product_info1']);
|
||||
}
|
||||
|
||||
// 현재상태
|
||||
if (!empty($data['rcpt_stat1'])) {
|
||||
$builder->like('a.rcpt_stat', $data['rcpt_stat1'], 'after');
|
||||
}
|
||||
|
||||
if (!empty($data['rcpt_stat2'])) {
|
||||
$builder->like('a.rcpt_stat', $data['rcpt_stat2'], 'after');
|
||||
}
|
||||
|
||||
if (!empty($data['rcpt_stat3'])) {
|
||||
$builder->where('a.rcpt_stat', $data['rcpt_stat3']);
|
||||
}
|
||||
|
||||
// 중개사명
|
||||
if (!empty($data['agent_nm'])) {
|
||||
$builder->like('a.agent_nm', $data['agent_nm'], 'both');
|
||||
}
|
||||
|
||||
// 동영상촬영여부
|
||||
if (!empty($data['exp_movie_yn'])) {
|
||||
$builder->where('a.exp_movie_yn', $data['exp_movie_yn']);
|
||||
}
|
||||
|
||||
// 홍보확인서여부
|
||||
if ($data['conf_img_yn'] == 'Y') {
|
||||
$builder->where('e.rsrv_sq IS NOT NULL', null, false);
|
||||
} else if ($data['conf_img_yn'] == 'N') {
|
||||
$builder->where('e.rsrv_sq IS NULL', null, false);
|
||||
}
|
||||
|
||||
// 분양권
|
||||
if ($data['parcel_out_yn'] == 'Y') {
|
||||
$builder->where('a.parcel_out_yn', 'Y');
|
||||
} else if ($data['parcel_out_yn'] == 'N') {
|
||||
$builder->where('a.parcel_out_yn', 'N');
|
||||
}
|
||||
|
||||
// CP ID
|
||||
if (!empty($data['rcpt_cpid'])) {
|
||||
if (strcmp($data['rcpt_cpid'], 'naver') == 0) {
|
||||
$builder->where('a.rcpt_cpid =', '');
|
||||
} else if (strcmp($data['rcpt_cpid'], 'cleancente') == 0) {
|
||||
$builder->where("a.rcpt_cpid !=", "");
|
||||
} else {
|
||||
$builder->where('a.rcpt_cpid', $data['rcpt_cpid']);
|
||||
}
|
||||
}
|
||||
|
||||
// 매물종류
|
||||
if (!empty($data['rcpt_product'])) {
|
||||
$builder->where('a.parcel_out_yn', $data['rcpt_product']);
|
||||
}
|
||||
|
||||
// 면적확인
|
||||
if ($data['exp_spc_yn'] == 'Y') {
|
||||
$builder->where('a.parcel_out_yn', 'Y');
|
||||
} else if ($data['exp_spc_yn'] == 'N') {
|
||||
$builder->where('a.parcel_out_yn', 'N');
|
||||
}
|
||||
|
||||
// 체크리스트
|
||||
if ($data['check_list_img_yn'] == 'Y') {
|
||||
$builder->where('a.check_list_img_yn', 'Y');
|
||||
} else if ($data['check_list_img_yn'] == 'N') {
|
||||
$builder->where('a.check_list_img_yn', 'N');
|
||||
}
|
||||
|
||||
// 평면도유무
|
||||
if ($data['ground_plan_yn'] == 'Y') {
|
||||
$builder->where('exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', NULL, FALSE);
|
||||
} else if ($data['ground_plan_yn'] == 'N') {
|
||||
$builder->where('not exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', NULL, FALSE);
|
||||
}
|
||||
|
||||
// 평면도요청
|
||||
if (!empty($data['ground_plan'])) {
|
||||
$builder->where('a.ground_plan', $data['ground_plan']);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($data['srchTxt'])) {
|
||||
// 중개사
|
||||
if ($data['srchType'] == '1') {
|
||||
$builder->groupStart()
|
||||
->like('a.agent_nm', $data['srchTxt'])
|
||||
->orLike('a.sellr_nm', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
// 주소
|
||||
} else if ($data['srchType'] == '2') {
|
||||
$builder->groupStart()
|
||||
->like('a.rcpt_dtl_addr', $data['srchTxt'])
|
||||
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
|
||||
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
// 사업자번호
|
||||
} else if ($data['srchType'] == '3') {
|
||||
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
|
||||
} else {
|
||||
$builder->groupStart()
|
||||
->like('a.agent_nm', $data['srchTxt'])
|
||||
->orLike('a.sellr_nm', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
$builder->groupStart()
|
||||
->like('a.rcpt_dtl_addr', $data['srchTxt'])
|
||||
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
|
||||
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$builder->orderBy('a.rcpt_atclno', 'DESC');
|
||||
|
||||
$builder->limit($end, $start);
|
||||
|
||||
echo $builder->getCompiledSelect(false);
|
||||
|
||||
// log_message('debug', '[getResultList] SQL = ' . $builder->getCompiledSelect());
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
|
||||
}
|
||||
|
||||
// 엑셀 다운로드
|
||||
public function getExcelList($data)
|
||||
{
|
||||
$usr_sq = session('usr_sq');
|
||||
$usr_level = session('usr_level');
|
||||
$dept_sq = session('dept_sq');
|
||||
|
||||
$builder = $this->db->table('receipt a');
|
||||
|
||||
$builder->select("get_code_name('RECEIPT_STATUS1', b.result_cd1) AS '현재상태',
|
||||
a.rcpt_atclno AS '매물ID',
|
||||
CONCAT(a.rsrv_date, ' ', b.rsrv_tm_ap) AS '예약일자',
|
||||
CASE WHEN a.rcpt_jibun_addr IS NOT NULL
|
||||
THEN CONCAT(c.region_nm, ' ', a.rcpt_jibun_addr, ' ', a.rcpt_etc_addr)
|
||||
ELSE CONCAT(c.region_nm, ' ', a.rcpt_dtl_addr, ' ', a.rcpt_ho)
|
||||
END AS '주소',
|
||||
CONCAT(a.rcpt_floor, '/', a.rcpt_floor2) AS '층',
|
||||
a.excls_spc AS '면적',
|
||||
IFNULL(a.rcpt_product_nm, a.rcpt_product) AS '매물종류',
|
||||
d.dept_nm AS '관할조직(팀)',
|
||||
u.usr_nm '방문담당',
|
||||
( SELECT usr_nm FROM users WHERE users.usr_sq = f.insert_usr ) AS '등록자명',
|
||||
CASE (SELECT COUNT(1) FROM result_imgs WHERE rsrv_sq=b.rsrv_sq AND img_type = 'I5' AND use_yn = 'Y') WHEN 0 THEN 'N' ELSE 'Y' END AS '평면도유무',
|
||||
a.ground_plan AS '평면도요청'");
|
||||
|
||||
$builder->join('result b', 'b.rcpt_sq = a.rcpt_sq', 'left outer');
|
||||
$builder->join('region_codes c', 'a.rcpt_dong = c.region_cd');
|
||||
$builder->join('departments d', 'b.dept_sq = d.dept_sq', 'left outer');
|
||||
$builder->join('users u', 'b.usr_sq = u.usr_sq', 'left outer');
|
||||
$builder->join('result_imgs e', "e.rsrv_sq = b.rsrv_sq AND e.img_type = 'I1' AND e.use_yn = 'Y'", 'left outer');
|
||||
$builder->join('result_imgs f', "f.rsrv_sq = b.rsrv_sq AND e.img_type = 'I5' AND e.use_yn = 'Y'", 'left outer');
|
||||
|
||||
$login_dept_info = $this->getDeptDetail($dept_sq); // 로그인 사용자 소속부서정보
|
||||
$child_dept = []; // 하위조직 목록
|
||||
if (strcmp($usr_level, '40') == 0) {
|
||||
$child = $this->getChildDept($login_dept_info);
|
||||
if (!empty($child)) {
|
||||
foreach ($child as $child) {
|
||||
$child_dept[] = $child['dept_sq'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((int) $usr_level >= 4 && $usr_level != '45') {
|
||||
if (!empty($child_dept)) {
|
||||
$builder->whereIn('b.dept_sq', $child_dept);
|
||||
} else {
|
||||
$builder->where('b.usr_sq', $usr_sq);
|
||||
}
|
||||
}
|
||||
|
||||
$builder->where('a.rcpt_tm >= DATE_ADD(CURDATE(), INTERVAL -3 MONTH)', null, false);
|
||||
$builder->where('b.use_yn', 'Y');
|
||||
$builder->where('f.img_path IS NOT NULL', null, false);
|
||||
|
||||
if (!empty($data['rcpt_atclno'])) {
|
||||
$builder->where('a.rcpt_atclno', $data['rcpt_atclno']);
|
||||
} else {
|
||||
if ($data['schDateGb'] == '1') {
|
||||
$builder->where('a.rcpt_tm >=', $data['sdate'] . ' 00:00:00');
|
||||
$builder->where('a.rcpt_tm <=', $data['edate'] . ' 23:59:59');
|
||||
} else if ($data['schDateGb'] == '2') {
|
||||
$builder->where('b.rsrv_date >=', $data['sdate'] . ' 00:00:00');
|
||||
$builder->where('b.rsrv_date <=', $data['edate'] . ' 23:59:59');
|
||||
}
|
||||
|
||||
// 지역
|
||||
if (!empty($data['dong'])) {
|
||||
$builder->where('a.rcpt_dong', $data['dong']);
|
||||
} else {
|
||||
if (!empty($data['gugun'])) {
|
||||
$builder->like('a.rcpt_gugun', substr($data['gugun'], 0, 5), 'after');
|
||||
} else {
|
||||
if (!empty($data['sido'])) {
|
||||
$builder->like('a.rcpt_gugun', substr($data['sido'], 0, 2), 'after');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 관할조직
|
||||
if (!empty($data['bonbu'])) {
|
||||
$builder->where('d.pdept_sq', $data['bonbu']);
|
||||
}
|
||||
|
||||
if (!empty($data['team'])) {
|
||||
$builder->where('d.dept_sq', $data['team']);
|
||||
}
|
||||
|
||||
if (!empty($data['user'])) {
|
||||
$builder->where('d.usr_sq', $data['user']);
|
||||
}
|
||||
|
||||
// 거래구분
|
||||
if (!empty($data['rcpt_product_info1'])) {
|
||||
$builder->where('a.rcpt_product_info1', $data['rcpt_product_info1']);
|
||||
}
|
||||
|
||||
// 현재상태
|
||||
if (!empty($data['rcpt_stat1'])) {
|
||||
$builder->like('a.rcpt_stat', $data['rcpt_stat1'], 'after');
|
||||
}
|
||||
|
||||
if (!empty($data['rcpt_stat2'])) {
|
||||
$builder->like('a.rcpt_stat', $data['rcpt_stat2'], 'after');
|
||||
}
|
||||
|
||||
if (!empty($data['rcpt_stat3'])) {
|
||||
$builder->where('a.rcpt_stat', $data['rcpt_stat3']);
|
||||
}
|
||||
|
||||
// 중개사명
|
||||
if (!empty($data['agent_nm'])) {
|
||||
$builder->like('a.agent_nm', $data['agent_nm'], 'both');
|
||||
}
|
||||
|
||||
// 동영상촬영여부
|
||||
if (!empty($data['exp_movie_yn'])) {
|
||||
$builder->where('a.exp_movie_yn', $data['exp_movie_yn']);
|
||||
}
|
||||
|
||||
// 홍보확인서여부
|
||||
if ($data['conf_img_yn'] == 'Y') {
|
||||
$builder->where('e.rsrv_sq IS NOT NULL', null, false);
|
||||
} else if ($data['conf_img_yn'] == 'N') {
|
||||
$builder->where('e.rsrv_sq IS NULL', null, false);
|
||||
}
|
||||
|
||||
// 분양권
|
||||
if ($data['parcel_out_yn'] == 'Y') {
|
||||
$builder->where('a.parcel_out_yn', 'Y');
|
||||
} else if ($data['parcel_out_yn'] == 'N') {
|
||||
$builder->where('a.parcel_out_yn', 'N');
|
||||
}
|
||||
|
||||
// CP ID
|
||||
if (!empty($data['rcpt_cpid'])) {
|
||||
if (strcmp($data['rcpt_cpid'], 'naver') == 0) {
|
||||
$builder->where('a.rcpt_cpid =', '');
|
||||
} else if (strcmp($data['rcpt_cpid'], 'cleancente') == 0) {
|
||||
$builder->where("a.rcpt_cpid !=", "");
|
||||
} else {
|
||||
$builder->where('a.rcpt_cpid', $data['rcpt_cpid']);
|
||||
}
|
||||
}
|
||||
|
||||
// 매물종류
|
||||
if (!empty($data['rcpt_product'])) {
|
||||
$builder->where('a.parcel_out_yn', $data['rcpt_product']);
|
||||
}
|
||||
|
||||
// 면적확인
|
||||
if ($data['exp_spc_yn'] == 'Y') {
|
||||
$builder->where('a.parcel_out_yn', 'Y');
|
||||
} else if ($data['exp_spc_yn'] == 'N') {
|
||||
$builder->where('a.parcel_out_yn', 'N');
|
||||
}
|
||||
|
||||
// 체크리스트
|
||||
if ($data['check_list_img_yn'] == 'Y') {
|
||||
$builder->where('a.check_list_img_yn', 'Y');
|
||||
} else if ($data['check_list_img_yn'] == 'N') {
|
||||
$builder->where('a.check_list_img_yn', 'N');
|
||||
}
|
||||
|
||||
// 평면도유무
|
||||
if ($data['ground_plan_yn'] == 'Y') {
|
||||
$builder->where('exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', NULL, FALSE);
|
||||
} else if ($data['ground_plan_yn'] == 'N') {
|
||||
$builder->where('not exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', NULL, FALSE);
|
||||
}
|
||||
|
||||
// 평면도요청
|
||||
if (!empty($data['ground_plan'])) {
|
||||
$builder->where('a.ground_plan', $data['ground_plan']);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($data['srchTxt'])) {
|
||||
// 중개사
|
||||
if ($data['srchType'] == '1') {
|
||||
$builder->groupStart()
|
||||
->like('a.agent_nm', $data['srchTxt'])
|
||||
->orLike('a.sellr_nm', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
// 주소
|
||||
} else if ($data['srchType'] == '2') {
|
||||
$builder->groupStart()
|
||||
->like('a.rcpt_dtl_addr', $data['srchTxt'])
|
||||
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
|
||||
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
// 사업자번호
|
||||
} else if ($data['srchType'] == '3') {
|
||||
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
|
||||
} else {
|
||||
$builder->groupStart()
|
||||
->like('a.agent_nm', $data['srchTxt'])
|
||||
->orLike('a.sellr_nm', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
$builder->groupStart()
|
||||
->like('a.rcpt_dtl_addr', $data['srchTxt'])
|
||||
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
|
||||
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$builder->orderBy('a.rcpt_atclno', 'DESC');
|
||||
|
||||
// log_message('debug', '[getResultList] SQL = ' . $builder->getCompiledSelect());
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
}
|
||||
835
app/Views/pages/article/ground/lists.php
Normal file
835
app/Views/pages/article/ground/lists.php
Normal file
@@ -0,0 +1,835 @@
|
||||
<?php
|
||||
$usr_level = session('usr_level');
|
||||
$usr_sq = session('usr_sq');
|
||||
$usr_nm = session('usr_nm');
|
||||
|
||||
?>
|
||||
<?= $this->extend('layouts/main') ?>
|
||||
|
||||
<?= $this->section('content') ?>
|
||||
|
||||
<style>
|
||||
th {
|
||||
font-size: 11px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
td {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#resultList tbody tr {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.blockUI {
|
||||
z-index: 1500 !important;
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 180px;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.card-header-tab {
|
||||
justify-content: flex-start !important;
|
||||
}
|
||||
|
||||
.table-scroll {
|
||||
max-height: 300px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.swal2-cancel {
|
||||
background-color: #ff0000 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
#resultList.dataTable {
|
||||
width: max-content !important;
|
||||
}
|
||||
|
||||
table.dataTable td,
|
||||
table.dataTable th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 테이블이 내용만큼 커지고, wrapper가 스크롤 담당 */
|
||||
.table-responsive {
|
||||
overflow-x: auto !important;
|
||||
}
|
||||
|
||||
/* 테이블 폭: 내용 기준으로 커지되, 최소는 100% */
|
||||
.table-responsive #resultList {
|
||||
width: max-content !important;
|
||||
min-width: 100% !important;
|
||||
table-layout: auto !important;
|
||||
}
|
||||
|
||||
/* 줄바꿈 금지 */
|
||||
#resultList th,
|
||||
#resultList td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* PC에서 가로 스크롤이 잘리는 대표 구간들 강제 해제 */
|
||||
.main-card,
|
||||
.card,
|
||||
.card-body {
|
||||
overflow-x: visible !important;
|
||||
}
|
||||
|
||||
/* 만약 레이아웃 wrapper가 숨기고 있으면 이것도 */
|
||||
.app-main__outer,
|
||||
.app-main__inner,
|
||||
.app-main {
|
||||
overflow-x: visible !important;
|
||||
}
|
||||
|
||||
/* flex 환경에서 필수 */
|
||||
.app-main,
|
||||
.app-main__outer,
|
||||
.app-main__inner,
|
||||
.card,
|
||||
.card-body {
|
||||
min-width: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>평면도 관리</h1>
|
||||
|
||||
<div class="col-md-12 col-xl-12">
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-body">
|
||||
<form id="frm_srch_info" method="get" onsubmit="return false;">
|
||||
<div class="alert alert-warning py-2 mb-3">
|
||||
<small class="mb-0">
|
||||
매물ID를 입력하면 <b>다른 조건은 무시</b>됩니다.
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<!-- 검색 폼 -->
|
||||
<div class="row g-3">
|
||||
<div class="col-md-1">
|
||||
<label class="form-label mb-1">매물ID</label>
|
||||
<input type="text" class="form-control" name="rcpt_atclno" id="rcpt_atclno"
|
||||
onkeypress="atcl_no_enter(event)">
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<label class="form-label mb-1">일자별조회</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<select class="form-select" name="schDateGb">
|
||||
<option value="1" selected>예약일자</option>
|
||||
<option value="2">등록일자</option>
|
||||
</select>
|
||||
<input type="date" class="form-control" name="sdate" id="sdate" placeholder="시작일">
|
||||
<span class="input-group-text">~</span>
|
||||
<input type="date" class="form-control" name="edate" id="edate" placeholder="종료일">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label class="form-label mb-1">관할조직</label>
|
||||
<div class="d-flex gap-1">
|
||||
<select name="bonbu" id="bonbu" class="form-select form-select-sm">
|
||||
<option value="">-본부-</option>
|
||||
<?php foreach ($bonbu as $d): ?>
|
||||
<option value="<?= $d['dept_sq'] ?>">
|
||||
<?= $d['dept_nm'] ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<select name="team" id="team" class="form-select form-select-sm">
|
||||
<option value="">-팀-</option>
|
||||
</select>
|
||||
<select name="damdang" id="damdang" class="form-select form-select-sm">
|
||||
<option value="">-담당자-</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label class="form-label mb-1">지역별조회</label>
|
||||
<div class="d-flex gap-1">
|
||||
<select name="srcSido" id="srcSido" class="form-select form-select-sm">
|
||||
<option value="">-시/도-</option>
|
||||
<?php foreach ($sido as $s): ?>
|
||||
<option value="<?= $s['region_cd'] ?>">
|
||||
<?= $s['region_nm'] ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<select name="srcGugun" id="srcGugun" class="form-select form-select-sm">
|
||||
<option value="">-시/군/구-</option>
|
||||
</select>
|
||||
<select name="srcDong" id="srcDong" class="form-select form-select-sm">
|
||||
<option value="">-읍/면/동-</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label class="form-label mb-1">현재상태</label>
|
||||
<div class="d-flex gap-1">
|
||||
<select name="rcpt_stat1" class="form-select form-select-sm">
|
||||
<option value="">예약확인지연</option>
|
||||
<?php foreach ($codes as $c): ?>
|
||||
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
|
||||
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<select name="rcpt_stat2" id="srcGugun" class="form-select form-select-sm">
|
||||
<option value="">-상태2-</option>
|
||||
</select>
|
||||
<select name="rcpt_stat3" id="srcDong" class="form-select form-select-sm">
|
||||
<option value="">-상태3-</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<label class="form-label mb-1">거래구분</label>
|
||||
<select class="form-select" name="rcpt_product_info1">
|
||||
<option value="">전체</option>
|
||||
<?php foreach ($codes as $c): ?>
|
||||
<?php if ($c['category'] === "NHN_DEAL_TYPE"): ?>
|
||||
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<label class="form-label mb-1">동영상촬영여부</label>
|
||||
<select class="form-select" name="exp_movie_yn">
|
||||
<option value="">전체</option>
|
||||
<option value="Y">촬영</option>
|
||||
<option value="N">미촬영</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<label class="form-label mb-1">홍보확인서여부</label>
|
||||
<select class="form-select" name="conf_img_yn">
|
||||
<option value="">전체</option>
|
||||
<option value="Y">Y</option>
|
||||
<option value="N">N</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<label class="form-label mb-1">분양권</label>
|
||||
<select class="form-select" name="parcel_out_yn">
|
||||
<option value="">전체</option>
|
||||
<option value="Y"> Y</option>
|
||||
<option value="N"> N</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<label class="form-label mb-1">CP ID</label>
|
||||
<select class="form-select" name="rcpt_cpid">
|
||||
<option value="">전체</option>
|
||||
<?php foreach ($codes as $c): ?>
|
||||
<?php if ($c['category'] === "CP_ID"): ?>
|
||||
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<label class="form-label mb-1">매물종류</label>
|
||||
<select class="form-select" name="rcpt_product">
|
||||
<option value="">전체</option>
|
||||
<?php foreach ($codes as $c): ?>
|
||||
<?php if ($c['category'] === "ARTICLE_TYPE"): ?>
|
||||
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<label class="form-label mb-1">면적확인</label>
|
||||
<select class="form-select" name="exp_spc_yn">
|
||||
<option value="">전체</option>
|
||||
<option value="Y"> Y</option>
|
||||
<option value="N"> N</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<label class="form-label mb-1">체크리스트</label>
|
||||
<select class="form-select" name="check_list_img_yn">
|
||||
<option value="">전체</option>
|
||||
<option value="Y"> Y
|
||||
</option>
|
||||
<option value="N"> N
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<label class="form-label mb-1">평면도유무</label>
|
||||
<select class="form-select" name="ground_plan_yn">
|
||||
<option value="">전체</option>
|
||||
<option value="Y">Y</option>
|
||||
<option value="N">N</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<label class="form-label mb-1">평면도요청</label>
|
||||
<select class="form-select" name="ground_plan">
|
||||
<option value="">전체</option>
|
||||
<option value="Y">Y</option>
|
||||
<option value="N">N</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- 검색유형 -->
|
||||
<div class="col-md-1">
|
||||
<label class="form-label mb-1">검색유형</label>
|
||||
<select class="form-select" name="srchType">
|
||||
<option value="">선택</option>
|
||||
<option value="1">중개사명</option>
|
||||
<option value="2">주소</option>
|
||||
<option value="3">사업자번호</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- 검색어 -->
|
||||
<div class="col-md-2">
|
||||
<label class="form-label mb-1">검색어</label>
|
||||
<input type="text" class="form-control" name="srchTxt" placeholder="검색어 입력">
|
||||
</div>
|
||||
|
||||
<div class="col-md-1 d-grid">
|
||||
<label class="form-label mb-1 invisible">검색</label>
|
||||
<button type="button" class="btn btn-primary" id="btnSearch">
|
||||
<i class="pe-7s-search me-1"></i>검색
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<div class="d-flex align-items-center flex-wrap" style="gap: 8px; flex: 1">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="ml-auto">
|
||||
<button class="btn btn-sm btn-outline-success" id="excel-download">
|
||||
<i class="fa fa-fw" aria-hidden="true" title="file-excel-o"></i>
|
||||
엑셀다운로드
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="resultList" class="table table-hover table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>현재상태</th>
|
||||
<th>매물ID</th>
|
||||
<th>예약일자</th>
|
||||
<th>주소</th>
|
||||
<th>층</th>
|
||||
<th>면적</th>
|
||||
<th>매물종류</th>
|
||||
<th>관할조직(팀)</th>
|
||||
<th>방문담당</th>
|
||||
<th>평면도유무</th>
|
||||
<th>평면도요청</th>
|
||||
<th>파일명</th>
|
||||
<th>미리보기</th>
|
||||
<th>다운로드</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- 여기는 비워둠: AJAX로 채움 -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 지도팝업 -->
|
||||
<?= $this->section('modals') ?>
|
||||
<div class="modal" id="previewModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">미리보기</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body p-0">
|
||||
<img id="imgPreview" src="" alt="미리보기" width="100%" height="500px">
|
||||
<video id="vdoPreview" controls playsinline preload="metadata"
|
||||
style="display: none;height: 500px;width: 100%;">
|
||||
<source id="videoSource" src="" type="video/mp4">
|
||||
브라우저가 video 태그를 지원하지 않습니다.
|
||||
</video>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css" />
|
||||
<link href="https://unpkg.com/dropzone@6.0.0-beta.1/dist/dropzone.css" rel="stylesheet" type="text/css" />
|
||||
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
||||
<script defer src="/architectui/assets/js/datatable.kor.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
const bonbuArr = <?= json_encode($bonbu, JSON_UNESCAPED_UNICODE); ?>;
|
||||
const teamArr = <?= json_encode($team, JSON_UNESCAPED_UNICODE); ?>;
|
||||
const userArr = <?= json_encode($user, JSON_UNESCAPED_UNICODE); ?>;
|
||||
|
||||
const date = new Date();
|
||||
var table;
|
||||
|
||||
$(function () {
|
||||
|
||||
initReceiptDate();
|
||||
|
||||
$("#srcSido, #srcGugun, #srcSido2, #srcGugun2").on("change", function (e) {
|
||||
|
||||
const targetId = this.id;
|
||||
|
||||
const isSecond = this.id.endsWith("2");
|
||||
|
||||
const params = {
|
||||
srcSido: isSecond
|
||||
? $("#srcSido2").val()
|
||||
: $("#frm_srch_info [name=srcSido]").val(),
|
||||
|
||||
srcGugun: isSecond
|
||||
? $("#srcGugun2").val()
|
||||
: $("#frm_srch_info [name=srcGugun]").val(),
|
||||
};
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: "/manage/areas/getAreaList",
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
data: params,
|
||||
beforeSend: function () {
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
blockUI.unblockPage()
|
||||
},
|
||||
success: function (result) {
|
||||
|
||||
switch (targetId) {
|
||||
case "srcSido":
|
||||
$("#srcGugun").empty()
|
||||
var str = "";
|
||||
str += "<option value=''>시/군/구</option>";
|
||||
|
||||
if ($("#srcSido").val() !== "") {
|
||||
if (result.length > 0) {
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
str += "<option value='" + result[i]['region_cd'] + "'>" + result[i].region_nm + "</option>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$("#srcGugun").append(str);
|
||||
|
||||
break;
|
||||
|
||||
case "srcGugun":
|
||||
$("#srcDong").empty()
|
||||
var str = "";
|
||||
str += "<option value=''>읍/면/동</option>";
|
||||
|
||||
if (result.length > 0) {
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
str += "<option value='" + result[i]['region_cd'] + "'>" + result[i].region_nm + "</option>";
|
||||
}
|
||||
}
|
||||
|
||||
$("#srcDong").append(str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("#bonbu, #team, #bonbu2, #team2").on("change", function (e) {
|
||||
const targetId = this.id;
|
||||
|
||||
|
||||
var str = "";
|
||||
if (targetId === "bonbu" || targetId === "bonbu2") {
|
||||
const dept_sq = $("#" + targetId).val();
|
||||
|
||||
str += `<option value="">-팀-</option>`;
|
||||
if (teamArr.length > 0) {
|
||||
for (var i = 0; i < teamArr.length; i++) {
|
||||
|
||||
// 이 팀이 현재 본부에 속한 팀인지 체크
|
||||
if (String(teamArr[i].pdept_sq) === String(dept_sq)) {
|
||||
str += `
|
||||
<option value="${teamArr[i].dept_sq}">${teamArr[i].dept_nm}</option>
|
||||
`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (targetId === "bonbu") {
|
||||
$("#team").html(str);
|
||||
} else if (targetId === "bonbu2") {
|
||||
$("#team2").html(str);
|
||||
}
|
||||
|
||||
} else if (targetId === "team" || targetId === "team2") {
|
||||
const dept_sq = $("#" + targetId).val();
|
||||
|
||||
str += `<option value="">-담당자-</option>`;
|
||||
if (userArr.length > 0) {
|
||||
for (var i = 0; i < userArr.length; i++) {
|
||||
|
||||
// 이 팀이 현재 본부에 속한 팀인지 체크
|
||||
if (String(userArr[i].dept_sq) === String(dept_sq)) {
|
||||
str += `
|
||||
<option value="${userArr[i].usr_id}">${userArr[i].usr_nm}</option>
|
||||
`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (targetId === "team") {
|
||||
$("#damdang").html(str);
|
||||
} else if (targetId === "team2") {
|
||||
$("#damdang2").html(str);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
// 검증방식 onchange
|
||||
$("#vrfcreq_way").on("change", function (e) {
|
||||
const val = e.target.value;
|
||||
|
||||
var str = "";
|
||||
str += `<option value="">-선택-</option>`;
|
||||
if (e.val !== "") {
|
||||
$.getJSON("/common/common/getVrfcCode?type=" + val, function (result) {
|
||||
var total = result.length;
|
||||
for (var i = 0; i < total; i++) {
|
||||
var cateNm = result[i].cd_nm;
|
||||
|
||||
if (total == 1) {
|
||||
str += "<option value=\"" + result[i].cd + "\" selected>" + cateNm + "</option>";
|
||||
} else {
|
||||
str += "<option value=\"" + result[i].cd + "\">" + cateNm + "</option>";
|
||||
}
|
||||
}
|
||||
|
||||
$("#vrfc_type_sub").html(str);
|
||||
});
|
||||
} else {
|
||||
$("#vrfc_type_sub").html(str);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
$("#btnSearch").on("click", function () {
|
||||
table.ajax.reload();
|
||||
});
|
||||
|
||||
|
||||
table = $('#resultList').DataTable({
|
||||
language: lang_kor,
|
||||
serverSide: true,
|
||||
processing: true,
|
||||
ajax: {
|
||||
url: '/article/ground_ctn/getResultList',
|
||||
type: 'GET',
|
||||
beforeSend: function () {
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
blockUI.unblockPage()
|
||||
},
|
||||
data: function (d) {
|
||||
|
||||
d.rcpt_atclno = $("#frm_srch_info [name=rcpt_atclno]").val(); // 매물ID
|
||||
d.schDateGb = $("#frm_srch_info [name=schDateGb]").val(); // 일자유형
|
||||
d.sdate = $("#frm_srch_info [name=sdate]").val(); // 시작일
|
||||
d.edate = $("#frm_srch_info [name=edate]").val(); // 종료일
|
||||
|
||||
d.bonbu = $("#frm_srch_info [name=bonbu]").val(); // 본부
|
||||
d.team = $("#frm_srch_info [name=team]").val(); // 팀
|
||||
d.user = $("#frm_srch_info [name=user]").val(); // 담당자
|
||||
|
||||
d.sido = $("#frm_srch_info [name=srcSido]").val(); // 시도
|
||||
d.gugun = $("#frm_srch_info [name=srcGugun]").val(); // 시군구
|
||||
d.dong = $("#frm_srch_info [name=srcDong]").val(); // 읍면동
|
||||
|
||||
d.rcpt_stat1 = $("#frm_srch_info [name=rcpt_stat1]").val(); // 상태1
|
||||
d.rcpt_stat2 = $("#frm_srch_info [name=rcpt_stat2]").val(); // 상태2
|
||||
d.rcpt_stat3 = $("#frm_srch_info [name=rcpt_stat3]").val(); // 상태3
|
||||
|
||||
d.rcpt_product_info1 = $("#frm_srch_info [name=rcpt_product_info1]").val(); // 거래구분
|
||||
d.exp_movie_yn = $("#frm_srch_info [name=exp_movie_yn]").val(); // 동영상촬영여부
|
||||
d.conf_img_yn = $("#frm_srch_info [name=conf_img_yn]").val(); // 홍보확인서여부
|
||||
d.parcel_out_yn = $("#frm_srch_info [name=parcel_out_yn]").val(); // 분양권
|
||||
d.rcpt_cpid = $("#frm_srch_info [name=rcpt_cpid]").val(); // CPID
|
||||
d.rcpt_product = $("#frm_srch_info [name=rcpt_product]").val(); // 매물종류
|
||||
d.exp_spc_yn = $("#frm_srch_info [name=exp_spc_yn]").val(); // 면적확인
|
||||
d.check_list_img_yn = $("#frm_srch_info [name=check_list_img_yn]").val(); // 체크리스트
|
||||
d.ground_plan_yn = $("#frm_srch_info [name=ground_plan_yn]").val(); // 평면도유무
|
||||
d.ground_plan = $("#frm_srch_info [name=ground_plan]").val(); // 평면도요청
|
||||
|
||||
d.srchType = $("#frm_srch_info [name=srchType]").val(); // 검색유형
|
||||
d.srchTxt = $("#frm_srch_info [name=srchTxt]").val(); // 검색어
|
||||
|
||||
d.start = d.start || 0
|
||||
d.length = d.length || 10
|
||||
},
|
||||
},
|
||||
"columnDefs": [
|
||||
{ className: 'text-center', targets: '_all' },
|
||||
{ 'targets': '_all', "defaultContent": "" },
|
||||
],
|
||||
columns: [
|
||||
{ data: 'rcpt_stat_nm' },
|
||||
{ data: 'rcpt_atclno' },
|
||||
{ data: null, render: fn_date_render },
|
||||
{ data: null, render: fn_addr_render },
|
||||
{ data: null, render: fn_floor_render },
|
||||
{ data: 'photo_save_dt' },
|
||||
{ data: 'excls_spc' },
|
||||
{ data: null, render: fn_product_render },
|
||||
{ data: 'dept_nm' },
|
||||
{ data: 'usr_nm' },
|
||||
{ data: 'ground_plan_yn' },
|
||||
{ data: 'ground_plan' },
|
||||
{ data: null, render: fn_btn_preview },
|
||||
{ data: null, render: fn_btn_download },
|
||||
],
|
||||
// 옵션들 예시
|
||||
destroy: true,
|
||||
deferRender: true,
|
||||
scrollX: false,
|
||||
autoWidth: false,
|
||||
paging: true,
|
||||
searching: false,
|
||||
ordering: false,
|
||||
});
|
||||
|
||||
// 테이블 row click
|
||||
$('#resultList tbody').on('click', 'tr', function (e) {
|
||||
if ($(e.target).closest('td.dt-no-rowclick').length) return;
|
||||
|
||||
const rowData = table.row(this).data();
|
||||
if (!rowData) return;
|
||||
});
|
||||
|
||||
|
||||
// 엑셀 다운로드 click
|
||||
$("#excel-download").on("click", function () {
|
||||
$.ajax({
|
||||
url: "/article/ground_ctn/excel",
|
||||
method: "GET",
|
||||
dataType: "json",
|
||||
data: $("#frm_srch_info").serialize(),
|
||||
beforeSend: function () {
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
blockUI.unblockPage()
|
||||
},
|
||||
success: function (result) {
|
||||
downloadExcel(result.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 미리보기
|
||||
$(document).on('click', '.btn-preview', function (e) {
|
||||
e.stopPropagation(); // 행 클릭 방지(2중 안전)
|
||||
fn_preview($(this).data('src'));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
// 접수기간 초기화
|
||||
function initReceiptDate() {
|
||||
|
||||
const before3 = new Date();
|
||||
before3.setDate(date.getDate() - 2);
|
||||
|
||||
const fmt = d => d.toISOString().slice(0, 10);
|
||||
|
||||
$('#sdate').val(fmt(before3));
|
||||
$('#edate').val(fmt(date));
|
||||
|
||||
}
|
||||
|
||||
function atcl_no_enter(event) {
|
||||
if (event.keyCode == 13) {
|
||||
table.ajax.reload()
|
||||
}
|
||||
}
|
||||
|
||||
/** datatable render */
|
||||
function fn_date_render(data, type, row) {
|
||||
var str = "";
|
||||
|
||||
str = row.rsrv_date + " " + row.rsrv_tm_ap;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function fn_addr_render(data, type, row) {
|
||||
var str = "";
|
||||
|
||||
if (row.rcpt_jibun_addr != null || row.rcpt_jibun_addr != "") {
|
||||
str = row.addr + " " + row.rcpt_jibun_addr + " " + row.rcpt_etc_addr;
|
||||
} else {
|
||||
str = row.addr + " " + row.rcpt_dtl_addr + " " + row.rcpt_ho;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function fn_floor_render(data, type, row) {
|
||||
var str = "";
|
||||
|
||||
str = row.rcpt_floor + "/" + row.rcpt_floor2;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function fn_product_render(data, type, row) {
|
||||
var str = "";
|
||||
|
||||
if (row.rcpt_product_nm == null || row.rcpt_product_nm == "") {
|
||||
str = row.rcpt_product;
|
||||
} else {
|
||||
str = row.rcpt_product_nm;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// 미리보기 btn
|
||||
function fn_btn_preview(data, type, row) {
|
||||
if (row.img_sq == null) return '';
|
||||
|
||||
let src = (row.cloud_upload_yn == "Y")
|
||||
? '<?= NCLOUD_OBJECT_STORAGE_URL ?>' + row.img_path + row.img_filenm
|
||||
: row.img_path + row.img_filenm;
|
||||
|
||||
return `
|
||||
<button type="button" class="btn btn-sm btn-link p-0 btn-preview" data-src="${src}">
|
||||
미리보기
|
||||
</button>
|
||||
`;
|
||||
}
|
||||
|
||||
// 다운로드 btn
|
||||
function fn_btn_download(data, type, row) {
|
||||
|
||||
var str = "";
|
||||
|
||||
if (row.img_sq != null) {
|
||||
var src = "";
|
||||
if (row.cloud_upload_yn == "Y") {
|
||||
src = '<?= NCLOUD_OBJECT_STORAGE_URL ?>' + '' + row.img_path + '' + row.img_filenm;
|
||||
} else {
|
||||
src = row.img_path + '' + row.img_filenm;
|
||||
}
|
||||
|
||||
str = `<a href="${src}" download="${row.filenm}">다운로드</a>`;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return str;
|
||||
}
|
||||
/** datatable render */
|
||||
|
||||
// 엑셀 다운로드
|
||||
function downloadExcel(data) {
|
||||
const ws = XLSX.utils.json_to_sheet(data);
|
||||
// ws['!cols'] = [
|
||||
// { wpx: 100 },
|
||||
// { wpx: 100 },
|
||||
// { wpx: 100 },
|
||||
// { wpx: 100 },
|
||||
// { wpx: 150 },
|
||||
// { wpx: 120 },
|
||||
// { wpx: 100 },
|
||||
// { wpx: 100 },
|
||||
// { wpx: 100 },
|
||||
// { wpx: 100 },
|
||||
// { wpx: 100 },
|
||||
// { wpx: 100 },
|
||||
// ];
|
||||
|
||||
const wb = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
|
||||
|
||||
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||
|
||||
const blob = new Blob([wbout], { type: 'application/octet-stream' });
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.href = URL.createObjectURL(blob);
|
||||
link.download = "아파트_평면도_내역" + getDateTimeString() + ".xlsx";
|
||||
link.click();
|
||||
URL.revokeObjectURL(link.href);
|
||||
}
|
||||
|
||||
|
||||
// 이미지 프리뷰
|
||||
function fn_preview(src) {
|
||||
const $img = $('#imgPreview');
|
||||
|
||||
// 이미지 표시
|
||||
$img.attr('src', src).show();
|
||||
|
||||
$('#previewTitle').text('이미지 미리보기');
|
||||
|
||||
|
||||
const modal = new bootstrap.Modal(document.getElementById('previewModal'));
|
||||
modal.show();
|
||||
}
|
||||
|
||||
</script>
|
||||
<?= $this->endSection() ?>
|
||||
@@ -769,8 +769,6 @@
|
||||
title: '정상 처리되었습니다.',
|
||||
icon: "success"
|
||||
});
|
||||
|
||||
table.ajax.reload();
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: result.msg,
|
||||
|
||||
Reference in New Issue
Block a user