<%--
  - FileName   : OrdItemPopup.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();
		
		jQuery("#btnSearch").click(function() {
        	jQuery("#fevent").val("SHEET_ITEM_SELECT");
        	var url = Modular.model.PageContext.CONTEXT_ROOT + "/bid/outside/OrdItemPopup_sheet.screen"; 
        	Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 30, "");
		});
		
		jQuery("#btnSearch").click();
	}
    
    function gridInit(sheetName){
		var init_sheet = {};
		init_sheet.Cfg = {SearchMode:2, Page:5000, MergeSheet:msPrevColumnMerge + msHeaderOnly};
		init_sheet.Cols = [
                            {Header:'발주번호',		Type:"Text",	SaveName:"DEMANDED_ID",		Width:100, 	Align:"Left", 	Edit:"false",	Hidden:"True"},
                            {Header:'공종코드',		Type:"Text",	SaveName:"CD_CSTR",		    Width:40, 	Align:"Left", 	Edit:"false"},
                            {Header:'내역코드',		Type:"Text",	SaveName:"DL_CSTR",		    Width:40, 	Align:"Left", 	Edit:"false"},
                            {Header:'예산순번',		Type:"Text",	SaveName:"SEQ_BUDGET",		Width:10, 	Align:"Left", 	Edit:"false",	Hidden:"True"},
                            {Header:'예산차수',		Type:"Text",	SaveName:"SQ_BUDGET",		Width:10, 	Align:"Left", 	Edit:"false",	Hidden:"True"},
			       			{Header:'내역명',		    Type:"Text",	SaveName:"NM_CSTR",		    Width:200, 	Align:"Left", 	Edit:"false"},
			       			{Header:'전체도급',		Type:"AutoSum",	SaveName:"TOT_CONT_AMT", 	Width:80, 	Align:"Right", 	Edit:"false"},
			    			{Header:'전체실행',		Type:"AutoSum",	SaveName:"TOT_EXE_AMT",		Width:80, 	Align:"Right", 	Edit:"false"},
			    			{Header:'도급금액',		Type:"AutoSum",	SaveName:"CONT_AMT", 		Width:80, 	Align:"Right", 	Edit:"false"},
			    			{Header:'실행금액',		Type:"AutoSum",	SaveName:"EXE_AMT",		    Width:80, 	Align:"Right", 	Edit:"false"}
			    			
		]; 

		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) {
	    	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="DEMANDED_ID" value="<%=params.get("DEMANDED_ID")%>" />
	<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>
 
 
 