<%--
  - FileName   : OutSupplierApprList.jsp
  - Author(s)  : Sung Min Lee
  - Date       : 2014.06.17
  -
  - Description: 협력업체평가현황
  --%>
  


<%@ 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);
    HandlerStorage storage = ctx.getHandlerStorage();
    ValueObject params = storage.getParams();
    ValueObject user = storage.getUser();
    
    String soc_nm_combo = "선택|대한전문건설협회|대한기계설비공사협회|한국소방시설협회|한국정보통신공사협회|한국전기공사협회";
    String soc_code_combo = "|01|02|03|04|05";
    
    java.util.Calendar curDate = java.util.Calendar.getInstance();
    curDate.add ( curDate.YEAR, -1 ); 
	java.text.SimpleDateFormat fmtDay = new java.text.SimpleDateFormat("yyyy");
	String p_yyyy = fmtDay.format(curDate.getTime()); // 오늘 
	
%>

<script type="text/javascript">
<!--
    document.body.onresize = addEvent( document.body.onresize, "autoResize()");
	/*예약함수*/
	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 (e.keyCode == 13)
        {
	        $.searchList();
        }
	    
	});
	
	$.gridInit = function(sheetName)
	{
		var init_sheet = {};
	    init_sheet.Cfg = {SearchMode:2, Page:30};
		
		init_sheet.Cols = [
									{Header:"Status",			Type:"Status",  			SaveName:"STATUS", 						Width:0, 	Align:"Center", Edit:"False", Hidden:"True"},
									{Header:"상호",	 		    Type:"Text", 				SaveName:"ISU_VENDNM",					Width:80, 	 Align:"Left", Edit:"False",},
									{Header:"현장명",	 			Type:"Text", 				SaveName:"DEPT_NAME",					Width:80, 	 Align:"Left", Edit:"False",},
									{Header:"☞계약명",	 		Type:"Text", 				SaveName:"CONT_NM",						Width:80, 	 Align:"Left", Edit:"False",},
									{Header:"기성년도",	 		Type:"Text", 				SaveName:"ACMP_YYYY",					Width:80, 	 Align:"Center", Edit:"False",},
									{Header:"착공연월일",	 	    Type:"Text", 				SaveName:"CONT_SDATE",					Width:80, 	 Align:"Center", Edit:"False", Format:"Ymd"},
									{Header:"준공연월일",	 	    Type:"Text", 				SaveName:"CONT_EDATE",					Width:80, 	 Align:"Center", Edit:"False", Format:"Ymd"},
									{Header:"총계약금액",	 	    Type:"Int", 				SaveName:"CONT_TAMT",					Width:80, 	 Align:"Right", Format:"#,##0", Edit:"False",},
									{Header:"당년도기성액",	 	Type:"Int", 				SaveName:"CUR_PAY_AMT",				    Width:80, 	 Align:"Right", Format:"#,##0", Edit:"False",},
									{Header:"제출협회코드",		Type:"Text", 				SaveName:"SOC_CD",						Width:0, 	 Align:"Center", Hidden:"True"},
									{Header:"제출협회",			Type:"Text", 				SaveName:"SOC_NM",						Width:80, 	 Align:"Center"},
									{Header:"진행상태코드",		Type:"Text", 				SaveName:"PROG_STAT_CD",				Width:0, 	 Align:"Center", Hidden:"True"},
									{Header:"진행상태",			Type:"Text", 				SaveName:"PROG_STAT_NM",				Width:80, 	 Align:"Center"},
									{Header:"외주계약변경ID",	    Type:"Text", 				SaveName:"SUB_CONT_MOD_ID",		        Width:80, 	 Align:"Center", Cursor:"Pointer", Edit:"False", Hidden:"True"},
									{Header:"CORP_ID", 			Type:"Text", 				SaveName:"CORP_ID",						Width:80, 	 Align:"Center", Cursor:"Pointer", Edit:"False", Hidden:"True"},
									{Header:"총계약금액",	 	    Type:"Int", 				SaveName:"CONT_TAMT_O",					Width:80, 	 Align:"Right", Format:"#,##0", Edit:"False", Hidden:"True"},
									{Header:"당년도기성액",	 	Type:"Int", 				SaveName:"CUR_PAY_AMT_O",				Width:80, 	 Align:"Right", Format:"#,##0", Edit:"False", Hidden:"True"}
									
									];
		
		
		init_sheet.HeaderMode = {Sort:1};
		IBS_InitSheet(sheetName, init_sheet);
		sheetName.SetDataAutoTrim(0);
		sheetName.SetEditable(false);
		//sheetName.SetCountPosition(0);
		
		sheetName.SetDataLinkMouse("CONT_NM", 1);
		sheetName.SetColFontColor("CONT_NM", "#0000ff");
		//sheetName.SetDataLinkMouse("ISU_VENDNM", 1);
		//sheetName.SetColFontColor("ISU_VENDNM", "#0000ff");
		
		sheetName.FitColWidth();
			
	}
	
	
	
	$.searchList = function()
	{
		$("#fevent").val("GET_LIST");
		
		var url = Modular.model.PageContext.CONTEXT_ROOT + "/result/outside/ResultIngList_sheet.screen";
		Modular.view.IBSheet7.doSearch(sheet1, url, $("#form1"), 30, "");
		
	}
	
	$(document).ready(function(){
		$.gridInit(sheet1);
		$.searchList();  
		autoResize();
	});
	
	
	
	$(function(){
	    
	    $("#btnSearch").click(function(){
	        $.searchList();
	    });
	    
	    $("#btnChkList").click(function(){
	    	var popUrl = "/result/outside/ResultChkList.screen?p_yyyy=" + $("#p_yyyy").val() + "&p_supp_nm=" +  $("#p_supp_nm").val();
			var popOption = "width=1240, height=600, resizable=yes, scrollbars=yes, status=no;";
			window.open(popUrl,"",popOption);
	    });
	});
	
	
	function sheet1_OnChange(Row, Col, Value, OldValue, RaiseFlag) {
		var comboValue = sheet1.GetCellValue(Row,"SOC_CD");
		if(comboValue != "" ){
			sheet1.SetCellImage(Row ,"REG", "/img/buyer/button/bt_save_item.gif");
			return;
		}		
	}
	
	function sheet1_OnDblClick(Row, Col) 
	{
		var comboValue = sheet1.GetCellValue(Row,"SOC_CD");
		
		if (sheet1.ColSaveName(Col) == "CONT_NM") 
		{
		    $("#p_corp_id").val(sheet1.GetCellValue(Row,"CORP_ID"));
		    $("#p_acmp_yyyy").val(sheet1.GetCellValue(Row,"ACMP_YYYY"));
		    $("#p_sub_cont_mod_id").val(sheet1.GetCellValue(Row,"SUB_CONT_MOD_ID"));
		    $("#p_soc_cd").val(sheet1.GetCellValue(Row,"SOC_CD"));
		    $("#p_List").val("/result/outside/ResultIngList.screen");
		    
		    
		    if(comboValue == "01")
		    {
			    $("#fevent").val("GET_DETAIL_01");
			    $("#form1").attr("action", "/result/outside/ResultDetail01.screen");
		    }
			else if(comboValue == "02")
		    {
			    $("#fevent").val("GET_DETAIL_02");
			    $("#form1").attr("action", "/result/outside/ResultDetail02.screen");
		    }
			else if(comboValue == "03")
		    {
			    $("#fevent").val("GET_DETAIL_03");
			    $("#form1").attr("action", "/result/outside/ResultDetail03.screen");
		    }
			else if(comboValue == "04")
		    {
			    $("#fevent").val("GET_DETAIL_04");
			    $("#form1").attr("action", "/result/outside/ResultDetail04.screen");
		    }
			else if(comboValue == "05")
		    {
			    $("#fevent").val("GET_DETAIL_05");
			    $("#form1").attr("action", "/result/outside/ResultDetail05.screen");
		    }
			
			$("#form1").attr("target", "_self");
			$("#form1").attr("method", "post");
			$("#form1").submit();
		}
		else if(sheet1.ColSaveName(Col) == "ISU_VENDNM"){
			//var popUrl = "/result/outside/ResultChkList.screen?p_yyyy="+sheet1.GetCellValue(Row, "ACMP_YYYY")+"&p_supp_nm="+sheet1.GetCellValue(Row, "ISU_VENDNM");
			//var popOption = "width=1240, height=600, resizable=yes, scrollbars=yes, status=no;";
			//window.open(popUrl,"",popOption);
 		}
	}		
	function sheet1_OnSearchEnd(code, message) {
	   if(code == 0) {
	    	sheet1.FitColWidth();
	    	var rowcnt = sheet1.RowCount();
	    	if(rowcnt > 0){
				for(var r=1; r < rowcnt+1; r++)
				{
					if(sheet1.GetCellValue(r,"CONT_TAMT") != sheet1.GetCellValue(r,"CONT_TAMT_O") ){
						sheet1.SetCellFontColor(r, "CONT_TAMT" , "#EF0B0B"); 
					}
					if(sheet1.GetCellValue(r,"CUR_PAY_AMT") != sheet1.GetCellValue(r,"CUR_PAY_AMT_O") ){
						sheet1.SetCellFontColor(r, "CUR_PAY_AMT" , "#EF0B0B");
					}
				}
			}
		} else {
			//조회 에러 수행
			alert(message);
		}
	    
	}
	
	function sheet1_OnSmartResize(Width, Height) { 
		sheet1.FitColWidth();
		autoResize();
		
	}
	
	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); 
	}	
	
	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_acmp_yyyy" id="p_acmp_yyyy" value="" />
