<%--
  - Author(s)  : Hyung min Son
  - Date       : 2014.08.08
  - 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.*" %>
<%@ page import="com.udapsoft.waf.common.ui.InitCombo" %>
<%@ page import="kr.co.udapsoft.common.code.CommCodeManager" %>
<%@ 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();
    
	//공통코드
	CommCodeManager commCodeManager = new CommCodeManager();
	InitCombo initCombo = new InitCombo();

	initCombo.makeComboData(commCodeManager.getCodeRowSet("BID_STATUS_CD"), "NAME", "CODE");
	String BID_STATUS_CD = initCombo.getCode();
	String BID_STATUS_NM = initCombo.getCodeName();
	
	initCombo = new InitCombo();

	initCombo.makeComboData(commCodeManager.getCodeRowSet("BID_SITEPARTI_YN"), "NAME", "CODE");
	String BID_SITEPARTI_CD = initCombo.getCode();
	String BID_SITEPARTI_NM = initCombo.getCodeName();
	
	initCombo = new InitCombo();

	initCombo.makeComboData(commCodeManager.getCodeRowSet("BID_SUPP_SUCC"), "NAME", "CODE");
	String BID_SUPP_SUCC_CD = initCombo.getCode();
	String BID_SUPP_SUCC_NM = initCombo.getCodeName();
%>
<SCRIPT language="JavaScript">
	/*예약함수*/
	var sheet1 = new ibsheetObject();
	var sheet1Row;
	var sheet1PageNo = 1;
	var pageLastRowIndex = 1;
	var validationResult = false;
	var filterShow = false;
	
	function _onReady(){
		/**
		 *	IBSheet object initialize
		 */
		gridInit(sheet1);
		autoResize();
		
		/**
		 *	Application Initialize
		 */
		jQuery("#btnSearch").click(function() {
			jQuery("#fevent").val("SHEET_SELECT");
			var url = Modular.model.PageContext.CONTEXT_ROOT + "/portal/bid/SuppBidResultList_sheet.screen";
			Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 30, "");
		});
		
		$("#P_BID_MASTER_NM").keydown(function (event){
			var keycode = (event.keyCode ? event.keyCode : event.which);
			if(keycode == 13){
				$("#btnSearch").click();
			}
		});
		
		$("#btnSearch").click();
		$("#dataClear").click(function(){$("#SITEDESC_FROM_DT").val("");$("#SITEDESC_TO_DT").val("");});
	}
	
	/**
	 *	IBSheet object initialize
	 */
	function gridInit(sheetName){
		var init_sheet = {};
		init_sheet.Cfg = {SearchMode:2, Page:30};
		init_sheet.Cols = [
		       			{Header:'Del',					Type:"DelCheck",		SaveName:"DEL_CHECK", 					Width:50, 			Align:"Center",		Hidden:"True"},
		    			{Header:'Status',				Type:"Status", 		SaveName:"STATUS", 						Width:0, 			Align:"Center",		Hidden:"True"},
		    			{Header:'No.',					Type:"Seq", 			SaveName:"NO",								Width:0, 			Align:"Center",		Hidden:"True"},
		    			{Header:'구분',					Type:"Text", 			SaveName:"DEMANDED_KIND_NM", 		Width:160, 			Align:"Center"},
		    			{Header:'입찰번호',				Type:"Text", 			SaveName:"BID_NO", 						Width:160, 			Align:"Center"},
		    			{Header:'차수',					Type:"Text", 			SaveName:"BID_DEG", 						Width:30, 			Align:"Center"},
		    			{Header:'☞입찰공고명',			Type:"Text", 			SaveName:"BID_MASTER_NM", 			Width:350, 			Align:"Left",			Cursor:"pointer"},
		    			{Header:'공고일시',				Type:"Text", 			SaveName:"NOTI_DY", 						Width:0, 			Align:"Center",		Format:"####-##-##"},
		    			{Header:'최종견적제출일시',		Type:"Text", 			SaveName:"SIGN_DT", 						Width:0, 			Align:"Center"},
		    			{Header:'견적설명회 참여여부',		Type:"Combo", 		SaveName:"SITEPARTI_YN", 				Width:0, 			Align:"Center",		ComboText:"<%=BID_SITEPARTI_NM%>", ComboCode:"<%=BID_SITEPARTI_CD%>"},
		    			{Header:'낙찰여부',				Type:"Combo", 		SaveName:"SUCC_YN", 						Width:0, 			Align:"Center",		FontColor:"blue",	ComboText:"<%=BID_SUPP_SUCC_NM%>", ComboCode:"<%=BID_SUPP_SUCC_CD%>"},
		    			{Header:'상태',					Type:"Combo", 		SaveName:"STATUS_CD", 					Width:60, 			Align:"Center",		ComboText:"<%=BID_STATUS_NM%>", 		ComboCode:"<%=BID_STATUS_CD%>"},
		    			{Header:'DEMANDED_ID',	Type:"Text", 			SaveName:"DEMANDED_ID",				Width:0, 			Align:"Center",		Hidden:"True"},
		];

		init_sheet.HeaderMode = {Sort:1};
		IBS_InitSheet(sheetName, init_sheet);
		sheetName.SetDataAutoTrim(0);
		sheetName.SetEditable(false);
		sheetName.SetActionMenu("ExcelDown");
		setGridSize();
	}

	function sheet1_OnSelectMenu(Text, Code) {
		  // text 또는 code값으로 Action수행
		switch(Text) {
	         case "ExcelDown":
	        	sheetExcelDown(sheet1,$('li').html());
	            break; 
		}
	}

	/**
	 *	IBSheet Event: Search End(IBSheet 데이터 조회 CallBack)
	 */
	function sheet1_OnSearchEnd(code, message) {
	    if(code == 0) {
	    	setGridSize();
	    	var rowcnt = sheet1.RowCount();
			if(rowcnt> 0){
				for(var r=0; r < rowcnt; r++)
				{
					if(sheet1.GetCellValue(r+1,"SUCC_YN") == "N"){
						sheet1.SetCellFontColor(r+1, 10, "red");
					}
				}
			}
	    	sheet1.SetColFontColor("BID_MASTER_NM", "#0000ff");
	    	autoResize();
		} else {
			//조회 에러 수행
			alert(message);
		}
	}
	
	/**
	 *	IBSheet Event: Click
	 */
	function sheet1_OnDblClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
		 if(Row == 0)return;
		 if (Col == 6) {
				$("#BID_NO").val(sheet1.GetCellValue(Row, "BID_NO"));
				$("#BID_DEG").val(sheet1.GetCellValue(Row, "BID_DEG"));
				$("#DEMANDED_ID").val(sheet1.GetCellValue(Row, "DEMANDED_ID"));
				$("#fevent").val("FORM_SELECT");
				$("#form1").attr("action", "/portal/bid/SuppBidResult.screen");
				$("#form1").attr("target", "_self");
				$("#form1").attr("method", "post");
				$("#form1").submit();
			}
	}
	
	/**
	 *	IBSheet size setting
	 */
	function setGridSize() {
		sheet1.FitColWidth();
	}
	
	
	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); 
	}
	

