<%--
  - Author(s)  : Hyung min Son
  - Date       : 2014.07.28
  - Description: 반려 사유 팝업
  --%>

<%@page import="monfox.toolkit.snmp.agent.modules.SnmpV2Mib.SysOREntry"%>
<%@page import="monfox.toolkit.snmp.agent.modules.SnmpV2Mib.SysOREntry"%>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="kr.co.udapsoft.common.*" %>
<%@ page import="com.udapsoft.waf.system.*" %>
<%@ page import="com.udapsoft.waf.common.*" %>
<%@ page import="com.udapsoft.waf.common.ui.HTMLMaker" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="kr.co.hsnc.common.util.*"%>
<%@ page import="kr.co.hsnc.common.util.ValueObject" %>
<%@ page import="kr.co.hsnc.common.sql.*" %>
<%@ page import="kr.co.hsnc.common.sql.RowSet" %>
<%@ page import="kr.co.hsnc.common.sql.util.*" %>

<%-- <%@ 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 user = ctx.getUser();
	/* String DEMANDED_ID =   (String) storage.get("DEMANDED_ID");
	String BID_NO =   (String) storage.get("BID_NO");
	String BID_DEG =   (String) storage.get("BID_DEG");*/
	String pop_win_id =   (String) storage.get("pop_win_id"); 
%>
<%@ page contentType="text/html; charset=utf-8" %>
<SCRIPT language="JavaScript">

	function doPageInit() {
		
	}
	
	function doClose()
	{
		returnValue = null;
     	parent.PopClose("<%=pop_win_id%>",returnValue);
	}

	function reject(){
		
		if ( stringByteSize4UTF($("#RJCT_REASON").val()) > 2000 ) {
	    	alert("반려사유는 500자까지 입력하실 수 있습니다.");
	    	jQuery("#RJCT_REASON").focus();
	    	return;
	    }
		
		if($("#RJCT_REASON").val().length > 0){
			if(confirm("반려 하시겠습니까?")){
				replace();
				var f = document.form1;
				//jQuery("#fevent").val("CONT_REJECT");
				submitXmlRequest("/cont/purchase/ContChgRcvDetail_form.screen", "CONT_REJECT", f);
				//var f = document.form1;
				//submitXmlRequest("/bid/outside/CancelBidPop_form.screen", "FORM_CANCEL_UPDATE", f);
			}
		}else{
			alert("반려사유는 필수 입니다.");
		}
	}
	
	function replace(){
		var content = $("#RJCT_REASON").val();
		content = content.replace(/\r\n/g, '<br>');
		content = content.replace(/\n/g, '<br>');
		content = content.replace(/\r/g, '<br>');
		$("#RJCTREASON").val(content);
	}
	

	function doResult(resultObj) {
		try {
			if( resultObj.getRequestEvent() == "CONT_REJECT") {
				if( resultObj.getSuccess() ) {
					returnValue = new Array(0,"반려 처리 되었습니다.");
					parent.PopClose("<%=pop_win_id%>",returnValue);
				}
				else {
					dlgErrorMsg(resultObj);
				}
			//	document.form1.isSubmit = false;
			}
		}
		catch(errorObject) {
			showErrorDlg("doResult()", errorObject);
		}
	}
</SCRIPT>
<FORM name="form1" method="post">
<TABLE  width="580px">
<INPUT type="hidden" name="DEMANDED_ID" value="<%=params.get("DEMANDED_ID")%>">
<INPUT type="hidden" name="PUR_CONT_MOD_ID" value="<%=params.get("PUR_CONT_MOD_ID")%>">
<INPUT type="hidden" name="fevent" id="fevent" value="">
<INPUT type="hidden" name="RJCTREASON" id="RJCTREASON" value="">
  <TR height="2"><TD colspan="2"></TD></TR>
  <TR height="25">
    <TD>
		<table  id="t1" width="100%" border="0" cellspacing="0" cellpadding="0" class="ftit_table">
				<colgroup>
					<col width="*" />
					<col width="150" />
				</colgroup>
			<tr>
			   	<th>
			   </th>
			   <td align="right">
					<span class="btnSearch center"><a href="javascript:reject();">반려</a></span>
			   </td>
		   	</tr>
		   	</table>
</TD>
  </TR>
</TABLE>
<!-- 버튼 영역 : 시작 -->



<!-- 유찰 사유 -->
<TABLE cellspacing="1" cellpadding="0" class="search_table">
  <TR height="100"> 
    <TD width="15%" class="insert_table_title required">반려사유</TD>
	<TD width="35%" class="search_table_data" > 
	 &nbsp;&nbsp; <textarea name="RJCT_REASON" id="RJCT_REASON" style="width:95%; height:140px; overflow-y:auto" maxlength="1000" class="input byteChk ctrlTarget"></textarea>
    </TD>
  </TR>
</TABLE>
</FORM>
