<%--
  - FileName   : BidItemPopup.jsp
  - Author(s)  : mklee
  - Date       : 2018.10.18
  - Description: ITEM 내역
  --%>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="kr.co.hsnc.common.sql.RowSet" %>
<%@ page import="kr.co.hsnc.common.util.ValueObject" %>
<%@ page import="com.udapsoft.waf.system.*" %>
<%@ page import="com.udapsoft.waf.common.*" %>
<%@ page import="kr.co.udapsoft.common.*" %>
<%@ page import="com.udapsoft.waf.common.util.*" %>
<%@ page import="kr.co.hsnc.common.util.*"%>
<%@ page import="kr.co.hsnc.common.util.Formatter"%>
<%@ page import="com.udapsoft.waf.common.ui.HTMLMaker" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@page import="java.net.URLDecoder"%>

<%@ 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 user       = ctx.getUser();
    ValueObject params     = storage.getParams();
    String event           = storage.getEvent(); 
%>

<SCRIPT language="JavaScript">
	var sheet1;
	var sheet1Row;
	var sheet1PageNo = 1;
	var pageLastRowIndex = 1;
	var validationResult = false;
	var filterShow = false;

	
    function _onReady(){
		gridInit(sheet1);
		autoResize();
		var info = [{StdCol:"DEPTH1" , SumCols:"8|9",CaptionText:"[소   계]",CaptionCol:3}];
		sheet1.ShowSubSum (info);
		sheet1.SetSumValue(3,"총  공  사  비");
 
		
		jQuery("#btnSearch").click(function() {
        	jQuery("#fevent").val("SHEET_ITEM_SELECT");
        	var url = Modular.model.PageContext.CONTEXT_ROOT + "/bid/outside/BidItemPopup_sheet.screen";
        	Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 30, "");
		});
		jQuery("#btnSearch").click();
	}
    
    function gridInit(sheetName){
		var init_sheet = {};
		init_sheet.Cfg = {SearchMode:0 ,  MergeSheet:msHeaderOnly+msPrevColumnMerge};
		init_sheet.Cols = [
                            {Header:'Del',					Type:"DelCheck",		SaveName:"DEL_CHECK", 				Width:0, 			Align:"Center",		Hidden:"True"},
                            {Header:'Status',				Type:"Status", 		    SaveName:"STATUS", 					Width:0, 			Align:"Center"		,		Hidden:"True"},
                            {Header:'구분',					Type:"Text", 			SaveName:"DEPTH1", 					Width:40, 			Align:"Center",		Edit:false},
                            {Header:'내역',					Type:"Text", 			SaveName:"ITEM_NAME", 				Width:120, 			Align:"left",	 		Edit:false},
                            {Header:'No.',					Type:"Seq", 			SaveName:"NO",						Width:0, 			Align:"Center",		Hidden:"True"},
                            {Header:'MATERIAL_CD',	        Type:"Text", 			SaveName:"MATERIAL_CD", 			Width:0, 			Align:"Center",		Hidden:"True"},
                            {Header:'PARENT_LEVEL',	        Type:"Text", 			SaveName:"PARENT_LEVEL", 			Width:0, 			Align:"left",			Hidden:"True"},
                            {Header:'수량/규격',			    Type:"Text", 			SaveName:"ITEMS", 					Width:0, 			Align:"Center", 	Hidden:"True"},
                            {Header:'도급금액',				Type:"AutoSum", 		SaveName:"AMT_ORD", 				Width:60, 			Align:"right"		},
                            {Header:'실행금액',				Type:"AutoSum", 		SaveName:"AMT_ACT", 				Width:60, 			Align:"right"		}
			    			
		]; 

		init_sheet.HeaderMode = {Sort:1};
		IBS_InitSheet(sheetName, init_sheet);
		sheetName.SetDataAutoTrim(0);
		setGridSize();
	}
 
 	function setGridSize() {
		sheet1.FitColWidth();
	}

    function sheet1_OnSearchEnd(code, message) { 
	    if(code == 0) { 
	    	var row = sheet1.RowCount();
	    	
	    	sheet1.RowDelete(row);
	    	//sheet1.RowDelete(row-2);
	    	//sheet1.RowDelete(row-4);
	    	//sheet1.SetMergeCell(row-3,2,1,2);//타이틀 머지
	    	//sheet1.SetMergeCell(row-4,2,1,2);
	    	//sheet1.SetMergeCell(row-5,2,1,2);
	    	sheet1.SetSelectRow(1);
    		setGridSize();
		} else {
			//조회 에러 수행
			alert(message);
		}
	} 
    function sheet1_OnSmartResize(Width, Height) { 
		sheet1.FitColWidth();
		//autoResize();
	}
    
   /**
    *  enter click 시 자동으로 검색이되도록 조
    */ 
	function check_Enter(){
		if (event.keyCode==13) 
			jQuery("#btnSearch").click();
	} 

 	function autoResize(){
		var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title_pop").scrollHeight + 20;
		var iframeHeight= document.body.scrollHeight - t1_height;   
		var iframeWidth= document.body.scrollWidth;   

		sheet1.SetSheetHeight(iframeHeight); 
	} 
    document.onkeydown 		= closePopupWindow;
    
    //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="get" modular:type="search">
	<INPUT type="hidden" name="fevent" id="fevent" value="">
	<INPUT	type="hidden" name="BID_NO" value="<%=params.get("BID_NO")%>" />
	<INPUT	type="hidden" name="BID_DEG" value="<%=params.get("BID_DEG")%>" />
	<INPUT	type="hidden" name="pop_win_id" value="<%=params.get("pop_win_id")%>" />
	<table id="search-table" class="search-form-table">
		<colgroup>
			<col width="*" />
		</colgroup>
		<tr>
			<td class="button" style="text-align:right; padding-right:10px;">
				<span class="btnSearch center" id="btnSearch" style="display:;"><a href="javascript:void(0);">검색</a></span> 
			</td>
		</tr>
	</table>
	<!-- 검색조건 종료 -->
	<div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 450px; overflow: auto;">
		<script>createIBSheet('sheet1','100%', '450px');</script>
	</div>
	
</form>
 
 
 