<input type="hidden" name="p_sub_cont_mod_id" id="p_sub_cont_mod_id" value="" />
<input type="hidden" name="p_page_gubun" id="p_page_gubun" value="info" />
<input type="hidden" name="p_soc_cd" id="p_soc_cd" value="" />
<input type="hidden" name="p_List" id="p_List" value="" />

<div align="left" id="title">
	<ul>
    	<li>실적증명 발급현황</li>
   	</ul>
</div>


<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%" id="search-table" class="search-form-table">
	<colgroup>
		<col width="15%" />
		<col width="15%" />
		<col width="15%" />
		<col width="15%" />
		<col width="15%" />
		<col width="15%" />
		<col width="10%" />
	</colgroup>
	<!-- 검색조건 영역, 테이터 영역 구분 여백 : 시작 -->
	<tr>
		<th>기성년도</th>
		<td>
			<%= InputText.get("p_yyyy", p_yyyy, 10, 4, "center, desc=기성년도,") %>
		</td>
		
		<th>업체명</th>
		<td>
			<input type="text" name="p_supp_nm" id="p_supp_nm" value="<%=params.get("p_supp_nm") %>" /> 
		</td>
		<th>진행상태</th>
		<td>
		     <SELECT class='input_select' id='P_STATUS' name='P_STATUS' style="width:100px;">
			 <option value='%' <%=params.get("p_status").equals("%") ? "selected=selected":""%>>--전체--</option>
			 <OPTION value='10' <%=params.get("p_status").equals("10") ? "selected=selected":""%>>작성중</OPTION>
			 <OPTION value='20' <%=params.get("p_status").equals("20") || params.get("p_status").equals("") ? "selected=selected":""%>>발급요청</OPTION>
			 <OPTION value='30' <%=params.get("p_status").equals("30") ? "selected=selected":""%>>발급완료</OPTION>
			 <OPTION value='91' <%=params.get("p_status").equals("91") ? "selected=selected":""%>>반려</OPTION>
		     </SELECT>  
		</td>
		<td class="button" >
			<span class="btnSearch center"><a href="javascript:void(0);" id="btnSearch">검색</a></span>
		</td>			
	</tr>
</table>

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

