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

<%@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");
%>

<%@ page contentType="text/html; charset=utf-8" %>
<SCRIPT language="JavaScript">

	function doPageInit() {
		
	}
	
	function doClose()
	{
     	returnValue = null;
     	parent.RtnReasonClose(returnValue);
	}

	function goRtn(){
		if($("#RTN_REASON").val().length > 0){
			if (confirm("반려 하시겠습니까?")){
				replace();
				var f = document.form1;
				submitXmlRequest("/bid/purchase/OrderReqeust_form.screen", "FROM_RETURN_UPDATE", f);
			}
		}else{
			alert("반려사유는 필수 입니다.");
		}
	}
	
	function replace(){
		var content = $("#RTN_REASON").val();
/* 		content = content.replace(/\r\n/g, '<br>');
		content = content.replace(/\n/g, '<br>');
		content = content.replace(/\r/g, '<br>'); */
		$("#RTNREASON").val(content);
	}
	

	function doResult(resultObj) {
		try {
			if( resultObj.getRequestEvent() == "FROM_RETURN_UPDATE") {
				if( resultObj.getSuccess() ) {
					alert("반려 되었습니다.");
					returnValue = new Array(0,"OK");
					parent.RtnReasonClose(returnValue);
				}
				else {
					dlgErrorMsg(resultObj);
				}
			}
		}
		catch(errorObject) {
			showErrorDlg("doResult()", errorObject);
		}
	}
	document.body.onload = doPageInit;


</SCRIPT>
<modular:search id="form1">
	<modular:key id="fevent" />
</modular:search>

<FORM name="form1" method="post" style="width:580px">
<INPUT type="hidden" name="DEMANDED_ID" value="<%=DEMANDED_ID%>">
<INPUT type="hidden" name="DEMANDED_KIND" value="<%=(String)storage.get("DEMANDED_KIND")%>">
<INPUT type="hidden" name="RTNREASON" value="">
<INPUT type="hidden" name="DEMANDED_STATUS" value="5">
<INPUT type="hidden" name="fevent" id="fevent" value="FROM_RETURN_UPDATE">

  
<table  id="t1" width="100%" border="0" cellspacing="0" cellpadding="0" class="ftit_table">
	<colgroup>
		<col width="150" />
		<col width="*" />
	</colgroup>
	<tr>
   		<th>
   		</th>
   		<td align="right">
       		<span class="btnSearch center" id="btnSearch"><a href="javascript:goRtn();">반려</a></span>
   		</td>
  	</tr>
</table>  

<TABLE class="form-table">
		<colgroup>
			<col width="150" />
			<col width="85%" />
		</colgroup>
  <TR height="150"> 
    <TH class="required" style="text-align:center">반려사유</TH>
	<TD><textarea name="RTN_REASON" id="RTN_REASON" style="width:99%; height:140px; overflow-y:auto" maxlength="1000" class="input byteChk ctrlTarget"></textarea></TD>
  </TR>
</TABLE>
</FORM>
