Browse Source

회의실 예약 사용료 추가

SH 2 weeks ago
parent
commit
c58c4130e6

+ 1 - 1
src/main/java/sgc/portal/cw/cw0804/dto/CW08040001USearch.java

@@ -25,5 +25,5 @@ public class CW08040001USearch extends BaseSearchDto {
 	private String reYyyymmddT;
 	private String reservationId;
 	private String cmpnCd;
-	
+	private String usePdeptCd;
 }

+ 248 - 87
src/main/resources/sqlmap/mappers/cw/cw0804/CW08040001UMapper.xml

@@ -295,94 +295,255 @@
 		   AND A.NUM=E.NUM
 	</select>
 	
-	<select id="getListRem" resultType="easyHashMap"><![CDATA[
-		SELECT A.RESERVATION_ID				RESERVATION_ID
-		     , A.MEETINGROOM_ID            	MEETINGROOM_ID
-		     , B.BUNHO                     	BUNHO
-		     , A.MEETING_NAME               MEETING_NAME
-		     , A.MEETING_CON                MEETING_CON
-		     , A.START_YYYYMMDD             START_YYYYMMDD
-		     , DECODE(A.START_YYYYMMDD, A.END_YYYYMMDD, TO_CHAR(TO_DATE(A.START_YYYYMMDD, 'YYYYMMDD'), 'YYYY-MM-DD'),TO_CHAR(TO_DATE(A.START_YYYYMMDD, 'YYYYMMDD'),'YYYY-MM-DD')||' ~ '||TO_CHAR(TO_DATE(A.END_YYYYMMDD, 'YYYYMMDD'),'YYYY-MM-DD')) PYMD
-		     , SUBSTR(A.START_HHMM, 1, 2)||':'||SUBSTR(A.START_HHMM, 3, 2)||' ~ '||SUBSTR(A.END_HHMM, 1, 2)||':'||SUBSTR(A.END_HHMM, 3, 2)    PHM
-		     , A.END_YYYYMMDD               END_YYYYMMDD
-		     , A.START_HHMM                 START_HHMM
-		     , A.END_HHMM                   END_HHMM
-		     , (SELECT CMPN_NM FROM SM_COM_CMPN WHERE CMPN_CD = A.SUBSC_CMPN_CD)	AS CMPN_NM
-		     , A.SUBSC_SABUN                SUBSC_SABUN
-		     , A.SUBSC_NAME                 SUBSC_NAME
-		     , A.DEPT_CD                   	DEPT_CD
-		     , A.DEPT_NAME                  DEPT_NAME
-		     , A.ATTEND_NUM                 ATTEND_NUM
- 			 , A.USE_PDEPT_CD   			USE_PDEPT_CD    
- 			 , ZEHR_CODE_NAME_FNC(A.SUBSC_CMPN_CD, 'RE009', A.USE_PDEPT_CD) AS USE_PDEPT_NM
-		     , A.STATUS                     STATUS
-		     , ZEHR_CODE_NAME_FNC(A.SUBSC_CMPN_CD, 'RE002',A.STATUS) AS STATUS_NM
-		     , A.KEY_YN                     KEY_YN
-		     , A.KEYSEND_YN                 KEYSEND_YN
-		     , A.GUBUN                      GUBUN
-		     , ZEHR_CODE_NAME_FNC(A.SUBSC_CMPN_CD, 'RE003',A.GUBUN) AS GUBUN_NM
-		     , A.WEEK_MU                    WEEK_MU
-		     , A.WEEK_TU                    WEEK_TU
-		     , A.WEEK_WE                    WEEK_WE
-		     , A.WEEK_TH                    WEEK_TH
-		     , A.WEEK_FR                    WEEK_FR
-		     , A.REMARK                     REMARK
-		     , F_MASK_FUN(C.PHONE,9,#{psnlinfoIqryn})      	PHONE
-		     , D.MR_LOCATION               	LOCATION_NM
-		     , CASE 
-		     	WHEN STATUS = '20' THEN '[승인요청]중인 예약은 사용후기 작성이 안됩니다.'
-	            WHEN STATUS = '40' THEN '[반려]된 예약은 사용후기 작성이 안됩니다.'
-	            WHEN STATUS = '50' THEN '이미 종료한 예약입니다.'
-	            WHEN STATUS = '60' THEN '[취소]된 예약은 사용후기 작성이 안됩니다.'
-	            WHEN TO_CHAR(SYSDATE,'YYYYMMDD') < START_YYYYMMDD THEN '지난 예약과 진행중인 예약만 종료 가능합니다.'
-	            WHEN TO_CHAR(SYSDATE,'YYYYMMDD') = START_YYYYMMDD AND TO_CHAR(SYSDATE,'HHmm') < START_HHMM THEN '지난 예약과 진행중인 예약만 종료 가능합니다.'
-	            ELSE '예약종료 가능.'
-	        END AS CLOSE_CN
-	        , CASE 
-	        	WHEN STATUS = '20' THEN 'N'
-	            WHEN STATUS = '40' THEN 'N'
-	            WHEN STATUS = '50' THEN 'N'
-	            WHEN STATUS = '60' THEN 'N'
-	            WHEN TO_CHAR(SYSDATE,'YYYYMMDD') < START_YYYYMMDD THEN 'N'
-	            WHEN TO_CHAR(SYSDATE,'YYYYMMDD') = START_YYYYMMDD AND TO_CHAR(SYSDATE,'HHmm') < START_HHMM THEN 'N'
-	            ELSE 'Y'
-        	END AS CLOSE_YN
-			, CASE 
-				WHEN STATUS = '40' THEN '[반려]된 예약은 취소가 안됩니다.'
-	            WHEN STATUS = '50' THEN '[종료]된 예약은 취소가 안됩니다.'
-	            WHEN STATUS = '60' THEN '이미 취소한 예약입니다.'
-	            WHEN TO_CHAR(SYSDATE,'YYYYMMDD') > START_YYYYMMDD THEN '지난 예약과 진행중인 예약은 취소가 안됩니다.'
-	            WHEN TO_CHAR(SYSDATE,'YYYYMMDD') = START_YYYYMMDD AND TO_CHAR(SYSDATE,'HHmm') > START_HHMM THEN '지난 예약과 진행중인 예약은 취소가 안됩니다.'
-	            ELSE '예약취소 가능.'
-	        END AS CANCEL_CN
-       		, CASE 
-	       		WHEN STATUS = '40' THEN 'N'
-	            WHEN STATUS = '50' THEN 'N'
-	            WHEN STATUS = '60' THEN 'N'
-	            WHEN TO_CHAR(SYSDATE,'YYYYMMDD') > START_YYYYMMDD THEN 'N'
-	            WHEN TO_CHAR(SYSDATE,'YYYYMMDD') = START_YYYYMMDD AND TO_CHAR(SYSDATE,'HHmm') > START_HHMM THEN 'N'
-	            ELSE 'Y'
-	        END AS CANCEL_YN        	
-		  FROM ZEHR_ROM_RESRVTN A
+	<select id="getListRem" resultType="easyHashMap">
+		WITH TimeRanges AS (
+		    SELECT 
+		        A.RESERVATION_ID
+				, A.MEETINGROOM_ID
+				, A.MEETING_NAME
+				, A.MEETING_CON
+		        , A.START_YYYYMMDD
+		        , A.END_YYYYMMDD
+		        , A.START_HHMM
+		        , A.END_HHMM
+		        , CASE 
+		            WHEN TO_TIMESTAMP(A.START_YYYYMMDD || A.START_HHMM, 'YYYYMMDDHH24MI') <![CDATA[<]]> TO_TIMESTAMP(A.START_YYYYMMDD || '0830', 'YYYYMMDDHH24MI') 
+		                THEN TO_TIMESTAMP(A.START_YYYYMMDD || '0830', 'YYYYMMDDHH24MI') 
+		            ELSE TO_TIMESTAMP(A.START_YYYYMMDD || A.START_HHMM, 'YYYYMMDDHH24MI') 
+		        END AS EffectiveStart,
+		        CASE 
+		            WHEN TO_TIMESTAMP(A.END_YYYYMMDD || A.END_HHMM, 'YYYYMMDDHH24MI') <![CDATA[>]]> TO_TIMESTAMP(A.END_YYYYMMDD || '1730', 'YYYYMMDDHH24MI') 
+		                THEN TO_TIMESTAMP(A.END_YYYYMMDD || '1730', 'YYYYMMDDHH24MI') 
+		            ELSE TO_TIMESTAMP(A.END_YYYYMMDD || A.END_HHMM, 'YYYYMMDDHH24MI') 
+		        END AS EffectiveEnd
+		        , A.SUBSC_CMPN_CD
+				, A.SUBSC_SABUN                
+				, A.SUBSC_NAME                 
+				, A.DEPT_CD                   	
+				, A.DEPT_NAME                  
+				, A.ATTEND_NUM                 
+		 		, A.USE_PDEPT_CD   			
+		 		, A.STATUS    
+		        , A.GUBUN
+		    FROM ZEHR_ROM_RESRVTN A
+				 WHERE ((A.START_YYYYMMDD <![CDATA[<=]]> #{reYyyymmddF} AND A.END_YYYYMMDD <![CDATA[>=]]> #{reYyyymmddT}) OR A.START_YYYYMMDD BETWEEN #{reYyyymmddF} AND #{reYyyymmddT})
+				<if test="meetingroomId != '' and meetingroomId != null and meetingroomId != 'all'">
+				   AND A.MEETINGROOM_ID = #{meetingroomId}
+				</if>
+				<if test="status != '' and status != null and status != 'all'">
+				   AND A.STATUS = #{status}
+				</if>
+				<if test="cmpnCd != '' and cmpnCd != null and cmpnCd != 'all'">
+				   AND A.SUBSC_CMPN_CD = #{cmpnCd}
+				</if>
+				<if test="usePdeptCd != '' and usePdeptCd != null and usePdeptCd != 'all'">
+				   AND A.USE_PDEPT_CD = #{usePdeptCd}
+				</if>
+		),
+		DateRanges AS (
+		SELECT 
+		    RESERVATION_ID
+		    , MEETINGROOM_ID
+		    , MEETING_NAME
+		    , MEETING_CON
+		    , START_YYYYMMDD
+		    , END_YYYYMMDD
+		    , START_HHMM
+		    , END_HHMM
+		    , EffectiveStart
+		    , EffectiveEnd
+		    , SUBSC_CMPN_CD
+			, SUBSC_SABUN                
+			, SUBSC_NAME                 
+			, DEPT_CD                   	
+			, DEPT_NAME                  
+			, ATTEND_NUM                 
+			, USE_PDEPT_CD   			
+			, STATUS    
+		    , GUBUN
+		    , TO_DATE(START_YYYYMMDD, 'YYYYMMDD') + LEVEL - 1 AS CurrentDate
+		FROM TimeRanges
+		WHERE GUBUN = '30'
+		    AND STATUS NOT IN ('40', '60')
+		CONNECT BY LEVEL <![CDATA[<=]]> (TO_DATE(END_YYYYMMDD, 'YYYYMMDD') - TO_DATE(START_YYYYMMDD, 'YYYYMMDD')) + 1
+		START WITH GUBUN = '30' AND STATUS NOT IN ('40', '60')
+		UNION ALL
+		SELECT 
+		    RESERVATION_ID
+		    , MEETINGROOM_ID
+		    , MEETING_NAME
+		    , MEETING_CON
+		    , START_YYYYMMDD
+		    , END_YYYYMMDD
+		    , START_HHMM
+		    , END_HHMM
+		    , EffectiveStart
+		    , EffectiveEnd
+		    , SUBSC_CMPN_CD
+			, SUBSC_SABUN                
+			, SUBSC_NAME                 
+			, DEPT_CD                   	
+			, DEPT_NAME                  
+			, ATTEND_NUM                 
+			, USE_PDEPT_CD   			
+			, STATUS    
+		    , GUBUN
+		    , TO_DATE(START_YYYYMMDD, 'YYYYMMDD') AS CurrentDate
+		FROM TimeRanges
+		WHERE STATUS IN ('40', '60')
+		UNION ALL
+		SELECT 
+		    RESERVATION_ID
+		    , MEETINGROOM_ID
+		    , MEETING_NAME
+		    , MEETING_CON
+		    , START_YYYYMMDD
+		    , END_YYYYMMDD
+		    , START_HHMM
+		    , END_HHMM
+		    , EffectiveStart
+		    , EffectiveEnd
+		    , SUBSC_CMPN_CD
+			, SUBSC_SABUN                
+			, SUBSC_NAME                 
+			, DEPT_CD                   	
+			, DEPT_NAME                  
+			, ATTEND_NUM                 
+			, USE_PDEPT_CD   			
+			, STATUS    
+		    , GUBUN
+		    , TO_DATE(START_YYYYMMDD, 'YYYYMMDD') AS CurrentDate
+		FROM TimeRanges
+		WHERE GUBUN IN ('10', '20')
+		    AND STATUS NOT IN ('40', '60')
+		)
+		    SELECT A.RESERVATION_ID
+			    , A.MEETINGROOM_ID
+				, B.BUNHO                     	
+			    , A.MEETING_NAME
+			    , A.MEETING_CON
+			    , A.START_YYYYMMDD
+			    , A.END_YYYYMMDD
+			    , A.START_HHMM
+			    , A.END_HHMM
+			    , DECODE(A.START_YYYYMMDD, A.END_YYYYMMDD, TO_CHAR(TO_DATE(A.START_YYYYMMDD, 'YYYYMMDD'), 'YYYY-MM-DD'),TO_CHAR(TO_DATE(A.START_YYYYMMDD, 'YYYYMMDD'),'YYYY-MM-DD')||'~'||TO_CHAR(TO_DATE(A.END_YYYYMMDD, 'YYYYMMDD'),'YYYY-MM-DD')) PYMD
+			    , SUBSTR(A.START_HHMM, 1, 2)||':'||SUBSTR(A.START_HHMM, 3, 2)||' ~ '||SUBSTR(A.END_HHMM, 1, 2)||':'||SUBSTR(A.END_HHMM, 3, 2)    PHM
+				, (SELECT CMPN_NM FROM SM_COM_CMPN WHERE CMPN_CD = A.SUBSC_CMPN_CD)	AS CMPN_NM
+				, A.SUBSC_SABUN                
+				, A.SUBSC_NAME                 
+				, A.DEPT_CD                   	
+				, A.DEPT_NAME                  
+				, A.ATTEND_NUM                 
+				, A.USE_PDEPT_CD   		
+		 		, ZEHR_CODE_NAME_FNC(A.SUBSC_CMPN_CD, 'RE009', A.USE_PDEPT_CD) AS USE_PDEPT_NM
+				, A.STATUS    
+				, ZEHR_CODE_NAME_FNC(A.SUBSC_CMPN_CD, 'RE002', A.STATUS) AS STATUS_NM
+			    , A.GUBUN
+				, ZEHR_CODE_NAME_FNC(A.SUBSC_CMPN_CD, 'RE003', A.GUBUN) AS GUBUN_NM	
+				, C.MR_LOCATION	AS LOCATION_NM
+		<!-- 	    , EffectiveStart
+			    , EffectiveEnd
+		        , TO_CHAR(CurrentDate, 'd') as ddd
+		        , TO_CHAR(CurrentDate, 'dy') as ddd -->
+		        , E.AMT_H
+		        , DECODE(A.STATUS, '40', 0, '60', 0, E.AMT_H * SUM(CASE 
+		            WHEN TO_CHAR(CurrentDate, 'd') NOT IN (1, 7) THEN
+		                CASE 
+		                    WHEN TO_DATE(START_YYYYMMDD, 'YYYYMMDD')+1 <![CDATA[<]]> TO_DATE(END_YYYYMMDD, 'YYYYMMDD') THEN
+		                        -- 여러일인 경우
+		                        (CASE 
+		                            WHEN CurrentDate = TO_DATE(START_YYYYMMDD, 'YYYYMMDD') THEN
+		                            	GREATEST(EXTRACT(HOUR FROM TO_TIMESTAMP(START_YYYYMMDD || '1730', 'YYYYMMDDHH24MI') - GREATEST(EffectiveStart, TO_TIMESTAMP(START_YYYYMMDD || '0830', 'YYYYMMDDHH24MI'))) +
+		                            					(EXTRACT(MINUTE FROM TO_TIMESTAMP(START_YYYYMMDD || '1730', 'YYYYMMDDHH24MI') - GREATEST(EffectiveStart, TO_TIMESTAMP(START_YYYYMMDD || '0830', 'YYYYMMDDHH24MI'))) / 60), 0) -
+		                            	CASE WHEN EffectiveStart <![CDATA[<=]]> TO_TIMESTAMP(START_YYYYMMDD || '1200', 'YYYYMMDDHH24MI') THEN 1
+		                                		WHEN EffectiveStart <![CDATA[<]]> TO_TIMESTAMP(START_YYYYMMDD || '1300', 'YYYYMMDDHH24MI') THEN 0.5
+		                                		ELSE  0
+		                                END
+		                            WHEN CurrentDate = TO_DATE(END_YYYYMMDD, 'YYYYMMDD') THEN
+		                            	GREATEST(EXTRACT(HOUR FROM LEAST(EffectiveEnd, TO_TIMESTAMP(END_YYYYMMDD || '1730', 'YYYYMMDDHH24MI')) - TO_TIMESTAMP(END_YYYYMMDD || '0830', 'YYYYMMDDHH24MI')) +
+		                            					(EXTRACT(MINUTE FROM LEAST(EffectiveEnd, TO_TIMESTAMP(END_YYYYMMDD || '1730', 'YYYYMMDDHH24MI')) - TO_TIMESTAMP(END_YYYYMMDD || '0830', 'YYYYMMDDHH24MI')) / 60), 0) -
+		                            	CASE WHEN EffectiveEnd <![CDATA[>=]]> TO_TIMESTAMP(END_YYYYMMDD || '1300', 'YYYYMMDDHH24MI') THEN 1
+		                                		WHEN EffectiveStart <![CDATA[>]]> TO_TIMESTAMP(END_YYYYMMDD || '1200', 'YYYYMMDDHH24MI') THEN 0.5
+		                                		ELSE  0
+		                                END
+		                            ELSE 8 -- 중간일의 기본 근무 시간
+		                        END)
+		                    WHEN TO_DATE(START_YYYYMMDD, 'YYYYMMDD')+1 = TO_DATE(END_YYYYMMDD, 'YYYYMMDD') THEN
+		                        -- 이틀인 경우
+		                        (CASE 
+		                            WHEN CurrentDate = TO_DATE(START_YYYYMMDD, 'YYYYMMDD') THEN
+		                            	GREATEST(EXTRACT(HOUR FROM TO_TIMESTAMP(START_YYYYMMDD || '1730', 'YYYYMMDDHH24MI') - GREATEST(EffectiveStart, TO_TIMESTAMP(START_YYYYMMDD || '0830', 'YYYYMMDDHH24MI'))) +
+		                            					(EXTRACT(MINUTE FROM TO_TIMESTAMP(START_YYYYMMDD || '1730', 'YYYYMMDDHH24MI') - GREATEST(EffectiveStart, TO_TIMESTAMP(START_YYYYMMDD || '0830', 'YYYYMMDDHH24MI'))) / 60), 0) -
+		                            	CASE WHEN EffectiveStart <![CDATA[<=]]> TO_TIMESTAMP(START_YYYYMMDD || '1200', 'YYYYMMDDHH24MI') THEN 1
+		                                		WHEN EffectiveStart <![CDATA[<]]> TO_TIMESTAMP(START_YYYYMMDD || '1300', 'YYYYMMDDHH24MI') THEN 0.5
+		                                		ELSE  0
+		                                END
+		                            WHEN CurrentDate = TO_DATE(END_YYYYMMDD, 'YYYYMMDD') THEN
+		                            	GREATEST(EXTRACT(HOUR FROM LEAST(EffectiveEnd, TO_TIMESTAMP(END_YYYYMMDD || '1730', 'YYYYMMDDHH24MI')) - TO_TIMESTAMP(END_YYYYMMDD || '0830', 'YYYYMMDDHH24MI')) +
+		                            					(EXTRACT(MINUTE FROM LEAST(EffectiveEnd, TO_TIMESTAMP(END_YYYYMMDD || '1730', 'YYYYMMDDHH24MI')) - TO_TIMESTAMP(END_YYYYMMDD || '0830', 'YYYYMMDDHH24MI')) / 60), 0) -
+		                            	CASE WHEN EffectiveEnd <![CDATA[>=]]> TO_TIMESTAMP(END_YYYYMMDD || '1300', 'YYYYMMDDHH24MI') THEN 1
+		                                		WHEN EffectiveStart <![CDATA[>]]> TO_TIMESTAMP(END_YYYYMMDD || '1200', 'YYYYMMDDHH24MI') THEN 0.5
+		                                		ELSE  0
+		                                END
+		                            ELSE 0
+		                        END)
+		                    WHEN TO_DATE(START_YYYYMMDD, 'YYYYMMDD') = TO_DATE(END_YYYYMMDD, 'YYYYMMDD') THEN
+		                        -- 시작일과 종료일이 같은 경우
+		                        EXTRACT(HOUR FROM TO_TIMESTAMP(START_YYYYMMDD || END_HHMM, 'YYYYMMDDHH24MI') - TO_TIMESTAMP(START_YYYYMMDD || START_HHMM, 'YYYYMMDDHH24MI')) 
+		                        + (EXTRACT(MINUTE FROM TO_TIMESTAMP(START_YYYYMMDD || END_HHMM, 'YYYYMMDDHH24MI') - TO_TIMESTAMP(START_YYYYMMDD || START_HHMM, 'YYYYMMDDHH24MI')) / 60 )
+<!-- 		                        GREATEST(EXTRACT(HOUR FROM LEAST(EffectiveEnd, TO_TIMESTAMP(START_YYYYMMDD || '1730', 'YYYYMMDDHH24MI')) - GREATEST(EffectiveStart, TO_TIMESTAMP(START_YYYYMMDD || '0830', 'YYYYMMDDHH24MI'))) +
+		                        (EXTRACT(MINUTE FROM LEAST(EffectiveEnd, TO_TIMESTAMP(START_YYYYMMDD || '1730', 'YYYYMMDDHH24MI')) - GREATEST(EffectiveStart, TO_TIMESTAMP(START_YYYYMMDD || '0830', 'YYYYMMDDHH24MI'))) / 60), 0) -
+		                        (CASE 
+		                            WHEN EffectiveStart <![CDATA[<=]]> TO_TIMESTAMP(START_YYYYMMDD || '1200', 'YYYYMMDDHH24MI')  THEN
+		                            		CASE WHEN EffectiveEnd <![CDATA[>=]]> TO_TIMESTAMP(START_YYYYMMDD || '1300', 'YYYYMMDDHH24MI')  THEN 1
+		                            				WHEN EffectiveEnd = TO_TIMESTAMP(START_YYYYMMDD || '1230', 'YYYYMMDDHH24MI')  THEN 0.5
+		                            				ELSE 0
+		                            		END
+		                            WHEN EffectiveStart = TO_TIMESTAMP(START_YYYYMMDD || '1230', 'YYYYMMDDHH24MI')  THEN
+		                            		CASE WHEN EffectiveEnd <![CDATA[>=]]> TO_TIMESTAMP(START_YYYYMMDD || '1300', 'YYYYMMDDHH24MI')  THEN 0.5
+		                            				ELSE 0
+		                            		END
+		                          ELSE 0
+		                          END) -->
+		                END
+		            ELSE 0
+		        END)) AS USE_AMT
+		    FROM DateRanges A
 		     , ZEHR_ROM_INFO B
-		     , ZEHR_PHM_INFO_R C
-		     , ZEHR_ROM_LOCTN D
-		 ]]>
-		 WHERE B.MEETINGROOM_ID = A.MEETINGROOM_ID
-		   AND A.SUBSC_SABUN = C.EMP_NO
-		   AND B.LOCATION_ID = D.LOCATION_ID
-		   AND B.VISIBLE_YN = 'Y'
-		<if test="meetingroomId != '' and meetingroomId != null and meetingroomId != 'all'">
-		   AND A.MEETINGROOM_ID = #{meetingroomId}
-		</if>
-		<if test="status != '' and status != null and status != 'all'">
-		   AND A.STATUS = #{status}
-		</if>
-		<if test="cmpnCd != '' and cmpnCd != null and cmpnCd != 'all'">
-		   AND A.SUBSC_CMPN_CD = #{cmpnCd}
-		</if>
-		   AND ((A.START_YYYYMMDD <![CDATA[<=]]> #{reYyyymmddF} AND A.END_YYYYMMDD <![CDATA[>=]]> #{reYyyymmddT}) OR A.START_YYYYMMDD BETWEEN #{reYyyymmddF} AND #{reYyyymmddT})
-		 ORDER BY D.MR_LOCATION, B.BUNHO, A.MEETING_NAME
+		     , ZEHR_ROM_LOCTN C
+		     , ZEHR_ROM_RENT_PERIOD D
+		     , ZEHR_ROM_RENTAL E
+			 WHERE B.MEETINGROOM_ID = A.MEETINGROOM_ID
+			   AND B.LOCATION_ID = C.LOCATION_ID
+			   AND D.SEQ = E.SEQ
+			   AND E.MEETINGROOM_ID = A.MEETINGROOM_ID
+			   AND D.USE_YN = 'Y'
+			   AND B.VISIBLE_YN = 'Y'
+		    GROUP BY RESERVATION_ID
+				    , A.MEETINGROOM_ID
+					, B.BUNHO             
+				    , A.MEETING_NAME
+				    , A.MEETING_CON
+				    , A.START_YYYYMMDD
+				    , A.END_YYYYMMDD
+				    , A.START_HHMM
+				    , A.END_HHMM
+				    , A.EffectiveStart
+				    , A.EffectiveEnd
+				    , A.SUBSC_CMPN_CD
+					, A.SUBSC_SABUN                
+					, A.SUBSC_NAME                 
+					, A.DEPT_CD                   	
+					, A.DEPT_NAME                  
+					, A.ATTEND_NUM                 
+					, A.USE_PDEPT_CD   			
+					, A.STATUS    
+				    , A.GUBUN
+					, C.MR_LOCATION              
+			        , E.AMT_H
+			ORDER BY C.MR_LOCATION
+					, B.BUNHO
+					, A.MEETING_NAME
 	</select>
 
 	<select id="getViewRem" resultType="easyHashMap"><![CDATA[

+ 44 - 32
src/main/webapp/ux/cw/cw0804/CW08040001U.xml

@@ -33,6 +33,7 @@
 						<w2:key id="status" name="예약상태" dataType="text"></w2:key>
 						<w2:key id="reYyyymmddF" name="name4" dataType="text"></w2:key>
 						<w2:key id="reYyyymmddT" name="name5" dataType="text"></w2:key>
+						<w2:key id="usePdeptCd" name="사용본부" dataType="text"></w2:key>
 					</w2:keyInfo>
 				</w2:dataMap>
 				<w2:dataList baseNode="list" id="dcRom" repeatNode="map" saveRemovedData="false" userData1="회사정보" style="">
@@ -159,19 +160,10 @@
 						<w2:column id="deptCd" name="부서코드" dataType="text"></w2:column>
 						<w2:column id="deptName" name="부서명" dataType="text"></w2:column>
 						<w2:column id="usePdeptCd" name="사용본부" dataType="text"></w2:column>
-						<w2:column id="attendNum" name="참석인원" dataType="text"></w2:column>
 						<w2:column id="status" name="상태" dataType="text"></w2:column>
-						<w2:column id="keyYn" name="열쇠사용여부" dataType="text"></w2:column>
-						<w2:column id="keysendYn" name="열쇠지급여부" dataType="text"></w2:column>
 						<w2:column id="gubun" name="예약구분" dataType="text"></w2:column>
-						<w2:column id="weekMu" name="요일월" dataType="text"></w2:column>
-						<w2:column id="weekTu" name="요일화" dataType="text"></w2:column>
-						<w2:column id="weekWe" name="요일수" dataType="text"></w2:column>
-						<w2:column id="weekTh" name="요일목" dataType="text"></w2:column>
-						<w2:column id="weekFr" name="요일금" dataType="text"></w2:column>
-						<w2:column id="remark" name="사용후기" dataType="text"></w2:column>
-						<w2:column id="phone" name="전화번호" dataType="text"></w2:column>
 						<w2:column id="locationNm" name="위치명" dataType="text"></w2:column>
+						<w2:column id="useAmt" name="비용" dataType="text"></w2:column>
 					</w2:columnInfo>
 					<w2:data use="false"></w2:data>
 				</w2:dataList>
@@ -246,6 +238,13 @@
         scwin.searchMonday();	//매주 월요일 찾기
         
         //tabsId = "2"
+        
+        if (scwin.master == "Y") {
+        	tab.showTab( 2 );
+        } else {
+        	tab.showTab( 2 );
+        	//tab.hideTab( 2 );
+        }
     };
 
     /**************************************************************************
@@ -270,7 +269,7 @@
     
 //회의실 마스터 권한
     for(var i=0; i<scwin.prgAuth.length; i++) {
-    	if(scwin.prgAuth[i].id == 126) {
+    	if(scwin.prgAuth[i].id == 126) {	//운영 회의실 권한 :126, 개발 회의실 권한 : 130	1	116	129	110
     		scwin.master = "Y";
     	}
     }
@@ -611,7 +610,7 @@
 			icalPeriod.setValue(dateLib.getCurrentDate('yyyyMMdd'),dateLib.getCurrentDate('yyyyMMdd'));
 			comboCommon.setCommonCode([{"code":"RE002","compID":"grdData3:status"},
 			                           {"code":"RE002","compID":"selStatus"},
-			                           {"code":"RE009","compID":"grdData3:usePdeptCd"}	//회의실)사용본부
+			                           {"code":"RE009","compID":"grdData3:usePdeptCd, selUsePdeptCd"}	//회의실)사용본부
 			                          ]);		//회의실)예약상태
     	}
 			                          
@@ -1010,17 +1009,21 @@
     
     scwin.grdSearch3 = function(){
 		dcsearchMap1.set( "cmpnCd", selCmpn.getValue() );
+		dcsearchMap1.set( "usePdeptCd", selUsePdeptCd.getValue() );
 		dcsearchMap1.set( "meetingroomId", selRom2.getValue() );
 		dcsearchMap1.set( "status", selStatus.getValue() );
 		dcsearchMap1.set( "reYyyymmddF", icalPeriod.getValue()[0] );
 		dcsearchMap1.set( "reYyyymmddT", icalPeriod.getValue()[1] );
         
+        WebSquare.layer.showProcessMessage("데이터 조회중...");
         ajaxLib.ajax("cw/cw0804/CW08040001U/listRem", {
             method: "POST",
-            mode:"synchronous",
+            mode:"asynchronous",
             requestData : strLib.serialize(dcsearchMap1.getJSON({ DB: true })),
             callback: function(result, e) {
                 dcdataList3.setJSON(result);
+		    	listCount3.setValue(grdData3.getTotalRow());
+                WebSquare.layer.hideProcessMessage();
                 var rows = dcdataList3.getRowCount();
 		    	for (var i=0; i<rows; i++) {
 		    		var status = dcdataList3.getCellData( i , "status" );
@@ -1029,7 +1032,6 @@
 		    			grdData3.setCellReadOnly( i , "sel" , true )
 		    		}
 		    	}
-		    	listCount3.setValue(grdData3.getTotalRow());
             }
         });
     };
@@ -1523,13 +1525,15 @@
 										</w2:attributes>
 										<xf:group tagname="caption"></xf:group>
 										<xf:group tagname="colgroup">
-											<xf:group style="width:8%;" tagname="col"></xf:group>
+											<xf:group style="width:7%;" tagname="col"></xf:group>
 											<xf:group style="width:10%;" tagname="col"></xf:group>
-											<xf:group style="width:8%;" tagname="col"></xf:group>
-											<xf:group style="width:20%;" tagname="col"></xf:group>
-											<xf:group style="width:8%;" tagname="col"></xf:group>
+											<xf:group style="width:7%;" tagname="col"></xf:group>
+											<xf:group style="width:10%;" tagname="col"></xf:group>
+											<xf:group style="width:7%;" tagname="col"></xf:group>
 											<xf:group style="width:20%;" tagname="col"></xf:group>
-											<xf:group style="width:8%;" tagname="col"></xf:group>
+											<xf:group style="width:7%;" tagname="col"></xf:group>
+											<xf:group style="width:15%;" tagname="col"></xf:group>
+											<xf:group style="width:7%;" tagname="col"></xf:group>
 											<xf:group style="width:10%;" tagname="col"></xf:group>
 											<xf:group style="width:*;" tagname="col"></xf:group>
 										</xf:group>
@@ -1548,6 +1552,14 @@
 													</xf:choices>
 												</xf:select1>
 											</xf:group>
+											<xf:group class="w2tb_th" style="" tagname="th">사용본부</xf:group>
+											<xf:group tagname="td" style="" class="w2tb_td">
+												<xf:select1 allOption="true" appearance="minimal" chooseOption="false" direction="auto" disabled="false"
+													disabledClass="w2selectbox_disabled" displayMode="label" id="selUsePdeptCd" optionOrder="false" selectedData="true"
+													style="width: 100%;height: 21px;" submenuSize="auto" ref="" chooseOptionLabel="" ev:onchange="scwin.usePdeptCd_onchange">
+													<xf:choices></xf:choices>
+												</xf:select1>
+											</xf:group>
 											<xf:group class="w2tb_th" style="" tagname="th">기간</xf:group>
 											<xf:group class="w2tb_td" style="" tagname="td">
 												<w2:udc_period_ical_ymd id="icalPeriod" ref1="data:dcsample.ymd1" ref2="data:dcsample.ymd2"
@@ -1595,23 +1607,23 @@
 												<w2:column width="60" id="reservationId" value="예약_ID" hidden="true"></w2:column>
 												<w2:column width="60" id="meetingroomId" value="회의실_ID" hidden="true"></w2:column>
 												<w2:column width="80" id="locationNm" value="위치명" useFilter="true" hideCustomFilter="true" autoFitFilterList="true"></w2:column>
-												<w2:column width="60" id="bunho" value="번호" useFilter="true" autoFitFilterList="true" hideCustomFilter="true"></w2:column>
-												<w2:column width="200" id="meetingName" value="회의 제목"></w2:column>
-												<w2:column width="300" id="meetingCon" value="회의 내용"></w2:column>
+												<w2:column width="50" id="bunho" value="번호" useFilter="true" autoFitFilterList="true" hideCustomFilter="true"></w2:column>
+												<w2:column width="240" id="meetingName" value="회의 제목"></w2:column>
+												<w2:column width="300" id="meetingCon" value="회의 내용" hidden="true"></w2:column>
 												<w2:column width="60" id="startYyyymmdd" value="시작일자" hidden="true"></w2:column>
-												<w2:column width="100" id="pymd" value="예약일자"></w2:column>
-												<w2:column width="100" id="phm" value="예약시간"></w2:column>
+												<w2:column width="140" id="pymd" value="예약일자"></w2:column>
+												<w2:column width="90" id="phm" value="예약시간"></w2:column>
 												<w2:column width="60" id="endYyyymmdd" value="종료일자" hidden="true"></w2:column>
 												<w2:column width="60" id="startHhmm" value="시작시간" hidden="true"></w2:column>
 												<w2:column width="60" id="endHhmm" value="종료시간" hidden="true"></w2:column>
-												<w2:column width="120" id="cmpnNm" value="예약자 회사"></w2:column>
+												<w2:column width="80" id="cmpnNm" value="예약자 회사"></w2:column>
 												<w2:column width="60" id="deptCd" value="부서코드" hidden="true"></w2:column>
 												<w2:column width="200" id="deptName" value="예약자 부서명"></w2:column>
-												<w2:column width="120" id="usePdeptCd" value="사용 본부"></w2:column>
 												<w2:column width="60" id="subscSabun" value="사번" hidden="true"></w2:column>
-												<w2:column width="90" id="subscName" value="예약자명" useFilter="true" autoFitFilterList="true" hideCustomFilter="true"></w2:column>
-												<w2:column width="60" id="attendNum" value="참석인원"></w2:column>
-												<w2:column width="60" id="status" value="상태" useFilter="true" autoFitFilterList="true" hideCustomFilter="true"></w2:column>
+												<w2:column width="70" id="subscName" value="예약자" useFilter="true" autoFitFilterList="true" hideCustomFilter="true"></w2:column>
+												<w2:column width="100" id="usePdeptCd" value="사용 본부"></w2:column>
+												<w2:column width="50" id="status" value="상태" useFilter="true" autoFitFilterList="true" hideCustomFilter="true"></w2:column>
+												<w2:column width="70" id="useAmt" value="비용"></w2:column>
 											</w2:row>
 										</w2:header>
 										<w2:gBody id="" style="">
@@ -1634,15 +1646,15 @@
 												<w2:column width="100" id="cmpnNm" readOnly="true"></w2:column>
 												<w2:column width="60" id="deptCd" readOnly="true"></w2:column>
 												<w2:column width="200" id="deptName" readOnly="true"></w2:column>
+												<w2:column width="60" id="subscSabun" readOnly="true"></w2:column>
+												<w2:column width="70" id="subscName" readOnly="true" useFilter=""></w2:column>
 												<w2:column width="200" id="usePdeptCd" readOnly="true" inputType="select" useFilter="">
 													<w2:choices></w2:choices>
 												</w2:column>
-												<w2:column width="60" id="subscSabun" readOnly="true"></w2:column>
-												<w2:column width="70" id="subscName" readOnly="true" useFilter=""></w2:column>
-												<w2:column width="70" id="attendNum" readOnly="true"></w2:column>
 												<w2:column width="70" id="status" readOnly="true" inputType="select" useFilter="">
 													<w2:choices></w2:choices>
 												</w2:column>
+												<w2:column width="70" id="useAmt" readOnly="true" dataType="number" displayFormat="#,###,###"></w2:column>
 											</w2:row>
 										</w2:gBody>
 									</w2:gridView>