  <%--
  - FileName   : dlgSearchBizRegNo.jsp
  - Author     : gyeongmo an
  - Date       : 2014.07.15
  - Copyright  : Copyright (c) 2014 www.udapsoft.co.kr, Inc.
  - All rights reserved.
  - Description: 거래처 찾기 
--%>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="kr.co.hsnc.common.util.*"%>
<%@ page import="kr.co.hsnc.common.sql.*" %>
<%@ 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();
%>

<SCRIPT language="JavaScript" src="/js/common.js"></SCRIPT>

<SCRIPT language="JavaScript">
	/*예약함수*/
	var sheet1;
	var sheet1Row;
	var sheet1PageNo = 1;
	var pageLastRowIndex = 1;
	var validationResult = false;
	var filterShow = false;
	
	function _onReady(){
		gridInit(sheet1);
		
		jQuery("#btnSearch").click(function() {
			var value   = $(':radio[name=condition]:checked').val();
			f.condition2.value = value;
			jQuery("#fevent").val("BizRegNo.Search");
			var url = Modular.model.PageContext.CONTEXT_ROOT + "/lib/dlgSearchBizRegNo_sheet.screen";
			Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 10, "");
		});
		
		jQuery("#btnClose").click(function() {
			parent.searchBizRegNoClose(null, '<%=params.get("obj_corp_id")%>', '<%=params.get("obj_corp_name")%>');
		});
		
		
		var f = document.form1;
		if(ent_corp_NM != "" && ent_corp_NM != undefined ){
			 f.desc.value = ent_corp_NM;
			 jQuery("#btnSearch").click();
		} else {
			f.desc.value = "";
			f.desc.focus();
		}
		
		desc = document.getElementById('desc');
	}
	
	function gridInit(sheetName){
		var init_sheet = {};
		init_sheet.Cfg = {SearchMode:2, Page:10};
		init_sheet.Cols = [
		       			{Header:'사업자번호',				Type:"Text",		SaveName:"reg_no", 		Width:120, 	Align:"Center"},
		    			{Header:'업체명',			Type:"Text", 			SaveName:"name", 			Width:250, 	Align:"Left"},
		    			{Header:'구분',				Type:"Text", 			SaveName:"gb",				Width:100, 	Align:"Center"},
		    			{Header:'id',		Type:"Text", 			SaveName:"id", 		Width:100,	Align:"Center",	Hidden:"True"},
		    			{Header:'acct_id',			Type:"Text", 			SaveName:"acct_id", 		Width:100, 	Align:"Center", Hidden:"True"}
		];
	
		init_sheet.HeaderMode = {Sort:1};
		IBS_InitSheet(sheetName, init_sheet);
		sheetName.SetDataAutoTrim(0);
		sheetName.SetEditable(false);
		
		setGridSize();
	}
	
	function sheet1_OnSearchEnd(code, message) {
	    if(code == 0) {
	    	//sheet1.MessageText("UserMsg14")   = "검색어를 입력하세요. (전체 검색은 '%')";
	    	setGridSize();
		} else {
			//조회 에러 수행
			alert("조회 실패");
		}
	}
	
	/**
	 *	IBSheet size setting
	 */
	function setGridSize() {
		sheet1.FitColWidth();
	}
//키처리
	document.onkeydown = function(){
		//F5 새로고침
		if(event.keyCode == "116"){
			jQuery("#btnSearch").click();
		}
		//ESC 창닫기
		if(event.keyCode == "27"){
    		window.close();
		} 
   };

	function doClose()
	{
		parent.searchBizRegNoClose(null, '<%=params.get("obj_corp_id")%>', '<%=params.get("obj_corp_name")%>');
	}

	function prcKeyPress()
	{
  	  	if( event.keyCode == 13 )
  	  	{
			//doSubmit();
			jQuery("#btnSearch").click();
		}
	}
	
	function sheet1_OnClick(Row, Col, Value, CellX, CellY, CellW, CellH) { 
    	var result = new Array();
		result[0] = sheet1.GetCellValue(Row, "reg_no");
		result[1] = sheet1.GetCellValue(Row, "name");
		parent.searchBizRegNoClose(result, '<%=params.get("obj_corp_id")%>', '<%=params.get("obj_corp_name")%>');
	}
	
</SCRIPT>
<modular:search id="form1">
	<modular:key id="fevent" />
</modular:search>
<form id="form1" name="form1" method="post" modular:type="search" style="width:100%;height:100%;">
<INPUT type="text" value="자동 Submit을 막기 위해서 있는 필드" size="0" style="display:none;">
<INPUT type="hidden" name="fevent" >
<INPUT type="hidden" name="ent_corp_id" >
<INPUT type="hidden" name="site_gb" value="<%=params.get("site_gb") %>">
<INPUT type="hidden" name="reg_gb" value="<%=params.get("reg_gb") %>" >
<INPUT type="hidden" name="work_id" >
<INPUT type="hidden" name="all_gb" value="<%=params.get("all_gb") %>">
<INPUT type="hidden" name="condition2">

<TABLE border="0" cellspacing="0" cellpadding="0" width="100%">
	<TR>
		<TD height="1">
            <TABLE cellspacing="1" cellpadding="0" class="search_table">
                <TR> 
                    <TD width="20%" class="search_table_title">
                    	<IMG src="/img/buyer/button/bullet_01.gif">구&nbsp;&nbsp;분
                    </TD>
                    <TD width="*" class="search_table_data"> 
			        	<LABEL for="cond_1"><INPUT id="cond_1" type="radio" name="condition" value="0" checked >업체명</LABEL>
			            <LABEL for="cond_2"><INPUT id="cond_2" type="radio" name="condition" value="1" >사업자번호</LABEL>
                    </TD>
                    <TD width="20%" class="search_button" rowspan="2">
						<DIV class="button_style"> 
							<IMG id="btnSearch" src="/img/buyer/button/bt_search.gif" alt="검색하기" border="0" style='cursor:hand'>
							<IMG id="btnClose" src="/img/buyer/button/bt_close.gif" border="0" style="cursor:hand;" >
						</DIV>
                    </TD>
                </TR>
                <TR>
                    <TD class="search_table_title">
                    	<IMG src="/img/buyer/button/bullet_01.gif">검색어
                    </TD>
                    <TD class="search_table_data">
                    	<INPUT class="input" type="text" name="desc" id="desc" onKeyPress="prcKeyPress()" style="font-family:'굴림'; font-size:10pt; IME-MODE : active; width:99%;">
                    </TD>
                </TR>
            </TABLE>
		</TD>
	</TR>
	
	<TR>
		<TD height="5"></TD>
	</TR>
</TABLE>
<div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 500px; overflow: auto;">
	<script>createIBSheet('sheet1','100%', '500px');</script>
</div>
		

</FORM>










