Browse Source

Backlog 연산 확인

dev001 10 months ago
parent
commit
1c26063eda
1 changed files with 549 additions and 5 deletions
  1. 549 5
      src/main/resources/sqlmap/mappers/ei/ei0102/EI01020001UMapper.xml

+ 549 - 5
src/main/resources/sqlmap/mappers/ei/ei0102/EI01020001UMapper.xml

@@ -2110,7 +2110,8 @@ SELECT AA.CMPN_CD
 	</select> -->
 	</select> -->
 	
 	
 	<!-- (컬럼 추가) 수주 테이블 / CCGRP_GB_CD / 사업본부 구분코드[EI002] -->
 	<!-- (컬럼 추가) 수주 테이블 / CCGRP_GB_CD / 사업본부 구분코드[EI002] -->
-	<select id="getList2" resultType="easyHashMap">
+	
+	<!-- <select id="getList2" resultType="easyHashMap">
 SELECT AA.CMPN_CD                                                                       /* 회사 코드                        */
 SELECT AA.CMPN_CD                                                                       /* 회사 코드                        */
 	 , AA.PYEAR                                                                         /* 기준 연도                        */
 	 , AA.PYEAR                                                                         /* 기준 연도                        */
 	 , AA.CCGRP_GB_CD                                                                   /* 사업본부 구분코드[EI002] */
 	 , AA.CCGRP_GB_CD                                                                   /* 사업본부 구분코드[EI002] */
@@ -2233,7 +2234,7 @@ SELECT AA.CMPN_CD
                     /*
                     /*
                     , CASE WHEN A.CCGRP_GB_CD = NULL OR A.CCGRP_GB_CD = ' ' THEN (SELECT ESBS_CD1 FROM SM_COM_COMMCD_D WHERE COMM_CD_ID = '1112' AND SPEC_CD = A.CCSCTR_GB_CD)
                     , CASE WHEN A.CCGRP_GB_CD = NULL OR A.CCGRP_GB_CD = ' ' THEN (SELECT ESBS_CD1 FROM SM_COM_COMMCD_D WHERE COMM_CD_ID = '1112' AND SPEC_CD = A.CCSCTR_GB_CD)
                            ELSE A.CCGRP_GB_CD
                            ELSE A.CCGRP_GB_CD
-                      END              AS CCGRP_GB_CD                      -- 사업본부 구분코드[EI002]
+                      END              AS CCGRP_GB_CD                      /* 사업본부 구분코드[EI002] */
                     */
                     */
                     , A.CCGRP_GB_CD                                        /* 사업본부 구분코드[EI002] */
                     , A.CCGRP_GB_CD                                        /* 사업본부 구분코드[EI002] */
                     
                     
@@ -2355,8 +2356,8 @@ SELECT AA.CMPN_CD
                            
                            
                            
                            
                            /* 20240111 (컬럼 추가) 수주 테이블 / CCGRP_GB_CD / 사업본부 구분코드[EI002] */
                            /* 20240111 (컬럼 추가) 수주 테이블 / CCGRP_GB_CD / 사업본부 구분코드[EI002] */
-                           -- , NVL(B.CCGRP_GB_CD, ' ')  AS CCGRP_GB_CD       /* 사업본부 구분코드[EI002] */
-                           -- , NVL(NVL(A.CCGRP_GB_CD, B.CCGRP_GB_CD), (SELECT ESBS_CD1 FROM SM_COM_COMMCD_D WHERE COMM_CD_ID = '1112' AND SPEC_CD = A.CCSCTR_GB_CD)) 
+                           /* , NVL(B.CCGRP_GB_CD, ' ')  AS CCGRP_GB_CD */       /* 사업본부 구분코드[EI002] */
+                           /* , NVL(NVL(A.CCGRP_GB_CD, B.CCGRP_GB_CD), (SELECT ESBS_CD1 FROM SM_COM_COMMCD_D WHERE COMM_CD_ID = '1112' AND SPEC_CD = A.CCSCTR_GB_CD)) */
                            , NVL(A.CCGRP_GB_CD, B.CCGRP_GB_CD)
                            , NVL(A.CCGRP_GB_CD, B.CCGRP_GB_CD)
                                                       AS CCGRP_GB_CD       /* 사업본부 구분코드[EI002] */
                                                       AS CCGRP_GB_CD       /* 사업본부 구분코드[EI002] */
                                                       
                                                       
@@ -2632,7 +2633,550 @@ SELECT AA.CMPN_CD
           , AA.PYEAR
           , AA.PYEAR
           , AA.CCGRP_GB_CD
           , AA.CCGRP_GB_CD
           , AA.SORT_NUM
           , AA.SORT_NUM
