단속처리상태에 따른 임대차계약서 등록 여부 수정.

main
JoJH 3 days ago
parent 9f2aae80e8
commit 78b1de9d64

@ -666,12 +666,13 @@
, P.RTPYR_NO <!-- 납부자 번호 -->
, P.RTPYR_NM <!-- 납부자 명 -->
, LM.LSCT_MPNG_ID <!-- 임대차계약 매핑 ID -->
, (CASE WHEN LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'RQ' THEN '기타(요청중)'
WHEN LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'RT' THEN '기타(요청취소)'
WHEN LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'AP' THEN '기타(승인)'
WHEN LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'UA' THEN '기타(미승인)'
WHEN LM.DMND_YN = 'N' AND LM.LSCT_MPNG_ID IS NOT NULL THEN '계약서등록'
ELSE '대상'
, (CASE WHEN LM.LSCT_MPNG_ID IS NOT NULL AND LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'RQ' THEN '승인요청(요청중)'
WHEN LM.LSCT_MPNG_ID IS NOT NULL AND LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'RT' THEN '승인요청(요청취소)'
WHEN LM.LSCT_MPNG_ID IS NOT NULL AND LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'AP' THEN '승인요청(승인)'
WHEN LM.LSCT_MPNG_ID IS NOT NULL AND LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'UA' THEN '승인요청(미승인)'
WHEN LM.LSCT_MPNG_ID IS NOT NULL AND LM.DMND_YN = 'N' THEN '계약서등록'
WHEN LM.LSCT_MPNG_ID IS NULL AND C.CRDN_STTS_CD BETWEEN '11' AND '45' THEN '대상'
ELSE CONCAT('기타', '(', GET_CODE_NM('FIM010',C.CRDN_STTS_CD), ')')
END) AS TRGT_STTS_NM <!-- 계약서 등록 대상 -->
, LM.LSCT_ID <!-- 임대차계약 ID -->
, (CASE WHEN LM.ENT_ID IS NULL THEN (SELECT RE.ENT_ID FROM TB_RENT_ENT RE WHERE RE.ENT_REG_NO = P.RTPYR_NO)
@ -730,16 +731,21 @@
</if>
<if test='trgtSttsNm != null and trgtSttsNm != "전체"'>
<choose>
<when test='trgtSttsNm == "대상"'>
AND C.CRDN_STTS_CD BETWEEN '11' AND '45'
AND LM.LSCT_MPNG_ID IS NULL
</when>
<when test='trgtSttsNm == "계약서등록"'>
AND LM.LSCT_MPNG_ID IS NOT NULL
AND LM.DMND_YN = 'N'
</when>
<when test='trgtSttsNm == "대상"'>
AND LM.LSCT_MPNG_ID IS NULL
</when>
<when test='trgtSttsNm == "기타"'>
<when test='trgtSttsNm == "승인요청"'>
AND LM.LSCT_MPNG_ID IS NOT NULL
AND LM.DMND_YN = 'Y'
</when>
<when test='trgtSttsNm == "기타"'>
AND C.CRDN_STTS_CD NOT BETWEEN '11' AND '45'
AND LM.LSCT_MPNG_ID IS NULL
</when>
<otherwise>
</otherwise>
@ -823,13 +829,12 @@
, LM.MDFCN_DT <!-- 수정 일시 -->
, LM.MDFR <!-- 수정자 -->
, (SELECT USER_NM FROM TB_USER X WHERE X.USER_ID = LM.MDFR) AS MDFR_NM <!-- 수정자 명 -->
, (CASE WHEN LM.DMND_YN = 'N' AND LM.CHG_APRV_STTS_CD IS NULL AND C.NXRP_CRDN_LINK_YN = 'N' THEN '대상'
WHEN LM.DMND_YN = 'N' AND LM.CHG_APRV_STTS_CD = 'RT' AND C.NXRP_CRDN_LINK_YN = 'N' THEN '요청취소'
WHEN LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'RQ' AND C.NXRP_CRDN_LINK_YN = 'N' THEN '요청중'
WHEN LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'AP' AND C.NXRP_CRDN_LINK_YN = 'N' THEN '승인'
WHEN LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'UA' AND C.NXRP_CRDN_LINK_YN = 'N' THEN '미승인'
WHEN C.NXRP_CRDN_LINK_YN = 'Y' THEN '기타(세외수입)'
ELSE '기타'
, (CASE WHEN LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'AP' THEN '승인'
WHEN LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'UA' THEN '미승인'
WHEN LM.DMND_YN = 'Y' AND LM.CHG_APRV_STTS_CD = 'RQ' AND C.CRDN_STTS_CD BETWEEN '11' AND '45' THEN '요청중'
WHEN LM.DMND_YN = 'N' AND LM.CHG_APRV_STTS_CD = 'RT' AND C.CRDN_STTS_CD BETWEEN '11' AND '45' THEN '요청취소'
WHEN LM.DMND_YN = 'N' AND LM.CHG_APRV_STTS_CD IS NULL AND C.CRDN_STTS_CD BETWEEN '11' AND '45' THEN '대상'
ELSE CONCAT('기타', '(', GET_CODE_NM('FIM010',C.CRDN_STTS_CD), ')')
END) AS TRGT_STTS_NM <!-- 계약서 등록 대상 -->
, RE.ENT_SE_CD <!-- 기업 구분 코드 -->
, (GET_CODE_NM('FIM088', RE.ENT_SE_CD)) AS ENT_SE_NM <!-- 기업 구분 명 -->
@ -912,33 +917,31 @@
</if>
<if test='trgtSttsNm != null and trgtSttsNm != "전체"'>
<choose>
<when test='trgtSttsNm == "대상"'>
AND LM.DMND_YN = 'N' <!-- 요청 여부 -->
AND LM.CHG_APRV_STTS_CD IS NULL <!-- 변경 승인 상태 -->
AND C.NXRP_CRDN_LINK_YN = 'N' <!-- 세외수입 단속 연계 여부 -->
</when>
<when test='trgtSttsNm == "요청취소"'>
AND LM.DMND_YN = 'N' <!-- 요청 여부 -->
AND LM.CHG_APRV_STTS_CD = 'RT' <!-- 변경 승인 상태 -->
AND C.NXRP_CRDN_LINK_YN = 'N' <!-- 세외수입 단속 연계 여부 -->
</when>
<when test='trgtSttsNm == "요청중"'>
AND LM.DMND_YN = 'Y' <!-- 요청 여부 -->
AND LM.CHG_APRV_STTS_CD = 'RQ' <!-- 변경 승인 상태 -->
AND C.NXRP_CRDN_LINK_YN = 'N' <!-- 세외수입 단속 연계 여부 -->
</when>
<when test='trgtSttsNm == "승인"'>
AND LM.DMND_YN = 'Y' <!-- 요청 여부 -->
AND LM.CHG_APRV_STTS_CD = 'AP' <!-- 변경 승인 상태 -->
AND C.NXRP_CRDN_LINK_YN = 'N' <!-- 세외수입 단속 연계 여부 -->
</when>
<when test='trgtSttsNm == "미승인"'>
AND LM.DMND_YN = 'Y' <!-- 요청 여부 -->
AND LM.CHG_APRV_STTS_CD = 'UA' <!-- 변경 승인 상태 -->
AND C.NXRP_CRDN_LINK_YN = 'N' <!-- 세외수입 단속 연계 여부 -->
</when>
<when test='trgtSttsNm == "요청중"'>
AND LM.DMND_YN = 'Y' <!-- 요청 여부 -->
AND LM.CHG_APRV_STTS_CD = 'RQ' <!-- 변경 승인 상태 -->
AND C.CRDN_STTS_CD BETWEEN '11' AND '45'
</when>
<when test='trgtSttsNm == "요청취소"'>
AND LM.DMND_YN = 'N' <!-- 요청 여부 -->
AND LM.CHG_APRV_STTS_CD = 'RT' <!-- 변경 승인 상태 -->
AND C.CRDN_STTS_CD BETWEEN '11' AND '45'
</when>
<when test='trgtSttsNm == "대상"'>
AND LM.DMND_YN = 'N' <!-- 요청 여부 -->
AND LM.CHG_APRV_STTS_CD IS NULL <!-- 변경 승인 상태 -->
AND C.CRDN_STTS_CD BETWEEN '11' AND '45'
</when>
<otherwise>
AND C.NXRP_CRDN_LINK_YN = 'Y' <!-- 세외수입 단속 연계 여부 -->
AND C.CRDN_STTS_CD NOT BETWEEN '11' AND '45'
</otherwise>
</choose>
</if>

Loading…
Cancel
Save