</SCRIPT>


<modular:search id="form1">
	<modular:key id="fevent" />
</modular:search>
<BODY onresize="autoResize()" >
<form id="form1" name="form1" method="post" modular:type="search">
<TABLE id="t1" border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">

<INPUT type="hidden" name="p_user_sabun" value="">
<INPUT type="hidden" name="fevent" id="fevent" value="">
<INPUT type="hidden" name="BID_NO" value="">
<INPUT type="hidden" name="BID_DEG" value="">
<INPUT type="hidden" name="P_DEMANDED_KIND" value="O">
<INPUT type="hidden" name="p_tel_no" value="">
<INPUT type="hidden" name="p_hand_tel_no" value="">
<INPUT type="hidden" name="VENDOR_CD" value="<%=user.get("CORP_ID")%>">
<INPUT type="hidden" name="p_user_name" value="">
<INPUT type="hidden" name="DEMANDED_ID" value="">

<INPUT type="hidden" name="j_usertype" value="head">
<input type='hidden' name='login_id' >
<input type='hidden' name='login_pw' >
<INPUT type="hidden" name="j_admin_login_gb" value="Y">

<div align="left" id="title" >
    <ul><li>입찰결과</li></ul>
</div>

<!-- 검색조건 영역 : 시작 -->
<TR><TD height="1">
<table id="search-table" class="search-form-table" >
	<colgroup>
		<col width="150" />
		<col width="250" />
		<col width="150" />
		<col width="*" />
		<col width="250" />
	</colgroup>
	<tr>
		<th>입찰공고명</th>
		<td >
	   		<%= InputText.get("P_BID_MASTER_NM", "", 50, 50, "hangule, desc=입찰공고명, PerSize") %>
		</td>
		<th>마감일자</th>
		<td>
			<%= InputText.get("SITEDESC_FROM_DT", "", 8, 50, "hangule,center, desc=마감일자,ReadOnly") %>
			<IMG name="start_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('SITEDESC_FROM_DT');">
						~
			<%= InputText.get("SITEDESC_TO_DT", "", 8, 50, "hangule,center, desc=마감일자,ReadOnly") %>
			<IMG name="start_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('SITEDESC_TO_DT');">
			<IMG name="dataClear" id="dataClear" src="/img/buyer/button/bt_eraser1.gif" border="0" align="absmiddle" style="cursor:pointer;">
		</td>
		<td class="button" rowspan="2">
			<span class="btnSearch center" id="btnSearch"><a href="javascript:void(0);">검색</a></span>
		</td>
	</tr>
	<tr>
		<th>상태</th>
		<td colspan="3">
		 <SELECT class='input_select' id='P_STATUS' name='P_STATUS' style="width:110px;">
			<option value=''>--전체--</option><OPTION value='10'>업체선정완료</OPTION><OPTION value='91'>유찰</OPTION><OPTION value='92'>취소</OPTION>
		</SELECT>   
		</td>
	</tr>
</table>
</TD></TR>
<!-- 검색조건 영역 : 종료 -->

<!-- 검색조건 영역, 테이터 영역 구분 여백 : 시작 -->
<TR><TD height="1">
<TABLE border="0" cellspacing="0" cellpadding="0" class="search_data_div_height">
<TR><TD></TD></TR>
</TABLE>
</TD></TR>
<!-- 검색조건 영역, 테이터 영역 구분 여백 : 종료 -->
</TABLE>
<div id="sheet1_div" style="padding-top:5px;height: auto; min-height: 350px; overflow: auto;">
<!-- <div id="sheet_div" style="padding-top:5px; width:100%; height:100%;" valign="top"> -->
	<script>createIBSheet('sheet1','100%', '350px');</script>
</div>
</FORM>