<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="com.udapsoft.waf.common.ui.*" %>
<%@ 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);
	ValueObject user = ctx.getUser();
	String USER_ID = user.get("USER_ID");

	HandlerStorage storage = ctx.getHandlerStorage();
	ValueObject params = storage.getParams();
	
	RowSet secoreYear = new RowSetImpl();
	RowSet reportList = storage.getRowSet("reportList");
	RowSet getreportgubun = new RowSetImpl();
%>

<script type="text/javascript">
<!--
/*예약함수*/
var sheet1 = new ibsheetObject();
var sheet1Row;
var sheet1PageNo = 1;
var pageLastRowIndex = 1;
var validationResult = false;
var filterShow = false;


$(function(){
    
    $.gridInit = function(sheetName)
	{
	    var init_sheet = {};
		
		init_sheet.Cfg = {SearchMode:2, Page:30, MergeSheet:msAll};
		init_sheet.Cols = [
									{Header:"Status|Status|Status",						Type:"Status", 		SaveName:"STATUS", 					Width:10, 	Align:"Center",  Hidden:"True", ColMerge:"False"},
									{Header:"삭제|삭제|삭제",									Type:"DelCheck", 		SaveName:"DEL_CHECK", 				Width:40, 	Align:"Center", ColMerge:"False"},
									{Header:"순번|순번|순번",									Type:"Seq", 			SaveName:"NO",							Width:30, 	Align:"Center", Edit:"False"},
									{Header:"대분류|대분류|대분류",							Type:"Text", 			SaveName:"GUBUN_1",					Width:60, 	Align:"Left" },
									{Header:"중분류|중분류|중분류",							Type:"Text", 			SaveName:"GUBUN_2",					Width:60, 	Align:"Left"},
									{Header:"중간 배점|중간 배점|중간 배점",					Type:"Text", 			SaveName:"STOCK_RATE_M",			Width:60, 	Align:"Center"},
									{Header:"소분류|소분류|소분류",							Type:"Text", 			SaveName:"GUBUN_3", 					Width:150, 	Align:"Left"},
									{Header:"APPR_CD_1",										Type:"Text", 			SaveName:"APPR_CD_1", 				Width:0, 	Align:"Left", Hidden:"True", ColMerge:"False"},
									{Header:"APPR_CD_2",										Type:"Text", 			SaveName:"APPR_CD_2", 				Width:0, 	Align:"Left", Hidden:"True", ColMerge:"False"},
									{Header:"APPR_CD_3",										Type:"Text", 			SaveName:"APPR_CD_3", 				Width:0, 	Align:"Left", Hidden:"True", ColMerge:"False"},
									{Header:"배점|배점|배점",									Type:"Text", 			SaveName:"STOCK_RATE", 			Width:60, 	Align:"Left", ColMerge:"False", ColMerge:"False"},
									{Header:"배점|A|A기준내용",								Type:"Text", 			SaveName:"A_CONTENT", 				Width:60, 	Align:"Left", ColMerge:"False"},
									{Header:"배점|A|A배점",										Type:"Text",	 		SaveName:"A_RATE", 					Width:60, 	Align:"Center", ColMerge:"False"},
									{Header:"배점|A|A연산값",									Type:"Text",	 		SaveName:"A_CAL_VAL", 				Width:60, 	Align:"Center", ColMerge:"False"},
									{Header:"배점|B|B기준내용",								Type:"Text", 			SaveName:"B_CONTENT", 				Width:60, 	Align:"Left", ColMerge:"False"},
									{Header:"배점|B|B배점",										Type:"Int",	 			SaveName:"B_RATE", 					Width:60, 	Align:"Center", ColMerge:"False"},
									{Header:"배점|B|B연산값",									Type:"Text",	 		SaveName:"B_CAL_VAL", 				Width:60, 	Align:"Center", ColMerge:"False"},
									{Header:"배점|C|C기준내용",								Type:"Text", 			SaveName:"C_CONTENT", 				Width:60, 	Align:"Left", ColMerge:"False"},
									{Header:"배점|C|C배점",										Type:"Int",	 			SaveName:"C_RATE", 					Width:60, 	Align:"Center", ColMerge:"False"},
									{Header:"배점|C|C연산값",									Type:"Text",	 		SaveName:"C_CAL_VAL", 				Width:60, 	Align:"Center", ColMerge:"False"},
									{Header:"배점|D|D기준내용",								Type:"Text", 			SaveName:"D_CONTENT", 				Width:60, 	Align:"Left", ColMerge:"False"},
									{Header:"배점|D|D배점",										Type:"Int",	 			SaveName:"D_RATE", 					Width:60, 	Align:"Center", ColMerge:"False"},
									{Header:"배점|D|D연산값",									Type:"Text",	 		SaveName:"D_CAL_VAL", 				Width:60, 	Align:"Center", ColMerge:"False"},
									{Header:"배점|E|E기준내용",								Type:"Text", 			SaveName:"E_CONTENT", 				Width:60, 	Align:"Left", ColMerge:"False"},
									{Header:"배점|E|E배점",										Type:"Int",	 			SaveName:"E_RATE", 					Width:60, 	Align:"Center", ColMerge:"False"},
									{Header:"배점|E|E연산값",									Type:"Text",	 		SaveName:"E_CAL_VAL", 				Width:60, 	Align:"Center", ColMerge:"False"},
									{Header:"비고|비고|비고",									Type:"Text", 			SaveName:"NOTI", 						Width:60, 	Hidden:"True", Align:"Left", ColMerge:"False"},
									{Header:"PARENT_LEVEL",									Type:"Text", 			SaveName:"PARENT_LEVEL", 			Width:60, 	Hidden:"True", Align:"Left", ColMerge:"False"},
									{Header:"DEPTH",												Type:"Text", 			SaveName:"DEPTH", 						Width:60, 	Hidden:"True", Align:"Left", ColMerge:"False"},
									{Header:"ADM_YEAR",										Type:"Text", 			SaveName:"ADM_YEAR", 				Width:60, 	Hidden:"True", Align:"Left", ColMerge:"False"},
									{Header:"DOC_CD",											Type:"Text", 			SaveName:"DOC_CD", 					Width:60, 	Hidden:"True", Align:"Left", ColMerge:"False"},
									{Header:"삭제여부|삭제여부|삭제여부",					Type:"Combo", 		SaveName:"DEL_YN", 					Width:60, 	Align:"Center", ColMerge:"False", ComboText:"삭제가능|삭제불가", ComboCode:"Y|N"}
		                   		];
		
		
		init_sheet.HeaderMode = {Sort:0};
		IBS_InitSheet(sheetName, init_sheet);
		sheetName.SetDataAutoTrim(0);
// 		sheetName.SetEditable(true);
// 		sheetName.SetDataLinkMouse("MATERIAL_NAME");
// 		sheetName.SetColFontColor("CORP_KOR", "#0000ff");
 		sheetName.FitColWidth();
	}
    
    
    $.searchList = function()
	{
        $("#fevent").val("GET_LIST");
    	
    	var url = Modular.model.PageContext.CONTEXT_ROOT + "/common/ScoreManageList_sheet.screen";
    	Modular.view.IBSheet7.doSearch(sheet1, url, $("#form1"), 30, "");
	}
    
    
    
    $("#p_adm_year").change(function(){
        
        var f = document.form1;
        
        if($(':radio[name="p_job_div"]:checked').val() == undefined)
        {
    	    alert("구분을 선택해 주세요.");
    	    $("#p_adm_year").val("");
    	    return;
        }
        else
        {
            $("#fevent").val("GET_REPORT_GUBUN");
            submitXmlRequest("/common/ScoreManageList_form.screen", "GET_REPORT_GUBUN", f, "ROWSET");
        }
    });
    
    
    $("#p_doc_gubun").change(function(){
        
        var f = document.form1;
        
        $("#fevent").val("GET_ADM_YEAR_CNT");
        submitXmlRequest("/common/ScoreManageList_form.screen", "GET_ADM_YEAR_CNT", f, "VALUEOBJECT");
        
    });
    
    
    
    $(':radio[name="p_job_div"]').click(function(){
        
        var f = document.form1;
        
        $("#p_doc_gubun").empty().data("options"); 
	    $("#p_doc_gubun").append("<option value=''>-- 전체 --</option>");
	    
        
        $("#p_job_div_gubun").val($(':radio[name="p_job_div"]:checked').val());
        
        $("#fevent").val("GET_ADM_YEAR");
        submitXmlRequest("/common/ScoreManageList_form.screen", "GET_ADM_YEAR", f, "ROWSET");
        
    });
	
    
    
    
    $("#btn_search").click(function(){
        
        if($(':radio[name="p_job_div"]:checked').val() == undefined)
        {
    	    alert("구분을 선택해 주세요.");
    	    return;
        }
        else if($("#p_adm_year").val().trim() == "")
       	{
        	alert("평가년도를 선택해 주세요");
        	return;
       	}
    	else if($("#p_doc_gubun").val().trim() == "") 
   	    {
    	    alert("평가표 구분을 선택해 주세요");
        	return;
   	    }
    	else
   	    {
//     	    $("select[name='detailcd'] option").remove();
    	    
    	    
    	    $.searchList();
   	    }
    });
    
    
    $("#btn_save").click(function(){
        
        if($(':radio[name="p_job_div"]:checked').val() == undefined)
        {
    	    alert("구분을 선택해 주세요.");
    	    return;
        }
        else if($("#p_adm_year").val().trim() == "")
       	{
        	alert("평가년도를 선택해 주세요");
        	return;
       	}
    	else if($("#p_doc_gubun").val().trim() == "") 
   	    {
    	    alert("평가표 구분을 선택해 주세요");
        	return;
   	    }
        
        
        if(confirm("저장하시겠습니까?"))
        {
            $("#fevent").val("SAVE_DATA");                    
        	
    	    var url = Modular.model.PageContext.CONTEXT_ROOT + "/common/ScoreManageList_sheet.screen";
    		var result = Modular.view.IBSheet7.doSave(sheet1, url, $("#form1"), false);
        }
        
    });
    
    
    
    $("#btn_new").click(function(){
        
        var f = document.form1;
        var year = new Date();
        if($("#p_adm_year").val().trim() == "")
        {
            alert("평가년도를 선택해 주세요.");
            return;
        }
        
        if($("#p_doc_gubun").val().trim() != "" )
        {
        	if($("#p_adm_year").val() == year.getFullYear()+1){
        		alert(year.getFullYear()+2 + "년도 생성할 수 없습니다.");
        		return;
        	}else{
	            if(confirm("신규 평가표 추가를 하시겠습니까?"))
	            {
	                $("#fevent").val("SAVE_NEW_TEST");
	                
	                submitXmlRequest("/common/ScoreManageList_form.screen", "SAVE_NEW_TEST", f);  
	            }
        	}
        }
        else
        {
            alert("평가표 구분을 선택해 주세요.");
            return;
        }
        
    });
    
    
    
    /*
    $("#btn_up").click(function(){
        
        var nowRow = sheet1.GetSelectRow();
        
        if(sheet1.GetCellValue(nowRow, "DEL_YN") == "N")
        {
            alert("행 이동을를 할 수 없습니다.");
            return;
        }
        
        if(sheet1.GetCellValue(nowRow, "PARENT_LEVEL") != sheet1.GetCellValue(nowRow-1, "PARENT_LEVEL"))
        {
            alert("중분류가 달라 위치를 변경할 수 없습니다.");
            return;
        }
        else
        {
            //행추가
            sheet1.DataInsert();
            
            //윗행 데이터 밀어넣기
            sheet1.SetCellValue(nowRow+1, "ADM_YEAR", sheet1.GetCellValue(nowRow-1, "ADM_YEAR"));
            sheet1.SetCellValue(nowRow+1, "DOC_CD", $("#p_doc_gubun").val());
            sheet1.SetCellValue(nowRow+1, "GUBUN_1", sheet1.GetCellValue(nowRow-1, "GUBUN_1"));
            sheet1.SetCellValue(nowRow+1, "GUBUN_2", sheet1.GetCellValue(nowRow-1, "GUBUN_2"));
            sheet1.SetCellValue(nowRow+1, "GUBUN_3", sheet1.GetCellValue(nowRow-1, "GUBUN_3"));
            sheet1.SetCellValue(nowRow+1, "APPR_CD_1", sheet1.GetCellValue(nowRow-1, "APPR_CD_1"));
            sheet1.SetCellValue(nowRow+1, "APPR_CD_2", sheet1.GetCellValue(nowRow-1, "APPR_CD_2"));
            sheet1.SetCellValue(nowRow+1, "APPR_CD_3", sheet1.GetCellValue(nowRow-1, "APPR_CD_3"));
            sheet1.SetCellValue(nowRow+1, "STOCK_RATE", sheet1.GetCellValue(nowRow-1, "STOCK_RATE"));
            sheet1.SetCellValue(nowRow+1, "A_CONTENT", sheet1.GetCellValue(nowRow-1, "A_CONTENT"));
            sheet1.SetCellValue(nowRow+1, "A_RATE", sheet1.GetCellValue(nowRow-1, "A_RATE"));
            sheet1.SetCellValue(nowRow+1, "B_CONTENT", sheet1.GetCellValue(nowRow-1, "B_CONTENT"));
            sheet1.SetCellValue(nowRow+1, "B_RATE", sheet1.GetCellValue(nowRow-1, "B_RATE"));
            sheet1.SetCellValue(nowRow+1, "C_CONTENT", sheet1.GetCellValue(nowRow-1, "C_CONTENT"));
            sheet1.SetCellValue(nowRow+1, "C_RATE", sheet1.GetCellValue(nowRow-1, "C_RATE"));
            sheet1.SetCellValue(nowRow+1, "D_CONTENT", sheet1.GetCellValue(nowRow-1, "D_CONTENT"));
            sheet1.SetCellValue(nowRow+1, "D_RATE", sheet1.GetCellValue(nowRow-1, "D_RATE"));
            sheet1.SetCellValue(nowRow+1, "E_CONTENT", sheet1.GetCellValue(nowRow-1, "E_CONTENT"));
            sheet1.SetCellValue(nowRow+1, "E_RATE", sheet1.GetCellValue(nowRow-1, "E_RATE"));
            sheet1.SetCellValue(nowRow+1, "NOTI", sheet1.GetCellValue(nowRow-1, "NOTI"));
            sheet1.SetCellValue(nowRow+1, "PARENT_LEVEL", sheet1.GetCellValue(nowRow-1, "PARENT_LEVEL"));
            sheet1.SetCellValue(nowRow+1, "DEPTH", sheet1.GetCellValue(nowRow-1, "DEPTH"));
            
            //선택행 윗행에 밀어넣기
            sheet1.SetCellValue(nowRow-1, "ADM_YEAR", sheet1.GetCellValue(nowRow, "ADM_YEAR"));
            sheet1.SetCellValue(nowRow-1, "DOC_CD", $("#p_doc_gubun").val());
            sheet1.SetCellValue(nowRow-1, "GUBUN_1", sheet1.GetCellValue(nowRow, "GUBUN_1"));
            sheet1.SetCellValue(nowRow-1, "GUBUN_2", sheet1.GetCellValue(nowRow, "GUBUN_2"));
            sheet1.SetCellValue(nowRow-1, "GUBUN_3", sheet1.GetCellValue(nowRow, "GUBUN_3"));
            sheet1.SetCellValue(nowRow-1, "APPR_CD_1", sheet1.GetCellValue(nowRow, "APPR_CD_1"));
            sheet1.SetCellValue(nowRow-1, "APPR_CD_2", sheet1.GetCellValue(nowRow, "APPR_CD_2"));
            sheet1.SetCellValue(nowRow-1, "APPR_CD_3", sheet1.GetCellValue(nowRow, "APPR_CD_3"));
            sheet1.SetCellValue(nowRow-1, "STOCK_RATE", sheet1.GetCellValue(nowRow, "STOCK_RATE"));
            sheet1.SetCellValue(nowRow-1, "A_CONTENT", sheet1.GetCellValue(nowRow, "A_CONTENT"));
            sheet1.SetCellValue(nowRow-1, "A_RATE", sheet1.GetCellValue(nowRow, "A_RATE"));
            sheet1.SetCellValue(nowRow-1, "B_CONTENT", sheet1.GetCellValue(nowRow, "B_CONTENT"));
            sheet1.SetCellValue(nowRow-1, "B_RATE", sheet1.GetCellValue(nowRow, "B_RATE"));
            sheet1.SetCellValue(nowRow-1, "C_CONTENT", sheet1.GetCellValue(nowRow, "C_CONTENT"));
            sheet1.SetCellValue(nowRow-1, "C_RATE", sheet1.GetCellValue(nowRow, "C_RATE"));
            sheet1.SetCellValue(nowRow-1, "D_CONTENT", sheet1.GetCellValue(nowRow, "D_CONTENT"));
            sheet1.SetCellValue(nowRow-1, "D_RATE", sheet1.GetCellValue(nowRow, "D_RATE"));
            sheet1.SetCellValue(nowRow-1, "E_CONTENT", sheet1.GetCellValue(nowRow, "E_CONTENT"));
            sheet1.SetCellValue(nowRow-1, "E_RATE", sheet1.GetCellValue(nowRow, "E_RATE"));
            sheet1.SetCellValue(nowRow-1, "NOTI", sheet1.GetCellValue(nowRow, "NOTI"));
            sheet1.SetCellValue(nowRow-1, "PARENT_LEVEL", sheet1.GetCellValue(nowRow, "PARENT_LEVEL"));
            sheet1.SetCellValue(nowRow-1, "DEPTH", sheet1.GetCellValue(nowRow, "DEPTH"));
            
            //추가행 데이터 현재행에 넣기
            sheet1.SetCellValue(nowRow, "ADM_YEAR", sheet1.GetCellValue(nowRow+1, "ADM_YEAR"));
            sheet1.SetCellValue(nowRow, "DOC_CD", $("#p_doc_gubun").val());
            sheet1.SetCellValue(nowRow, "GUBUN_1", sheet1.GetCellValue(nowRow+1, "GUBUN_1"));
            sheet1.SetCellValue(nowRow, "GUBUN_2", sheet1.GetCellValue(nowRow+1, "GUBUN_2"));
            sheet1.SetCellValue(nowRow, "GUBUN_3", sheet1.GetCellValue(nowRow+1, "GUBUN_3"));
            sheet1.SetCellValue(nowRow, "APPR_CD_1", sheet1.GetCellValue(nowRow+1, "APPR_CD_1"));
            sheet1.SetCellValue(nowRow, "APPR_CD_2", sheet1.GetCellValue(nowRow+1, "APPR_CD_2"));
            sheet1.SetCellValue(nowRow, "APPR_CD_3", sheet1.GetCellValue(nowRow+1, "APPR_CD_3"));
            sheet1.SetCellValue(nowRow, "STOCK_RATE", sheet1.GetCellValue(nowRow+1, "STOCK_RATE"));
            sheet1.SetCellValue(nowRow, "A_CONTENT", sheet1.GetCellValue(nowRow+1, "A_CONTENT"));
            sheet1.SetCellValue(nowRow, "A_RATE", sheet1.GetCellValue(nowRow+1, "A_RATE"));
            sheet1.SetCellValue(nowRow, "B_CONTENT", sheet1.GetCellValue(nowRow+1, "B_CONTENT"));
            sheet1.SetCellValue(nowRow, "B_RATE", sheet1.GetCellValue(nowRow+1, "B_RATE"));
            sheet1.SetCellValue(nowRow, "C_CONTENT", sheet1.GetCellValue(nowRow+1, "C_CONTENT"));
            sheet1.SetCellValue(nowRow, "C_RATE", sheet1.GetCellValue(nowRow+1, "C_RATE"));
            sheet1.SetCellValue(nowRow, "D_CONTENT", sheet1.GetCellValue(nowRow+1, "D_CONTENT"));
            sheet1.SetCellValue(nowRow, "D_RATE", sheet1.GetCellValue(nowRow+1, "D_RATE"));
            sheet1.SetCellValue(nowRow, "E_CONTENT", sheet1.GetCellValue(nowRow+1, "E_CONTENT"));
            sheet1.SetCellValue(nowRow, "E_RATE", sheet1.GetCellValue(nowRow+1, "E_RATE"));
            sheet1.SetCellValue(nowRow, "NOTI", sheet1.GetCellValue(nowRow+1, "NOTI"));
            sheet1.SetCellValue(nowRow, "PARENT_LEVEL", sheet1.GetCellValue(nowRow+1, "PARENT_LEVEL"));
            sheet1.SetCellValue(nowRow, "DEPTH", sheet1.GetCellValue(nowRow+1, "DEPTH"));
            
            
            //코드값 재변경
            sheet1.SetCellValue(nowRow, "APPR_CD_1", sheet1.GetCellValue(nowRow-1, "APPR_CD_1"));
            sheet1.SetCellValue(nowRow, "APPR_CD_2", sheet1.GetCellValue(nowRow-1, "APPR_CD_2"));
            sheet1.SetCellValue(nowRow, "APPR_CD_3", sheet1.GetCellValue(nowRow-1, "APPR_CD_3"));
            
            sheet1.SetCellValue(nowRow-1, "APPR_CD_1", sheet1.GetCellValue(nowRow+1, "APPR_CD_1"));
            sheet1.SetCellValue(nowRow-1, "APPR_CD_2", sheet1.GetCellValue(nowRow+1, "APPR_CD_2"));
            sheet1.SetCellValue(nowRow-1, "APPR_CD_3", sheet1.GetCellValue(nowRow+1, "APPR_CD_3"));
            
            //추가된 행 제거.
            sheet1.RowDelete(nowRow+1, 0);
            
            //최초 선택행 선택
            sheet1.SelectCell(nowRow, 0); 
            
            
        }
        
//         $("#fevent").val("SAVE_DATA");
//         var url = Modular.model.PageContext.CONTEXT_ROOT + "/common/ScoreManageList_sheet.screen";
// 		var result = Modular.view.IBSheet7.doSave(sheet1, url, $("#form1"), false);
    });
    
    
    
    
	$("#btn_down").click(function(){
        
        var nowRow = sheet1.GetSelectRow();
        
        if(sheet1.GetCellValue(nowRow, "DEL_YN") == "N")
        {
            alert("행 이동을를 할 수 없습니다.");
            return;
        }
        
        if(sheet1.GetCellValue(nowRow, "PARENT_LEVEL") != sheet1.GetCellValue(nowRow+1, "PARENT_LEVEL"))
        {
            alert("중분류가 달라 위치를 변경할 수 없습니다.");
            return;
        }
        else
        {
            //행추가
            sheet1.DataInsert();
            
            //아래행 데이터 밀어넣기
            sheet1.SetCellValue(nowRow+1, "ADM_YEAR", sheet1.GetCellValue(nowRow, "ADM_YEAR"));
            sheet1.SetCellValue(nowRow+1, "DOC_CD", $("#p_doc_gubun").val());
            sheet1.SetCellValue(nowRow+1, "GUBUN_1", sheet1.GetCellValue(nowRow, "GUBUN_1"));
            sheet1.SetCellValue(nowRow+1, "GUBUN_2", sheet1.GetCellValue(nowRow, "GUBUN_2"));
            sheet1.SetCellValue(nowRow+1, "GUBUN_3", sheet1.GetCellValue(nowRow, "GUBUN_3"));
            sheet1.SetCellValue(nowRow+1, "APPR_CD_1", sheet1.GetCellValue(nowRow+2, "APPR_CD_1"));
            sheet1.SetCellValue(nowRow+1, "APPR_CD_2", sheet1.GetCellValue(nowRow+2, "APPR_CD_2"));
            sheet1.SetCellValue(nowRow+1, "APPR_CD_3", sheet1.GetCellValue(nowRow+2, "APPR_CD_3"));
            sheet1.SetCellValue(nowRow+1, "STOCK_RATE", sheet1.GetCellValue(nowRow, "STOCK_RATE"));
            sheet1.SetCellValue(nowRow+1, "A_CONTENT", sheet1.GetCellValue(nowRow, "A_CONTENT"));
            sheet1.SetCellValue(nowRow+1, "A_RATE", sheet1.GetCellValue(nowRow, "A_RATE"));
            sheet1.SetCellValue(nowRow+1, "B_CONTENT", sheet1.GetCellValue(nowRow, "B_CONTENT"));
            sheet1.SetCellValue(nowRow+1, "B_RATE", sheet1.GetCellValue(nowRow, "B_RATE"));
            sheet1.SetCellValue(nowRow+1, "C_CONTENT", sheet1.GetCellValue(nowRow, "C_CONTENT"));
            sheet1.SetCellValue(nowRow+1, "C_RATE", sheet1.GetCellValue(nowRow, "C_RATE"));
            sheet1.SetCellValue(nowRow+1, "D_CONTENT", sheet1.GetCellValue(nowRow, "D_CONTENT"));
            sheet1.SetCellValue(nowRow+1, "D_RATE", sheet1.GetCellValue(nowRow, "D_RATE"));
            sheet1.SetCellValue(nowRow+1, "E_CONTENT", sheet1.GetCellValue(nowRow, "E_CONTENT"));
            sheet1.SetCellValue(nowRow+1, "E_RATE", sheet1.GetCellValue(nowRow, "E_RATE"));
            sheet1.SetCellValue(nowRow+1, "NOTI", sheet1.GetCellValue(nowRow, "NOTI"));
            sheet1.SetCellValue(nowRow+1, "PARENT_LEVEL", sheet1.GetCellValue(nowRow, "PARENT_LEVEL"));
            sheet1.SetCellValue(nowRow+1, "DEPTH", sheet1.GetCellValue(nowRow, "DEPTH"));
            
//             //선택행에 데이터 밀어넣기
            sheet1.SetCellValue(nowRow, "ADM_YEAR", sheet1.GetCellValue(nowRow+2, "ADM_YEAR"));
            sheet1.SetCellValue(nowRow, "DOC_CD", $("#p_doc_gubun").val());
            sheet1.SetCellValue(nowRow, "GUBUN_1", sheet1.GetCellValue(nowRow+2, "GUBUN_1"));
            sheet1.SetCellValue(nowRow, "GUBUN_2", sheet1.GetCellValue(nowRow+2, "GUBUN_2"));
            sheet1.SetCellValue(nowRow, "GUBUN_3", sheet1.GetCellValue(nowRow+2, "GUBUN_3"));
//             sheet1.SetCellValue(nowRow, "APPR_CD_1", sheet1.GetCellValue(nowRow+2, "APPR_CD_1"));
//             sheet1.SetCellValue(nowRow, "APPR_CD_2", sheet1.GetCellValue(nowRow+2, "APPR_CD_2"));
//             sheet1.SetCellValue(nowRow, "APPR_CD_3", sheet1.GetCellValue(nowRow+2, "APPR_CD_3"));
            sheet1.SetCellValue(nowRow, "STOCK_RATE", sheet1.GetCellValue(nowRow+2, "STOCK_RATE"));
            sheet1.SetCellValue(nowRow, "A_CONTENT", sheet1.GetCellValue(nowRow+2, "A_CONTENT"));
            sheet1.SetCellValue(nowRow, "A_RATE", sheet1.GetCellValue(nowRow+2, "A_RATE"));
            sheet1.SetCellValue(nowRow, "B_CONTENT", sheet1.GetCellValue(nowRow+2, "B_CONTENT"));
            sheet1.SetCellValue(nowRow, "B_RATE", sheet1.GetCellValue(nowRow+2, "B_RATE"));
            sheet1.SetCellValue(nowRow, "C_CONTENT", sheet1.GetCellValue(nowRow+2, "C_CONTENT"));
            sheet1.SetCellValue(nowRow, "C_RATE", sheet1.GetCellValue(nowRow+2, "C_RATE"));
            sheet1.SetCellValue(nowRow, "D_CONTENT", sheet1.GetCellValue(nowRow+2, "D_CONTENT"));
            sheet1.SetCellValue(nowRow, "D_RATE", sheet1.GetCellValue(nowRow+2, "D_RATE"));
            sheet1.SetCellValue(nowRow, "E_CONTENT", sheet1.GetCellValue(nowRow+2, "E_CONTENT"));
            sheet1.SetCellValue(nowRow, "E_RATE", sheet1.GetCellValue(nowRow+2, "E_RATE"));
            sheet1.SetCellValue(nowRow, "NOTI", sheet1.GetCellValue(nowRow+2, "NOTI"));
            sheet1.SetCellValue(nowRow, "PARENT_LEVEL", sheet1.GetCellValue(nowRow+2, "PARENT_LEVEL"));
            sheet1.SetCellValue(nowRow, "DEPTH", sheet1.GetCellValue(nowRow+2, "DEPTH"));
            
//             //추가행 데이터 현재행에 넣기
            sheet1.SetCellValue(nowRow+2, "ADM_YEAR", sheet1.GetCellValue(nowRow+1, "ADM_YEAR"));
            sheet1.SetCellValue(nowRow+2, "DOC_CD", $("#p_doc_gubun").val());
            sheet1.SetCellValue(nowRow+2, "GUBUN_1", sheet1.GetCellValue(nowRow+1, "GUBUN_1"));
            sheet1.SetCellValue(nowRow+2, "GUBUN_2", sheet1.GetCellValue(nowRow+1, "GUBUN_2"));
            sheet1.SetCellValue(nowRow+2, "GUBUN_3", sheet1.GetCellValue(nowRow+1, "GUBUN_3"));
            sheet1.SetCellValue(nowRow+2, "APPR_CD_1", sheet1.GetCellValue(nowRow+1, "APPR_CD_1"));
            sheet1.SetCellValue(nowRow+2, "APPR_CD_2", sheet1.GetCellValue(nowRow+1, "APPR_CD_2"));
            sheet1.SetCellValue(nowRow+2, "APPR_CD_3", sheet1.GetCellValue(nowRow+1, "APPR_CD_3"));
            sheet1.SetCellValue(nowRow+2, "STOCK_RATE", sheet1.GetCellValue(nowRow+1, "STOCK_RATE"));
            sheet1.SetCellValue(nowRow+2, "A_CONTENT", sheet1.GetCellValue(nowRow+1, "A_CONTENT"));
            sheet1.SetCellValue(nowRow+2, "A_RATE", sheet1.GetCellValue(nowRow+1, "A_RATE"));
            sheet1.SetCellValue(nowRow+2, "B_CONTENT", sheet1.GetCellValue(nowRow+1, "B_CONTENT"));
            sheet1.SetCellValue(nowRow+2, "B_RATE", sheet1.GetCellValue(nowRow+1, "B_RATE"));
            sheet1.SetCellValue(nowRow+2, "C_CONTENT", sheet1.GetCellValue(nowRow+1, "C_CONTENT"));
            sheet1.SetCellValue(nowRow+2, "C_RATE", sheet1.GetCellValue(nowRow+1, "C_RATE"));
            sheet1.SetCellValue(nowRow+2, "D_CONTENT", sheet1.GetCellValue(nowRow+1, "D_CONTENT"));
            sheet1.SetCellValue(nowRow+2, "D_RATE", sheet1.GetCellValue(nowRow+1, "D_RATE"));
            sheet1.SetCellValue(nowRow+2, "E_CONTENT", sheet1.GetCellValue(nowRow+1, "E_CONTENT"));
            sheet1.SetCellValue(nowRow+2, "E_RATE", sheet1.GetCellValue(nowRow+1, "E_RATE"));
            sheet1.SetCellValue(nowRow+2, "NOTI", sheet1.GetCellValue(nowRow+1, "NOTI"));
            sheet1.SetCellValue(nowRow+2, "PARENT_LEVEL", sheet1.GetCellValue(nowRow+1, "PARENT_LEVEL"));
            sheet1.SetCellValue(nowRow+2, "DEPTH", sheet1.GetCellValue(nowRow+1, "DEPTH"));
            
            
//             //코드값 재변경
//             sheet1.SetCellValue(nowRow, "APPR_CD_1", sheet1.GetCellValue(nowRow-1, "APPR_CD_1"));
//             sheet1.SetCellValue(nowRow, "APPR_CD_2", sheet1.GetCellValue(nowRow-1, "APPR_CD_2"));
//             sheet1.SetCellValue(nowRow, "APPR_CD_3", sheet1.GetCellValue(nowRow-1, "APPR_CD_3"));
            
//             sheet1.SetCellValue(nowRow-1, "APPR_CD_1", sheet1.GetCellValue(nowRow+1, "APPR_CD_1"));
//             sheet1.SetCellValue(nowRow-1, "APPR_CD_2", sheet1.GetCellValue(nowRow+1, "APPR_CD_2"));
//             sheet1.SetCellValue(nowRow-1, "APPR_CD_3", sheet1.GetCellValue(nowRow+1, "APPR_CD_3"));
            
//             //추가된 행 제거.
            sheet1.RowDelete(nowRow+1, 0);
            
            //최초 선택행 선택
            sheet1.SelectCell(nowRow, 0); 
            
            
        }
    });
    */
    
    $("#btn_add").click(function(){
        
        var nowRow = sheet1.GetSelectRow();
        var appr_cd_3 = sheet1.GetCellValue(nowRow, "APPR_CD_3");
        
        var lastRow = sheet1.LastRow();
        
        
        if($(':radio[name="p_job_div"]:checked').val() == undefined)
        {
    	    alert("구분을 선택해 주세요.");
    	    return;
        }
        else if($("#p_adm_year").val().trim() == "")
       	{
        	alert("평가년도를 선택해 주세요");
        	return;
       	}
    	else if($("#p_doc_gubun").val().trim() == "") 
   	    {
    	    alert("평가표 구분을 선택해 주세요");
        	return;
   	    }
        
        
        /*
        if(sheet1.GetCellValue(nowRow, "DEL_YN") == "N")
        {
            alert("행 추가를 할 수 없습니다.");
            return;
        }
        */
        
        /*
        if(sheet1.GetCellValue(nowRow, "PARENT_LEVEL") == sheet1.GetCellValue(nowRow+1, "PARENT_LEVEL"))
        {
            sheet1.DataInsert();
            
            sheet1.SetCellValue(nowRow+1, "ADM_YEAR", sheet1.GetCellValue(nowRow, "ADM_YEAR"));
            sheet1.SetCellValue(nowRow+1, "DOC_CD", $("#p_doc_gubun").val());
            sheet1.SetCellValue(nowRow+1, "GUBUN_1", sheet1.GetCellValue(nowRow, "GUBUN_1"));
            sheet1.SetCellValue(nowRow+1, "GUBUN_2", sheet1.GetCellValue(nowRow, "GUBUN_2"));
            sheet1.SetCellValue(nowRow+1, "APPR_CD_1", sheet1.GetCellValue(nowRow, "APPR_CD_1"));
            sheet1.SetCellValue(nowRow+1, "APPR_CD_2", sheet1.GetCellValue(nowRow, "APPR_CD_2"));
            sheet1.SetCellValue(nowRow+1, "APPR_CD_3", sheet1.GetCellValue(nowRow, "APPR_CD_2") + leadingZeros(Number(appr_cd_3.substring(appr_cd_3.length-2, appr_cd_3.length)) +1, 2));
            
            sheet1.SetCellValue(nowRow+1, "PARENT_LEVEL", sheet1.GetCellValue(nowRow, "PARENT_LEVEL"));
            sheet1.SetCellValue(nowRow+1, "DEPTH", sheet1.GetCellValue(nowRow, "DEPTH"));
            
            
            for(i=1; i < sheet1.LastRow(); i++)
            {
                if(sheet1.GetCellValue(i, "PARENT_LEVEL") == sheet1.GetCellValue(nowRow, "PARENT_LEVEL"))
                {
                    if(sheet1.GetCellValue(i, "APPR_CD_3").substring(sheet1.GetCellValue(i, "APPR_CD_3").length-2, sheet1.GetCellValue(i, "APPR_CD_3").length) != "01")
                    {
                        sheet1.SetCellValue(i, "APPR_CD_3", sheet1.GetCellValue(i, "APPR_CD_2") + leadingZeros(Number(sheet1.GetCellValue(i-1, "APPR_CD_3").substring(sheet1.GetCellValue(i-1, "APPR_CD_3").length-2, sheet1.GetCellValue(i-1, "APPR_CD_3").length)) +1, 2));
                    }
                }
            }
        }
        else
        {
			sheet1.DataInsert();
            
            sheet1.SetCellValue(nowRow+1, "ADM_YEAR", sheet1.GetCellValue(nowRow, "ADM_YEAR"));
            sheet1.SetCellValue(nowRow+1, "DOC_CD", $("#p_doc_gubun").val());
            sheet1.SetCellValue(nowRow+1, "GUBUN_1", sheet1.GetCellValue(nowRow, "GUBUN_1"));
            sheet1.SetCellValue(nowRow+1, "GUBUN_2", sheet1.GetCellValue(nowRow, "GUBUN_2"));
            sheet1.SetCellValue(nowRow+1, "APPR_CD_1", sheet1.GetCellValue(nowRow, "APPR_CD_1"));
            sheet1.SetCellValue(nowRow+1, "APPR_CD_2", sheet1.GetCellValue(nowRow, "APPR_CD_2"));
            sheet1.SetCellValue(nowRow+1, "APPR_CD_3", sheet1.GetCellValue(nowRow, "APPR_CD_2") + leadingZeros(Number(appr_cd_3.substring(appr_cd_3.length-2, appr_cd_3.length)) +1, 2));
            
            sheet1.SetCellValue(nowRow+1, "PARENT_LEVEL", sheet1.GetCellValue(nowRow, "PARENT_LEVEL"));
            sheet1.SetCellValue(nowRow+1, "DEPTH", sheet1.GetCellValue(nowRow, "DEPTH"));
        }   
        */
        
        var idx = 0;
        var chk_cnt = 0;
        for(i=1; i < sheet1.LastRow(); i++)
        {
            if(sheet1.GetCellValue(nowRow, "PARENT_LEVEL") == sheet1.GetCellValue(i, "PARENT_LEVEL"))
            {
                if(chk_cnt == 0)
                {
                    chk_cnt = idx;
                }
                idx = i;
            }
        }
        
        sheet1.DataInsert(idx+1);
        
        sheet1.SetCellValue(idx+1, "ADM_YEAR", sheet1.GetCellValue(idx, "ADM_YEAR"));
        sheet1.SetCellValue(idx+1, "DOC_CD", $("#p_doc_gubun").val());
        sheet1.SetCellValue(idx+1, "GUBUN_1", sheet1.GetCellValue(idx, "GUBUN_1"));
        sheet1.SetCellValue(idx+1, "GUBUN_2", sheet1.GetCellValue(idx, "GUBUN_2"));
        sheet1.SetCellValue(idx+1, "APPR_CD_1", sheet1.GetCellValue(idx, "APPR_CD_1"));
        if($("#p_doc_gubun").val() == "12")
        {
            sheet1.SetCellValue(idx+1, "APPR_CD_2", sheet1.GetCellValue(idx, "APPR_CD_1") + leadingZeros(Number(sheet1.GetCellValue(idx, "APPR_CD_2").substring(sheet1.GetCellValue(idx, "APPR_CD_2").length-2, sheet1.GetCellValue(idx, "APPR_CD_2").length)) +1, 2));
        }
        else
        {
            sheet1.SetCellValue(idx+1, "APPR_CD_2", sheet1.GetCellValue(idx, "APPR_CD_2"));
            sheet1.SetCellValue(idx+1, "APPR_CD_3", sheet1.GetCellValue(idx, "APPR_CD_2") + leadingZeros(Number(sheet1.GetCellValue(idx, "APPR_CD_3").substring(sheet1.GetCellValue(idx, "APPR_CD_3").length-2, sheet1.GetCellValue(idx, "APPR_CD_3").length)) +1, 2));    
        }
        
        sheet1.SetCellValue(idx+1, "STOCK_RATE_M", sheet1.GetCellValue(idx, "STOCK_RATE_M"));
        sheet1.SetCellValue(idx+1, "PARENT_LEVEL", sheet1.GetCellValue(idx, "PARENT_LEVEL"));
        sheet1.SetCellValue(idx+1, "DEPTH", sheet1.GetCellValue(idx, "DEPTH"));
        sheet1.SetCellValue(idx+1, "DEL_YN", "Y");
        
        
      //배당점수 머지.
      /*
	    var idx = 1;
	    var idx2 = 1;
	    for(i=1; i < lastRow; i++)
        {
            sheet1.SetMergeCell(idx, 3, idx2++, 1);
            sheet1.SetMergeCell(idx, 4, idx2++, 1);
            sheet1.SetMergeCell(idx, 5, idx2++, 1);
            
            if(sheet1.GetCellValue(i, "APPR_CD_2") != sheet1.GetCellValue(i+1, "APPR_CD_2"))
            {   
	            idx = i+1;
	            idx2 = 1;
            }
            
            if(sheet1.GetCellValue(i, "DEL_YN") == "N")
            {
                sheet1.SetCellEditable(i, "DEL_CHECK", false);
            }
        }
	    */
	    
	    
	    
        
    });
    
    
});


	$(document).ready(function(){
		
	    $.gridInit(sheet1);
		autoResize();
		
		
		$("#btn_add_area").css("display", "none");
// 		$("#btn_save_area").css("display", "none");
		
		
	});


	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 leadingZeros(n, digits) {
		  var zero = '';
		  n = n.toString();
	
		  if (n.length < digits) {
		    for (var i = 0; i < digits - n.length; i++)
		      zero += '0';
		  }
		  return zero + n;
	}

	function sheet1_OnSearchEnd(code, message)
	{
	    var lastRow = sheet1.LastRow();
	    if($("#p_doc_gubun").val() == "12")
        {
	        sheet1.SetColHidden("GUBUN_3", true);
// 	        sheet1.SetColHidden("APPR_CD_3", true);
	        sheet1.SetColHidden("A_CONTENT", true);
	        sheet1.SetColHidden("A_CAL_VAL", true);
	        sheet1.SetColHidden("B_CONTENT", true);
	        sheet1.SetColHidden("B_CAL_VAL", true);
	        sheet1.SetColHidden("C_CONTENT", true);
	        sheet1.SetColHidden("C_CAL_VAL", true);
	        sheet1.SetColHidden("D_CONTENT", true);
	        sheet1.SetColHidden("D_CAL_VAL", true);
	        sheet1.SetColHidden("E_CONTENT", true);
	        sheet1.SetColHidden("E_CAL_VAL", true);
	        sheet1.SetColHidden("NOTI", true);
	        
	        
	        
	        
	        sheet1.SetColHidden("STOCK_RATE_M", true);
	        sheet1.FitColWidth();
        }
	    else
        {
	        sheet1.SetColHidden("GUBUN_3", false);
// 	        sheet1.SetColHidden("APPR_CD_3", false);
	        sheet1.SetColHidden("A_CONTENT", false);
	        sheet1.SetColHidden("A_CAL_VAL", false);
	        sheet1.SetColHidden("B_CONTENT", false);
	        sheet1.SetColHidden("B_CAL_VAL", false);
	        sheet1.SetColHidden("C_CONTENT", false);
	        sheet1.SetColHidden("C_CAL_VAL", false);
	        sheet1.SetColHidden("D_CONTENT", false);
	        sheet1.SetColHidden("D_CAL_VAL", false);
	        sheet1.SetColHidden("E_CONTENT", false);
	        sheet1.SetColHidden("E_CAL_VAL", false);
	        sheet1.SetColHidden("NOTI", false);
	        
	        sheet1.SetColHidden("STOCK_RATE_M", false);
        }
	    
	    //배당점수 머지.
	    
	    var idx = 1;
	    var idx2 = 1;
	    for(i=1; i <= lastRow; i++)
        {
            sheet1.SetMergeCell(idx, 5, idx2++, 1);
            
            if(sheet1.GetCellValue(i, "APPR_CD_2") != sheet1.GetCellValue(i+1, "APPR_CD_2"))
            {   
	            idx = i+1;
	            idx2 = 1;
            }
            
            if(sheet1.GetCellValue(i, "DEL_YN") == "N" || sheet1.GetCellValue(i, "DEL_YN") == "")
            {
                sheet1.SetCellEditable(i, "DEL_CHECK", false);
            }
            
            if($("#p_doc_gubun").val() == "12" || $("#p_doc_gubun").val() == "01" || $("#p_doc_gubun").val() == "02")
            {
                sheet1.SetCellEditable(i, "DEL_YN", false);
            }
        }
	    
	    
// 	    sheet1.SetMergeCell(1, 5, 3, 1);
// 	    sheet1.SetMergeCell(4, 5, 5, 1);
// 	    sheet1.FitColWidth();
	    
	    var cfg = {MergeSheet:msAll}
	    sheet1.SetConfig(cfg); 
	    
	    
	    if($("#p_doc_gubun").val() == "01" || $("#p_doc_gubun").val() == "02" || $("#p_doc_gubun").val() == "11")
        {
	        $("#btn_add_area").css("display", "none");
// 	        $("#btn_save_area").css("display", "none");
        }
	    else
        {
	        $("#btn_add_area").css("display", "");
// 	        $("#btn_save_area").css("display", "");
        }
	}
	
	function sheet1_OnChange(Row, Col, Value, OldValue)
	{
	    var saveName = sheet1.CellSaveName(Row, Col);
	    
	    if(saveName == "A_RATE")
        {
	        sheet1.SetCellValue(Row,  "STOCK_RATE", sheet1.GetCellValue(Row, "A_RATE"));
        }
	    else  if(saveName == "STOCK_RATE")
        {
	        sheet1.SetCellValue(Row,  "A_RATE", sheet1.GetCellValue(Row, "A_RATE"));
        }
	    else  if(saveName == "B_RATE")
        {
	        if(sheet1.GetCellValue(Row, "A_RATE") <= sheet1.GetCellValue(Row, "B_RATE"))
            {
	            alert("입력된 값이 평가 최대 점수보다 크거나 같습니다.");
	            return sheet1.SetCellValue(Row, "B_RATE", OldValue);
            }
        }
	    else  if(saveName == "C_RATE")
        {
	        if(sheet1.GetCellValue(Row, "A_RATE") <= sheet1.GetCellValue(Row, "C_RATE"))
            {
	            alert("입력된 값이 평가 최대 점수보다 크거나 같습니다.");
	            return sheet1.SetCellValue(Row, "C_RATE", OldValue);
            }
        }
	    else if(saveName == "D_RATE")
        {
	        if(sheet1.GetCellValue(Row, "A_RATE") <= sheet1.GetCellValue(Row, "D_RATE"))
            {
	            alert("입력된 값이 평가 최대 점수보다 크거나 같습니다.");
	            return sheet1.SetCellValue(Row, "D_RATE", OldValue);
            }
        }
	    else if(saveName == "E_RATE")
        {
	        if(sheet1.GetCellValue(Row, "A_RATE") <= sheet1.GetCellValue(Row, "E_RATE"))
            {
	            alert("입력된 값이 평가 최대 점수보다 크거나 같습니다.");
	            return sheet1.SetCellValue(Row, "E_RATE", OldValue);
            }
        }
	    else if(saveName == "DEL_YN")
        {
	        if(sheet1.GetCellValue(Row, "DEL_YN") == "Y")
            {
	            sheet1.SetCellEditable(Row, "DEL_CHECK", true);
            }
	        else
            {
	            sheet1.SetCellEditable(Row, "DEL_CHECK", false);
            }
        }
	}

	function sheet1_OnSaveEnd(code, msg)
	{
	    var event = $("#fevent").val();
		var f = document.form1;
		
		document.form1.isSubmit = false;
		
	    try {
	        if(event == "SAVE_DATA")
			{
	            if(code >= "0")
				{
	                alert("저장되었습니다.");
	                $.searchList();
				}
	            else
	            {
	                alert(code+":"+msg);
	            }
			}
	    }
	    catch(errorObject) {
	        showErrorDlg("doResult()", errorObject);
		}
	}
	
	
	function doResult(resultObj) {
	    try {
	        if ( resultObj.getRequestEvent() == "GET_REPORT_GUBUN" ) 
			{
				if ( resultObj.getSuccess() == true ) 
				{
				    var rowSet	= resultObj.getRowSet();
				    
				    $("#p_doc_gubun").empty().data("options"); 
				    $("#p_doc_gubun").append("<option value=''>-- 전체 --</option>");
				    
				    for ( var i = 0; i < rowSet.getRowSize(); i++ )	
				    {
				        $("#p_doc_gubun").append("<option value='"+rowSet.getColValue( i, 0 )+"'>" + rowSet.getColValue( i, 1 )+"</option>");
					}
					
				    document.form1.isSubmit = false;
					
				} else {
                    dlgErrorMsg(resultObj);
                }
			}
	        else if ( resultObj.getRequestEvent() == "GET_ADM_YEAR" )
            {
	            if ( resultObj.getSuccess() == true ) 
				{
				    var rowSet	= resultObj.getRowSet();
				    
				    $("#p_adm_year").empty().data("options"); 
				    $("#p_adm_year").append("<option value=''>-- 전체 --</option>");
				    
				    for ( var i = 0; i < rowSet.getRowSize(); i++ )	
				    {
				        $("#p_adm_year").append("<option value='"+rowSet.getColValue( i, 0 )+"'>" + rowSet.getColValue( i, 0 )+"</option>");
				        
// 				        if(rowSet.getColValue( i, 0 ) == rowSet.getColValue( i, 1 ))
// 			            {
// 				            $("#btn_new_area").css("display", "none");
// 			            }
// 				        else
// 			            {
// 				            $("#btn_new_area").css("display", "");
// 			            }
					}
					
				    document.form1.isSubmit = false;
					
				} else {
                    dlgErrorMsg(resultObj);
                }
            }
	        else if ( resultObj.getRequestEvent() == "SAVE_NEW_TEST" )
            {
	            if ( resultObj.getSuccess() == true ) 
				{
				    document.form1.isSubmit = false;
				    
				    alert("등록이 완료되었습니다.");
					location.href="/common/ScoreManageList.screen";
				    
				} else {
                    dlgErrorMsg(resultObj);
                }
            }
	        else if ( resultObj.getRequestEvent() == "GET_ADM_YEAR_CNT" )
            {
	            if ( resultObj.getSuccess() == true ) 
				{
				    document.form1.isSubmit = false;
				    
				    var vo = resultObj.getValueObject();
				    
				    if(vo.get("CNT") != "0")
			        {
				        $("#btn_new_area").css("display", "none");
			        }
				    else
			        {
				        $("#btn_new_area").css("display", "");
			        }
				    
				} else {
                    dlgErrorMsg(resultObj);
                }
            }
	        
	        
		}
		catch(errorObject) {
	        showErrorDlg("doResult()", errorObject);
		}
	}
	