-	</select>
+	</select> -->
+	<select id="getList2" resultType="easyHashMap">
+SELECT AA.CMPN_CD                                                                       /* 회사 코드                        */
+	 , AA.PYEAR                                                                         /* 기준 연도                        */
+	 , AA.CCGRP_GB_CD                                                                   /* 사업본부 구분코드[EI002] */
+	 , AA.SORT_NUM                                                                      /* 정렬 순번                        */
+	 
+	 , NVL(BB.BACKLOG_PFMC_00, 0)   AS BACKLOG_PFMC_00                                                               /* 연말 실적                        */
+	 
+	 , NVL(BB.BACKLOG_PFMC_00, 0) + NVL(AA.CNTRT_AMT_01, 0) - NVL(CC.SLAMT_SUM_01, 0)  AS BACKLOG_PFMC_01     /* 월별 Backlog 실적(1월) */  /*  당월(당월이전) = 전월Backlog + 수주실적 – 매출실적 */
+	 , NVL(BB.BACKLOG_FCST_01, 0)   AS BACKLOG_FCST_01                                                        /* 월별 Backlog 전망(1월) */
+
+	 , (NVL(BB.BACKLOG_PFMC_00, 0) + NVL(AA.CNTRT_AMT_01, 0) - NVL(CC.SLAMT_SUM_01, 0))
+	   + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('02')), -1, NVL(AA.RCORD_FCST_02, 0), NVL(AA.CNTRT_AMT_02, 0)) 
+	   - NVL(CC.SLAMT_SUM_02, 0)            AS BACKLOG_PFMC_02                                  /* 월별 Backlog 실적(2월) */  /* 당월(당월이전) = 전월Backlog + 수주실적 – 매출실적 */
+	 , NVL(BB.BACKLOG_FCST_02, 0)   AS BACKLOG_FCST_02                                                                     /* 당월이후          = 전월Backlog + 수주전망 – 매출전망 */
+
+	 , ((NVL(BB.BACKLOG_PFMC_00, 0) + NVL(AA.CNTRT_AMT_01, 0) - NVL(CC.SLAMT_SUM_01, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('02')), -1, NVL(AA.RCORD_FCST_02, 0), NVL(AA.CNTRT_AMT_02, 0)) - NVL(CC.SLAMT_SUM_02, 0))
+	   + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('03')), -1, NVL(AA.RCORD_FCST_03, 0), NVL(AA.CNTRT_AMT_03, 0)) 
+	   - NVL(CC.SLAMT_SUM_03, 0)            AS BACKLOG_PFMC_03   
+	 , NVL(BB.BACKLOG_FCST_03, 0)   AS BACKLOG_FCST_03
+
+	 , (((NVL(BB.BACKLOG_PFMC_00, 0) + NVL(AA.CNTRT_AMT_01, 0) - NVL(CC.SLAMT_SUM_01, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('02')), -1, NVL(AA.RCORD_FCST_02, 0), NVL(AA.CNTRT_AMT_02, 0)) - NVL(CC.SLAMT_SUM_02, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('03')), 1, NVL(AA.RCORD_FCST_03, 0), NVL(AA.CNTRT_AMT_03, 0))  - NVL(CC.SLAMT_SUM_03, 0))
+	   + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('04')), -1, NVL(AA.RCORD_FCST_04, 0), NVL(AA.CNTRT_AMT_04, 0)) 
+	   - NVL(CC.SLAMT_SUM_04, 0)            AS BACKLOG_PFMC_04
+	 , NVL(BB.BACKLOG_FCST_04, 0)   AS BACKLOG_FCST_04
+
+	 , ((((NVL(BB.BACKLOG_PFMC_00, 0) + NVL(AA.CNTRT_AMT_01, 0) - NVL(CC.SLAMT_SUM_01, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('02')), -1, NVL(AA.RCORD_FCST_02, 0), NVL(AA.CNTRT_AMT_02, 0)) - NVL(CC.SLAMT_SUM_02, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('03')), 1, NVL(AA.RCORD_FCST_03, 0), NVL(AA.CNTRT_AMT_03, 0))  - NVL(CC.SLAMT_SUM_03, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('04')), -1, NVL(AA.RCORD_FCST_04, 0), NVL(AA.CNTRT_AMT_04, 0)) - NVL(CC.SLAMT_SUM_04, 0))
+	   + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('05')), -1, NVL(AA.RCORD_FCST_05, 0), NVL(AA.CNTRT_AMT_05, 0)) 
+	   - NVL(CC.SLAMT_SUM_05, 0)            AS BACKLOG_PFMC_05
+	 , NVL(BB.BACKLOG_FCST_05, 0)   AS BACKLOG_FCST_05
+
+	 , (((((NVL(BB.BACKLOG_PFMC_00, 0) + NVL(AA.CNTRT_AMT_01, 0) - NVL(CC.SLAMT_SUM_01, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('02')), -1, NVL(AA.RCORD_FCST_02, 0), NVL(AA.CNTRT_AMT_02, 0)) - NVL(CC.SLAMT_SUM_02, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('03')), 1, NVL(AA.RCORD_FCST_03, 0), NVL(AA.CNTRT_AMT_03, 0))  - NVL(CC.SLAMT_SUM_03, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('04')), -1, NVL(AA.RCORD_FCST_04, 0), NVL(AA.CNTRT_AMT_04, 0)) - NVL(CC.SLAMT_SUM_04, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('05')), -1, NVL(AA.RCORD_FCST_05, 0), NVL(AA.CNTRT_AMT_05, 0)) - NVL(CC.SLAMT_SUM_05, 0))
+	   + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('06')), -1, NVL(AA.RCORD_FCST_06, 0), NVL(AA.CNTRT_AMT_06, 0)) 
+	   - NVL(CC.SLAMT_SUM_06, 0)            AS BACKLOG_PFMC_06
+	 , NVL(BB.BACKLOG_FCST_06, 0)   AS BACKLOG_FCST_06
+
+	 , ((((((NVL(BB.BACKLOG_PFMC_00, 0) + NVL(AA.CNTRT_AMT_01, 0) - NVL(CC.SLAMT_SUM_01, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('02')), -1, NVL(AA.RCORD_FCST_02, 0), NVL(AA.CNTRT_AMT_02, 0)) - NVL(CC.SLAMT_SUM_02, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('03')), 1, NVL(AA.RCORD_FCST_03, 0), NVL(AA.CNTRT_AMT_03, 0))  - NVL(CC.SLAMT_SUM_03, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('04')), -1, NVL(AA.RCORD_FCST_04, 0), NVL(AA.CNTRT_AMT_04, 0)) - NVL(CC.SLAMT_SUM_04, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('05')), -1, NVL(AA.RCORD_FCST_05, 0), NVL(AA.CNTRT_AMT_05, 0)) - NVL(CC.SLAMT_SUM_05, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('06')), -1, NVL(AA.RCORD_FCST_06, 0), NVL(AA.CNTRT_AMT_06, 0)) - NVL(CC.SLAMT_SUM_06, 0))
+	   + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('07')), -1, NVL(AA.RCORD_FCST_07,0) , NVL(AA.CNTRT_AMT_07, 0)) 
+	   - NVL(CC.SLAMT_SUM_07, 0)            AS BACKLOG_PFMC_07
+	 , NVL(BB.BACKLOG_FCST_07, 0)   AS BACKLOG_FCST_07
+
+	 , (((((((NVL(BB.BACKLOG_PFMC_00, 0) + NVL(AA.CNTRT_AMT_01, 0) - NVL(CC.SLAMT_SUM_01, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('02')), -1, NVL(AA.RCORD_FCST_02, 0), NVL(AA.CNTRT_AMT_02, 0)) - NVL(CC.SLAMT_SUM_02, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('03')), 1, NVL(AA.RCORD_FCST_03, 0), NVL(AA.CNTRT_AMT_03, 0))  - NVL(CC.SLAMT_SUM_03, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('04')), -1, NVL(AA.RCORD_FCST_04, 0), NVL(AA.CNTRT_AMT_04, 0)) - NVL(CC.SLAMT_SUM_04, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('05')), -1, NVL(AA.RCORD_FCST_05, 0), NVL(AA.CNTRT_AMT_05, 0)) - NVL(CC.SLAMT_SUM_05, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('06')), -1, NVL(AA.RCORD_FCST_06, 0), NVL(AA.CNTRT_AMT_06, 0)) - NVL(CC.SLAMT_SUM_06, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('07')), -1, NVL(AA.RCORD_FCST_07,0) , NVL(AA.CNTRT_AMT_07, 0)) - NVL(CC.SLAMT_SUM_07, 0))
+	   + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('08')), -1, NVL(AA.RCORD_FCST_08, 0), NVL(AA.CNTRT_AMT_08, 0)) 
+	   - NVL(CC.SLAMT_SUM_08, 0)            AS BACKLOG_PFMC_08
+	 , NVL(BB.BACKLOG_FCST_08, 0)   AS BACKLOG_FCST_08
+
+	 , ((((((((NVL(BB.BACKLOG_PFMC_00, 0) + NVL(AA.CNTRT_AMT_01, 0) - NVL(CC.SLAMT_SUM_01, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('02')), -1, NVL(AA.RCORD_FCST_02, 0), NVL(AA.CNTRT_AMT_02, 0)) - NVL(CC.SLAMT_SUM_02, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('03')), 1, NVL(AA.RCORD_FCST_03, 0), NVL(AA.CNTRT_AMT_03, 0))  - NVL(CC.SLAMT_SUM_03, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('04')), -1, NVL(AA.RCORD_FCST_04, 0), NVL(AA.CNTRT_AMT_04, 0)) - NVL(CC.SLAMT_SUM_04, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('05')), -1, NVL(AA.RCORD_FCST_05, 0), NVL(AA.CNTRT_AMT_05, 0)) - NVL(CC.SLAMT_SUM_05, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('06')), -1, NVL(AA.RCORD_FCST_06, 0), NVL(AA.CNTRT_AMT_06, 0)) - NVL(CC.SLAMT_SUM_06, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('07')), -1, NVL(AA.RCORD_FCST_07,0) , NVL(AA.CNTRT_AMT_07, 0)) - NVL(CC.SLAMT_SUM_07, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('08')), -1, NVL(AA.RCORD_FCST_08, 0), NVL(AA.CNTRT_AMT_08, 0)) - NVL(CC.SLAMT_SUM_08, 0))
+	   + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('09')), -1, NVL(AA.RCORD_FCST_09, 0), NVL(AA.CNTRT_AMT_09, 0)) 
+	   - NVL(CC.SLAMT_SUM_09, 0)            AS BACKLOG_PFMC_09
+	 , NVL(BB.BACKLOG_FCST_09, 0)   AS BACKLOG_FCST_09
+
+	 , (((((((((NVL(BB.BACKLOG_PFMC_00, 0) + NVL(AA.CNTRT_AMT_01, 0) - NVL(CC.SLAMT_SUM_01, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('02')), -1, NVL(AA.RCORD_FCST_02, 0), NVL(AA.CNTRT_AMT_02, 0)) - NVL(CC.SLAMT_SUM_02, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('03')), 1, NVL(AA.RCORD_FCST_03, 0), NVL(AA.CNTRT_AMT_03, 0))  - NVL(CC.SLAMT_SUM_03, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('04')), -1, NVL(AA.RCORD_FCST_04, 0), NVL(AA.CNTRT_AMT_04, 0)) - NVL(CC.SLAMT_SUM_04, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('05')), -1, NVL(AA.RCORD_FCST_05, 0), NVL(AA.CNTRT_AMT_05, 0)) - NVL(CC.SLAMT_SUM_05, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('06')), -1, NVL(AA.RCORD_FCST_06, 0), NVL(AA.CNTRT_AMT_06, 0)) - NVL(CC.SLAMT_SUM_06, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('07')), -1, NVL(AA.RCORD_FCST_07,0) , NVL(AA.CNTRT_AMT_07, 0)) - NVL(CC.SLAMT_SUM_07, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('08')), -1, NVL(AA.RCORD_FCST_08, 0), NVL(AA.CNTRT_AMT_08, 0)) - NVL(CC.SLAMT_SUM_08, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('09')), -1, NVL(AA.RCORD_FCST_09, 0), NVL(AA.CNTRT_AMT_09, 0)) - NVL(CC.SLAMT_SUM_09, 0))
+	   + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('10')), -1, NVL(AA.RCORD_FCST_10, 0), NVL(AA.CNTRT_AMT_10, 0)) 
+	   - NVL(CC.SLAMT_SUM_10, 0)            AS BACKLOG_PFMC_10
+	 , NVL(BB.BACKLOG_FCST_10, 0)   AS BACKLOG_FCST_10
+
+	 , ((((((((((NVL(BB.BACKLOG_PFMC_00, 0) + NVL(AA.CNTRT_AMT_01, 0) - NVL(CC.SLAMT_SUM_01, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('02')), -1, NVL(AA.RCORD_FCST_02, 0), NVL(AA.CNTRT_AMT_02, 0)) - NVL(CC.SLAMT_SUM_02, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('03')), 1, NVL(AA.RCORD_FCST_03, 0), NVL(AA.CNTRT_AMT_03, 0))  - NVL(CC.SLAMT_SUM_03, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('04')), -1, NVL(AA.RCORD_FCST_04, 0), NVL(AA.CNTRT_AMT_04, 0)) - NVL(CC.SLAMT_SUM_04, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('05')), -1, NVL(AA.RCORD_FCST_05, 0), NVL(AA.CNTRT_AMT_05, 0)) - NVL(CC.SLAMT_SUM_05, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('06')), -1, NVL(AA.RCORD_FCST_06, 0), NVL(AA.CNTRT_AMT_06, 0)) - NVL(CC.SLAMT_SUM_06, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('07')), -1, NVL(AA.RCORD_FCST_07,0) , NVL(AA.CNTRT_AMT_07, 0)) - NVL(CC.SLAMT_SUM_07, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('08')), -1, NVL(AA.RCORD_FCST_08, 0), NVL(AA.CNTRT_AMT_08, 0)) - NVL(CC.SLAMT_SUM_08, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('09')), -1, NVL(AA.RCORD_FCST_09, 0), NVL(AA.CNTRT_AMT_09, 0)) - NVL(CC.SLAMT_SUM_09, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('10')), -1, NVL(AA.RCORD_FCST_10, 0), NVL(AA.CNTRT_AMT_10, 0)) - NVL(CC.SLAMT_SUM_10, 0))
+	   + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('11')), -1, NVL(AA.RCORD_FCST_11, 0), NVL(AA.CNTRT_AMT_11, 0)) 
+	   - NVL(CC.SLAMT_SUM_11, 0)            AS BACKLOG_PFMC_11
+	 , NVL(BB.BACKLOG_FCST_11, 0)   AS BACKLOG_FCST_11
+
+	 , (((((((((((NVL(BB.BACKLOG_PFMC_00, 0) + NVL(AA.CNTRT_AMT_01, 0) - NVL(CC.SLAMT_SUM_01, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('02')), -1, NVL(AA.RCORD_FCST_02, 0), NVL(AA.CNTRT_AMT_02, 0)) - NVL(CC.SLAMT_SUM_02, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('03')), 1, NVL(AA.RCORD_FCST_03, 0), NVL(AA.CNTRT_AMT_03, 0))  - NVL(CC.SLAMT_SUM_03, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('04')), -1, NVL(AA.RCORD_FCST_04, 0), NVL(AA.CNTRT_AMT_04, 0)) - NVL(CC.SLAMT_SUM_04, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('05')), -1, NVL(AA.RCORD_FCST_05, 0), NVL(AA.CNTRT_AMT_05, 0)) - NVL(CC.SLAMT_SUM_05, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('06')), -1, NVL(AA.RCORD_FCST_06, 0), NVL(AA.CNTRT_AMT_06, 0)) - NVL(CC.SLAMT_SUM_06, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('07')), -1, NVL(AA.RCORD_FCST_07,0) , NVL(AA.CNTRT_AMT_07, 0)) - NVL(CC.SLAMT_SUM_07, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('08')), -1, NVL(AA.RCORD_FCST_08, 0), NVL(AA.CNTRT_AMT_08, 0)) - NVL(CC.SLAMT_SUM_08, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('09')), -1, NVL(AA.RCORD_FCST_09, 0), NVL(AA.CNTRT_AMT_09, 0)) - NVL(CC.SLAMT_SUM_09, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('10')), -1, NVL(AA.RCORD_FCST_10, 0), NVL(AA.CNTRT_AMT_10, 0)) - NVL(CC.SLAMT_SUM_10, 0)) + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('11')), -1, NVL(AA.RCORD_FCST_11, 0), NVL(AA.CNTRT_AMT_11, 0)) - NVL(CC.SLAMT_SUM_11, 0))
+	   + DECODE(SIGN(TO_NUMBER(#{pmonth}) - TO_NUMBER('12')), -1, NVL(AA.RCORD_FCST_12, 0), NVL(AA.CNTRT_AMT_12, 0)) 
+	   - NVL(CC.SLAMT_SUM_12, 0)            AS BACKLOG_PFMC_12
+	 , NVL(BB.BACKLOG_FCST_12, 0)   AS BACKLOG_FCST_12
+  FROM (
+         /* 수주내역 */
+         SELECT A.CMPN_CD                                /* 회사 코드                        */
+              , A.PYEAR                                  /* 기준 연도                        */
+              , A.CCGRP_GB_CD                            /* 사업본부 구분코드[EI002] */
+              , CASE WHEN A.CCGRP_GB_CD = 'J0' THEN 1  
+                  WHEN A.CCGRP_GB_CD = 'Y0' THEN 2  
+                  WHEN A.CCGRP_GB_CD = 'N0' THEN 3  
+                  ELSE 99
+                END                  AS SORT_NUM         /* 정렬 순번                        */
+              , SUM(A.RCORD_PLAN_01) AS RCORD_PLAN_01    /* 1월 수주 계획                   */
+         	  , SUM(A.CNTRT_AMT_01)  AS CNTRT_AMT_01     /* 1월 실적                         */
+         	  , SUM(A.RCORD_FCST_01) AS RCORD_FCST_01    /* 1월 수주 전망                   */
+         	  , SUM(A.RCORD_PLAN_02) AS RCORD_PLAN_02
+              , SUM(A.CNTRT_AMT_02)  AS CNTRT_AMT_02
+         	  , SUM(A.RCORD_FCST_02) AS RCORD_FCST_02
+         	  , SUM(A.RCORD_PLAN_03) AS RCORD_PLAN_03
+              , SUM(A.CNTRT_AMT_03)  AS CNTRT_AMT_03
+         	  , SUM(A.RCORD_FCST_03) AS RCORD_FCST_03
+         	  , SUM(A.RCORD_PLAN_04) AS RCORD_PLAN_04
+              , SUM(A.CNTRT_AMT_04)  AS CNTRT_AMT_04
+         	  , SUM(A.RCORD_FCST_04) AS RCORD_FCST_04
+         	  , SUM(A.RCORD_PLAN_05) AS RCORD_PLAN_05
+         	  , SUM(A.CNTRT_AMT_05)  AS CNTRT_AMT_05
+         	  , SUM(A.RCORD_FCST_05) AS RCORD_FCST_05
+         	  , SUM(A.RCORD_PLAN_06) AS RCORD_PLAN_06
+         	  , SUM(A.CNTRT_AMT_06)  AS CNTRT_AMT_06
+         	  , SUM(A.RCORD_FCST_06) AS RCORD_FCST_06
+         	  , SUM(A.RCORD_PLAN_07) AS RCORD_PLAN_07
+         	  , SUM(A.CNTRT_AMT_07)  AS CNTRT_AMT_07
+         	  , SUM(A.RCORD_FCST_07) AS RCORD_FCST_07
+         	  , SUM(A.RCORD_PLAN_08) AS RCORD_PLAN_08
+         	  , SUM(A.CNTRT_AMT_08)  AS CNTRT_AMT_08
+         	  , SUM(A.RCORD_FCST_08) AS RCORD_FCST_08
+         	  , SUM(A.RCORD_PLAN_09) AS RCORD_PLAN_09
+         	  , SUM(A.CNTRT_AMT_09)  AS CNTRT_AMT_09
+         	  , SUM(A.RCORD_FCST_09) AS RCORD_FCST_09
+         	  , SUM(A.RCORD_PLAN_10) AS RCORD_PLAN_10
+         	  , SUM(A.CNTRT_AMT_10)  AS CNTRT_AMT_10
+         	  , SUM(A.RCORD_FCST_10) AS RCORD_FCST_10
+         	  , SUM(A.RCORD_PLAN_11) AS RCORD_PLAN_11
+         	  , SUM(A.CNTRT_AMT_11)  AS CNTRT_AMT_11
+         	  , SUM(A.RCORD_FCST_11) AS RCORD_FCST_11
+         	  , SUM(A.RCORD_PLAN_12) AS RCORD_PLAN_12
+         	  , SUM(A.CNTRT_AMT_12)  AS CNTRT_AMT_12
+         	  , SUM(A.RCORD_FCST_12) AS RCORD_FCST_12
+         FROM (
+               SELECT A.CMPN_CD                                            /* 회사 코드                        */
+                    , A.PYEAR                                              /* 기준 연도                        */
+                    , A.PMONTH	                                          /* 기준 월                          */
+                    , A.CCSCTR_GB_CD                                       /* 사업부문 구분코드[EI003] */
+                    
+
+
+                    /* 20240111 (컬럼 추가) 수주 테이블 / CCGRP_GB_CD / 사업본부 구분코드[EI002] */
+                    /*
+                    , CASE WHEN A.CCGRP_GB_CD = NULL OR A.CCGRP_GB_CD = ' ' THEN (SELECT ESBS_CD1 FROM SM_COM_COMMCD_D WHERE COMM_CD_ID = '1112' AND SPEC_CD = A.CCSCTR_GB_CD)
+                           ELSE A.CCGRP_GB_CD
+                      END              AS CCGRP_GB_CD                      -- 사업본부 구분코드[EI002]
+                    */
+                    , A.CCGRP_GB_CD                                        /* 사업본부 구분코드[EI002] */
+                    
+                    
+                    , CASE WHEN A.PMONTH = '01' THEN NVL(A.RCORD_PLAN, 0)  /* 수주 계획                       */
+                           ELSE 0
+                      END              AS RCORD_PLAN_01
+                    , CASE WHEN A.PMONTH = '01' THEN NVL(A.CNTRT_AMT, 0)   /* 계약금액(실적)         */
+                           ELSE 0
+                      END              AS CNTRT_AMT_01
+                    , CASE WHEN A.PMONTH = '01' THEN NVL(A.RCORD_FCST, 0)   /* 수주 전망                      */
+                           ELSE 0
+                      END              AS RCORD_FCST_01
+                    , CASE WHEN A.PMONTH = '02' THEN NVL(A.RCORD_PLAN, 0)   
+                           ELSE 0
+                      END              AS RCORD_PLAN_02
+                    , CASE WHEN A.PMONTH = '02' THEN NVL(A.CNTRT_AMT, 0)   
+                           ELSE 0
+                      END              AS CNTRT_AMT_02
+                    , CASE WHEN A.PMONTH = '02' THEN NVL(A.RCORD_FCST, 0)  
+                           ELSE 0
+                      END              AS RCORD_FCST_02
+         		    , CASE WHEN A.PMONTH = '03' THEN NVL(A.RCORD_PLAN, 0)  
+                           ELSE 0
+                      END              AS RCORD_PLAN_03
+                    , CASE WHEN A.PMONTH = '03' THEN NVL(A.CNTRT_AMT, 0)   
+                           ELSE 0
+                      END              AS CNTRT_AMT_03
+                    , CASE WHEN A.PMONTH = '03' THEN NVL(A.RCORD_FCST, 0)  
+                           ELSE 0
+                      END              AS RCORD_FCST_03
+                    , CASE WHEN A.PMONTH = '04' THEN NVL(A.RCORD_PLAN, 0)  
+                           ELSE 0
+                      END              AS RCORD_PLAN_04
+                    , CASE WHEN A.PMONTH = '04' THEN NVL(A.CNTRT_AMT, 0)   
+                           ELSE 0
+                      END              AS CNTRT_AMT_04
+                    , CASE WHEN A.PMONTH = '04' THEN NVL(A.RCORD_FCST, 0)  
+                           ELSE 0
+                      END              AS RCORD_FCST_04
+                    , CASE WHEN A.PMONTH = '05' THEN NVL(A.RCORD_PLAN, 0)  
+                           ELSE 0
+                      END              AS RCORD_PLAN_05
+                    , CASE WHEN A.PMONTH = '05' THEN NVL(A.CNTRT_AMT, 0)   
+                           ELSE 0
+                      END              AS CNTRT_AMT_05
+                    , CASE WHEN A.PMONTH = '05' THEN NVL(A.RCORD_FCST, 0)  
+                           ELSE 0
+                      END              AS RCORD_FCST_05
+                    , CASE WHEN A.PMONTH = '06' THEN NVL(A.RCORD_PLAN, 0)  
+                           ELSE 0
+                      END              AS RCORD_PLAN_06
+                    , CASE WHEN A.PMONTH = '06' THEN NVL(A.CNTRT_AMT, 0)   
+                           ELSE 0
+                      END              AS CNTRT_AMT_06
+                    , CASE WHEN A.PMONTH = '06' THEN NVL(A.RCORD_FCST, 0) 
+                           ELSE 0
+                      END              AS RCORD_FCST_06
+                    , CASE WHEN A.PMONTH = '07' THEN NVL(A.RCORD_PLAN, 0) 
+                           ELSE 0
+                      END              AS RCORD_PLAN_07
+                    , CASE WHEN A.PMONTH = '07' THEN NVL(A.CNTRT_AMT, 0)  
+                           ELSE 0
+                      END              AS CNTRT_AMT_07
+                    , CASE WHEN A.PMONTH = '07' THEN NVL(A.RCORD_FCST, 0) 
+                           ELSE 0
+                      END              AS RCORD_FCST_07
+                    , CASE WHEN A.PMONTH = '08' THEN NVL(A.RCORD_PLAN, 0) 
+                           ELSE 0
+                      END              AS RCORD_PLAN_08
+                    , CASE WHEN A.PMONTH = '08' THEN NVL(A.CNTRT_AMT, 0)  
+                           ELSE 0
+                      END              AS CNTRT_AMT_08
+                    , CASE WHEN A.PMONTH = '08' THEN NVL(A.RCORD_FCST, 0) 
+                           ELSE 0
+                      END              AS RCORD_FCST_08
+                    , CASE WHEN A.PMONTH = '09' THEN NVL(A.RCORD_PLAN, 0) 
+                           ELSE 0
+                      END              AS RCORD_PLAN_09
+                    , CASE WHEN A.PMONTH = '09' THEN NVL(A.CNTRT_AMT, 0)  
+                           ELSE 0
+                      END              AS CNTRT_AMT_09
+                    , CASE WHEN A.PMONTH = '09' THEN NVL(A.RCORD_FCST, 0) 
+                           ELSE 0
+                      END              AS RCORD_FCST_09
+                    , CASE WHEN A.PMONTH = '10' THEN NVL(A.RCORD_PLAN, 0) 
+                           ELSE 0
+                      END              AS RCORD_PLAN_10
+                    , CASE WHEN A.PMONTH = '10' THEN NVL(A.CNTRT_AMT, 0)  
+                           ELSE 0
+                      END              AS CNTRT_AMT_10
+                    , CASE WHEN A.PMONTH = '10' THEN NVL(A.RCORD_FCST, 0) 
+                           ELSE 0
+                      END              AS RCORD_FCST_10
+                    , CASE WHEN A.PMONTH = '11' THEN NVL(A.RCORD_PLAN, 0) 
+                           ELSE 0
+                      END              AS RCORD_PLAN_11
+                    , CASE WHEN A.PMONTH = '11' THEN NVL(A.CNTRT_AMT, 0)  
+                           ELSE 0
+                      END              AS CNTRT_AMT_11
+                    , CASE WHEN A.PMONTH = '11' THEN NVL(A.RCORD_FCST, 0) 
+                           ELSE 0
+                      END              AS RCORD_FCST_11
+                    , CASE WHEN A.PMONTH = '12' THEN NVL(A.RCORD_PLAN, 0) 
+                           ELSE 0
+                      END              AS RCORD_PLAN_12
+                    , CASE WHEN A.PMONTH = '12' THEN NVL(A.CNTRT_AMT, 0)  
+                           ELSE 0
+                      END              AS CNTRT_AMT_12
+                    , CASE WHEN A.PMONTH = '12' THEN NVL(A.RCORD_FCST, 0) 
+                           ELSE 0
+                      END              AS RCORD_FCST_12
+               FROM (
+                     /* 마스터 테이블 변경 start */
+                     SELECT A.CMPN_CD                                     /* 회사 코드                        */
+                           , A.PYEAR                                       /* 기준 연도                        */
+                           , A.PMONTH	                                  /* 기준 월                          */
+                           , A.CCSCTR_GB_CD                                /* 사업부문 구분코드[EI003] */
+                           
+                           
+                           /* 20240111 (컬럼 추가) 수주 테이블 / CCGRP_GB_CD / 사업본부 구분코드[EI002] */
+                           -- , NVL(B.CCGRP_GB_CD, ' ')  AS CCGRP_GB_CD       /* 사업본부 구분코드[EI002] */
+                           -- , NVL(NVL(A.CCGRP_GB_CD, B.CCGRP_GB_CD), (SELECT ESBS_CD1 FROM SM_COM_COMMCD_D WHERE COMM_CD_ID = '1112' AND SPEC_CD = A.CCSCTR_GB_CD)) 
+                           , NVL(A.CCGRP_GB_CD, B.CCGRP_GB_CD)
+                                                      AS CCGRP_GB_CD       /* 사업본부 구분코드[EI002] */
+                                                      
+                           , NVL(B.RCORD_PLAN, 0)     AS RCORD_PLAN        /* 수주 계획                        */
+                      	   , NVL(A.CNTRT_AMT, 0)      AS CNTRT_AMT         /* 계약금액(실적)         */
+                           , NVL(B.RCORD_FCST, 0)     AS RCORD_FCST        /* 수주 전망                       */
+                        FROM (
+                               SELECT CMPN_CD                            /* 회사 코드                        */
+                                    , PYEAR                              /* 기준 연도                        */
+                                    , PMONTH	                            /* 기준 월                          */
+                                    , CCSCTR_GB_CD                       /* 사업부문 구분코드[EI003] */
+                                    
+                                    /* 20240111 (컬럼 추가) 수주 테이블 / CCGRP_GB_CD / 사업본부 구분코드[EI002] */
+                                    , CCGRP_GB_CD                        /* 사업본부 구분코드[EI002] */
+                                    
+                      			  , SUM(CNTRT_AMT)   AS CNTRT_AMT       /* 계약금액                         */
+                                 FROM EIS_MI_RCORD_PFMC  /* EIS) 경영정보 - 수주실적 */
+                               WHERE CMPN_CD = #{cmpnCd}  /* 회사 코드 */
+                                 AND PYEAR = #{pyear}     /* 기준 연도 */
+                               GROUP BY CMPN_CD         /* 회사 코드                       */
+                                      , PYEAR           /* 기준 연도                       */
+                                      , PMONTH	       /* 기준 월                          */
+                                      , CCSCTR_GB_CD    /* 사업부문 구분코드[EI003] */    
+                                      
+                                      /* 20240111 (컬럼 추가) 수주 테이블 / CCGRP_GB_CD / 사업본부 구분코드[EI002] */
+                                      , CCGRP_GB_CD    /* 사업본부 구분코드[EI002] */
+                                 
+                              ) A
+                              LEFT OUTER JOIN
+                              EIS_MI_RCORD B  /* EIS) 경영정보 - 수주 */
+                          ON A.CMPN_CD = B.CMPN_CD
+                         AND A.PYEAR = B.PYEAR
+                         AND A.PMONTH = B.PMONTH
+                         AND A.CCSCTR_GB_CD = B.CCSCTR_GB_CD
+                         
+                         /* 20240111 (컬럼 추가) 수주 테이블 / CCGRP_GB_CD / 사업본부 구분코드[EI002] */
+                         AND A.CCGRP_GB_CD = B.CCGRP_GB_CD
+                         
+                       WHERE A.CMPN_CD = #{cmpnCd}  /* 회사 코드 */
+                         AND A.PYEAR = #{pyear}     /* 기준 연도 */
+                     /* 마스터 테이블 변경 end */   
+                    ) A
+                ) A
+          GROUP BY A.CMPN_CD            /* 회사 코드                        */
+                 , A.PYEAR              /* 기준 연도                        */
+                 , A.CCGRP_GB_CD        /* 사업본부 구분코드[EI002] */
+         ) AA
+             
+         
+         LEFT OUTER JOIN
+         (
+         /* 2_Backlog */
+         SELECT A.CMPN_CD                                       /* 회사 코드                        */
+              , A.PYEAR                                         /* 기준 연도                        */
+              , A.CCGRP_GB_CD                                   /* 사업본부 구분코드[EI002] */
+              , CASE WHEN A.CCGRP_GB_CD = 'J0' THEN 1  
+                              WHEN A.CCGRP_GB_CD = 'Y0' THEN 2  
+                              WHEN A.CCGRP_GB_CD = 'N0' THEN 3  
+                     ELSE 99
+                 END                     AS SORT_NUM             /* 정렬 순번                        */
+              , MIN(A.BACKLOG_PFMC_00)  AS BACKLOG_PFMC_00      /* 연말 실적                        */
+              , SUM(A.BACKLOG_PFMC_01)  AS BACKLOG_PFMC_01      /* 월별 Backlog 실적(1월) */
+              , SUM(A.BACKLOG_FCST_01)  AS BACKLOG_FCST_01      /* 월별 Backlog 전망(1월) */
+              , SUM(A.BACKLOG_PFMC_02)  AS BACKLOG_PFMC_02  
+              , SUM(A.BACKLOG_FCST_02)  AS BACKLOG_FCST_02  
+              , SUM(A.BACKLOG_PFMC_03)  AS BACKLOG_PFMC_03  
+              , SUM(A.BACKLOG_FCST_03)  AS BACKLOG_FCST_03  
+              , SUM(A.BACKLOG_PFMC_04)  AS BACKLOG_PFMC_04  
+              , SUM(A.BACKLOG_FCST_04)  AS BACKLOG_FCST_04  
+              , SUM(A.BACKLOG_PFMC_05)  AS BACKLOG_PFMC_05  
+              , SUM(A.BACKLOG_FCST_05)  AS BACKLOG_FCST_05  
+              , SUM(A.BACKLOG_PFMC_06)  AS BACKLOG_PFMC_06  
+              , SUM(A.BACKLOG_FCST_06)  AS BACKLOG_FCST_06 
+              , SUM(A.BACKLOG_PFMC_07)  AS BACKLOG_PFMC_07  
+              , SUM(A.BACKLOG_FCST_07)  AS BACKLOG_FCST_07
+              , SUM(A.BACKLOG_PFMC_08)  AS BACKLOG_PFMC_08  
+              , SUM(A.BACKLOG_FCST_08)  AS BACKLOG_FCST_08  
+              , SUM(A.BACKLOG_PFMC_09)  AS BACKLOG_PFMC_09  
+              , SUM(A.BACKLOG_FCST_09)  AS BACKLOG_FCST_09  
+              , SUM(A.BACKLOG_PFMC_10)  AS BACKLOG_PFMC_10  
+              , SUM(A.BACKLOG_FCST_10)  AS BACKLOG_FCST_10  
+              , SUM(A.BACKLOG_PFMC_11)  AS BACKLOG_PFMC_11  
+              , SUM(A.BACKLOG_FCST_11)  AS BACKLOG_FCST_11  
+              , SUM(A.BACKLOG_PFMC_12)  AS BACKLOG_PFMC_12  
+              , SUM(A.BACKLOG_FCST_12)  AS BACKLOG_FCST_12 
+           FROM (
+                  SELECT A.CMPN_CD       /* 회사 코드                         */
+         	             , A.PYEAR         /* 기준 연도                         */
+         	             , A.PMONTH        /* 기준 월(00 고정)        */
+         	             , A.CCGRP_GB_CD   /* 사업본부 구분코드[EI002] */
+         	       , (
+         	                 SELECT BACKLOG_PFMC FROM EIS_MI_BACKLOG_CROV 
+         	                  WHERE CMPN_CD = A.CMPN_CD 
+         	                    AND PYEAR = A.PYEAR
+         	                    AND PMONTH = '00'
+         	                    AND CCGRP_GB_CD = A.CCGRP_GB_CD
+         	               )                 AS BACKLOG_PFMC_00  /* 연말 실적 */
+         	             ,  0                AS BACKLOG_PFMC_01  /* Backlog 실적(1월) */
+         	             , CASE WHEN A.PMONTH = '01' THEN NVL(A.BACKLOG_FCST, 0)   /* Backlog 전망(1월) */
+         	                    ELSE 0
+         	                END              AS BACKLOG_FCST_01
+         	             ,  0                AS BACKLOG_PFMC_02
+         	             , CASE WHEN A.PMONTH = '02' THEN NVL(A.BACKLOG_FCST, 0)   
+         	                    ELSE 0
+         	                END              AS BACKLOG_FCST_02
+         	             ,  0                AS BACKLOG_PFMC_03
+         	             , CASE WHEN A.PMONTH = '03' THEN NVL(A.BACKLOG_FCST, 0)   
+         	                    ELSE 0
+         	                END              AS BACKLOG_FCST_03
+         	             ,  0                AS BACKLOG_PFMC_04
+         	             , CASE WHEN A.PMONTH = '04' THEN NVL(A.BACKLOG_FCST, 0)   
+         	                    ELSE 0
+         	                END              AS BACKLOG_FCST_04
+         	             ,  0                AS BACKLOG_PFMC_05
+         	             , CASE WHEN A.PMONTH = '05' THEN NVL(A.BACKLOG_FCST, 0)   
+         	                    ELSE 0
+         	                END              AS BACKLOG_FCST_05
+         	             ,  0                AS BACKLOG_PFMC_06
+         	             , CASE WHEN A.PMONTH = '06' THEN NVL(A.BACKLOG_FCST, 0)   
+         	                    ELSE 0
+         	                END              AS BACKLOG_FCST_06
+         	             ,  0                AS BACKLOG_PFMC_07
+         	             , CASE WHEN A.PMONTH = '07' THEN NVL(A.BACKLOG_FCST, 0)   
+         	                    ELSE 0
+         	                END              AS BACKLOG_FCST_07
+         	             ,  0                AS BACKLOG_PFMC_08
+         	             , CASE WHEN A.PMONTH = '08' THEN NVL(A.BACKLOG_FCST, 0)   
+         	                    ELSE 0
+         	                END              AS BACKLOG_FCST_08
+         	             ,  0                AS BACKLOG_PFMC_09
+         	             , CASE WHEN A.PMONTH = '09' THEN NVL(A.BACKLOG_FCST, 0)   
+         	                    ELSE 0
+         	                END              AS BACKLOG_FCST_09
+         	             ,  0                AS BACKLOG_PFMC_10
+         	             , CASE WHEN A.PMONTH = '10' THEN NVL(A.BACKLOG_FCST, 0)   
+         	                    ELSE 0
+         	                END              AS BACKLOG_FCST_10
+         	             ,  0                AS BACKLOG_PFMC_11
+         	             , CASE WHEN A.PMONTH = '11' THEN NVL(A.BACKLOG_FCST, 0)   
+         	                    ELSE 0
+         	                END              AS BACKLOG_FCST_11
+         	             ,  0                AS BACKLOG_PFMC_12
+         	             , CASE WHEN A.PMONTH = '12' THEN NVL(A.BACKLOG_FCST, 0)   
+         	                    ELSE 0
+         	                END              AS BACKLOG_FCST_12
+         	        FROM EIS_MI_BACKLOG A       /* EIS) 경영정보 - Backlog */
+         	       WHERE A.CMPN_CD = #{cmpnCd}  /* 회사 코드 */
+         	         AND A.PYEAR = #{pyear}     /* 기준 연도 */
+         		     /* 20240108 추가 - 공통코드 EI002의 설정1 = 'Y' 인 본부만 사용*/
+         	         AND A.CCGRP_GB_CD IN (
+         	                               SELECT SPEC_CD   /* 사업본부 구분코드   */
+                                              FROM SM_COM_COMMCD_D   /* 공통)공통코드상세 */
+                                             WHERE COMM_CD_ID = '1111'
+                                               AND ESBS_CD1 = 'Y'
+                                           ) 
+                 ) A  
+         GROUP BY A.CMPN_CD            /* 회사 코드                        */
+                , A.PYEAR              /* 기준 연도                        */
+                , A.CCGRP_GB_CD        /* 사업본부 구분코드[EI002] */
+         ) BB
+          ON AA.CMPN_CD = BB.CMPN_CD
+         AND AA.PYEAR = BB.PYEAR
+         AND AA.CCGRP_GB_CD = BB.CCGRP_GB_CD
+         
+         LEFT OUTER JOIN
+         (
+         /* 매출 */
+         SELECT A.CMPN_CD                                       /* 회사 코드                        */
+         	 , A.PYEAR                                         /* 기준 연도                        */
+         	 , A.CCGRP_GB_CD                                   /* 사업본부 구분코드[EI002] */
+         	 , CASE WHEN A.CCGRP_GB_CD = 'J0' THEN 1  
+         	                 WHEN A.CCGRP_GB_CD = 'Y0' THEN 2  
+         	                 WHEN A.CCGRP_GB_CD = 'N0' THEN 3  
+         	        ELSE 99
+         	    END                     AS SORT_NUM             /* 정렬 순번                        */
+         	 , SUM(A.SLAMT_SUM_01)  AS SLAMT_SUM_01   /* 01 월              */
+         	 , SUM(A.SLAMT_SUM_02)  AS SLAMT_SUM_02
+         	 , SUM(A.SLAMT_SUM_03)  AS SLAMT_SUM_03
+         	 , SUM(A.SLAMT_SUM_04)  AS SLAMT_SUM_04
+         	 , SUM(A.SLAMT_SUM_05)  AS SLAMT_SUM_05
+         	 , SUM(A.SLAMT_SUM_06)  AS SLAMT_SUM_06
+         	 , SUM(A.SLAMT_SUM_07)  AS SLAMT_SUM_07
+         	 , SUM(A.SLAMT_SUM_08)  AS SLAMT_SUM_08
+         	 , SUM(A.SLAMT_SUM_09)  AS SLAMT_SUM_09
+         	 , SUM(A.SLAMT_SUM_10)  AS SLAMT_SUM_10
+         	 , SUM(A.SLAMT_SUM_11)  AS SLAMT_SUM_11
+         	 , SUM(A.SLAMT_SUM_12)  AS SLAMT_SUM_12
+         FROM (
+         	   SELECT A.CMPN_CD                                    /* 회사 코드             */
+         	        , A.PYEAR                                      /* 기준 연도             */
+         	        , A.CCGRP_GB_CD                                /* 사업본부 구분코드   */
+         	        , A.PMONTH                                     /* 기준 월(00 고정) */
+         	        , CASE WHEN A.PMONTH = '01' THEN A.SLAMT_SUM   /* 기준 월               */
+         	          ELSE 0
+         	          END  AS SLAMT_SUM_01
+         	        , CASE WHEN A.PMONTH = '02' THEN A.SLAMT_SUM
+         	          ELSE 0
+         	          END  AS SLAMT_SUM_02
+         	        , CASE WHEN A.PMONTH = '03' THEN A.SLAMT_SUM
+         	          ELSE 0
+         	          END  AS SLAMT_SUM_03
+         	        , CASE WHEN A.PMONTH = '04' THEN A.SLAMT_SUM
+         	          ELSE 0
+         	          END  AS SLAMT_SUM_04
+         	        , CASE WHEN A.PMONTH = '05' THEN A.SLAMT_SUM
+         	          ELSE 0
+         	          END  AS SLAMT_SUM_05
+         	        , CASE WHEN A.PMONTH = '06' THEN A.SLAMT_SUM
+         	          ELSE 0
+         	          END  AS SLAMT_SUM_06
+         	        , CASE WHEN A.PMONTH = '07' THEN A.SLAMT_SUM
+         	          ELSE 0
+         	          END  AS SLAMT_SUM_07
+         	        , CASE WHEN A.PMONTH = '08' THEN A.SLAMT_SUM
+         	          ELSE 0
+         	          END  AS SLAMT_SUM_08
+         	        , CASE WHEN A.PMONTH = '09' THEN A.SLAMT_SUM
+         	          ELSE 0
+         	          END  AS SLAMT_SUM_09
+         	        , CASE WHEN A.PMONTH = '10' THEN A.SLAMT_SUM
+         	          ELSE 0
+         	          END  AS SLAMT_SUM_10
+         	        , CASE WHEN A.PMONTH = '11' THEN A.SLAMT_SUM
+         	          ELSE 0
+         	          END  AS SLAMT_SUM_11
+         	        , CASE WHEN A.PMONTH = '12' THEN A.SLAMT_SUM
+         	          ELSE 0
+         	          END  AS SLAMT_SUM_12
+         	   FROM (
+         	          SELECT A.CMPN_CD                               /* 회사 코드           */
+         	               , A.PYEAR                                 /* 기준 연도           */
+         	               , A.CCGRP_GB_CD                           /* 사업본부 구분코드 */
+         	               , A.PMONTH                                /* 기준 월             */
+         	               , SUM(A.SLAMT_SUM)  AS SLAMT_SUM          /* 매출                 */
+         	            FROM (
+         	                   SELECT CMPN_CD                 /* 회사 코드             */
+         	                        , PYEAR                   /* 기준 연도             */
+         	                        , CCGRP_GB_CD             /* 사업본부 구분코드 */
+         	                        , PMONTH                  /* 기준 월                */
+         	                        , CASE WHEN PMONTH   <![CDATA[<=]]>   #{pmonth} AND (SLAMT_PFMC_RV = 0 OR SLAMT_PFMC_RV = NULL) THEN NVL(SLAMT_PFMC, 0)      /* 매출실적          */
+         	                               WHEN PMONTH   <![CDATA[<=]]>   #{pmonth}                                                 THEN NVL(SLAMT_PFMC_RV, 0)   /* 매출실적(보정) */
+         	                           ELSE NVL(SLAMT_FCST, 0)                                                                                               /* 매출전망          */
+         	                          END                     AS  SLAMT_SUM       /* 매출 */
+         	                   FROM EIS_MI_PL_ETEC  /* EIS 경영정보 손익(이테크) */
+         	                  WHERE CMPN_CD = #{cmpnCd}  /* 회사 코드 */
+         	                    AND PYEAR = #{pyear}     /* 기준 연도 */
+         	                    /* AND CCGRP_GB_CD IN ('J0','N0','Y0') */  /* 추가 20240102 사업본부 구분코드[EI002] */
+                                 /* 20240108 추가 - 공통코드 EI002의 설정1 = 'Y' 인 본부만 사용*/
+         	                    AND CCGRP_GB_CD IN (
+         	                                        SELECT SPEC_CD   /* 사업본부 구분코드   */
+                                                       FROM SM_COM_COMMCD_D   /* 공통)공통코드상세 */
+                                                      WHERE COMM_CD_ID = '1111'
+                                                        AND ESBS_CD1 = 'Y'
+                                                    )
+         	        ) A
+               GROUP BY A.CMPN_CD      /* 회사 코드            */
+                      , A.PYEAR        /* 기준 연도            */
+                      , A.CCGRP_GB_CD  /* 사업본부 구분코드  */
+                      , A.PMONTH       /* 기준 월              */
+              ) A
+         	                     
+         	                     
+            ) A
+            GROUP BY A.CMPN_CD            /* 회사 코드                        */
+                   , A.PYEAR              /* 기준 연도                        */
+                   , A.CCGRP_GB_CD        /* 사업본부 구분코드[EI002] */
+         ) CC 
+         ON AA.CMPN_CD = CC.CMPN_CD
+         AND AA.PYEAR = CC.PYEAR
+         AND AA.CCGRP_GB_CD = CC.CCGRP_GB_CD
+                           
+   ORDER BY AA.SORT_NUM
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+