<%--
  - FileName   : PuSupplierList.jsp
  - Author(s)  : Sung Min Lee
  - Date       : 2014.06.17
  - Copyright  : Copyright (c) 2002-2007 www.hwenc.com, Inc.
  -
  - Description: 협력업체현황
--%>
  
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="com.udapsoft.waf.common.ui.*" %>
<%@ page import="com.udapsoft.waf.common.util.DateUtil"%>
<%@ 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();
    ValueObject user = storage.getUser();
    String event = storage.getEvent();
    ValueObject authYN = storage.getValueObject("Auth");
    
    
    RowSet materialKindCodeLv1 = storage.getRowSet("materialKindCodeLv1");
	RowSet materialKindCodeLv2 = new RowSetImpl();
	RowSet materialKindCodeLv3 = new RowSetImpl();
	
	RowSet nationRowSet = new RowSetImpl();
	
	
	RowSet suppStatusRowSet = storage.getRowSet("SuppStatusRowSet"); //상태값
	String sToday = DateUtil.getSystemDate().substring(0,8);
	
%>
<script type="text/javascript" src="/js/creditEvaluationPop.js"></script>
<script language="javascript">
	/*예약함수*/
	var sheet1 = new ibsheetObject();
	var sheet1Row;
	var sheet1PageNo = 1;
	var pageLastRowIndex = 1;
	var validationResult = false;
	var filterShow = false;
	
	
	$(document).on("keyup", "input:text", function(e) {
	    if($(this).attr("numberOnly") == "true")
        {
	        $(this).val( $(this).val().replace(/[^0-9]/gi,"") );
        }
	    
	    if (e.keyCode == 13)
        {
	        $.searchList();
        }
	    
	});
	
	
	
