<%--
  - Author(s)  : kyj	
  - Date       : 2015.01.19
  - 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="com.udapsoft.waf.common.util.StringUtils" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="kr.co.hsnc.common.util.ValueObject" %>
<%@ page import="kr.co.hsnc.common.sql.RowSet" %>

<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 p_corp_id = params.get("p_corp_id");
    
    ValueObject vo = storage.getValueObject("InfoBaseList");
    RowSet rowset = storage.getRowSet("out_main");
    RowSet getFileListRowSet = storage.getRowSet("getFileListRowSet");
    RowSet getApprYearList = storage.getRowSet("getApprYearList");
    
    
%>

<SCRIPT language="JavaScript">
	
	function doPageInit() {
		//주력분야 체크불러오기	
		var main_cd = "";
	    <%
	    for(int i=0; i < rowset.size(); i++)
	    {
	    %>
	    	main_cd =  "<%=rowset.getRow(i).get("OUT_MAIN_CD")%>";
		    
		    $(":checkbox[name='out_main_cd']").each(function(pi,po){
			    if(main_cd == $(this).val())
			    {
			        $(this).attr("checked", true);
			    }
			  });
	    <%
	    }
	    %>
	    
	    //저장된 첨부파일 리스트 불러오기
	    getFileListForTextarea();
	}
	
	function doRdPop() {
		if($("#p_corp_id").val()=="" || $("#p_arr_id").val()=="" || $("#p_appr_dy").val()==""){
			alert("해당 경영평가표가 존재하지 않습니다.");
		}else{
			<%-- var win_id = "_ContTargetRdPop";
			 var link = "/cont/outside/ContTargetRdPopup.screen";
			     link += "?pop_win_id="+win_id;
			     link += "&p_corp_id="+$("#p_corp_id").val();
			     link += "&p_arr_id="+$("#p_arr_id").val();
			     link += "&p_appr_dy="+$("#p_appr_dy").val();
			     link += "&p_doc_cd="+"<%=vo.get("DOC_CD")%>";
			   
			parent.fLayerPop(win_id, link, 1000, 1200, '', '', 'NO'); --%>
			
			var url = "/cont/outside/ContTargetRdPopup.screen";
			url += "?p_corp_id=" + $("#p_corp_id").val();
			url += "&p_arr_id="+$("#p_arr_id").val();
			url += "&p_appr_dy="+$("#p_appr_dy").val();
			url += "&p_doc_cd="+"<%=vo.get("DOC_CD")%>";
			url += "&sModule="+"LM";
			
			window.open(url, "_ContTargetRdPop","width=1000,height=1200,SCROLLBARS=yes"); 
		}
	}
	
	function doCancle() {
		window.close();
	}

	function doResult(resultObj) {
		try {
			if(resultObj.getRequestEvent() == "GET_ATTACHFILE")
	    	{
	    		if( resultObj.getSuccess() ) {				
					document.form1.p_AttachFile1.value = resultObj.getValueObject().get("AttachFile");
				}else {
					dlgErrorMsg(resultObj);
				}
				document.form1.isSubmit = false;
	    	}
		}
		catch(errorObject) {
			showErrorDlg("doResult()", errorObject);
		}
	}
	
	function doAttachFile(obj,No,fileName) {

		if(obj.value != ''){ 
			var upLoadFlg = "N";
			viewFileListNew1('TERMS_AGREE_INFO_'+obj.value, No, document.form1.p_AttachFile2, upLoadFlg, "own/outside/"+obj.value, null, fileName);
		} 
	}	
	
	function viewFileListNew1(fileGB, id, obj, isModify, isDrectory, iframeID, user_filename) {
		
		var win_id = "_viewFileList";
		var link = "/common/file/FileListNew.screen";
		    link += "?pop_win_id="+win_id;
		    link += "&extFunction=viewFileListClose1";
		    link += "&file_gb=" + fileGB;
		    link += "&id=" + id;
		    
		    if( obj.id != null )
			    link += "&obj_id=" + obj.id;
		    if( iframeID != null )
		    	link += "&iframeID=" + iframeID;
		    
			if( isModify != null )
				link += "&is_modify=" + isModify;
			if( isDrectory != null )
				link += "&sys_gb=" + isDrectory;	    
			if( user_filename != null )
				link += "&user_filename=" + user_filename;	 
		
		fLayerPop(win_id, link, 750,430, '', '', 'NO', '200');
	}
	
	//첨부목록 조회
	function getFileListForTextarea(){
		document.form1.p_AttachFile1.value = "";
		var f = document.form1;  
		jQuery("#fevent").val("GET_ATTACHFILE");
		submitXmlRequest("/supplier/purchase/PuSupplierList_form.screen", "GET_ATTACHFILE", f, "VALUEOBJECT");	
	}
	
	
	document.body.onload = doPageInit;

