<%--
  - FileName   : rejectionPopup.jsp
  - Author(s)  : ok
  - Date       : 2014.06.26
  - Copyright  : Copyright (c) 2013 www.udapsoft.co.kr, Inc.
  - Description: 서급 반려등록 팝업
--%>

<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="com.udapsoft.waf.common.ui.*" %>
<%@ page import="kr.co.hsnc.common.util.*"%>
<%@ page import="kr.co.hsnc.common.sql.*" %>
<%@ page import="kr.co.hsnc.common.util.Formatter"%>

<%@ include file="/jsp/work/taglib.jsp" %>
<jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
<%
	ctx.init(request, response);
	HandlerStorage storage = ctx.getHandlerStorage();

	ValueObject params = storage.getParams();
	ValueObject rejectionData = storage.getValueObject("rejectionData");	//반려사유
	
%>

<SCRIPT language="JavaScript">
	//document.body.onresize = addEvent( document.body.onresize, "doResizeSheet(document.all.sheet1 )");
	document.body.onload = doPageInit;
	
	//키처리
	document.onkeydown = function(){
		//ESC 창닫기
		if(event.keyCode == "27"){
    		window.close();
		} 
   };
	
	
	/*****************************************************************************************************************************************************/
	// 				Global Variable 선언
	/*****************************************************************************************************************************************************/
	//var argObj 		= window.dialogArguments;
	//var title 		= argObj.title;
	//var acmp_id		= argObj.acmp_id; 
	//var buildName 	= argObj.buildName ;
	
   	function doResult(resultObj) { 
		try {
			document.form01.isSubmit = false;
			
			if( resultObj.getRequestEvent() == "SAVE_DATA" ) {
				
				alert("반려 되었습니다.");
				document.form01.resultFlg.value = "1";
				doClose();
				
			}
			
			
		} catch(errorObject) {
	        showErrorDlg("doResult()", errorObject);
		}
	}
   
    function doPageInit() {
		
    	//반려일 설정
    	//setDate();
	}
	
	function setDate(){
		
		//var newDay = new Date( get_year(), get_month(), get_day());
	    //var lastDay = newDay.getDate();
	    var rejecDate = get_year() +'-'+ get_month() +'-'+ get_day();
	    var f = document.form01;
	    
	    if(f.rtnDate.value == ""){
	    	f.rtnDate.value = rejecDate;	
	    }
	}
	
	function doSave() {

		var f = document.form01;
		var rtnReason = f.rtnReason.value.replace(/(^\s*)|(\s*$)/gi, "");
		if(rtnReason.length == 0){
		       alert("반려사유를 입력해주세요.");  
		       f.rtnReason.focus();
		       return;
		}
		
		//반려사유 check maxlength 1000으로 제한
/* 		if(f.rtnReason.value.length > 10){  
		       alert("반려사유는 1000자 이내로 제한됩니다.");  
		       f.rtnReason.focus();
		       return;
		  } */ 
		f.rtnReason1.value = f.rtnReason.value.replace( /\n/gi, '<br//>');
		if(confirm("반려사유를 등록 하시겠습니까?")){
			submitXmlRequest("/payment/outside/RejectionPopup_form.screen", "SAVE_DATA", f, "SUCCESS");
		}

	}

	function doClose(){
		
/* 		var retArray = new Array();
		retArray[0] = document.form01.resultFlg.value;	//저장차리 여부
		window.returnValue = retArray;
		self.close(); */
		
		parent.RejectionPopupClose();

	}

</SCRIPT>

<modular:search id="form01">
	<modular:key id="fevent" />
</modular:search>

<FORM name="form01" method="post" style="width:580px">

	<INPUT type="hidden" name="fevent" id="fevent" value="">
	<INPUT type="hidden" name="prepayId" value="<%=rejectionData.get("PREPAY_ID") %>">
	<INPUT type="hidden" name="resultFlg" value="0">
	<INPUT type="hidden" name="pageDiv" id="pageDiv" value="<%=params.get("pageDiv") %>">
	<INPUT type="hidden" name="rtnReason1" id="rtnReason1" value="">

	<!-- SMS처리용 -->
	<INPUT type='hidden' id="resUserName" name="resUserName" value="<%=rejectionData.get("RES_USER_NAME") %>">	<!-- 계약담당자 -->
	<INPUT type='hidden' id="resHp" name="resHp" value="<%=rejectionData.get("RES_HP") %>">	<!-- 계약담당자 핸드폰번호 -->
	<INPUT type='hidden' id="resEmail" name="resEmail" value="<%=rejectionData.get("RES_EMAIL") %>">	<!-- 계약담당자 이메일 -->
	<INPUT type='hidden' id="resDivision" name="resDivision" value="<%=rejectionData.get("RES_DIVISION") %>">
	<INPUT type='hidden' id="conDocNo" name="conDocNo" value="<%=rejectionData.get("CON_DOC_NO") %>">	<!-- 발주계약번호 -->
	<INPUT type='hidden' id="deptName" name="deptName" value="<%=rejectionData.get("DEPT_NAME") %>">	<!-- 현장명 -->
	<INPUT type='hidden' id="buildName" name="buildName" value="<%=rejectionData.get("BUILD_NAME") %>">	<!-- 계약명 -->
	<INPUT type='hidden' id="memberName" name="memberName" value="<%=rejectionData.get("CORP_KOR") %>">	<!-- 계약업체명 -->
	<INPUT type='hidden' id="userName" name="userName" value="<%=rejectionData.get("USER_NAME") %>">	<!-- 업체담당자명 -->
	<INPUT type='hidden' id="hp" name="hp" value="<%=rejectionData.get("HP") %>">	<!-- 업체담당자 핸드폰번호 -->
	<INPUT type='hidden' id="eMail" name="eMail" value="<%=rejectionData.get("EMAIL") %>">	<!-- 업체담당자 이메일 -->

<!-- 제목 및 버튼 -->
<table width="100%">
	<colgroup>
		<col width="150" />
		<col width="*" />
	</colgroup>
	<tr>
   		<th>
	   		<div align="left" id="title">
				<ul>
		    		<li></li>
		    	</ul>
			</div>
		</th>
		<td align="right">
			<span class="btnSearch center"><a href="javascript:doSave();" id="btnSearch">반려</a></span>
			<!-- <span class="btnSearch center"><a href="javascript:doClose();" id="btnClose">닫기</a></span> -->
		</td>
	</tr>
</table>	

<TABLE class="form-table">
	<colgroup>
		<col width="150" />
		<col width="85%" />
	</colgroup>
	<tr height="150">
		<th>반려사유</th>
		<TD>
			<textarea name="rtnReason" id="rtnReason" style="width:98%; height:140px; overflow-y:auto" maxlength="1000" class="input byteChk ctrlTarget"><%=rejectionData.get("RTN_REASON") %></textarea>
    	</TD>
  	</TR>
</TABLE>
</FORM>
