<%--
  - 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.*" %>
<%@ page import="com.udapsoft.waf.common.ui.*" %>
<%@ page import="com.udapsoft.waf.common.util.*" %>
<%@ page import="kr.co.udapsoft.common.code.CommCodeManager" %>
<%-- <%@ 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();

	ValueObject SearchInfo = storage.getValueObject("SearchInfo");
%>

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

	function doPageInit() {
		
	}
	
	function doClose()
	{
     	returnValue = null;
     	parent.EditCallReasonClose(returnValue);
	}
	function _onReady(){
		/**
		 *	Application Initialize
		 */
		jQuery("#btnSearch").click(function() {
			if(jQuery("#CONT_ID").val() == ""){
				alert("관리번호 앞자리를 입력해 주세요.");
				jQuery("#CONT_ID").focus();
				return;
			}				
			if(jQuery("#MOD_NO").val() == ""){
				alert("관리번호 가운데 자리를 입력해 주세요.");
				jQuery("#MOD_NO").focus();
				return;
			}				
			if(jQuery("#TRUE_RANDOM").val() == ""){
				alert("관리번호 뒷자리를 입력해 주세요.");
				jQuery("#TRUE_RANDOM").focus();
				return;
			}				
			var f = document.form1;
			jQuery("#fevent").val("FORM_SELECT");
			submitXmlRequest("/portal/cont/ContSearchPopup_form.screen", "FORM_SELECT", f);
		});	
		jQuery("#dataClear").click(function(){
			jQuery("#CONT_ID").val("");
			jQuery("#MOD_NO").val("");
			jQuery("#TRUE_RANDOM").val("");
			jQuery("#CONT_NAME").val("");
			jQuery("#CONT_DEPT").val("");
			jQuery("#MEMBER_NAME").val("");
			jQuery("#CONT_DATE").val("");
		});
		
		$("#CONT_TRUE_CD").on("change",function(){
			if($("#CONT_TRUE_CD").val()=="00"){
				$("#yearDiv").html("계약일자");
				$("#yearSpan").html("");
				$("#dataClear").click();
			}else if($("#CONT_TRUE_CD").val()=="10"){
				$("#yearDiv").html("신청년도");
				$("#yearSpan").html("년");
				$("#dataClear").click();
			}
		});
	} 

	function doResult(resultObj) {
		try {
			if( resultObj.getRequestEvent() == "FORM_SELECT") {
				if( resultObj.getSuccess() ) {
					var reData = new Array(); 
					if(resultObj.message.length > 0){
						reData = resultObj.message.split('$');
						jQuery("#CONT_NAME").val(reData[0]);
						jQuery("#CONT_DEPT").val(reData[1]);
						jQuery("#MEMBER_NAME").val(reData[3]);
						jQuery("#CONT_DATE").val(reData[2]);										
					}else{
						jQuery("#CONT_NAME").val("");
						jQuery("#CONT_DEPT").val("");
						jQuery("#MEMBER_NAME").val("");
						jQuery("#CONT_DATE").val("");
						alert("조회된 계약 데이터가 없습니다.");
					}
				}
				else {
					dlgErrorMsg(resultObj);
				}
			}
			document.form1.isSubmit = false;
		}
		catch(errorObject) {
			showErrorDlg("doResult()", errorObject);
		}
	}
	document.body.onload = doPageInit;


</SCRIPT>
<STYLE>
BODY {
	padding : 0 0 0 0;
}
</STYLE>
<modular:search id="form1">
	<modular:key id="fevent" />
</modular:search>

<FORM name="form1" method="post">
<INPUT type="hidden" name="fevent" id="fevent" value="FORM_SELECT">
  
<table id="search-table" class="search-form-table" style="margin-bottom:10px;">
	<colgroup>
		<col width="*" />
	</colgroup>
	<tr>
   		<td style="text-align:center">
   			<%=CommCodeManager.getSelectCodeSearchList("CONT_TRUE_CD","CONT_TRUE_CD","height=18;width:100px;","","","") %>
   			<%= InputText.get("CONT_ID", "", 5, 10, "desc=관리번호,number,center") %>
       		-
       		<%= InputText.get("MOD_NO", "", 2, 2, "desc=관리번호,number,center") %>
       		-
       		<%= InputText.get("TRUE_RANDOM", "", 6, 10, "desc=관리번호,number,center") %>
			(* 계약서 하단 우측의 관리번호 입력)
       		<span class="btnSearch center" id="btnSearch"><a href="javascript:void(0);">검색</a></span>
       		<IMG name="dataClear" id="dataClear" src="/img/buyer/button/bt_eraser1.gif" border="0" align="absmiddle" style="cursor:pointer;">
   		</td>
  	</tr>
</table>  

<TABLE cellspacing="1" cellpadding="0" class="search_table">
		<colgroup>
			<col width="100" />
			<col width="85%" />
		</colgroup>
  <TR height="25"> 
    <TD class="search_table_title" style="text-align:center">계약명</TD>
	<TD class="search_table_data" style="padding-left:5px;text-align:left;"><%= InputText.get("CONT_NAME", "", 90, 200, "desc=계약명,persize,readonly") %></TD>
  </TR>
  <TR height="25"> 
    <TD class="search_table_title" style="text-align:center">현장</TD>
	<TD class="search_table_data" style="padding-left:5px;text-align:left;"><%= InputText.get("CONT_DEPT", "", 90, 200, "desc=원사업자,persize,readonly") %></TD>
  </TR>
  <TR height="25"> 
    <TD class="search_table_title" style="text-align:center">수급사업자</TD>
	<TD class="search_table_data" style="padding-left:5px;text-align:left;"><%= InputText.get("MEMBER_NAME", "", 90, 200, "desc=수급사업자,persize,readonly") %></TD>
  </TR>
  <TR height="25"> 
    <TD class="search_table_title" style="text-align:center"><div id="yearDiv">계약일자</div></TD>
	<TD class="search_table_data" style="padding-left:5px;text-align:left;"><%= InputText.get("CONT_DATE", "", 10, 10, "desc=계약일자,readonly") %><span id="yearSpan"></span></TD>
  </TR>
</TABLE>
</FORM>
