<%--
  - FileName   : ContPriceSearch.jsp
  - Author(s)  : lee mi kyoung
  - Date       : 2016.6.24
  -
  - 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 = "blowfishj.*"%>   
<%@ page import = "java.text.SimpleDateFormat"%>    
<%@ page import="com.udapsoft.waf.common.util.DateUtil"%>                                                                                                                                                                                                         
<%@ page import = "java.util.Date"%>                                                                                                                                                                                                                         
<%@ page import = "java.util.*"%>  
<%@ 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 event = storage.getEvent();
    
    
    /*RowSet materialKindCodeLv1 = storage.getRowSet("materialKindCodeLv1");
    RowSet materialKindCodeLv2 = new RowSetImpl();
	RowSet materialKindCodeLv3 = new RowSetImpl();*/
	
	
	
	//검색조건 작성일
	String  initSearchDateStart = params.get("p_from_dt");
    String  initSearchDateEnd = params.get("p_to_dt");

	ValueObject defaultDate = DateUtil.getDefaultPeriod();
	if("".equals(initSearchDateStart)){
		initSearchDateStart = defaultDate.get("START_DATE");
	}
	if("".equals(initSearchDateEnd)){
		initSearchDateEnd = defaultDate.get("END_DATE");
	}
   
%>



<script type="text/javascript" src="/js/creditEvaluationPop.js"></script>
<script language="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($(this).attr("numberOnly") == "true")
        {
	        $(this).val( $(this).val().replace(/[^0-9]/gi,"") );
        }
	    
	    if (e.keyCode == 13)
        {
	        $.searchList();
        }
	    
	});
	
	
	$.gridInit = function(sheetName)
	{
		var init_sheet = {};
		init_sheet.Cfg = {SearchMode:2, MergeSheet:msHeaderOnly, Page:100};
		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", 	Edit:"false", Hidden:"True"},
		    			{Header:'MR NO',				Type:"Text", 			SaveName:"REQ_DOC_NO", 			    Width:120, 		Align:"Left", 	    Edit:"false"},
		    			{Header:'자재명',					Type:"Text", 			SaveName:"CST_DOC_NAME", 			Width:180, 		Align:"Left", 		Edit:"false"},
		    			{Header:'도급예산',				Type:"AutoSum", 		SaveName:"CONT_AMT",				Width:60, 		Align:"Right", 		Edit:"false"},
		    			{Header:'실행예산',				Type:"AutoSum", 		SaveName:"EXE_AMT",				    Width:60, 		Align:"Right", 		Edit:"false"},
		    			{Header:'계약금액',				Type:"AutoSum", 		SaveName:"ORD_SUPPLY_AMT", 			Width:60,		Align:"Right", 		Edit:"false"},
		    			{Header:'계약금액(KRW)',			Type:"AutoSum", 		SaveName:"ORD_AMT_KRW", 			Width:60,		Align:"Right", 		Edit:"false"},
		    			{Header:'계약일자',				Type:"Text", 			SaveName:"ORD_CON_DATE", 			Width:70, 		Align:"Center", 	Edit:"false"},
		    			{Header:'예실대비',				Type:"Float",			SaveName:"RATE", 			        Width:60, 		Align:"Right", 	    Edit:"false"},
		    			{Header:'예산절감액',				Type:"AutoSum", 		SaveName:"ADV_AMT", 			    Width:60, 		Align:"Right", 		Edit:"false"},
		    			{Header:'계약화폐',				Type:"Text", 			SaveName:"CUR_GB", 			        Width:50, 		Align:"Center", 	Edit:"false"},
		    			{Header:'VENDOR',				Type:"Text", 			SaveName:"MEMBER_NAME", 			Width:150, 		Align:"Left",		Edit:"false"},
		    			{Header:'IP',	  			    Type:"Text", 			SaveName:"A", 			Width:150, 		Align:"Left",		Edit:"false", Hidden:"True"},
		    			{Header:'TERMINAL',				Type:"Text", 			SaveName:"B", 			Width:150, 		Align:"Left",		Edit:"false", Hidden:"True"},
		    			{Header:'MODULE',				Type:"Text", 			SaveName:"C", 			Width:150, 		Align:"Left",		Edit:"false", Hidden:"True"},
		    			{Header:'SERVER_HOST',			Type:"Text", 			SaveName:"D", 			Width:150, 		Align:"Left",		Edit:"false", Hidden:"True"}
		    			
		];

		init_sheet.HeaderMode = {Sort:1};
		IBS_InitSheet(sheetName, init_sheet);
		sheetName.SetDataAutoTrim(0);
		setGridSize();
	}
	
	
	$(function(){
		
		$("#btn_search").click(function(){
		    $.searchList();
		});
		
		$("#btn_excel").click(function(){
	        var params = {FileName:"계약단가현황.xls",SheetName:"계약단가현황",Merge:1,SheetDesign:1, HiddenColumn:1};
	        sheet1.Down2Excel (params);
	    });
		
		$.searchList = function()
		{
			$("#fevent").val("BUDGET_CONTROL");
			
			var url = Modular.model.PageContext.CONTEXT_ROOT + "/cont/purchase/ContBudgetSearch_sheet.screen";
			Modular.view.IBSheet7.doSearch(sheet1, url, $("#form1"), 30, "");
		} 
		 
	});
	
	
	
	
	$(document).ready(function(){
		
	    $.gridInit(sheet1);
		
		autoResize(); 
	});
	 
	function calendar(thisDayObj){
		dlgCalendar(thisDayObj);
	}
	
	function setGridSize() {sheet1.FitColWidth();}
	
	 
	
	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="materialgroup" id="materialgroup" value=""/>
 