$(function(){
	if(<%=storage.getUser().get("ACCT_TYPE_CODE").equals("ADMIN")%> || <%=authYN.get("AUTH_CHK").equals("Y")%>){
	    $("#span_btn_email").show();
	    $("#span_btn_send").show();
	    $("#span_btn_sms").show();
	    $("#span_btn_sms_send").show();
    }else{
	    $("#span_btn_email").hide();
	    $("#span_btn_send").hide();
	    $("#span_btn_sms").hide();
	    $("#span_btn_sms_send").hide();
    }
    
    $.gridInit = function()
	{
		var init_sheet = {};
		init_sheet.Cfg = {SearchMode:2, Page:30, MergeSheet:msHeaderOnly};
		init_sheet.Cols = [
									{Header:"Status",													Type:"Status", 		    SaveName:"STATUS", 					Width:0, 		Align:"Center", 	Edit:"False",  Hidden:"True"},
									{Header:"선택|선택",												Type:"CheckBox", 		SaveName:"checkBox",			Width:60, 		Align:"Left", 		Edit:"True"},
									{Header:"대표공종|대분류",												Type:"Text", 			SaveName:"GUBUN_1",					Width:100, 		Align:"Left", 		Edit:"False"},
									{Header:"대표공종|중분류",												Type:"Text", 			SaveName:"GUBUN_2",					Width:100, 		Align:"Left", 		Edit:"False"},
									{Header:"대표공종|공종명",												Type:"Text", 			SaveName:"GUBUN_3",					Width:100, 		Align:"Left", 		Edit:"False"},
									{Header:"사업자번호|사업자번호",										Type:"Text",	 		SaveName:"CORP_REG_NO",			    Width:100, 		Align:"Left", 		Format:"SaupNo",	Edit:"False"},
									{Header:"☞업체명|☞업체명",											Type:"Text", 			SaveName:"CORP_KOR",				Width:150, 		Align:"Left", 		Edit:"False"},
									{Header:"국내외구분코드|국내외구분코드",							        Type:"Text", 			SaveName:"IN_OUT_DIV_CODE",		    Width:100, 		Align:"Center", 	Hidden:"True"},
									{Header:"국내외구분|국내외구분",										Type:"Text", 			SaveName:"IN_OUT_DIV",				Width:100, 		Align:"Center",	Edit:"False"},
									{Header:"대표자명|대표자명",											Type:"Text", 			SaveName:"REP_NAME",				Width:100, 		Align:"Left", 		Edit:"False"},
// 									{Header:"사업자구분|사업자구분",										Type:"Text", 			SaveName:"CORP_DIV_CD",			    Width:100, 		Align:"Center",		Edit:"True"},
									{Header:"등록신청일|등록신청일",										Type:"Text", 			SaveName:"REG_DT",					Width:100, 		Align:"Center", 	Edit:"False"},
									{Header:"등록승인일/\n거래취소일|등록승인일/\n거래취소일",	                Type:"Text", 			SaveName:"APPR_CAN_DT",			    Width:100, 		Align:"Center", 	Edit:"False"},
									{Header:"평가기관코드|평가기관코드",									    Type:"Text", 			SaveName:"CREDIT_CORP_CD",		    Width:0, 		Align:"Center", 	Hidden:"True"},
									{Header:"입찰상한액|입찰상한액",										Type:"Text", 			SaveName:"BID_AMT",		        	Width:100, 		Align:"Right" , 	Edit:"False"},
									{Header:"☞경영평가|☞경영평가",										Type:"Text", 			SaveName:"APPR_TOT_RATE",		    Width:100, 		Align:"Center",	Edit:"False"},
									{Header:"☞신용등급|☞신용등급",										Type:"Text", 			SaveName:"CREDIT_GRADE",			Width:100, 		Align:"Center",	Edit:"False"},
									{Header:"상태|상태",													Type:"Text", 			SaveName:"CORP_STATUS",			    Width:100, 		Align:"Center", 	Edit:"False"},
									{Header:"계약현황|계약현황",											Type:"Text", 			SaveName:"CONT_CNT",			    Width:900, 		Align:"Left",    	Edit:"False"},
									{Header:"CORP_ID|CORP_ID",											Type:"Text", 			SaveName:"CORP_ID",					Width:0, 		Align:"Center",		Hidden:"True"},
									{Header:"EVAL_CMP|EVAL_CMP",									    Type:"Text", 			SaveName:"EVAL_CMP",				Width:0, 		Align:"Center", 	Hidden:"True"},
									{Header:"DOC_CD|DOC_CD",											Type:"Text", 			SaveName:"DOC_CD",					Width:0, 		Align:"Center", 	Hidden:"True"},
									{Header:"ARR_ID|ARR_ID",											Type:"Text", 			SaveName:"ARR_ID",					Width:0, 		Align:"Center", 	Hidden:"True"},
									{Header:"APPR_DY|APPR_DY",										    Type:"Text", 			SaveName:"APPR_DY",					Width:0, 		Align:"Center", 	Hidden:"True"},
									{Header:"YEAR_STD|YEAR_STD",	   								    Type:"Text", 			SaveName:"YEAR_STD",			    Width:0, 		Align:"Center", 	Hidden:"True", 	Edit:"False"}
		                   		];
		
		
		init_sheet.HeaderMode = {Sort:1};
		IBS_InitSheet(sheet1, init_sheet);
		sheet1.SetDataAutoTrim(0);
		//sheet1.SetEditable(false);
		sheet1.SetDataLinkMouse("CORP_KOR", 1);
		sheet1.SetColFontColor("CORP_KOR", "#0000ff");
		sheet1.SetDataLinkMouse("APPR_TOT_RATE", 1);
		sheet1.SetColFontColor("APPR_TOT_RATE", "#0000ff");
		sheet1.SetDataLinkMouse("CREDIT_GRADE", 1);
		sheet1.SetColFontColor("CREDIT_GRADE", "#0000ff");
		
		sheet1.FitColWidth("5");
	}
	    
	    
		$("#btn_reg").click(function(){
 			$("#fevent").val("REG_DATA");
		    
			$("#p_doc_cd").val("11");
			$("#p_in_out_div").val("O");
			
			$("#form1").attr("action", "/supplier/outside/OutSupplier.screen");
			$("#form1").attr("target", "_self");
			$("#form1").attr("method", "post");
			$("#form1").submit();
		});
		
		$("#btnsearch").click(function(){
			//2017.09.01 검색조건 하나는 지정 공종,사업자번호,국내/해외,업체명,상태,국가명      
			if($("#material_Kind_Code_Lv1").val().trim() == "" && $("#corp_no").val().trim() == ""  && $("#in_out_gubun").val().trim() == "" && $("#corp_name").val().trim() == "" && $("#corp_status").val().trim() == "" && $("#nation_cd").val().trim() == "" ){
				alert("검색조건을 지정하십시요.");
				return;
			}
		    $.searchList();
		});
		
		$("#btn_excel").click(function(){
	        var params = {FileName:"외주 협력업체현황.xls",SheetName:"외주 협력업체현황",Merge:1,SheetDesign:1, HiddenColumn:1};
	        sheet1.Down2Excel (params);
	    });
		
		/* $("#btn_regist").click(function(){
		    
		    $("#fevent").val("REG_DATA");
		    
			$("#p_doc_cd").val("11");
			$("#p_in_out_div").val("O");
	        
		    
			$("#form1").attr("action", "/supplier/outside/OutSupplier.screen");
			$("#form1").attr("target", "_self");
			$("#form1").attr("method", "post");
			$("#form1").submit();
		    
		}); */
		
		
		$("#material_Kind_Code_Lv1").change(function(){
		    
		    var f = document.form1;
		    
		    if($("#material_Kind_Code_Lv1").val().trim() == "")
		    {
			    $("#material_Kind_Code_Lv2").empty().data("options"); 
			    $("#material_Kind_Code_Lv2").append("<option value=''>-- 전체 --</option>");
			    
			    $("#material_Kind_Code_Lv3").empty().data("options"); 
			    $("#material_Kind_Code_Lv3").append("<option value=''>-- 전체 --</option>");
		    }
		    else
		    {
		        $("#fevent").val("GET_MATL_KIND_CODE_LV2");
			    
			    $("#materiallevel").val("2");
			    $("#materialgroup").val($("#material_Kind_Code_Lv1").val());
			    
			    
			    submitXmlRequest("/supplier/outside/OutSupplierList_form.screen", "GET_MATL_KIND_CODE_LV2", f, "ROWSET");
		    }   
		});
		
		
		
		$("#material_Kind_Code_Lv2").change(function(){
		    
		    var f = document.form1;
		    
		    if($("#material_Kind_Code_Lv2").val().trim() == "")
		    {
			    $("#material_Kind_Code_Lv3").empty().data("options"); 
			    $("#material_Kind_Code_Lv3").append("<option value=''>-- 전체 --</option>");
			    
			    $.searchList();
		    }
		    else
		    {
		        $("#fevent").val("GET_MATL_KIND_CODE_LV3");
			    
			    $("#materiallevel").val("3");
			    $("#materialgroup").val($("#material_Kind_Code_Lv2").val());
			    
			    
			    submitXmlRequest("/supplier/outside/OutSupplierList_form.screen", "GET_MATL_KIND_CODE_LV3", f, "ROWSET");
		    }    
		});
		
		$("#material_Kind_Code_Lv3").change(function(){
		    $.searchList();
		});
		
		
		$("#in_out_gubun").change(function(){
		    
		    var f = document.form1;
		    if($("#in_out_gubun").val() == "O")
	        {
		        $("#fevent").val("GET_NATION");
			    
			    submitXmlRequest("/supplier/purchase/PuSupplierList_form.screen", "GET_NATION", f, "ROWSET");
	        }
		    else
	        {
		        $("#nation_cd").empty().data("options"); 
			    $("#nation_cd").append("<option value=''>-- 전체 --</option>");
	        }
		    
		    $("#btn_search").click();
		});
		
		
		$.searchList = function()
		{	
			$("#fevent").val("GET_LIST_READ");
			
			var url = Modular.model.PageContext.CONTEXT_ROOT + "/supplier/outside/OutSupplierList_sheet.screen";
			Modular.view.IBSheet7.doSearch(sheet1, url, $("#form1"), 30, ""); 
		}
		
		$("#btn_email").click(function (){
		    var win_id = "Subemail";
			var link = "/supplier/outside/QuotSupplierEmail.screen";
			    link += "?pop_win_id="+win_id;
			    //link += "&searchDateStart=" + jQuery("#searchDateStart").val();
			    //link += "&searchDateEnd=" + jQuery("#searchDateEnd").val();
			    link += "&pageDiv=1";	//1:조달, 2:포탈
			    fLayerPop(win_id, link, 980, 250, '', '', 'NO');
		});
		
		
		$("#btn_send").click(function(){
			if(!confirm("메일을 전송하시겠습니까?")) return;
		    $("#fevent").val("QUOT_EMAIL_SEND");
			var url = Modular.model.PageContext.CONTEXT_ROOT + "/supplier/outside/OutSupplierList_sheet.screen";
			var result = Modular.view.IBSheet7.doSave(sheet1, url, $("#form1"), false);
		});
		
		$("#btn_sms").click(function (){
		    var win_id = "Subsms";
			var link = "/supplier/outside/QuotSupplierSms.screen";
			    link += "?pop_win_id="+win_id;
			    //link += "&searchDateStart=" + jQuery("#searchDateStart").val();
			    //link += "&searchDateEnd=" + jQuery("#searchDateEnd").val();
			    link += "&pageDiv=1";	//1:조달, 2:포탈
			    fLayerPop(win_id, link, 600, 80, '', '', 'NO');
		});
		
		
		$("#btn_sms_send").click(function(){
			if(!confirm("SMS를 전송하시겠습니까?")) return;
		    $("#fevent").val("QUOT_SMS_SEND");
			var url = Modular.model.PageContext.CONTEXT_ROOT + "/supplier/outside/OutSupplierList_sheet.screen";
			var result = Modular.view.IBSheet7.doSave(sheet1, url, $("#form1"), false);
		});
		
	});
	
	
	
	$(document).ready(function(){
	    
	    $.gridInit();
// 	    $.searchList();
		autoResize();
		
		
		var material_Kind_Code_Lv1 = "<%=params.get("material_Kind_Code_Lv1")%>";
		
		if(material_Kind_Code_Lv1.trim() != "")
	    {
		    $("#material_Kind_Code_Lv1").change();
	    }
		else
	    {
		    //$.searchList();
	    }
		
	});
	
	
	function SubemailClose(){
		setTimeout(function(){fLayerPopClose('Subemail');},100);
	}
	
	function SubesmsClose(){
		setTimeout(function(){fLayerPopClose('Subsms');},100);
	}
	
	function autoResize(){
		var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title").scrollHeight + 24;
		var iframeHeight= document.body.scrollHeight - t1_height;   
		var iframeWidth= document.body.scrollWidth;   
		
		
		sheet1.SetSheetHeight(iframeHeight); 
	}	
	
	
	function doResult(resultObj) {
		try {
			if ( resultObj.getRequestEvent() == "GET_MATL_KIND_CODE_LV2" ) 
			{
				if ( resultObj.getSuccess() == true ) 
				{
				    var rowSet	= resultObj.getRowSet();
				    
				    $("#material_Kind_Code_Lv2").empty().data("options"); 
				    $("#material_Kind_Code_Lv2").append("<option value=''>-- 전체 --</option>");
				    
				    for ( var i = 0; i < rowSet.getRowSize(); i++ )	
				    {
				        $("#material_Kind_Code_Lv2").append("<option value='"+rowSet.getColValue( i, 0 )+"'>" + rowSet.getColValue( i, 1 )+"</option>");
					}
				    
				    
				    if($("#material_Kind_Code_Lv1").val() == "") 
				    {
					    $("#material_Kind_Code_Lv2").empty().data("options"); 
					    $("#material_Kind_Code_Lv2").append("<option value=''>-- 전체 --</option>");
					}
				    
				    if($("#material_Kind_Code_Lv3").val() == "") 
				    {
					    $("#material_Kind_Code_Lv3").empty().data("options"); 
					    $("#material_Kind_Code_Lv3").append("<option value=''>-- 전체 --</option>");
					}
					
				    document.form1.isSubmit = false;
				    
					var material_Kind_Code_Lv2 = "<%=params.get("material_Kind_Code_Lv2")%>";
				    
				    if(material_Kind_Code_Lv2.trim() != "")
			        {
// 				        $("#material_Kind_Code_Lv2 option:eq("+material_Kind_Code_Lv2+")").attr("selected", "selected");
				        $("#material_Kind_Code_Lv2").val(material_Kind_Code_Lv2).attr("selected", "selected");
				        $("#material_Kind_Code_Lv2").change();
			        }
				    
				    if("<%=params.get("material_Kind_Code_Lv3")%>".trim() == "" )
			        {
				        $.searchList();
			        }
				    
					
				} else {
                    dlgErrorMsg(resultObj);
                }
			}
			else if ( resultObj.getRequestEvent() == "GET_MATL_KIND_CODE_LV3" ) 
			{
				if ( resultObj.getSuccess() == true ) 
				{
				    var rowSet	= resultObj.getRowSet();
				    
				    $("#material_Kind_Code_Lv3").empty().data("options"); 
				    $("#material_Kind_Code_Lv3").append("<option value=''>-- 전체 --</option>");
				    
				    for ( var i = 0; i < rowSet.getRowSize(); i++ )	
				    {
				        $("#material_Kind_Code_Lv3").append("<option value='"+rowSet.getColValue( i, 0 )+"'>" + rowSet.getColValue( i, 1 )+"</option>");
					}
				    
				    if($("#material_Kind_Code_Lv2").val() == "") 
				    {
					    $("#material_Kind_Code_Lv3").empty().data("options"); 
					    $("#material_Kind_Code_Lv3").append("<option value=''>-- 전체 --</option>");
					}
					
					document.form1.isSubmit = false;
					
					var material_Kind_Code_Lv3 = "<%=params.get("material_Kind_Code_Lv3")%>";
				    
				    if(material_Kind_Code_Lv3.trim() != "")
			        {
// 				        $("#material_Kind_Code_Lv3 option:eq("+material_Kind_Code_Lv3+")").attr("selected", "selected");
				        $("#material_Kind_Code_Lv3").val(material_Kind_Code_Lv3).attr("selected", "selected");
			        }
				    
				    $.searchList();
				}
				else 
				{
                    dlgErrorMsg(resultObj);
                }
			}
			else if(resultObj.getRequestEvent() == "GET_CREADIT_REG_CHK")
		    {
			    document.form1.isSubmit = false;
			    
			    var url = resultObj.getValueObject().get("returnUrl");
			    
			    window.open(url, "pop", "width=1024,height=600, resizable=yes, scrollbars=yes");
		    }
			else if(resultObj.getRequestEvent() == "GET_CREADIT_REG_CHK2")
		    {
			    document.form1.isSubmit = false;
			    
			    var url = resultObj.getValueObject().get("return_url");
	            var open = window.open('',"go_ksrm","width=900,height=600,scrollbar=auto");
	            var f = document.form1;
	            
	            f.action = url;
	            f.target = "go_ksrm";
	            f.method = "post";
	            f.submit();
		    }
			else if(resultObj.getRequestEvent() == "GET_NATION")
		    {
			    if ( resultObj.getSuccess() == true ) 
				{
			        $("#nation_cd").empty().data("options"); 
				    $("#nation_cd").append("<option value=''>-- 전체 --</option>");
				    
				    var rowSet	= resultObj.getRowSet();
				    
				    for ( var i = 0; i < rowSet.getRowSize(); i++ )	
				    {
				        $("#nation_cd").append("<option value='"+rowSet.getColValue( i, 0)+"'>"+rowSet.getColValue( i, 1 ) + "</option>");
					}
				}
		    }
		}
		catch(errorObject) {
			showErrorDlg("doResult()", errorObject);
		}
	}

	
	function sheet1_OnDblClick(Row, Col, Value)
	{
	    
		var s_name = sheet1.ColSaveName(Col);
	    
	    if(s_name == "CORP_KOR")
	    {
	        if(sheet1.GetCellValue(Row, "IN_OUT_DIV_CODE") == "I")
            {
	            $("#fevent").val("GET_DETAIL");
	            $("#p_in_out_div").val("I");
            }
	        else
            {
	            $("#fevent").val("GET_OUT_DETAIL");
	            $("#p_in_out_div").val("O");
            }
	        $("#p_corp_id").val(sheet1.GetCellValue(Row, "CORP_ID"));
	        $("#p_corp_reg_no").val(sheet1.GetCellValue(Row, "CORP_REG_NO"));
	        $("#p_eval_cmp").val(sheet1.GetCellValue(Row, "EVAL_CMP"));
	        $("#p_doc_cd").val(sheet1.GetCellValue(Row, "DOC_CD"));
		    
		    $("#form1").attr("action", "/supplier/outside/OutSupplierReadOnly.screen");
			$("#form1").attr("target", "_self");
			$("#form1").attr("method", "post");
			$("#form1").submit();
	    }
	    else if (sheet1.ColSaveName(Col) == "APPR_TOT_RATE") {
		    var reportInfo = new ReportInfo();
		    
		    if(sheet1.GetCellValue(Row, "APPR_TOT_RATE").trim() != "" )
	        {
		    	if(sheet1.GetCellValue(Row, "DOC_CD") == "11")
		        {
			        reportInfo.title = "공사 협력업체 경영평가표(공사)";    
			        reportInfo.reportName = "/report/mrd/buyer/supplier/outside/OutSupplierReport13.mrd";
		        }
			    /*else if(sheet1.GetCellValue(Row, "DOC_CD") == "12")
		        {
			        reportInfo.title = "협력업체 현장평가표";    
			        reportInfo.reportName = "/report/mrd/buyer/supplier/outside/OutSuppFixApprReport.mrd";
		        }*/
		        if(sheet1.GetCellValue(Row, "DOC_CD") == "13")
		        {
			        reportInfo.title = "공사 협력업체 경영평가표(공사)";    
			        if (sheet1.GetCellValue(Row, "YEAR_STD") == "2018"){
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/outside/OutSupplierReport13_2018.mrd";
		        	}else if (sheet1.GetCellValue(Row, "YEAR_STD") == "2019"){
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/outside/OutSupplierReport13_2019.mrd";
		        	}else if (sheet1.GetCellValue(Row, "YEAR_STD") == "2022"){
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/outside/OutSupplierReport13_2022.mrd";
		        	}else{
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/outside/OutSupplierReport13.mrd";
		        	}
		        }
		        if(sheet1.GetCellValue(Row, "DOC_CD") == "14")
		        {
			        reportInfo.title = "공사 협력업체 경영평가표(설계.인허가)";    
			        if (sheet1.GetCellValue(Row, "YEAR_STD") == "2018"){
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/outside/OutSupplierReport14_2018.mrd";
		        	}else if (sheet1.GetCellValue(Row, "YEAR_STD") == "2022"){
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/outside/OutSupplierReport14_2022.mrd";
		        	}else{
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/outside/OutSupplierReport14.mrd";
		        	}
		        }
		        if(sheet1.GetCellValue(Row, "DOC_CD") == "15")
		        {
			        reportInfo.title = "해외 협력업체 경영평가표";    
			        reportInfo.reportName = "/report/mrd/buyer/supplier/outside/OutSupplierReport15.mrd";
		        }
		        
		        
		        
		        reportInfo.width = 1000;                         	// Default: 1024
		        reportInfo.height = 700;                         	// Default: 768

		        
		        reportInfo.set(sheet1.GetCellValue(Row, "CORP_ID"));    	// $1
		        reportInfo.set(sheet1.GetCellValue(Row, "ARR_ID"));    	// $2
		        reportInfo.set(sheet1.GetCellValue(Row, "APPR_DY").substring(0,4)); 
		        reportInfo.showPopup();
	        }
		}
	    else if(s_name == "CREDIT_GRADE")
        {
	        var code = sheet1.GetCellValue(Row, "CREDIT_CORP_CD");
	        var reg_no = sheet1.GetCellValue(Row, "CORP_REG_NO");

	        /*
	        	이크레더블 : E
	        	서울신용평가 : S
	        	나이스디앤비 : N
	        	한국기업데이터 : K
	        	나이스평가정보:M
	        	
	        */
	        if(code == "E")
            {
	            var u = "2d2d424547494e204349504845522d2d313131310000000b3030303030303030eef0492ff42855bbffb697d670d4e3d109dafed98f4d7900293e8d4b9c1dcebd28eb9d58fd4c815c4d4829f1415fdfb730302d2d454e44204349504845522d2d";
	            var p = "2d2d424547494e204349504845522d2d313131310000000830303030303030301bb8ae01f161a326e30cc8d45f3844afd1bd2d39f5da22e9405f40dff013966445d4ea4029f89ad1385c4624cf679cc230302d2d454e44204349504845522d2d";
	            var i = reg_no; //협력업체사업자번호
	            var k = ""; //협력업체법인번호
	            
	            var m ='3';
	            var link ='http://www.esrm.co.kr/esrm/SrmplusLogin?u='+ u +'&p='+ p +'&i='+ i +'&k='+ k +'&c=7&m='+ m +'&g=2';
	            var features ='height=768, width=1024, status=no, scrollbars=auto, resizable=yes';
	            window.open(link, 'watchwin', features);  
            }
	        else if(code == "S")
            {
	            var  link = "http://www.bizrating.co.kr/url/urlPage.do?param1=ZXRlY2g=&param2=YWV0ZWNo&param3=" + reg_no;
	            window.open(link, "pop", "width=975,height=600, resizable=yes, scrollbars=yes");
            }
	        else if(code == "N")
            {
	            var f = document.form1;
	            
	            $("#p_corp_reg_no").val(reg_no);
		        $("#fevent").val("GET_CREADIT_REG_CHK");
		        
	            submitXmlRequest("/supplier/purchase/PuSupplierList_form.screen", "GET_CREADIT_REG_CHK", f, "VALUEOBJECT");
            }
	        else if(code == "K")
            {
	            
	            var f = document.form1;
	            
	            $("#p_corp_reg_no").val(reg_no);
		        $("#fevent").val("GET_CREADIT_REG_CHK2");
		        
	            submitXmlRequest("/supplier/purchase/PuSupplierList_form.screen", "GET_CREADIT_REG_CHK2", f, "VALUEOBJECT");
	            
            }
	        else if(code == "M")
            {
	        	var vnk = "<%= sToday%>" * 677; 
	        	var  link = "http://service.ecredit.co.kr/p01/A0001M001.nice?bizno=" + reg_no + "&eid=ETECENC&nk=" + vnk;
	            window.open(link, "pop", "width=975,height=600, resizable=yes, scrollbars=yes");
	            
            }
	        
        }
	}
	
	function sheet1_OnSaveEnd(code, msg) {
        if(code >= 0) {
	        alert("전송되었습니다.");  // 저장 성공 메시지
	     }
        else {
        	alert(msg);
        }
	}
	
	document.body.onresize = addEvent( document.body.onresize, "autoResize()");