</SCRIPT>
<style type="text/css">
#input01{ text-align:left; background-color:#FFFFFF;line-height:28px; height:28px;}
#input01 ul{ display:inline; margin:0px;padding-left:3px; }
#input01 ul li{ padding-left:3px;display:inline; overflow:hidden; vertical-align:middle;}
</style>
<modular:search id="form1">
	<modular:key id="fevent" />
</modular:search>

<FORM name="form1" method="post">

<INPUT type="hidden" name="p_corp_id" id="p_corp_id" value="<%=p_corp_id%>">
<INPUT type="hidden" name="p_arr_id" id="p_arr_id" value="<%=vo.get("ARR_ID")%>">
<INPUT type="hidden" name="p_appr_dy" id="p_appr_dy" value="<%=vo.get("APPR_DY")%>">
<input type="hidden" name="p_AttachFile2" id="p_AttachFile2" onPropertyChange="JavaScript:getFileListForTextarea();"/>

<TABLE class="screen_title_table">
<TR height="2"><TD colspan="2"></TD>
<TR height="25"><TD>
  	<!-- 제목 및 버튼 -->
   	<table id="t1" width="100%" class="ftit_table">
		<colgroup>
			<col width="*" />
			<col width="150" />
		</colgroup>
	<tr>
	   	<th>
	   </th>
	   <td align="right">
			<span class="btnSearch center"><a href="javascript:doCancle();">닫기</a></span>
	   </td>
   	</tr>
   	</table>
    </TD>
  </TR>
<tr>
<td>


