실적관리 추가

This commit is contained in:
yangsh
2025-12-18 14:50:48 +09:00
parent 80826843d7
commit 59db781aef
58 changed files with 9587 additions and 28 deletions

View File

@@ -148,4 +148,51 @@ class HomeModel extends Model
return $rows;
}
// 실적 조회
public function viewStatData($param)
{
$sql = "select a1.*
from(
SELECT
CASE a.insert_user WHEN 0 THEN 1 ELSE a.insert_user END insert_user,
COUNT( DISTINCT CASE WHEN b.vrfc_type = 'T' AND a.stat_cd = '38' THEN a.vr_sq ELSE NULL END ) phone_cnt ,
COUNT( DISTINCT CASE WHEN b.vrfc_type = 'D' AND (a.stat_cd = '35' or a.stat_cd = '39') THEN a.vr_sq ELSE NULL END ) paper_cnt ,
COUNT( CASE WHEN (a.stat_cd = '77') THEN a.vr_sq ELSE NULL END ) + COUNT( DISTINCT CASE WHEN b.stat_cd = '60' AND a.stat_cd = '76' THEN a.vr_sq ELSE NULL END ) AS reg_open_cnt,
COUNT( CASE WHEN (a.stat_cd = '85') THEN a.vr_sq ELSE NULL END ) + COUNT( DISTINCT CASE WHEN b.stat_cd = '60' AND a.stat_cd = '80' THEN a.vr_sq ELSE NULL END ) AS reg_tempOpen_cnt,
COUNT( DISTINCT CASE WHEN a.stat_cd = '86' or a.stat_cd = '88' THEN a.vr_sq ELSE NULL END ) AS real_top_R,
COUNT( DISTINCT CASE WHEN a.stat_cd = '87' or a.stat_cd = '89' THEN a.vr_sq ELSE NULL END ) AS real_top_G,
IFNULL((select count(distinct f1.vr_sq)
from v2_files f1
INNER JOIN v2_vrfc_req b ON b.vr_sq = f1.vr_sq and b.vrfc_type = 'M'
where f1.insert_tm between concat(DATE_FORMAT({$param['s_date']}, '%Y-%m-%d'),' 00:00:00') AND concat(DATE_FORMAT({$param['s_date']}, '%Y-%m-%d'),' 23:59:59')
and f1.file_type = '2'
and f1.use_yn = 'Y'
AND f1.insert_user = a.insert_user) ,0) AS mobile_cnt
FROM v2_chg_stat_stats a
INNER JOIN v2_vrfc_req b ON b.vr_sq = a.vr_sq
INNER JOIN v2_article_info c ON c.vr_sq = a.vr_sq
WHERE 1=1
and a.insert_user = {$param['usr_sq']}
and a.insert_tm between concat(DATE_FORMAT({$param['s_date']}, '%Y-%m-%d'),' 00:00:00') AND concat(DATE_FORMAT({$param['s_date']}, '%Y-%m-%d'),' 23:59:59')
) a1 ";
$query = $this->db->query($sql);
return $query->getRowArray();
}
// 팩스 건수 조회
public function getHomeFaxCount()
{
$sql = "SELECT
date_format(now(), '%H') as base_time
,(SELECT count(*) FROM uds_tiff where save_time >= concat(date_format(now(), '%Y-%m-%d %H'), ':00:00')) as enfax_count
,(SELECT COUNT(*) FROM FC_RECV_TRAN where TR_RECVTIME >= concat(date_format(now(), '%Y%m%d%H'), '0000')) as lgfax_count ";
$query = $this->db->query($sql);
return $query->getRowArray();
}
}