<%--
  - FileName   : ResultTargetList.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) storage.getObject("issueName");
    String soc_code_combo = (String) storage.getObject("issueCode");
%>

<script type="text/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 (e.keyCode == 13)
        {
	        $.searchList();
        }
	    
	});
	
	$.gridInit = function(sheetName)
	{
	    
	    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:"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:"Combo", 				SaveName:"CNT_SOC_CD_01",						Width:30, 	 Align:"Center", Edit:"False",ComboText:"|√", ComboCode:"0|1"},
									{Header:"설비", 			Type:"Combo", 				SaveName:"CNT_SOC_CD_02",						Width:30, 	 Align:"Center", Edit:"False",ComboText:"|√", ComboCode:"0|1"},
									{Header:"소방", 			Type:"Combo", 				SaveName:"CNT_SOC_CD_03",						Width:30, 	 Align:"Center", Edit:"False",ComboText:"|√", ComboCode:"0|1"},
									{Header:"통신", 			Type:"Combo", 				SaveName:"CNT_SOC_CD_04",						Width:30, 	 Align:"Center", Edit:"False",ComboText:"|√", ComboCode:"0|1"},
									{Header:"전기", 			Type:"Combo", 				SaveName:"CNT_SOC_CD_05",						Width:30, 	 Align:"Center", Edit:"False",ComboText:"|√", ComboCode:"0|1"},
									{Header:"제출협회",	 		Type:"Combo", 			SaveName:"SOC_CD",						Width:80, 	 Align:"Center", ComboText:"<%=soc_nm_combo%>", ComboCode:"<%=soc_code_combo%>"},
									{Header:"☞작성",	 			Type:"Text", 				SaveName:"REG",								Width:80, 	 Align:"Center", Cursor:"Pointer", Edit:"False",},
									{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"}
		                   		];
		
		
		init_sheet.HeaderMode = {Sort:1};
		IBS_InitSheet(sheetName, init_sheet);
		sheetName.SetDataAutoTrim(0);
// 		sheetName.SetEditable(false);
// 		sheetName.SetCountPosition(0);
		
// 		sheetName.SetDataLinkMouse("USER_NAME", 1);
// 		sheetName.SetColFontColor("USER_NAME", "#0000ff");
	
		sheetName.FitColWidth();
	}
	
	
	
	$.searchList = function()
	{
		var yy = $("#p_yyyy").val();
		$("#fevent").val("GET_TARGET_LIST");
		$("#acmp_yyyy").val(yy);  //2016.10.11
		var url = Modular.model.PageContext.CONTEXT_ROOT + "/portal/result/ResultTargetList_sheet.screen";
		Modular.view.IBSheet7.doSearch(sheet1, url, $("#form1"), 30, "");
	}
	
	$(document).ready(function(){
		
	    $.gridInit(sheet1);
		$.searchList();
		
		autoResize();
		
	});
	
	
	
	$(function(){
	    
	    $("#btnSearch").click(function(){
	        $.searchList();
	    });
	    
	});
	
	
	function sheet1_OnChange(Row, Col, Value, OldValue, RaiseFlag) {
		var comboValue = sheet1.GetCellValue(Row,"SOC_CD");
		if(comboValue != "" )
		{
			if(comboValue=="01"&&sheet1.GetCellValue(Row,"CNT_SOC_CD_01")!="0"){
				alert("이미 작성중인 대상입니다.");
				sheet1.SetCellValue(Row,"SOC_CD","");
				sheet1.SetCellImage(Row ,"REG","/img/com/blank.gif");
				return;
			}
			else if(comboValue=="02"&&sheet1.GetCellValue(Row,"CNT_SOC_CD_02")!="0"){
				alert("이미 작성중인 대상입니다.");
				sheet1.SetCellValue(Row,"SOC_CD","");
				sheet1.SetCellImage(Row ,"REG","/img/com/blank.gif");
				return;
			}
			else if(comboValue=="03"&&sheet1.GetCellValue(Row,"CNT_SOC_CD_03")!="0"){
				alert("이미 작성중인 대상입니다.");
				sheet1.SetCellValue(Row,"SOC_CD","");
				sheet1.SetCellImage(Row ,"REG","/img/com/blank.gif");
				return;
			}
			else if(comboValue=="04"&&sheet1.GetCellValue(Row,"CNT_SOC_CD_04")!="0"){
				alert("이미 작성중인 대상입니다.");
				sheet1.SetCellValue(Row,"SOC_CD","");
				sheet1.SetCellImage(Row ,"REG","/img/com/blank.gif");
				return;
			}
			else if(comboValue=="05"&&sheet1.GetCellValue(Row,"CNT_SOC_CD_05")!="0"){
				alert("이미 작성중인 대상입니다.");
				sheet1.SetCellValue(Row,"SOC_CD","");
				sheet1.SetCellImage(Row ,"REG","/img/com/blank.gif");
				return;
			}
			
			sheet1.SetCellImage(Row ,"REG", "/img/buyer/btn/btn_write.gif");
			return;
		}
// 		else
// 	    {
// 		    sheet1.SetCellImage(Row ," ", "");
// 			return;
// 	    }
	}
	
	
	function sheet1_OnClick(Row, Col) 
	{
		var comboValue = sheet1.GetCellValue(Row,"SOC_CD");
	
		if (sheet1.ColSaveName(Col) == "REG") 
		{
		    $("#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"));
		    
		    
		    if(comboValue == "01")
		    {
			    $("#fevent").val("GET_DETAIL_01");
			    $("#form1").attr("action", "/portal/result/ResultDetail01.screen");
		    }
			else if(comboValue == "02")
		    {
			    $("#fevent").val("GET_DETAIL_02");
			    $("#form1").attr("action", "/portal/result/ResultDetail02.screen");
		    }
			else if(comboValue == "03")
		    {
			    $("#fevent").val("GET_DETAIL_03");
			    $("#form1").attr("action", "/portal/result/ResultDetail03.screen");
		    }
			else if(comboValue == "04")
		    {
			    $("#fevent").val("GET_DETAIL_04");
			    $("#form1").attr("action", "/portal/result/ResultDetail04.screen");
		    }
			else if(comboValue == "05")
		    {
			    $("#fevent").val("GET_DETAIL_05");
			    $("#form1").attr("action", "/portal/result/ResultDetail05.screen");
		    }
		    
		    
		    if(comboValue != "")
	        {
		        $("#form1").attr("target", "_self");
				$("#form1").attr("method", "post");
				$("#form1").submit();
	        }
		}
	}		
	
	
	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); 
	}	
	



//-->
</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="acmp_yyyy" id="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="target" />
<input type="hidden" name="p_soc_cd" id="p_soc_cd" 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="30%" />
		<col width="15%" />
		<col width="30%" />
		<col width="10%" />
	</colgroup>
	<!-- 검색조건 영역, 테이터 영역 구분 여백 : 시작 -->
	<tr>
		<th>기성년도</th>
		<td>
			<input type="text" name="p_yyyy" id="p_yyyy" value="<%=params.get("p_yyyy") %>"/> 
		</td>
		
		<th>현장명</th>
		<td>
			<input type="text" name="p_dept_nm" id="p_dept_nm" value="<%=params.get("p_dept_nm") %>" /> 
		</td>
		<td class="button" rowspan="2">
			<span class="btnSearch center"><a href="javascript:void(0);" id="btnSearch">검색</a></span>
		</td>			
	</tr>
	<tr>
		<th>계약명</th>
		<td colspan="3">
			<input type="text" name="p_cont_nm" id="p_cont_nm" value="<%=params.get("p_cont_nm") %>" /> 
		</td>
	</tr>
</table>

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

</form>

