<%--
  - FileName   : OutSuppFixApprPop.jsp
  --%>
<%@ 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();
	String event = storage.getEvent();
	
	ValueObject vo = storage.getValueObject("getAppr");
	RowSet getApprSrdList = storage.getRowSet("getApprSrdList");
	String status_cd = params.get("status_cd");
	String yyyymmdd = (new java.text.SimpleDateFormat ("yyyy년 MM월 dd일")).format (new java.util.Date());
	String appr_date = (new java.text.SimpleDateFormat ("yyyyMMdd")).format (new java.util.Date());
	
%>
 <script type="text/javascript">
 
 var chkVal = 0;
 
 	function test(obj, code)
 	{
 	    
		var id = document.getElementById(obj.getAttribute("id")).getAttribute("id"); 	   
		
 	   	var cnt = obj.name.substring(obj.name.lastIndexOf("_")+1, obj.name.length);
   		document.getElementById("result_" + cnt).innerHTML = obj.value;
   		
   		var cnt2 = id.substring(id.indexOf("_")+1, id.lastIndexOf("_"));
   		
		var appr_cd = "";   		
		var idx = 0;
		var idx2 = 0;
		var total_1 = 0;
		var total_2 = 0;
		var total_3 = 0;
		var total_4 = 0;
		var total_5 = 0;
		
		
		
		<%
		for(int k=0; k < getApprSrdList.size(); k++)
		{
		%>
		    if("01" == "<%=getApprSrdList.getRow(k).get("APPR_CD").substring(0,2)%>")
			{
	 	      total_1 += Number(document.getElementById("result_" + idx).innerHTML);
	 	      document.getElementById("totalAll_0").innerHTML = total_1;
				if(document.getElementById("test_"+cnt2+"_" + idx).checked)
				{
					if(cnt2 == "1")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "S";
				    }
					else if(cnt2 == "2")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "A";
				    }
					else if(cnt2 == "3")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "B";
				    }
					else if(cnt2 == "4")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "C";
				    }
					else if(cnt2 == "5")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "D";
				    }
					else
				    {
					    document.form1.chkResultCd_<%=k%>.value = "D";
				    }
				}
	 	      
	 	     idx++;
			}
		 	else if("02" == "<%=getApprSrdList.getRow(k).get("APPR_CD").substring(0,2)%>")
			{
	 	      	total_2 += Number(document.getElementById("result_" + idx).innerHTML);
	 	        document.getElementById("totalAll_1").innerHTML = total_2;
	 	        
	 	        if(document.getElementById("test_"+cnt2+"_" + idx).checked)
				{
					if(cnt2 == "1")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "S";
				    }
					else if(cnt2 == "2")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "A";
				    }
					else if(cnt2 == "3")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "B";
				    }
					else if(cnt2 == "4")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "C";
				    }
					else if(cnt2 == "5")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "D";
				    }
				}
	 	       
	 	     	idx++;
			}
		 	else if("03" == "<%=getApprSrdList.getRow(k).get("APPR_CD").substring(0,2)%>")
			{
	 	      	total_3 += Number(document.getElementById("result_" + idx).innerHTML);
	 	        document.getElementById("totalAll_2").innerHTML = total_3;
	 	        
	 	        if(document.getElementById("test_"+cnt2+"_" + idx).checked)
				{
					if(cnt2 == "1")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "S";
				    }
					else if(cnt2 == "2")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "A";
				    }
					else if(cnt2 == "3")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "B";
				    }
					else if(cnt2 == "4")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "C";
				    }
					else if(cnt2 == "5")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "D";
				    }
				}
	 	       
	 	     	idx++;
			}
		 	else if("04" == "<%=getApprSrdList.getRow(k).get("APPR_CD").substring(0,2)%>")
			{
	 	      	total_4 += Number(document.getElementById("result_" + idx).innerHTML);
	 	        document.getElementById("totalAll_3").innerHTML = total_4;
	 	        
	 	        if(document.getElementById("test_"+cnt2+"_" + idx).checked)
				{
					if(cnt2 == "1")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "S";
				    }
					else if(cnt2 == "2")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "A";
				    }
					else if(cnt2 == "3")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "B";
				    }
					else if(cnt2 == "4")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "C";
				    }
					else if(cnt2 == "5")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "D";
				    }
				}
	 	     	idx++;
			}
		 	else if("05" == "<%=getApprSrdList.getRow(k).get("APPR_CD").substring(0,2)%>")
			{
	 	      	total_5 += Number(document.getElementById("result_" + idx).innerHTML);
	 	        document.getElementById("totalAll_4").innerHTML = total_5;
	 	        
	 	        if(document.getElementById("test_"+cnt2+"_" + idx).checked)
				{
					if(cnt2 == "1")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "S";
				    }
					else if(cnt2 == "2")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "A";
				    }
					else if(cnt2 == "3")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "B";
				    }
					else if(cnt2 == "4")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "C";
				    }
					else if(cnt2 == "5")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "D";
				    }
				}
	 	     	idx++;
			}
				
		<%
		}
		%>
	document.getElementById("total_rate_all").innerHTML = total_1 + total_2 + total_3 + total_4 + total_5;
	document.getElementById("total_value").innerHTML = total_1 + total_2 + total_3 + total_4 + total_5;
	document.form1.appr_tot_rate.value = total_1 + total_2 + total_3 + total_4 + total_5;
	
		var total_test_value  = total_1 + total_2 + total_3 + total_4 + total_5;
	
		if(total_test_value >= 92)
	    {
		    document.getElementById("total_level").innerHTML = "S등급";
		    document.form1.item_std_cd.value = "S";
	    }
		else if(total_test_value >= 84)
	    {
		    document.getElementById("total_level").innerHTML = "A등급";
		    document.form1.item_std_cd.value = "A";
	    }
		else if(total_test_value >= 76)
	    {
		    document.getElementById("total_level").innerHTML = "B등급";
		    document.form1.item_std_cd.value = "B";
	    }
		else if(total_test_value >= 68)
	    {
		    document.getElementById("total_level").innerHTML = "C등급";
		    document.form1.item_std_cd.value = "C";
	    }
		else
	    {
		    document.getElementById("total_level").innerHTML = "D등급";
		    document.form1.item_std_cd.value = "D";
	    }
		
 	}
 	
 	
 	
 	
 	function test2(id, code)
 	{
 	    
		var id = document.getElementById(obj.getAttribute("id")).getAttribute("id"); 	   
		
 	   	var cnt = obj.name.substring(obj.name.lastIndexOf("_")+1, obj.name.length);
   		document.getElementById("result_" + cnt).innerHTML = obj.value;
   		
   		var cnt2 = id.substring(id.indexOf("_")+1, id.lastIndexOf("_"));
   		
		var appr_cd = "";   		
		var idx = 0;
		var idx2 = 0;
		var total_1 = 0;
		var total_2 = 0;
		var total_3 = 0;
		var total_4 = 0;
		var total_5 = 0;
		
		
		
		<%
		for(int k=0; k < getApprSrdList.size(); k++)
		{
		%>
		    if("01" == "<%=getApprSrdList.getRow(k).get("APPR_CD").substring(0,2)%>")
			{
	 	      total_1 += Number(document.getElementById("result_" + idx).innerHTML);
	 	      document.getElementById("totalAll_0").innerHTML = total_1;
				if(document.getElementById("test_"+cnt2+"_" + idx).checked)
				{
					if(cnt2 == "1")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "S";
				    }
					else if(cnt2 == "2")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "A";
				    }
					else if(cnt2 == "3")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "B";
				    }
					else if(cnt2 == "4")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "C";
				    }
					else if(cnt2 == "5")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "D";
				    }
					else
				    {
					    document.form1.chkResultCd_<%=k%>.value = "D";
				    }
				}
	 	     idx++;
			}
		 	else if("02" == "<%=getApprSrdList.getRow(k).get("APPR_CD").substring(0,2)%>")
			{
	 	      	total_2 += Number(document.getElementById("result_" + idx).innerHTML);
	 	        document.getElementById("totalAll_1").innerHTML = total_2;
	 	        
	 	        if(document.getElementById("test_"+cnt2+"_" + idx).checked)
				{
					if(cnt2 == "1")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "S";
				    }
					else if(cnt2 == "2")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "A";
				    }
					else if(cnt2 == "3")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "B";
				    }
					else if(cnt2 == "4")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "C";
				    }
					else if(cnt2 == "5")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "D";
				    }
				}
	 	     	idx++;
			}
		 	else if("03" == "<%=getApprSrdList.getRow(k).get("APPR_CD").substring(0,2)%>")
			{
	 	      	total_3 += Number(document.getElementById("result_" + idx).innerHTML);
	 	        document.getElementById("totalAll_2").innerHTML = total_3;
	 	        
	 	        if(document.getElementById("test_"+cnt2+"_" + idx).checked)
				{
					if(cnt2 == "1")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "S";
				    }
					else if(cnt2 == "2")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "A";
				    }
					else if(cnt2 == "3")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "B";
				    }
					else if(cnt2 == "4")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "C";
				    }
					else if(cnt2 == "5")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "D";
				    }
				}
	 	     	idx++;
			}
		 	else if("04" == "<%=getApprSrdList.getRow(k).get("APPR_CD").substring(0,2)%>")
			{
	 	      	total_4 += Number(document.getElementById("result_" + idx).innerHTML);
	 	        document.getElementById("totalAll_3").innerHTML = total_4;
	 	        
	 	        if(document.getElementById("test_"+cnt2+"_" + idx).checked)
				{
					if(cnt2 == "1")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "S";
				    }
					else if(cnt2 == "2")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "A";
				    }
					else if(cnt2 == "3")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "B";
				    }
					else if(cnt2 == "4")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "C";
				    }
					else if(cnt2 == "5")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "D";
				    }
				}
	 	     	idx++;
			}
		 	else if("05" == "<%=getApprSrdList.getRow(k).get("APPR_CD").substring(0,2)%>")
			{
	 	      	total_5 += Number(document.getElementById("result_" + idx).innerHTML);
	 	        document.getElementById("totalAll_4").innerHTML = total_5;
	 	        
	 	        if(document.getElementById("test_"+cnt2+"_" + idx).checked)
				{
					if(cnt2 == "1")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "S";
				    }
					else if(cnt2 == "2")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "A";
				    }
					else if(cnt2 == "3")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "B";
				    }
					else if(cnt2 == "4")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "C";
				    }
					else if(cnt2 == "5")
				    {
					    document.form1.chkResultCd_<%=k%>.value = "D";
				    }
				}
	 	     	idx++;
			}
		<%
		}
		%>
	document.getElementById("total_rate_all").innerHTML = total_1 + total_2 + total_3 + total_4 + total_5;
	document.getElementById("total_value").innerHTML = total_1 + total_2 + total_3 + total_4 + total_5;
	document.form1.appr_tot_rate.value = total_1 + total_2 + total_3 + total_4 + total_5;
	
	var total_test_value  = total_1 + total_2 + total_3 + total_4 + total_5;
	total_test_value = total_test_value; 
		if(total_test_value >= 92)
	    {
		    document.getElementById("total_level").innerHTML = "S등급";
		    document.form1.item_std_cd.value = "S";
	    }
		else if(total_test_value >= 84)
	    {
		    document.getElementById("total_level").innerHTML = "A등급";
		    document.form1.item_std_cd.value = "A";
	    }
		else if(total_test_value >= 76)
	    {
		    document.getElementById("total_level").innerHTML = "B등급";
		    document.form1.item_std_cd.value = "B";
	    }
		else if(total_test_value >= 68)
	    {
		    document.getElementById("total_level").innerHTML = "C등급";
		    document.form1.item_std_cd.value = "C";
	    }
		else
	    {
		    document.getElementById("total_level").innerHTML = "D등급";
		    document.form1.item_std_cd.value = "D";
	    }
		
 	}
 	
 	
 	
 	
 	function loadTest()
 	{
 	   <%
 	   for (int ll = 0; ll < getApprSrdList.size(); ll++) 
 	   {
 	   %>
 	  		var index = $(':radio[name="test_<%=ll%>"]').index($(':radio[name="test_<%=ll%>"]:checked')) +1;
 	  		
 	  		if(index == "1")
  		    {
 	  		    $("#test_1_<%=ll%>").click();
  		    }
 	  		else if(index == "2")
 	  		{
 	  		 	$("#test_2_<%=ll%>").click();
  		    }
 	  		else if(index == "3")
  		    {
 	  		 	$("#test_3_<%=ll%>").click();
  		    }
 	  		else if(index == "4")
  		    {
 	  		 	$("#test_4_<%=ll%>").click();
  		    }
 	  		else if(index == "5")
  		    {
 	  		 	$("#test_5_<%=ll%>").click();
  		    }
 	   <%
 	   }
 	   %>
 	}
 	
 	
 	
 	
 	
 	function doSave()
 	{
 	   var f = document.form1;
 	   
 	  $("#fevent").val("GET_SAVE");
 	
	   
	   if(f.appr_note.value == ""){
		  alert("평가자 종합의견을 작성해주십시오.");
		  return
	   }
	   
 	   if (f.item_std_cd.value == "C"){
		   if (!confirm("입력하신 해당업체의 준공평가 결과는 C등급으로 당사에서 수행하는  모든 프로젝트의 입찰이 1년간 제한됩니다.<br>저장하시겠습니까?")){
			   return
		   }
	   }else if (f.item_std_cd.value == "D"){
		  if (!confirm("입력하신 해당업체의 준공평가 결과는 D등급으로 협력업체 등록 취소 및 당사에서 수행하는 모든 프로젝트 입찰이 영구 제한됩니다.<br>저장하시겠습니까?")){
			   return
		   }
	   }else {
		  if (!confirm("저장하시겠습니까?")){
			   return
		  }
	   }
 	   submitXmlRequest("/supplier/outside/OutSuppFixApprPopSave.screen", "GET_SAVE", f);
	}
 	
 	
 	
 	
 	function doResult(resultObj) {
 		var f = document.form1;
 		try 
 		{
 		   document.form1.isSubmit = false;
 		   
 		   if(resultObj.getRequestEvent() == "GET_SAVE")
 		   {
 		      if (resultObj.getSuccess())	
 		      {
 		          alert("저장완료");
 		      }
 		      else
	          {
 		         dlgErrorMsg( resultObj );
	          }
 		   }
 		}
 		catch(errorObject) {
 	        showErrorDlg("doResult()", errorObject);
 		}
 	}
 	
 	
 	
 	
 	$(document).ready(function(){
 	    
 	    loadTest();
 	    
 	 //페이지 로드시 콤마 찍어주기.
 	    $(".numberic").each(function(){
 	        $(this).val($(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(',')); 
 	    });
 	    
 	});
 	
 	
 	
 	
 	$(window).load(function () {
        $(".gubun").each(function () {
            var rows = $(".gubun:contains('" + $(this).text() + "')");
            if (rows.length > 1) {
                rows.eq(0).attr("rowspan", rows.length);
                rows.not(":eq(0)").remove(); 
            }
        });
    });
 	
 	
 	$(function(){
 	    
 	   $(document).on("keyup", "input:text[numberOnly]", function(){
 	       $(this).val( $(this).val().replace(/[^0-9]/gi,"") );
       });
	    
 	   $(document).on("keyup", ".numberic", function(){
 	       $(this).val($(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));  //콤마찍기 정규식...귀찮ㄹ타
       });
	    
 	});
 	
 </script>
 <modular:search id="form1">
	<modular:key id="fevent" />
</modular:search>
 <form name="form1" method="post" action="" >
 	<input type="hidden" name="fevent" id="fevent" value="" />
 	<input type="hidden" name="listSize" id="listSize" value="<%=getApprSrdList.size() %>" />
 	<input type="hidden" name="corp_id" id="corp_id" value="<%=params.get("corp_id") %>" />
 	<input type="hidden" name="corp_no" id="corp_no" value="<%=params.get("corp_no") %>" />
 	<input type="hidden" name="appr_date" id="appr_date" value="<%=appr_date %>" />
 	<input type="hidden" name="item_std_cd" id="item_std_cd" value="" />
 	<input type="hidden" name="appr_tot_rate" id="appr_tot_rate" value="" />
 	<input type="hidden" name="doc_cd" id="doc_cd" value="<%=params.get("p_doc_cd") %>" />
 	<input type="hidden" name="dept_cd" id="dept_cd" value="<%=params.get("dept_cd") %>" />
 	<input type="hidden" name="dept_name" id="dept_name" value="<%=params.get("dept_name") %>" />
 	<input type="hidden" name="acmp_id" id="acmp_id" value="<%=params.get("acmp_id") %>" />
 	<input type="hidden" name="arr_id" id="arr_id" value="<%=vo.get("arr_id") %>" />
 	<input type="hidden" name="USER_SABUN" id="USER_SABUN" value="<%=params.get("USER_SABUN") %>" />
 	<input type="hidden" name="subContId" id="subContId" value="<%=params.get("subContId") %>" />
 	<input type="hidden" name="out_item_cd" id="out_item_cd" value="06" />
 	 	
 
 	<div style="width: 100%; text-align: center; margin-top: 10px; margin-bottom: 15px;" >
  		<span style="font-size: 15px; font-weight: bold;">협력업체 준공평가표 (설계.인허가)</span>
  	</div>
  	
  	<div style="width: 100%;">
  		<div style="text-align: left; width:50%; float: left;">현장명 : <%=params.get("dept_name") %></div>
  		<div style="text-align: right; width:50%; float: left;"><%=yyyymmdd %> 현재</div>
  	</div>
 	
 	<TABLE cellspacing="0" cellpadding="0" border="1" bordercolordark="#FFFFF" bordercolorlight="#d2d2d2" class="input_table" style="width:100%;">
 		<col width="25%" />
 		<col width="25%" />
 		<col width="25%" />
 		<!-- <col width="20%" />
 		<col width="12%" /> -->
 		<col width="*" />
 		<tr>
 			<td class="insert_table_title" style="text-align: center;">협력업체명<br/>/연락처</td>
 			<td class="search_table_input2">
 				<input type="text" name="corp_kor" id="corp_kor" value="<%=vo.get("corp_kor") %>" class="input required" style="width: 99%;"/><br/>
 				<input type="text" name="corp_tel" id="corp_tel" value="<%=vo.get("corp_tel") %>" class="input required" style="width: 99%;"/>
 			</td>
 			
 			<td class="insert_table_title" style="text-align: center;">협력업체소장<br/>/대표자</td>
 			<td class="search_table_input2">
 				<input type="text" name="corp_manager" id="corp_manager" value="<%=vo.get("corp_manager") %>" class="input required" style="width: 99%;"/><br/>
 				<input type="text" name="rep_name" id="rep_name" value="<%=vo.get("rep_name") %>"class="input required" style="width: 99%;" />
 			</td>
 			
 			<%-- <td class="insert_table_title" align="center">
	 			<div>3년평균</div>
	 			<div>매출액</div>
 			</td>
 			<td class="search_table_input2">
 				<input type="text" name="sales_3year" id="sales_3year" value="<%=vo.get("sales_3year") %>" class="input required numberic" numberOnly="true" style="width: 95%; text-align: right;"/>
 			</td> --%>
 		</tr>
 		<tr>
 			<td class="insert_table_title"  style="text-align: center;">공 종 명</td>
 			<td class="search_table_input2">
 				<input type="text" name="item_name" id="item_name" value="<%=vo.get("item_name") %>" class="input required" style="width: 99%;"/>
 			</td>
 			
 			<td class="insert_table_title" style="text-align: center;">계약금액(VAT별도)</td>
 			<td class="search_table_input2">
 				<input type="text" name="con_amt" id="con_amt" value="<%=vo.get("con_amt").equals("") ? params.get("con_supply_amt") : vo.get("con_supply_tamt")%>" class="input required numberic" numberOnly="true" style="width: 99%; text-align: right;"/>
 			</td>
 			
 		</tr>
 		<tr>
 			<td class="insert_table_title" style="text-align: center;">계약공기</td>
 			<td class="search_table_input2">
 				<input type="text" name="start_work_date" id="start_work_date" value="<%=vo.get("start_work_date").equals("") ? params.get("startWorkDate") : vo.get("start_work_date") %>" class="input required" style="width: 35%; text-align: center;"/>
 				<A href="JavaScript:dlgCalendar('start_work_date');"><IMG src="/img/supplier/template/bt_calender.gif" alt="달력" border="0" align="absmiddle"></A>~
 				<input type="text" name="end_work_date" id="end_work_date" value="<%=vo.get("end_work_date").equals("") ? params.get("endWorkDate") : vo.get("end_work_date")  %>" class="input required" style="width: 35%; text-align: center;" />
 				<A href="JavaScript:dlgCalendar('end_work_date');"><IMG src="/img/supplier/template/bt_calender.gif" alt="달력" border="0" align="absmiddle"></A>
 			</td>
 			<td class="insert_table_title" style="text-align: center;">실공기</td>
 			<td class="search_table_input2">
 				<input type="text" name="start_real_date" id="start_real_date" value="<%=vo.get("start_real_date") %>" class="input required" style="width: 35%; text-align: center;" />
 				<A href="JavaScript:dlgCalendar('start_real_date');"><IMG src="/img/supplier/template/bt_calender.gif" alt="달력" border="0" align="absmiddle"></A>~
 				<input type="text" name="end_real_date" id="end_real_date" value="<%=vo.get("end_real_date") %>" class="input required" style="width: 35%; text-align: center;" />
 				<A href="JavaScript:dlgCalendar('end_real_date');"><IMG src="/img/supplier/template/bt_calender.gif" alt="달력" border="0" align="absmiddle"></A>
 			</td>
 		</tr>
 		<tr>
 			<td class="insert_table_title" style="text-align: center;">작성 및 평가자</td>
 			<td class="search_table_input2" style="text-align: center;">
 				<%=vo.get("USER_NAME") %> (인) <br/>
 				<input type="hidden" name="write_no" id="write_no" value="<%=vo.get("USER_NAME") %>"  class="input required" style="width: 99%;" /> 
 			</td>
 			
 			<td class="insert_table_title" style="text-align: center;">평가구분</td>
 			<td class="search_table_input2" style="text-align: center;">
 				연평가, 준공평가
 			</td>

 		</tr>
 	</table>
 	
 	
 	
 	<table cellspacing="0" cellpadding="0" border="1" bordercolordark="#FFFFF" bordercolorlight="#d2d2d2" class="input_table" style="width:100%;">
 		<col width="15%" />
 		<col width="*" />
 		<col width="7%" />
 		<col width="8%" />
 		<col width="8%" />
 		<col width="8%" />
 		<col width="8%" />
 		<!-- <col width="8%" /> -->
 		<col width="15%" />
 		
 		
 		<tr>
 			<td class="insert_table_title" colspan="2" rowspan="2" style="text-align: center;">평 가 항 목</td>
 			<td class="insert_table_title" rowspan="2" style="text-align: center;">배점</td>
 			<td class="insert_table_title" rowspan="2" style="text-align: center; text-indent : 0px;">평가점수</td>
 			<td class="insert_table_title" colspan="4" style="text-align: center;">평 가 등 급</td>
 		</tr>
 		
 		<tr>
 			<td class="insert_table_title" style="text-align: center;"><div>E</div>Exceed</td>
 			<td class="insert_table_title" style="text-align: center;"><div>M</div>Meet</td>
 			<td class="insert_table_title" style="text-align: center;"><div>B</div>Below</td>
 			<td class="insert_table_title" style="text-align: center;"><div>평가사유</div></td>
 			<!-- <td class="insert_table_title" style="text-align: center;"><div>C</div>(미흡)</td>
 			<td class="insert_table_title" style="text-align: center;"><div>D</div>(불량)</td> -->
 		</tr>
 		
 		
 		<% 
 		String chk = "";
 		int idx = 0;
 		int sum_stock_rate = 0;
 		int all_sum_stock_rate = 0;
 		String appr_cd = "";
 		for(int i=0; i < getApprSrdList.size(); i++)
 		{
	    %>
	    	<%
	    		if(!appr_cd.equals("") && !appr_cd.equals(getApprSrdList.getRow(i).get("APPR_CD").substring(0,2)))
	    		{
	    		    System.out.println("타는시점?");
	    		    System.out.println(getApprSrdList.getRow(i).get("APPR_CD").substring(0,2));
	    	%>
	    		<tr height="25">
		    		<td class="insert_table_title gubun" style="text-indent: 0px;"><%=getApprSrdList.getRow(i-1).get("GUBUN_1") %></td>
		    		<td class="insert_table_title"  style="text-align: center; text-indent: 0px;">소 계</td>
		    		<td class="insert_table_title" style="text-align: center; text-indent: 0px;"><%=sum_stock_rate %></td>
		    		<td class="insert_table_title" style="text-align: center; text-indent: 0px;"><div id="totalAll_<%=idx%>">0</div></td>
	    		 	<td class="insert_table_title" style="text-align: center; text-indent: 0px;" colspan="4">&nbsp;</td>
		    	</tr>
		    	<tr>
		    		<td class="insert_table_title gubun" style="text-indent: 0px;"><%=getApprSrdList.getRow(i).get("GUBUN_1") %></td>
		    		<td class="insert_table_title" style="text-indent: 0px;"><%=getApprSrdList.getRow(i).get("GUBUN_2") %></td>
		    		<td class="insert_table_title" style="text-align: center; text-indent: 0px;"><%=getApprSrdList.getRow(i).get("STOCK_RATE") %></td>
		    		<td style="text-align: center; text-indent: 0px;">
		    			<div id="result_<%=i%>">0</div>
		    			<div style="display: none;"><input type="hidden" name="appr_cd_<%=i %>" value="<%=getApprSrdList.getRow(i).get("APPR_CD") %>" /></div>
		    			<div style="display: none;"><input type="hidden" name="chkResultCd_<%=i %>" value="<%=getApprSrdList.getRow(i).get("APPR_RESULT_CD") %>" /></div>
		    		</td>
		    		<td style="text-align: center; text-indent: 0px;"><input type="radio" name="test_<%=i %>" id="test_1_<%=i %>" value="<%=getApprSrdList.getRow(i).get("A_RATE") %>" onclick="test(this, '<%=getApprSrdList.getRow(i).get("APPR_CD").substring(0,2)%>');" <%=getApprSrdList.getRow(i).get("A_RATE").equals(getApprSrdList.getRow(i).get("APPR_RATE")) ? "checked=\"checked\"" : ""%> /><div>(<%=getApprSrdList.getRow(i).get("A_RATE") %>)</div></td>
	    			<td style="text-align: center; text-indent: 0px;"><input type="radio" name="test_<%=i %>" id="test_2_<%=i %>" value="<%=getApprSrdList.getRow(i).get("B_RATE") %>" onclick="test(this, '<%=getApprSrdList.getRow(i).get("APPR_CD").substring(0,2)%>');" <%=getApprSrdList.getRow(i).get("B_RATE").equals(getApprSrdList.getRow(i).get("APPR_RATE")) ? "checked=\"checked\"" : ""%>/><div>(<%=getApprSrdList.getRow(i).get("B_RATE") %>)</div></td>
	    			<td style="text-align: center; text-indent: 0px;"><input type="radio" name="test_<%=i %>" id="test_3_<%=i %>" value="<%=getApprSrdList.getRow(i).get("C_RATE") %>" onclick="test(this, '<%=getApprSrdList.getRow(i).get("APPR_CD").substring(0,2)%>');" <%=getApprSrdList.getRow(i).get("C_RATE").equals(getApprSrdList.getRow(i).get("APPR_RATE")) ? "checked=\"checked\"" : ""%>/><div>(<%=getApprSrdList.getRow(i).get("C_RATE") %>)</div></td>
	    			<td style="text-align: left; text-indent: 0px;"><textarea maxlength="250" cols="95%" name="appr_reason_<%=i %>" id="appr_reason_<%=i %>" style="width:98%" ><%=getApprSrdList.getRow(i).get("APPR_REASON") %></textarea></td>
	    			<%-- <td style="text-align: center; text-indent: 0px;"><input type="radio" name="test_<%=i %>" id="test_4_<%=i %>" value="<%=getApprSrdList.getRow(i).get("D_RATE") %>" onclick="test(this, '<%=getApprSrdList.getRow(i).get("APPR_CD").substring(0,2)%>');" <%=getApprSrdList.getRow(i).get("D_RATE").equals(getApprSrdList.getRow(i).get("APPR_RATE")) ? "checked=\"checked\"" : ""%>/><div>(<%=getApprSrdList.getRow(i).get("D_RATE") %>)</div></td>
	    			<td style="text-align: center; text-indent: 0px;"><input type="radio" name="test_<%=i %>" id="test_5_<%=i %>" value="<%=getApprSrdList.getRow(i).get("E_RATE") %>" onclick="test(this, '<%=getApprSrdList.getRow(i).get("APPR_CD").substring(0,2)%>');" <%=getApprSrdList.getRow(i).get("E_RATE").equals(getApprSrdList.getRow(i).get("APPR_RATE")) ? "checked=\"checked\"" : ""%>/><div>(<%=getApprSrdList.getRow(i).get("E_RATE") %>)</div></td> --%>
		    	</tr>
		    	
	    	<%	    all_sum_stock_rate += sum_stock_rate;
	    			sum_stock_rate = 0;
	    			idx++;
	    		}else{
	    	%>
	    		<tr>
		    		<td class="insert_table_title gubun" style="text-indent: 0px;"><%=getApprSrdList.getRow(i).get("GUBUN_1") %></td>
		    		<td class="insert_table_title" style="text-indent: 0px;"><%=getApprSrdList.getRow(i).get("GUBUN_2") %></td>
		    		<td class="insert_table_title" style="text-align: center; text-indent: 0px;"><%=getApprSrdList.getRow(i).get("STOCK_RATE") %></td>
		    		<td style="text-align: center; text-indent: 0px;">
		    			<div id="result_<%=i%>">0</div>
		    			<div style="display: none;"><input type="hidden" name="appr_cd_<%=i %>" value="<%=getApprSrdList.getRow(i).get("APPR_CD") %>" /></div>
		    			<div style="display: none;"><input type="hidden" name="chkResultCd_<%=i %>" value="<%=getApprSrdList.getRow(i).get("APPR_RESULT_CD") %>" /></div>
		    		</td>
		    		<td style="text-align: center; text-indent: 0px;"><input type="radio" name="test_<%=i %>" id="test_1_<%=i %>" value="<%=getApprSrdList.getRow(i).get("A_RATE") %>" onclick="test(this, '<%=getApprSrdList.getRow(i).get("APPR_CD").substring(0,2)%>');" <%=getApprSrdList.getRow(i).get("A_RATE").equals(getApprSrdList.getRow(i).get("APPR_RATE")) ? "checked=\"checked\"" : ""%> /><div>(<%=getApprSrdList.getRow(i).get("A_RATE") %>)</div></td>
	    			<td style="text-align: center; text-indent: 0px;"><input type="radio" name="test_<%=i %>" id="test_2_<%=i %>" value="<%=getApprSrdList.getRow(i).get("B_RATE") %>" onclick="test(this, '<%=getApprSrdList.getRow(i).get("APPR_CD").substring(0,2)%>');" <%=getApprSrdList.getRow(i).get("B_RATE").equals(getApprSrdList.getRow(i).get("APPR_RATE")) ? "checked=\"checked\"" : ""%>/><div>(<%=getApprSrdList.getRow(i).get("B_RATE") %>)</div></td>
	    			<td style="text-align: center; text-indent: 0px;"><input type="radio" name="test_<%=i %>" id="test_3_<%=i %>" value="<%=getApprSrdList.getRow(i).get("C_RATE") %>" onclick="test(this, '<%=getApprSrdList.getRow(i).get("APPR_CD").substring(0,2)%>');" <%=getApprSrdList.getRow(i).get("C_RATE").equals(getApprSrdList.getRow(i).get("APPR_RATE")) ? "checked=\"checked\"" : ""%>/><div>(<%=getApprSrdList.getRow(i).get("C_RATE") %>)</div></td>
	    			<td style="text-align: left; text-indent: 0px;"><textarea maxlength="250" cols="95%" name="appr_reason_<%=i %>" id="appr_reason_<%=i %>" style="width:98%" ><%=getApprSrdList.getRow(i).get("APPR_REASON") %></textarea></td>
	    			<%-- <td style="text-align: center; text-indent: 0px;"><input type="radio" name="test_<%=i %>" id="test_4_<%=i %>" value="<%=getApprSrdList.getRow(i).get("D_RATE") %>" onclick="test(this, '<%=getApprSrdList.getRow(i).get("APPR_CD").substring(0,2)%>');" <%=getApprSrdList.getRow(i).get("D_RATE").equals(getApprSrdList.getRow(i).get("APPR_RATE")) ? "checked=\"checked\"" : ""%>/><div>(<%=getApprSrdList.getRow(i).get("D_RATE") %>)</div></td>
	    			<td style="text-align: center; text-indent: 0px;"><input type="radio" name="test_<%=i %>" id="test_5_<%=i %>" value="<%=getApprSrdList.getRow(i).get("E_RATE") %>" onclick="test(this, '<%=getApprSrdList.getRow(i).get("APPR_CD").substring(0,2)%>');" <%=getApprSrdList.getRow(i).get("E_RATE").equals(getApprSrdList.getRow(i).get("APPR_RATE")) ? "checked=\"checked\"" : ""%>/><div>(<%=getApprSrdList.getRow(i).get("E_RATE") %>)</div></td> --%>
		    	</tr>
	    	<%	 	
	    		}
	    	%>
	    <%
	    appr_cd = getApprSrdList.getRow(i).get("APPR_CD").substring(0,2);
	    sum_stock_rate += Integer.parseInt(getApprSrdList.getRow(i).get("STOCK_RATE"));
	    
	    if (i+1 == getApprSrdList.size())  //마지막이면 소계표기 2015.8.5
	    {
	    	all_sum_stock_rate += sum_stock_rate;
	    %>
	    <tr height="25">
			<td class="insert_table_title gubun" style="text-indent: 0px;"><%=getApprSrdList.getRow(i).get("GUBUN_1") %></td>
			<td class="insert_table_title"  style="text-align: center; text-indent: 0px;">소 계</td>
			<td class="insert_table_title" style="text-align: center; text-indent: 0px;"><%=sum_stock_rate %></td>
			<td class="insert_table_title" style="text-align: center; text-indent: 0px;"><div id="totalAll_<%=idx%>">0</div></td>
			<td class="insert_table_title" style="text-align: center; text-indent: 0px;" colspan="4">&nbsp;</td>
	    </tr>
	    <% 
	    }
 		}%>
 		
 		<tr height="25">
 			<td class="insert_table_title gubun" colspan="2" align="center" style="text-indent: 0px;">합계</td>
 			<td style="text-align: center;" class="insert_table_title" style="text-indent: 0px;">
 				<div name="total_rate" id="total_rate">
 				<%=all_sum_stock_rate %>
 				</div>
 			</td>
 			<td style="text-align: center;" class="insert_table_title" style="text-indent: 0px;">
 				<div name="total_rate_all" id="total_rate_all">
 				0
 				</div>
 			</td>
 			<td style="text-align: center;" class="insert_table_title" style="text-indent: 0px;" colspan="4">
 			&nbsp;
 			</td>
 		</tr>
 	</table>
 	
 	<table cellspacing="0" cellpadding="0" border="1" bordercolordark="#FFFFF" bordercolorlight="#d2d2d2" class="input_table" style="width:100%;">
 		<col width="15%" />
 		<col width="20%" />
 		<col width="7%" />
 		<col width="8%" />
 		<col width="8%" />
 		<col width="8%" />
 		<col width="8%" />
 		<col width="8%" />
 		<col width="9%" />
 		
 		
 		<% 
 		chk = "";
 		sum_stock_rate = 0;
 		appr_cd = "";
 		%>
		<tr>
			<td class="insert_table_title"  style="text-align: center; text-indent: 0px;" rowspan="2">종합평가</td>
			<td class="insert_table_title"  style="text-align: left; text-indent: 0px;">
				<div style="float: left;">합계 점수</div>
				<div style="float: right;" id="total_value">0</div>
			</td>
			<td class="insert_table_title"  style="text-align: left; text-indent: 0px;" rowspan="2" colspan="7">
				<div style="margin-bottom: 3px; margin-top: 3px;">S등급(탁월: 92점~100점): 입찰참여 기회 보장 및 협력업체 평가시 가산점 부여 (+20점)</div>
				<div style="margin-bottom: 3px;">A등급(우수: 84점~91점): 입찰참여 기회 보장 및 협력업체 평가시 가산점 부여 (+10점)</div>
				<div style="margin-bottom: 3px;">B등급(보통: 76점~83점): 협력업체 유지</div>
				<div style="margin-bottom: 3px;">C등급(미흡: 68점~75점): 입찰참여 1년간 제한 및 협력업체 평가시 가산점 부여 (-5점)</div>
				<div style="margin-bottom: 3px;">D등급(불량:  0점~67점): 협력업체 등록 취소 및 입찰참여 영구 제한 및 협력업체 평가시 가산점 부여 (-10점)</div>
			</td>
		</tr>
		<tr>
			<td class="insert_table_title"  style="text-align: left; text-indent: 0px;">
				<div style="float: left;">협력업체<div style="margin-top: 3px;">등&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;급</div></div>
				<div style="float: right; height: 30px; line-height: 30px;" id="total_level">등급</div>
			</td>
		</tr>
		<tr>
			<td class="insert_table_title"  style="text-align: center; text-indent: 0px;" >평가자 종합의견</td>
			<td class="insert_table_title"  style="text-align: left; text-indent: 0px;" colspan="8">
				<textarea rows="5" cols="95%" name="appr_note" id="appr_note" ><%=vo.get("appr_note") %></textarea>
			</td>
		</tr>
		<tr>
			<td class="insert_table_title"  style="text-align: left; text-indent: 0px;" colspan="9">
				<div style="margin-bottom: 3px;">*작성 시 유의사항</div>
				<div style="margin-bottom: 3px;">1)항목별 점수는 각 항목마다 Exceed(우수), Meet(양호), Below(미흡)으로 한다.</div>
				<div style="margin-bottom: 3px;color:red;">2)"Exceed" 또는 "Below"로 평가 시 반드시 구체적인 평가사유를 작성해야 한다.</div>
				<div style="margin-bottom: 3px;">3)추가평가 항목의 경우, 가산점 부여 시 이에 대한 평가 사유를 작성해야 한다.</div>
				<div style="margin-bottom: 3px;">4)이 평가표는 향후 협력업체 등록 및 계약 시 영향을 끼칠 것이므로 공정하고 신중하게 작성되어야 한다.</div>
				<div style="margin-bottom: 3px;">5)최종 평가 결과, C등급인 경우 향후 1년간 입찰 제한, D등급인 경우 협력업체 등록을 취소한다.</div>
				<div style="margin-bottom: 3px;color:red;">6)평가자 종합의견 작성 필수</div>
				<div style="margin-bottom: 3px;color:red;">&nbsp&nbsp- 평가자 종합의견 미비사항은 추후 입찰 참여 시 대책방안 제출하도록 하여 검토, 확인 후 입찰 진행</div>
			</td>
		</tr>
	</table>
       	
 </form>
 <div style="width: 100%; text-align: center;">
 	<%if(("".equals(vo.get("REGU_STATUS_CD")) || vo.get("REGU_STATUS_CD").equals("01")) && ("01".equals(status_cd) || "02".equals(status_cd) || "03".equals(status_cd)) ){ %>  <!--  !"10".equals(status_cd) 2017.04.25 결재올린후 평가수정하는 경우 발생 -->
 	<img alt="저장" src="/img/buyer/button/bt_save.gif" style="cursor: pointer;" onclick="doSave();"/>
 	<%} %>
 </div>