<!-- 발주의뢰정보 : 시작 -->
<div class="tab_container">
<table border="0" cellspacing="0" cellpadding="0" style="width: 100%; margin-left: 0px; margin-top: 0px;">
		<tr>
			<td align="left">
				<div style="margin-bottom: 5px; margin-top: 5px; font-size: 12px;" class="screen_title_text">
					<img src="/img/buyer/common/subtitle_bullet.gif" style="vertical-align: middle;">&nbsp;회사정보
				</div>
			</td>
		</tr>
		<tr>
			<td align="left">
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-table">
	            	<col width="15%" />
					<col width="35%" />
					<col width="15%" />
					<col width="35%" />
					<tr>
						<th>
							사업자 등록번호
						</th>
						<td>
							<%=StringUtils.getBizNo(vo.get("CORP_REG_NO")) %> 
						</td>
						<th id="p_head_corp_reg_n">
							본사 사업자번호
						</th>
						<td>
							<%=StringUtils.getBizNo(vo.get("HEAD_CORP_REG_N")) %><%-- <%=vo.get("HEAD_CORP_REG_N") %> --%>
						</td>
					</tr>
					<tr>
						<th id="p_corp_no" >
							법인번호
						</th>
						<td>
							<%=vo.get("COPR_NO") %>
						</td>
						<th>
							종사업장번호
						</th>
						<td>
							<%=vo.get("SUB_PLACE_NO") %>
						</td>
					</tr>
					<tr>
						<th>
							업체명
						</th>
						<td >
							<%=vo.get("corp_kor") %>
						</td>
						<th>
							대표자명
						</th>
						<td >
							<%=vo.get("rep_name") %>
						</td>
					</tr>
					<tr>
						<th>
							업태
						</th>
						<td>
							<%=vo.get("corp_sts") %>
						</td>
						<th>
							업종
						</th>
						<td>
							<%=vo.get("biz_form") %>
						</td>
					</tr>
					<tr>
						<th>
							사업자구분
						</th>
						<td>
							<input type="radio" name="corp_div_cd" id="corp_div_cd_1" value="1" <%=vo.get("corp_div_cd").equals("1") ? "checked=\"checked\"" : ""%> disabled="disabled" /> 법인
							<input type="radio" name="corp_div_cd" id="corp_div_cd_2" value="2"<%=vo.get("corp_div_cd").equals("2") ? "checked=\"checked\"" : ""%> disabled="disabled" /> 개인
						</td>
						<th>
							설립일자
						</th>
						<td>
							<%=vo.get("esta_date") %>
						</td>
					</tr>
					<tr>
						<th>
							전화번호
						</th>
						<td>
							<%=vo.get("corp_tel") %>
						</td>
						<th>
							FAX번호
						</th>
						<td>
							<%=vo.get("corp_fax") %>
						</td>
					</tr>
					<tr>
						<th>
							회사규모
						</th>
						<td>
							<input type="radio" name="corp_scale" id="corp_scale_1" value="B" <%=vo.get("corp_scale").equals("B") ? "checked=\"checked\"" : ""%> disabled="disabled"/> 대기업
							<input type="radio" name="corp_scale" id="corp_scale_2" value="S"<%=vo.get("corp_scale").equals("S") ? "checked=\"checked\"" : ""%> disabled="disabled"/> 중소기업
						</td>
						<th>
							경영평가표
						</th>
						<td>
							<IMG src="/img/buyer/button/bt_search_right.gif" onclick="javascript:doRdPop();" id="contPurWarr" alt="경영정보표" border="0" align="absmiddle" style="cursor:pointer;" />
						</td>
					</tr>
					<tr>
						<th>
							본점 소재지
						</th>
						<td colspan="5">
							<input type="text" name="post_no_1" id="post_no_1" value="<%=!vo.get("post_no").equals("") ? vo.get("post_no").substring(0, 3) : ""%>" class="input" style="background-color: rgb(218, 227, 244); width: 30px; text-align: center;" readonly="readonly">
							-
							<input type="text" name="post_no_2" id="post_no_2" value="<%=!vo.get("post_no").equals("") ? vo.get("post_no").substring(3, 6) : ""%>" class="input" style="background-color: rgb(218, 227, 244); width: 30px; text-align: center;" readonly="readonly">
							
							<%=vo.get("address") %>
						</td>
					</tr>
					<tr>
						<th>
							사업장 소재지
						</th>
						<td colspan="3">
							<div id="input01">
								<input type="text" name="place_post_no_1" id="place_post_no_1" value="<%=!vo.get("place_post_no").equals("") ? vo.get("place_post_no").substring(0, 3) : "" %>" class="input" style="background-color: rgb(218, 227, 244); width: 30px; text-align: center;" readonly="readonly">
								-
								<input type="text" name="place_post_no_2" id="place_post_no_2" value="<%=!vo.get("place_post_no").equals("") ? vo.get("place_post_no").substring(3, 6) : "" %>" class="input" style="background-color: rgb(218, 227, 244); width: 30px; text-align: center;" readonly="readonly">
								
								<%=vo.get("place_address") %>
						</td>
					</tr>
					<tr>
						<th>
							세금계산서 발행주소
						</th>
						<td colspan="3">
							<input type="radio" name="tax_addr_cd" id="tax_addr_cd_1" value="B" <%=vo.get("tax_addr_cd").equals("B")  ? "checked=\"checked\"" : ""%> disabled="disabled"/> 본사
							<input type="radio" name="tax_addr_cd" id="tax_addr_cd_2" value="S" <%=vo.get("tax_addr_cd").equals("S")  ? "checked=\"checked\"" : ""%> disabled="disabled"/> 사업장
						</td>
					</tr>
					<tr>
						<th>주력분야</th>
						<td colspan="3">
							<div id="input01">
								<ul>
									<li><input type="checkbox" name="out_main_cd" id="out_main_cd_1" value="31" style="vertical-align: middle;" disabled="disabled"/>&nbsp;주택분야</li>
									<li><input type="checkbox" name="out_main_cd" id="out_main_cd_2" value="32" style="vertical-align: middle;" disabled="disabled"/>&nbsp;공동주택</li>
									<li><input type="checkbox" name="out_main_cd" id="out_main_cd_3" value="33" style="vertical-align: middle;" disabled="disabled"/>&nbsp;산업플랜트</li>
									<li><input type="checkbox" name="out_main_cd" id="out_main_cd_4" value="34" style="vertical-align: middle;" disabled="disabled"/>&nbsp;발전플랜트</li>
									<li><input type="checkbox" name="out_main_cd" id="out_main_cd_5" value="35" style="vertical-align: middle;" disabled="disabled"/>&nbsp;화공플랜트</li>
									<li><input type="checkbox" name="out_main_cd" id="out_main_cd_6" value="36" style="vertical-align: middle;" disabled="disabled"/>&nbsp;환경플랜트</li>
									<li><input type="checkbox" name="out_main_cd" id="out_main_cd_7" value="37" style="vertical-align: middle;" disabled="disabled"/>&nbsp;제약플랜트</li>
								</ul>
							</div>
						</td>
					</tr>
					<tr >
						<th rowspan="2">
							첨부파일
						</th>
						<td colspan="3" id="input01">
								<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<%
							if(getFileListRowSet.size() > 0){
								int i_mod = 0;
								for(int i = 0; getFileListRowSet.size() > i; i++){
									i_mod = i%3;
									if(i_mod == 0){ %>
										<TR>
								<%	} %>
											<td width="2%">
											<input type="checkbox" name="<%=getFileListRowSet.getRow(i).get("DETAILSORTNM") %>" value="<%=getFileListRowSet.getRow(i).get("DETAILCD") %>" style="cursor:pointer;" onClick="fileCheck(this,'<%=getFileListRowSet.getRow(i).get("DETAILCD") %>')" <%if(!getFileListRowSet.getRow(i).get("DOC_CD").equals("")){out.print("checked");} %> disabled="disabled">
											</td>
											<td width="20%">
											<%=getFileListRowSet.getRow(i).get("DETAILNM") %>
											</td>
											<td width="7%" height="24">
											<IMG src="/img/supplier/button/bt_attach_file.gif" id="<%=getFileListRowSet.getRow(i).get("DETAILCD") %>" alt="첨부파일 관리" align="top" style="display:<%if(!getFileListRowSet.getRow(i).get("DOC_CD").equals("")){out.print("inline");}else{out.print("none");} %>" onClick="doAttachFile(document.form1.p_corp_id, '<%=getFileListRowSet.getRow(i).get("DETAILCD") %>', '<%=getFileListRowSet.getRow(i).get("DETAILNM")%>');" class="button">
											</td>
								<%	if(i_mod == 2) { %>		
										</TR>
								<%	} %>		
							<%
								}
								for(int i=i_mod+1; i<3; i++){ %>
									<td></td>
							<%	}
								if(i_mod == 0 || i_mod == 1){ %>
									</TR>	
							<%	}
							}
						%>
							</table>
						</TD>
					</tr>
					<tr>
						<td colspan="3" id="input01">
							<textarea name="p_AttachFile1" id="p_AttachFile1" style="width:85%;height:80px" rows="1" class="input" readOnly></textarea>
							<!-- <img id="search_spot_button" src='/img/buyer/button/bt_change.gif' border='0'  align="top" align='absmiddle' alt='[Attach File]' style='cursor:pointer; vertical-align: middle; margin-bottom: 20px;'> -->
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
  </div>	
  </td>
  </tr>
</TABLE>
</FORM>