<div align="left" id="title">
	<ul>
    	<li>계약단가조회</li> 
   	</ul>
</div> 
<!-- 검색조건 시작 -->
<table id="search-table" class="search-form-table">
	<colgroup>
		<col width="100" />
		<col width="480" />
		<col width="100" />
		<col width="*" />
		<col width="100" />
	</colgroup>
  <tr height="25"> 
  	<th>현장</th>
   	<td>
  		<%=InputText.getSiteCodeNew("p_dept_cd", "p_dept_nm", "", user, params.get("p_dept_cd"), params.get("p_dept_nm"))%>
	</td>
  	<th>계약명</th>
   	<td>
   		<INPUT type="text" name="p_cst_doc_name" class="input" value="<%= params.get("p_cst_doc_name") %>" style="width:90%"> 
	</td>
	<td class="button" rowspan="2">
		<span class="btnSearch center" id="btn_search"><a href="javascript:void(0);">검색</a></span>
		<span class="btnSearch center"><a href="javascript:void(0);" id="btn_excel">엑셀</a></span>
	</td>	
  </tr>
  <tr>
	<th>계약일</th>
    <td> 
		<%= InputText.get("p_from_dt", initSearchDateStart, 15, 50, "Center, date, PerSize, readonly", "date", "") %>
		<a href="JavaScript:calendar('p_from_dt');"><img src="/img/buyer/button/bt_calender.gif" alt="달력" border="0" align="absmiddle" /></a>
		&nbsp;~&nbsp;
		<%= InputText.get("p_to_dt", initSearchDateEnd, 15, 50, "Center, date, PerSize, readonly", "date", "") %>
		<a href="JavaScript:calendar('p_to_dt');"><img src="/img/buyer/button/bt_calender.gif" alt="달력" border="0" align="absmiddle" /></a>
    </td>
    <th>업체명</th>
    <td> 
		<INPUT type="text" name="p_member_name" class="input" value="<%= params.get("p_member_name") %>" style="width:90%">
    </td>
  </tr>
   
</table>
</form>
<img src="/img/com/blank.gif" height="5px" />
   <div align="right" id="bugase">
    	<ul>
        단위(천원)
    	</ul>
  	</div>
<div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 400px; overflow: auto;">
	<script>createIBSheet('sheet1','100%', '400px');</script>
</div>