</script>


<modular:search id="form1">
	<modular:key id="fevent" />
</modular:search>
<form id="form1" name="form1" method="post" modular:type="search">
<INPUT type="hidden" name="fevent" id="fevent" value="" />
<INPUT type="hidden" name="p_corp_id" id="p_corp_id" value="" />
<INPUT type="hidden" name="p_corp_reg_no" id="p_corp_reg_no" value="" />
<INPUT type="hidden" name="p_eval_cmp" id="p_eval_cmp" value="" />
<INPUT type="hidden" name="p_doc_cd" id="p_doc_cd" value="" />
<input type="hidden" name="p_in_out_div" id="p_in_out_div" value="" />
<input type="hidden" name="chk_all" id="chk_all" value="false" />

<div align="left" id="title">
	<ul>
    	<li>외주_협력업체현황</li>
   	</ul>
</div>

<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%" id="search-table">
	<!-- 검색조건 영역 : 시작 -->
	<tr>
		<td height="1">
			<table cellspacing="1" cellpadding="0" class="search-form-table">
				<col width="10%">
				<col width="30%">
				<col width="10%">
				<col width="10%">
				<col width="10%">
				<col width="10%">
				<col width="20%">
				
				<tr height="25"> 
    			<!-- 검색조건 타이틀 1 -->
    				<th>
    					공종
    				</th>
   					<td>
  							<%= HTMLMaker.getSelectTag(materialKindCodeLv1, "materialgroup", "materialgroupname" , "material_Kind_Code_Lv1", "style='width:28%;height=18;'", "<OPTION value=''>-- 전체 --</OPTION>", params.get("material_Kind_Code_Lv1"), 0) %>
							<%= HTMLMaker.getSelectTag(materialKindCodeLv2, "materialgroup", "materialgroupname" , "material_Kind_Code_Lv2", "style='width:28%;height=18;'", "<OPTION value=''>-- 전체 --</OPTION>", params.get("material_Kind_Code_Lv2"), 0) %>
							<%= HTMLMaker.getSelectTag(materialKindCodeLv3, "materialgroup", "materialgroupname" , "material_Kind_Code_Lv3", "style='width:28%;height=18;'", "<OPTION value=''>-- 전체 --</OPTION>", params.get("material_Kind_Code_Lv3"), 0) %>
					</td>
    				<th>
        				사업자번호
    				</th>
    				<td >
    					<input type="text" name="corp_no" id="corp_no" style="width: 86%;"  value="<%=params.get("corp_no") %>" numberOnly="true" maxlength="10"/>
    				</td>
    				<th>
        				국내/해외 
    				</th> 
    				<td>
  						<select name="in_out_gubun" id="in_out_gubun" style="width: 70%;" class="input_select" height=18>
  							<option value=''>--전체--</option>
  							<option value="I" <%=params.get("in_out_gubun").equals("I") ? "selected=\"selected\" " : "" %>>국내</option>
  							<option value="O" <%=params.get("in_out_gubun").equals("O") ? "selected=\"selected\" " : "" %>>해외</option>
  						</select>
					</td>
				    <td rowspan="2" class="button" style="text-align: center;"> 
			         	<!-- 검색버튼 영역 : 시작 -->
            			<span class="btnSearch center"><a href="javascript:void(0);" id="btnsearch">검색</a></span>
            			<span class="btnSearch center"><a href="javascript:void(0);" id="btn_excel">엑셀저장</a></span>
            			<span class="btnSearch center" id="span_btn_email" style="display: none;"><a href="javascript:void(0);" id="btn_email">이메일</a></span>
			         	<span class="btnSearch center" id="span_btn_send" style="display: none;"><a href="javascript:void(0);" id="btn_send">이메일 보내기</a></span>
			         	<span class="btnSearch center" id="span_btn_sms" style="display: none;"><a href="javascript:void(0);" id="btn_sms">SMS</a></span>
			         	<span class="btnSearch center" id="span_btn_sms_send" style="display: none;"><a href="javascript:void(0);" id="btn_sms_send">SMS 보내기</a></span>
			         	<!-- <span class="btnSearch center"><a href="javascript:void(0);" id="btn_regist">해외업체 신규등록</a></span> -->
            			<!-- 검색버튼 영역 : 종료 -->  
    				</td>
  				</tr>

  				<tr height="25"> 
    				<!-- 검색조건 타이틀 1 -->
	    			<th>
	        			업체명
	    			</th>
    				<td>
      					<input type="text" name="corp_name" id="corp_name" style="width: 86%;"  value="<%=params.get("corp_name")%>"/>
    				</td>
    				<th>
	        			상태
	    			</th>
    				<td >
    					<%= HTMLMaker.getSelectTag(suppStatusRowSet, "DETAILCD", "DETAILNM", "corp_status", "width:70px;height=18;", "<option value=''>--전체--</option>", params.get("corp_status")) %>
    				</td>
    				<th>
    					국가명
    				</th>
    				<td>
    					<%= HTMLMaker.getSelectTag(nationRowSet, "detailcd", "detailnm" , "nation_cd", "style='width:70%;height=18;'", "<OPTION value=''>-- 전체 --</OPTION>", params.get("nation_cd"), 0) %>
    				</td>
    			</tr>
			</table>
		</td>
	</tr>
	<!-- 검색조건 영역 : 종료 -->

	<!-- 검색조건 영역, 테이터 영역 구분 여백 : 시작 -->
	<tr>
		<td height="1">
			<table border="0" cellspacing="0" cellpadding="0" class="search_data_div_height">
				<tr>
					<td>
					</td>				
				</tr>
			</table>
		</td>
	</tr>
	<!-- 검색조건 영역, 테이터 영역 구분 여백 : 종료 -->



	<!-- 검색조건 영역, 테이터 영역 구분 여백 : 종료 -->
</table>
</form>

<div style="width: 100%; height: 100%; margin-top: 5px;">
	<!-- 데이터 영역 : 시작 -->
	<!-- ibsheet7 그리드 생성 -->
		<script>createIBSheet("sheet1","100%", "250px");</script>
	<!-- 데이터 영역 : 종료 -->
</div>