//-->
</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_job_div_gubun" id="p_job_div_gubun" value="">

<div align="left" id="title">
	<ul>
    	<li>평가표 관리</li>
   	</ul>
</div> 
 
 
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="search-table">
	<!-- 검색조건 영역 : 시작 -->
	<tr>
		<td height="1">
			<table cellspacing="1" cellpadding="0" class="search-form-table">
				<col width="10%">
				<col width="25%">
				<col width="10%">
				<col width="25%">
				<col width="30%">

				<tr height="25"> 
    			<!-- 검색조건 타이틀 1 -->
    				<th>
    					구매/외주 구분
    				</th>
    				<td style="text-align: left;">
							<span><input type="radio" name="p_job_div" id="p_job_div_1" value="P"> 구매</span>
							<span style="margin-left: 50px;"><input type="radio" name="p_job_div" id="p_job_div_2" value="O"> 외주</span>
					</td>
    				<th>
    					평가년도
    				</th>
   					<td>
  						<%= HTMLMaker.getSelectTag(secoreYear, "ADM_YEAR", "ADM_YEAR", "p_adm_year", "width:100px;height=18;", "<option value= \"\">----선택----</option>", params.get("p_adm_year")) %>
					</td>
				    <td rowspan="2" class="search_button" align="center"> 
				    	<span class="btnSearch center"><a href="javascript:void(0);" id="btn_search">검색</a></span>
				    	<span class="btnSearch center" id="btn_new_area"><a href="javascript:void(0);" id="btn_new">신규</a></span>
				    	<span class="btnSearch center" id="btn_add_area"><a href="javascript:void(0);" id="btn_add">추가</a></span>
<!-- 				    	<span class="btnSearch center"><a href="javascript:void(0);" id="btn_up">위로</a></span> -->
<!-- 				    	<span class="btnSearch center"><a href="javascript:void(0);" id="btn_down">아래로</a></span> -->
				    	<span class="btnSearch center" id="btn_save_area"><a href="javascript:void(0);" id="btn_save">저장</a></span>
    				</td>
  				</tr>
  				<tr>
  					<th>
    					평가표 구분
    				</th>
    				<td colspan="3">
  						<%= HTMLMaker.getSelectTag(getreportgubun, "detailcd", "detailnm" , "p_doc_gubun", "style='width:200px;height=18;'", "<option value= \"\">----선택----</option>", "", 0) %>
					</td>
  				</tr>
			</table>
		</td>
	</tr>
	<!-- 검색조건 영역 : 종료 -->

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

<div id="sheet1_div" style="padding-top:5px; width:100%; height: 400px">
	<script>createIBSheet("sheet1","100%", "400px");</script>
</div>

</form>