<%--
  - Author(s)  : Hyung min Son
  - Date       : 2014.07.02
  - Description: 구매_견적서작성
  --%>

<%@page import="monfox.toolkit.snmp.agent.modules.SnmpV2Mib.SysOREntry"%>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="com.udapsoft.waf.common.ui.*" %>
<%@ page import="com.udapsoft.waf.common.util.StringUtils" %>
<%@ page import= "kr.co.hsnc.common.sql.util.RowSetUtility" %>
<%@ page import="kr.co.udapsoft.common.code.*" %>
<%@ 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();
    ValueObject Order = storage.getValueObject("Order");
    ValueObject file = storage.getValueObject(Order.get("FILE_GB"));
    SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
    RowSet CODE911 = storage.getRowSet("CODE911");
    String str = sd.format(new Date()); 
%>
<SCRIPT language="JavaScript">
	/*예약함수*/
	var sheet1 = new ibsheetObject();
	var pageLastRowIndex = 1;
	var validationResult = false;
	var filterShow = false;
	var must_msg = "(은)는 필수 입력 항목입니다."; 
	var cost_point = <%=Order.get("PointCount")%>;
	
	function _onReady(){
		gridInit(sheet1);
		gridInit(sheet2);
		//var info = [{StdCol:4 , SumCols:"8|10",CaptionText:"[합    계]",CaptionCol:5,},{StdCol:6 , SumCols:"8|10",CaptionText:"[소    계]",CaptionCol:6}];
		//sheet1.ShowSubSum (info);
		sheet1.SetSumValue(5,"합      계");
		/**
		 *	Application Initialize
		 */
		 
		 $("#btn_back").click(function() {
			 	jQuery("#fevent").val("FORM_SELECT");
				jQuery("#form1").attr("action", "/bid/purchase/SuccessBid.screen");
				jQuery("#form1").attr("target", "_self");
				jQuery("#form1").attr("method", "post");
				jQuery("#form1").submit();
		});
		
		 $("#btn_signdata").click(function() {
			 if(makecheck()){
			 	fMakeItemInfo();
			 }
		});
		 
		 
		$("#btnExcelDown").click(function(){
				var params = { FileName : "견적내역(부가세별도).xls",  SheetName : "견적내역(부가세별도)", SheetDesign:1 ,DownSum:false, DownCols:"MATERIAL_NAME|STD|UNIT_KIND|QTY|UNIT_COST|ROW_SUM_AMT"
					,	TitleText : "<%=Order.get("BID_MASTER_NM")%> 견적서 \r\n| |*단가 항목만 수정하여 업로드 바랍니다."
					,	UserMerge : "0,0,1,6 1,2,1,4"
					};
			sheet1.Down2Excel(params);
		});
		
		$("#btnExcelUpload").click(function(){
			sheet2.RemoveAll();			
			var params = { Mode : 'HeaderMatch',  StartRow: "3"};
			sheet2.LoadExcel(params);
		});
		doSearchSheet();
		
		<%if(!"Y".equals(Order.get("CURRENCY_GB_YN"))){%>
		$("#CURRENCY_GB").attr("disabled",true);
		<%}%>
		<%if(!"Y".equals(Order.get("DELIVERY_CONDITION_YN"))){%>
		$("#DELIVERY_CONDITION").attr("disabled",true);
		<%}%>
		
		$("#CURRENCY_GB").change(function(){
			CURRENCY_change();
		});
		
		$("#sheet2_div").hide();
		
		$("#paycondi_type_1").click(function(){
			$("#CBC_FIRST_RATE").val("<%=Order.get("CBC_FIRST_RATE_MAIN")%>");
			$("#PBC_FIRST_CONDI").val("<%=Order.get("PBC_FIRST_CONDI_MAIN")%>");
			$("#CPC_MID_RATE").val("<%=Order.get("CPC_MID_RATE_MAIN")%>");
			$("#PBC_MID_CONDI").val("<%=Order.get("PBC_MID_CONDI_MAIN")%>");
			$("#PBC_REST_RATE").val("<%=Order.get("PBC_REST_RATE_MAIN")%>");
			$("#PBC_REST_CONDI").val("<%=Order.get("PBC_REST_CONDI_MAIN")%>");
			
			$("#CBC_FIRST_RATE").attr("disabled",true);
			$("#PBC_FIRST_CONDI").attr("disabled",true);
			$("#CPC_MID_RATE").attr("disabled",true);
			$("#PBC_MID_CONDI").attr("disabled",true);
			$("#PBC_REST_RATE").attr("disabled",true);
			$("#PBC_REST_CONDI").attr("disabled",true);
		});

		$("#paycondi_type_2").click(function(){
			$("#CBC_FIRST_RATE").attr("disabled",false);
			$("#PBC_FIRST_CONDI").attr("disabled",false);
			$("#CPC_MID_RATE").attr("disabled",false);
			$("#PBC_MID_CONDI").attr("disabled",false);
			$("#PBC_REST_RATE").attr("disabled",false);
			$("#PBC_REST_CONDI").attr("disabled",false);
		});
		
		if("<%=Order.get("PAYCONDI_YN")%>" == "Y"){
			$("#paycondi_type_1").click();
		}
	}

	function doSearchSheet(){
		$("#fevent").val("VENDOR_SHEET_SELECT");
		var url = Modular.model.PageContext.CONTEXT_ROOT + "/bid/purchase/BidOfflineAmt_sheet.screen";
		Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 30, "");
	}
	
	function gridInit(sheetName){
		var init_sheet = {};
		init_sheet.Cfg = {SearchMode:2, Page:30};
		if(sheetName.id == "sheet1"){
			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:'No.',					Type:"Text", 			SaveName:"SEQ1",							Width:30, 			Align:"Center",     Edit:false},
				    			{Header:'자재코드',				Type:"Text", 			SaveName:"MATERIAL_CD", 				Width:100, 			Align:"Left",		Hidden:"True"},
				    			{Header:'자재명',				   Type:"Text", 			SaveName:"MATERIAL_NAME", 			    Width:100, 			Align:"Left",		Edit:false},
				    			{Header:'규격',					Type:"Text", 			SaveName:"STD", 						Width:120, 			Align:"Left", 		Edit:false},
				    			{Header:'단위',					Type:"Text", 			SaveName:"UNIT_KIND", 					Width:50, 			Align:"Center", 	Edit:false},
				    			{Header:'수량',					Type:"Float", 			SaveName:"QTY", 						Width:80, 			Align:"Right", 		Edit:false},
				    			{Header:'단가',					Type:"Float", 			SaveName:"UNIT_COST", 					Width:80, 			Align:"Right",		PointCount:<%=Order.get("PointCount")%>},
				    			{Header:'금액',					Type:"AutoSum", 		SaveName:"ROW_SUM_AMT",			 	    Width:80, 			Align:"Right",      Edit:false,	CalcLogic:"|QTY|*|UNIT_COST|",		PointCount:<%=Order.get("PointCount")%>}
				    			
				];
		}else{
			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:'No.',					Type:"Seq", 			SaveName:"NO",							Width:0, 			Align:"Center"},
				    			{Header:'자재코드',				Type:"Text", 			SaveName:"MATERIAL_CD", 				Width:100, 			Align:"Left",		Hidden:"True"},
				    			{Header:'자재명',				    Type:"Text", 			SaveName:"MATERIAL_NAME", 			    Width:300, 			Align:"Left",		Edit:false},
				    			{Header:'규격',					Type:"Text", 			SaveName:"STD", 						Width:120, 			Align:"Left", 		Edit:false},
				    			{Header:'단위',					Type:"Text", 			SaveName:"UNIT_KIND", 					Width:50, 			Align:"Center", 	Edit:false},
				    			{Header:'수량',					Type:"Float", 			SaveName:"QTY", 						Width:50, 			Align:"Right", 		Edit:false},
				    			{Header:'단가',					Type:"Float", 			SaveName:"UNIT_COST", 					Width:80, 			Align:"Right",		PointCount:<%=Order.get("PointCount")%>},
				    			{Header:'금액',					Type:"AutoSum", 		SaveName:"ROW_SUM_AMT",			 	    Width:80, 			Align:"Right",      Edit:false,	CalcLogic:"|QTY|*|UNIT_COST|",		PointCount:<%=Order.get("PointCount")%>}
				];
		}
		init_sheet.HeaderMode = {Sort:1};
		IBS_InitSheet(sheetName, init_sheet);
		sheetName.SetDataAutoTrim(0);
		sheetName.SetFocusEditMode(1);
		sheetName.SetEditEnterBehavior("down");
		setGridSize();
	}

function sheet2_OnLoadExcel(result) {
		
		var DataCopy = true;
		var GrowCount1 = sheet1.LastRow();
		var GrowCount2 = sheet2.LastRow();
		if(GrowCount1 != GrowCount2){
			alert("현재 견적내용과 업로드한 견적내용이 다릅니다.\n엑셀 파일을 확인 후 재업로드 해주세요.");
			sheet2.RemoveAll();
			return;
		}
		for(var i=0; i < GrowCount1;i++){
			var q1 = sheet1.GetCellValue(i+1,"QTY");
			var q2 = sheet2.GetCellValue(i+1,"QTY");
			if(q1 != q2){
				alert("엑셀파일 "+(i+2)+"행 수량이 변경 되었습니다.\n단가를 제외한 모든 내용은 수정할 수 없습니다.");
				sheet2.RemoveAll();
				return;
			}
		}
		
		for(var i=0; i < GrowCount1;i++){
			var Uc = sheet2.GetCellValue(i+1,"UNIT_COST");
			sheet1.SetCellValue(i+1,"UNIT_COST",Uc);
		}
		var amt = sheet1.GetCellValue(GrowCount1,"ROW_SUM_AMT");
		if(amt != ""){
			$("#TOT_AMT_CK").val(amt);
			var arrAmt = $("#TOT_AMT_CK").val().split(".");
			if(arrAmt.length > 1){
				$("#TOT_AMT").val(formatComma(amt,cost_point));
			}else{
				$("#TOT_AMT").val(amt);
				$("#TOT_AMT").val($("#TOT_AMT").val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			}
		}
		
		sheet2.RemoveAll();

/* 		if(result) {			
	    	alert("엑셀 로딩이 완료되었습니다.");
		} else {
			alert("엑셀 로딩중 오류가 발생하였습니다.");
		} */
	}
	
	/**
	 *	IBSheet Event: Search End(IBSheet 데이터 조회 CallBack)
	 */
	function sheet1_OnSearchEnd(code, message) {
	    if(code == 0) {
    		sheet1.FitColWidth();
    	/**
    	*		단가 계약일경우 모든 수량을 1로 변경
    	**/
		var GrowCount = sheet1.LastRow();
		var amt = sheet1.GetCellValue(GrowCount,"ROW_SUM_AMT");
		if(amt != ""){
			$("#TOT_AMT_CK").val(amt);
			var arrAmt = $("#TOT_AMT_CK").val().split(".");
			if(arrAmt.length > 1){
				$("#TOT_AMT").val(formatComma(amt,cost_point));
			}else{
				$("#TOT_AMT").val(amt);
				$("#TOT_AMT").val($("#TOT_AMT").val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			}
		}
		$("#ESTI_TOT_AMT").val(amt);
		} else {
			//조회 에러 수행
			alert(message);
		}
	}
	/**
	 *	IBSheet Event: Click
	 */
	function sheet1_OnClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
		//alert("Row :" + Row + "              Col : " +Col);	 
	 }
	
	/**
	 *	IBSheet size setting
	 */
	function setGridSize() {
		sheet1.FitColWidth();
	}
	
	function sheet1_OnChange(Row, Col, Value) {
		if(Col == 8){//단가 수정시
			var Qty = sheet1.GetCellValue(Row,"QTY");
			var amt = Value * Qty;
			sheet1.SetCellValue(Row,"ROW_SUM_AMT",amt);
		}
		var GrowCount = sheet1.LastRow();
		var amt = sheet1.GetCellValue(GrowCount,"ROW_SUM_AMT");
		if(amt != ""){
			$("#TOT_AMT_CK").val(amt);
			var arrAmt = $("#TOT_AMT_CK").val().split(".");
			if(arrAmt.length > 1){
				$("#TOT_AMT").val(formatComma(amt,cost_point));
			}else{
				$("#TOT_AMT").val(amt);
				$("#TOT_AMT").val($("#TOT_AMT").val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			}
		}
		$("#ESTI_TOT_AMT").val(amt);
	}
	
	 function numberFormat(num) {
		 var pattern = /(-?[0-9]+)([0-9]{3})/;
		 while(pattern.test(num)) {
			 num = num.replace(pattern,"$1,$2");
		 }
		 return num;
	 }
	 
	//첨부파일   
	function doAttachFile(obj) {
		var file_div = "bid/purchase/"+"<%=Order.get("BID_NO")%>"+"/";
		 if(obj==''){
			alert("After you have saved, you can attach a file.");
		}
		else if(obj != ''){ 
			viewFileListNew("<%=Order.get("FILE_GB")%>", obj.value, document.form1.p_AttachFile, "Y", file_div);
		} 
	}
	
	function doResult(resultObj) {
		try {
			if( resultObj.getRequestEvent() == "FORM_UPDATE") {
				if( resultObj.getSuccess() ) {
					alert("저장 되었습니다.");
					jQuery("#fevent").val("");
					jQuery("#form1").attr("action", "/bid/purchase/BidPlanList.screen");
					jQuery("#form1").attr("target", "_self");
					jQuery("#form1").attr("method", "post");
					jQuery("#form1").submit();
				}
				else {
					dlgErrorMsg(resultObj);
				}
			}
			
			if( resultObj.getRequestEvent() == "FORM_DELETE") {
				if( resultObj.getSuccess() ) {
					alert("삭제 되었습니다.");
 					$("#btn_list").click();
				}
				else {
					dlgErrorMsg(resultObj);
				}
			}
		} catch(errorObject) {
			showErrorDlg("doResult()", errorObject);
		}
	}
	
	function sheet1_OnSmartResize(Width, Height) { 
		sheet1.FitColWidth();
		autoResize();
	}
	
	function valreturn(data){
		if(data == undefined){
			data ="NULL";
		} 
		return data;
	}

	function autoResize(){

	}
	
	function AddZero(str){
		
		if((str+"").length==1){
			return "0"+str;
		}	
		return str;
	}
	
	function makecheck(){
		<% if("Y".equals(Order.get("PBC_INSTALL_YN"))){ %>
		if(must_ck_radio("INSTALL_YN","Installation"))return false;
		<%} if("Y".equals(Order.get("PBC_COMMISS_YN"))){ %>
		if(must_ck_radio("COMMISS_YN","Spare parts for Commissioning"))return false;
		<%} if("Y".equals(Order.get("PBC_SPETOOL_YN"))){ %>
		if(must_ck_radio("SPETOOL_YN","Special Tool"))return false;
		<%} if("Y".equals(Order.get("PBC_TEST_YN"))){ %>
		if(must_ck_radio("TEST_YN","Test & Inspection at Fabrication shop"))return false;
		<%} if("Y".equals(Order.get("PBC_DOC_YN"))){ %>
		if(must_ck_radio("DOC_YN","Documentation"))return false;
		<%} if("Y".equals(Order.get("PBC_PACK_YN"))){ %>
		if(must_ck_radio("PACK_YN","Packing cost"))return false;
		<%} if("Y".equals(Order.get("PBC_LANDTRAN_YN"))){ %>
		if(must_ck_radio("LANDTRAN_YN","Inland Transportaion"))return false;
		<%}%>
		if(must_ck_radio("PAYCONDI_YN","payment Condition"))return false;
		if(must_ck_radio("CONTFUL_YN","Performance Bond"))return false;
		if(must_ck_radio("FRSTGUAR_YN","First Payment Bond"))return false;
		if(must_ck_radio("WARR_YN","Guarantee Bond"))return false;
		if(must_ck_radio("DEFECT_YN","Guarantee Period"))return false;
		
		return true;
	}
	
	function fMakeItemInfo(){
			var GrowCount = sheet1.LastRow();
			var rowsum = 0;
			var costzero = false;
			
			//2017.04.18
			if ($("#CURRENCY_GB").val() == ""){
				alert("통화를 선택 해 주세요.");
				return;
			}
			
			
			 for(var	i=1; i < 	GrowCount+1; i++)
			{
				 if(sheet1.GetCellValue(i,"UNIT_COST") == 0){
					 costzero = true;
				 }
				 rowsum += sheet1.GetCellValue(i,"UNIT_COST");	
			}
			if(rowsum == 0){
				alert("단가를 입력해 주세요.");
				return;
			}

			var confirmMsg = ""; 
			 	confirmMsg = "견적총금액은 "+sheet1.GetCellValue(GrowCount,"ROW_SUM_AMT").toLocaleString()+" "+ $("#CURRENCY_GB").val()+" (VAT별도)입니다.\n\n견적서를 제출하시겠습니까?";
			
			 if(confirm(confirmMsg)){
					jQuery("#fevent").val("SAVE");
					var url = Modular.model.PageContext.CONTEXT_ROOT + "/bid/purchase/BidOfflineAmt_sheet.screen";
					Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), 30, "");	 
			 }
	}
	// radio 박스 체크
	function must_ck_radio(obj,name){
		var value   = $(':radio[name='+obj+']:checked').val();
		if(value == undefined){
			alert(name+must_msg);
			$("#"+obj).focus();
			return true;
		}
 		return false;
	}

	
	function sheet1_OnSaveEnd(code, msg)
	{
		var event = $("#fevent").val();
		if(event == "SAVE"){
			if(code >= "0"){
				alert("저장되었습니다.");
				historyback();
			}else{
				alert(msg);
			}
		}
	}
	function historyback(){
		$("#fevent").val("FORM_SELECT");
		$("#form1").attr("action", "/bid/purchase/SuccessBid.screen");
		$("#form1").attr("target", "_self");
		$("#form1").attr("method", "post");
		$("#form1").submit();
	}
	
	function isEmptyVal( value ) {
		if(value.length == 0){
			return true;
		}
		if( value == "" ) {
			return true;
		}
		return false;
	}

	function CURRENCY_change(){
		<% 
		     for(int i=0;i < CODE911.size();i++){
			   ValueObject Vo = RowSetUtility.getValueObject(CODE911.getRow(i));	
		%>
				if($("#CURRENCY_GB").val() == "<%=Vo.get("DETAILCD")%>"){
					InitCellProperty("<%=Vo.get("CHG_CODE01").equals("0") ? "Int" : "Float"%>",<%=Vo.get("CHG_CODE01")%>);
				}
		<%}%>
	}
	
	function InitCellProperty(CellType, CellPointCount){
		var GrowCount = sheet1.LastRow();
		var init = "";
		var init2 = "";
		cost_point = CellPointCount;
		for(var	i=0; i < 	GrowCount; i++)
		{
			if(CellType == "Int"){
				init = {Type:"Int",	 PointCount:CellPointCount};
				init2 = {Type:"AutoSum",	 PointCount:CellPointCount};
			}else{
				init = {Type:"Float",	PointCount:CellPointCount};
				init2 = {Type:"AutoSum",	 PointCount:CellPointCount};
			}
			sheet1.InitCellProperty(i+1,"UNIT_COST",init);	
			sheet2.InitCellProperty(i+1,"UNIT_COST",init);
		}
	}

		
//	setInterval("dpTime()",1000);
</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="ESTI_TOT_AMT" value="">
<INPUT type='hidden' name="DEMANDED_ID" value="<%=Order.get("DEMANDED_ID")%>">
<INPUT type='hidden' name="DEMANDED_KIND" value="<%=Order.get("DEMANDED_KIND")%>">
<INPUT type='hidden' name="BID_NO" value="<%=Order.get("BID_NO")%>">
<INPUT type='hidden' name="BID_DEG" value="<%=Order.get("BID_DEG")%>">
<INPUT type='hidden' name="STATUS_CD" value="<%=Order.get("STATUS_CD")%>">
<INPUT type='hidden' name="VENDOR_CD" value="<%=Order.get("VENDOR_CD")%>">
<INPUT type='hidden' name="FILE_GB" value="<%=Order.get("FILE_GB")%>">
<INPUT type='hidden' name="ATT_ID" value="<%=Order.get("ATT_ID")%>">
<INPUT type='hidden' name="TOT_AMT_CK" value="">
<INPUT type='hidden' name="ESTI_SIGNDATA" value="">
<INPUT type='hidden' name="sItemInfo" value="">
<INPUT type='hidden' name="signeddata" value="">

<table width="100%">
	<colgroup>
		<col width="*" />
		<col width="130" />
	</colgroup>
	<tr>
   		<th>
	   		<div align="left" id="title" >
 			  <ul><li>견적서작성</li></ul>
			</div> 
   		</th>
   		<td align="right">
       		<span class="btnSearch center" id="btn_back"><a href="javascript:void(0);">이전</a></span>
			<span class="btnSearch center" id="btn_signdata"><a href="javascript:void(0);">견적서제출</a></span>
   		</td>
  	</tr>
</table>
<div class="application-info magT10" >
	<div class="application-sub-title">
		<span class="title">견적정보</span>
	</div>
</div>
<TABLE class="form-table" style="margin-top:3px">
	<colgroup>
		<col width="160">
		<col/>
	</colgroup>
	<TR height="25"> 
		<TH style="text-align:left">사업자번호</TH>
		<TD><%=StringUtils.getBizNo(Order.get("CORP_REG_NO")) %></TD>
	</TR>
	<TR height="25">     
		<TH style="text-align:left"> 업체명</TH>
		<TD><%=Order.get("CORP_KOR")%></TD>
	</TR>
	<TR height="25"> 
		<TH style="text-align:left"> 견적합계금액</TH>
		<TD><%= InputText.get("TOT_AMT", "", 50, 300, "class=input_blank,desc=견적합계금액,readOnly=white") %></TD>
	</TR>
</table>


<TABLE width="100%">
	<colgroup>
		<col width="50%">
		<col width="50%"/>
	</colgroup>
<tr><td valign="top"  rowspan="2" >
	<div class="application-info magT10" >
	<div class="application-sub-title">
		<span class="title">견적조건</span>
	</div>
</div>
<TABLE class="form-table">
	<colgroup>
		<col width="160">
		<col/>
	</colgroup>
  <TR height="25"> 
	<TH style="text-align:left">견적통화</TH>
	<TD><%=CommCodeManager.getSelectCodeList("911","CURRENCY_GB","height=18;","<option value=''>--선택--</option>",Order.get("CURRENCY_GB")) %>
	<%if("Y".equals(Order.get("CURRENCY_GB_YN"))){%>(견적의뢰 통화 : <%=Order.get("CURRENCY_GB_NM")%>) * 업체 변경가능<%} %>
	</TD>
  </TR>
  <% if("Y".equals(Order.get("PBC_INSTALL_YN"))){ %>
	<TR height="25">
		<TH style="text-align:left">Installation</TH>
		<TD>
			<LABEL for="install_type_1"><INPUT id="install_type_1" type="radio" name="INSTALL_YN" value="Y" desc="Installation" <%=Order.get("INSTALL_YN").equals("Y") ? "checked=\"checked\"" : "" %> > included</LABEL>
			<LABEL for="install_type_2"><INPUT id="install_type_2" type="radio" name="INSTALL_YN" value="N" desc="Installation" <%=Order.get("INSTALL_YN").equals("N") ? "checked=\"checked\"" : "" %> > not included</LABEL>
		</TD>
	</TR>
	<%} if("Y".equals(Order.get("PBC_COMMISS_YN"))){ %>
	<TR height="25">	
		<TH style="text-align:left">Spare parts for<br>Commissioning</TH>
		<TD>
			<LABEL for="commiss_type_1"><INPUT id="commiss_type_1" type="radio" name="COMMISS_YN" value="Y" desc="Installation" <%=Order.get("COMMISS_YN").equals("Y") ? "checked=\"checked\"" : "" %> > included</LABEL>
			<LABEL for="commiss_type_2"><INPUT id="commiss_type_2" type="radio" name="COMMISS_YN" value="N" desc="Installation" <%=Order.get("COMMISS_YN").equals("N") ? "checked=\"checked\"" : "" %> > not included</LABEL>
		</TD>
	</TR>
	<%} if("Y".equals(Order.get("PBC_SPETOOL_YN"))){ %>
	<TR height="25">	
		<TH style="text-align:left">Special Tool</TH>
		<TD>
			<LABEL for="spetool_type_1"><INPUT id="spetool_type_1" type="radio" name="SPETOOL_YN" value="Y" desc="Installation" <%=Order.get("SPETOOL_YN").equals("Y") ? "checked=\"checked\"" : "" %> > included</LABEL>
			<LABEL for="spetool_type_2"><INPUT id="spetool_type_2" type="radio" name="SPETOOL_YN" value="N" desc="Installation" <%=Order.get("SPETOOL_YN").equals("N") ? "checked=\"checked\"" : "" %> > not included</LABEL>
		</TD>
	</TR>
	<%} if("Y".equals(Order.get("PBC_TEST_YN"))){ %>
	<TR height="25">	
		<TH style="text-align:left">Test & Inspection at<br>Fabrication shop</TH>
		<TD>
			<LABEL for="test_type_1"><INPUT id="test_type_1" type="radio" name="TEST_YN" value="Y" desc="Installation" <%=Order.get("TEST_YN").equals("Y") ? "checked=\"checked\"" : "" %> > included</LABEL>
			<LABEL for="test_type_2"><INPUT id="test_type_2" type="radio" name="TEST_YN" value="N" desc="Installation" <%=Order.get("TEST_YN").equals("N") ? "checked=\"checked\"" : "" %> > not included</LABEL>
		</TD>
	</TR>
	<%} if("Y".equals(Order.get("PBC_DOC_YN"))){ %>
	<TR height="25">	
		<TH style="text-align:left">Documentation</TH>
		<TD>
		<LABEL for="doc_type_1"><INPUT id="doc_type_1" type="radio" name="DOC_YN" value="Y" desc="Installation" <%=Order.get("DOC_YN").equals("Y") ? "checked=\"checked\"" : "" %> > included</LABEL>
		<LABEL for="doc_type_2"><INPUT id="doc_type_2" type="radio" name="DOC_YN" value="N" desc="Installation" <%=Order.get("DOC_YN").equals("N") ? "checked=\"checked\"" : "" %> > not included</LABEL>
		</TD>
	</TR>
	<%} if("Y".equals(Order.get("PBC_PACK_YN"))){ %>
	<TR height="25">	
		<TH style="text-align:left">Packing cost</TH>
		<TD>
		<LABEL for="pack_type_1"><INPUT id="pack_type_1" type="radio" name="PACK_YN" value="Y" desc="Installation" <%=Order.get("PACK_YN").equals("Y") ? "checked=\"checked\"" : "" %> > included</LABEL>
		<LABEL for="pack_type_2"><INPUT id="pack_type_2" type="radio" name="PACK_YN" value="N" desc="Installation" <%=Order.get("PACK_YN").equals("N") ? "checked=\"checked\"" : "" %> > not included</LABEL>
		</TD>
	</TR>
	<%} if("Y".equals(Order.get("PBC_LANDTRAN_YN"))){ %>
	<TR height="25">	
		<TH style="text-align:left">Inland Transportaion</TH>
		<TD>
		<LABEL for="landtran_type_1"><INPUT id="landtran_type_1" type="radio" name="LANDTRAN_YN" value="Y" desc="Installation" <%=Order.get("LANDTRAN_YN").equals("Y") ? "checked=\"checked\"" : "" %> > included</LABEL>
		<LABEL for="landtran_type_2"><INPUT id="landtran_type_2" type="radio" name="LANDTRAN_YN" value="N" desc="Installation" <%=Order.get("LANDTRAN_YN").equals("N") ? "checked=\"checked\"" : "" %> > not included</LABEL>
		</TD>
	</TR>
	<%}%>
	<TR height="25">	
		<TH style="text-align:left">Delivery Condition</TH>
		<TD>
			<%=CommCodeManager.getSelectCodeList("PUR_LEAD_GB","DELIVERY_CONDITION","height=18;","<option value=''>--선택--</option>",Order.get("DELIVERY_CONDITION")) %>
			<%if("Y".equals(Order.get("DELIVERY_CONDITION_YN"))){%>(견적의뢰 조건 : <%=Order.get("DELIVERY_CONDITION_NM")%>) * 업체 변경가능<%} %>		 </TD>
		</TD>
	</TR>
	<%if("Y".equals(Order.get("PBC_FEE_YN"))){ %>
	<TR height="25">	
		<TH style="text-align:left">Supervision fee</TH>
		<TD>
			<%= InputText.get("FEE_NOTI", Order.get("FEE_NOTI"), 50, 2000, "") %> ex) per day $500		
		</TD>
	</TR>
	<%} if("Y".equals(Order.get("PBC_OPTION_YN"))){ %>
	<TR height="25">	
		<TH style="text-align:left"><%=Order.get("PBC_OPTION_COMMENT")%></TH>
		<TD>
			<%= InputText.get("OPTION_NOTI", Order.get("OPTION_NOTI"), 50, 50, "") %>	ex) per day $500
		</TD>
	</TR>
	<%} %>
	<TR height="25">	
		<TH style="text-align:left">Quotation No</TH>
		<TD><%= InputText.get("QUOT_NO", Order.get("QUOT_NO"), 50, 50, "") %>
		</TD>
	</TR>
	<TR height="25">	
		<TH style="text-align:left">payment Condition</TH>
		<TD>
			<LABEL for="paycondi_type_1"><INPUT id="paycondi_type_1" type="radio" name="PAYCONDI_YN" value="Y" desc="Installation" <%=Order.get("PAYCONDI_YN").equals("Y") ? "checked=\"checked\"" : "" %> > accept</LABEL>
			<LABEL for="paycondi_type_2"><INPUT id="paycondi_type_2" type="radio" name="PAYCONDI_YN" value="N" desc="Installation" <%=Order.get("PAYCONDI_YN").equals("N") ? "checked=\"checked\"" : "" %> > not included</LABEL>		
<%-- 		<%if(!Order.get("CBC_FIRST_RATE").isEmpty()){%><br>선급금 : <%=Order.get("CBC_FIRST_RATE") %>%(계약금액 기준)<%} %>
		<%if(!Order.get("CPC_MID_RATE").isEmpty()){%><br>중도금 : <%=Order.get("CPC_MID_RATE") %>%(계약금액 기준)<%} %>
		<%if(!Order.get("PBC_REST_RATE").isEmpty()){%><br>잔 금  : <%=Order.get("PBC_REST_RATE") %>%(계약금액 기준)<%} %> --%>
		<br>선급금 : <%= InputText.get("CBC_FIRST_RATE", Order.get("CBC_FIRST_RATE").isEmpty() ? Order.get("CBC_FIRST_RATE_MAIN") : Order.get("CBC_FIRST_RATE"), 5, 3, "Right,Number","Number") %>% <%= InputText.get("PBC_FIRST_CONDI", Order.get("PBC_FIRST_CONDI").isEmpty() ? Order.get("PBC_FIRST_CONDI_MAIN") : Order.get("PBC_FIRST_CONDI"), 20, 50, "") %>&nbsp;(계약금액 기준)
		<br>중도금 : <%= InputText.get("CPC_MID_RATE", Order.get("CPC_MID_RATE").isEmpty() ? Order.get("CPC_MID_RATE_MAIN") : Order.get("CPC_MID_RATE"), 5, 3, "Right,Number","Number") %>% <%= InputText.get("PBC_MID_CONDI", Order.get("PBC_MID_CONDI").isEmpty() ? Order.get("PBC_MID_CONDI_MAIN") : Order.get("PBC_MID_CONDI"), 20, 50, "") %>&nbsp;(계약금액 기준)
		<br>잔 &nbsp; 금 : <%= InputText.get("PBC_REST_RATE", Order.get("PBC_REST_RATE").isEmpty() ? Order.get("PBC_REST_RATE_MAIN") : Order.get("PBC_REST_RATE"), 5, 3, "Right,Number","Number") %>% <%= InputText.get("PBC_REST_CONDI", Order.get("PBC_REST_CONDI").isEmpty() ? Order.get("PBC_REST_CONDI_MAIN") : Order.get("PBC_REST_CONDI"), 20, 50, "") %>&nbsp;(계약금액 기준)
		<br><br><TEXTAREA name="PAYCONDI_NOT_NOTI" id="PAYCONDI_NOT_NOTI" style="width:98%;height:50px" rows="1" class="input"><%=Order.get("PAYCONDI_NOT_NOTI") %></TEXTAREA>
		</TD>
	</TR>
	<TR height="25">	
		<TH style="text-align:left">Performance Bond</TH>
		<TD><%=Order.get("CONTFUL_RATE") %>%(계약금액 기준)
		<LABEL for="contful_type_1"><INPUT id="contful_type_1" type="radio" name="CONTFUL_YN" value="Y" desc="Installation" <%=Order.get("CONTFUL_YN").equals("Y") ? "checked=\"checked\"" : "" %> > accept</LABEL>
		<LABEL for="contful_type_2"><INPUT id="contful_type_2" type="radio" name="CONTFUL_YN" value="N" desc="Installation" <%=Order.get("CONTFUL_YN").equals("N") ? "checked=\"checked\"" : "" %> > not accept</LABEL>
		 &nbsp&nbsp<TEXTAREA name="CONTFUL_NOT_NOTI" id="CONTFUL_NOT_NOTI" style="width:40%;height:20px" rows="1" class="input"><%=Order.get("CONTFUL_NOT_NOTI") %></TEXTAREA>
		</TD>
	</TR>
	<TR height="25">	
		<TH style="text-align:left">First Payment Bond</TH>
		<TD>
		<%=Order.get("PBC_FRSTGUAR_RATE") %>%(계약금액 기준)
		<LABEL for="frtguar_type_1"><INPUT id="frtguar_type_1" type="radio" name="FRSTGUAR_YN" value="Y" desc="Installation" <%=Order.get("FRSTGUAR_YN").equals("Y") ? "checked=\"checked\"" : "" %> > accept</LABEL>
		<LABEL for="frtguar_type_2"><INPUT id="frtguar_type_2" type="radio" name="FRSTGUAR_YN" value="N" desc="Installation" <%=Order.get("FRSTGUAR_YN").equals("N") ? "checked=\"checked\"" : "" %> > not accept</LABEL>
		 &nbsp<TEXTAREA name="FRSTGUAR_NOT_NOTI" id="FRSTGUAR_NOT_NOTI" style="width:40%;height:25px" rows="1" class="input"><%=Order.get("FRSTGUAR_NOT_NOTI") %></TEXTAREA>
		</TD>
	</TR>
	<TR height="25">	
		<TH style="text-align:left">Guarantee Bond</TH>
		<TD><%=Order.get("WARR_RATE") %>%(계약금액 기준)
		<LABEL for="warr_type_1"><INPUT id="warr_type_1" type="radio" name="WARR_YN" value="Y" desc="Installation" <%=Order.get("WARR_YN").equals("Y") ? "checked=\"checked\"" : "" %> > accept</LABEL>
		<LABEL for="warr_type_2"><INPUT id="warr_type_2" type="radio" name="WARR_YN" value="N" desc="Installation" <%=Order.get("WARR_YN").equals("N") ? "checked=\"checked\"" : "" %> > not accept</LABEL>
		 &nbsp&nbsp<TEXTAREA name="WARR_NOT_NOTI" id="WARR_NOT_NOTI" style="width:40%;height:20px" rows="1" class="input"><%=Order.get("WARR_NOT_NOTI") %></TEXTAREA>
		</TD>
	</TR>
	<TR height="25">	
		<TH style="text-align:left">Guarantee Period</TH>
		<TD><%=Order.get("PBC_DEFECT_CONDI") %> <%=Order.get("CBC_DEFECT_DAY") %><%=Order.get("CBC_DERECT_TERM_NM") %>간<br>
		<LABEL for="defect_type_1"><INPUT id="defect_type_1" type="radio" name="DEFECT_YN" value="Y" desc="Installation" <%=Order.get("DEFECT_YN").equals("Y") ? "checked=\"checked\"" : "" %> > accept</LABEL>
		<LABEL for="defect_type_2"><INPUT id="defect_type_2" type="radio" name="DEFECT_YN" value="N" desc="Installation" <%=Order.get("DEFECT_YN").equals("N") ? "checked=\"checked\"" : "" %> > not accept</LABEL>
		 &nbsp;<TEXTAREA name="DEFECT_NOT_NOTI" id="DEFECT_NOT_NOTI" style="width:98%;" rows="1" class="input"><%=Order.get("DEFECT_NOT_NOTI") %></TEXTAREA>
		</TD>
	</TR>
	<TR height="50">	
		<TH style="text-align:left">OTHERS TO BE<br>CONFIRMED</TH>
		<TD>
		 <TEXTAREA name="BID_CONDI_NOTI" id="BID_CONDI_NOTI" style="width:98%;height:50px" rows="1" class="input"><%=Order.get("BID_CONDI_NOTI") %></TEXTAREA>
		</TD>
  </TR>
</TABLE>
</TD>
<TD style="padding-left:5px;" valign="top">
	<table style="width:100%;height:25px;margin-top:-4px;">
		<colgroup>
			<col width="*" />
			<col width="200" />
		</colgroup>
		<tr heigth="25">
	   		<th>
	   		<div class="application-info magT10">
				<div class="application-sub-title">
					<span class="title">견적내역(부가세별도)</span>
				</div>
			</div>
	   		</th>
	   		<td align="right">
	       		<span class="btnSearch center" id="btnExcelUpload"><a href="javascript:void(0);">Excel Upload</a></span>
	       		<span class="btnSearch center" id="btnExcelDown"><a href="javascript:void(0);">Excel Down</a></span>
	   		</td>
	  	</tr>
	</table>
		<div id="sheet1_div" style="height: auto; min-height:100px;width:100%; overflow: auto;height:100%">
			<script>createIBSheet('sheet1','100%', '450px');</script>
		</div>
</TD>
</TR>
<TR><TD valign="top" width="*">
<div class="application-info magT10" >
	<div class="application-sub-title">
		<span class="title">첨부파일</span>
	</div>
</div>
	<TABLE class="form-table">
		<colgroup>
			<col width="160">
			<col/>
		</colgroup>
	  <TR height="100"> 
		<TH style="text-align:left"> 첨부파일</TD>
		<TD>
		 <TEXTAREA name="p_AttachFile" id="p_AttachFile" style="width:85%;height:80px" rows="1" class="input" readOnly><%=file.get(Order.get("FILE_GB")) %></TEXTAREA>
		                    <IMG id='search_spot_button' onClick="doAttachFile(document.form1.DEMANDED_ID);" src='/img/buyer/button/bt_change.gif' border='0'  align="top" align='absmiddle' alt='[Attach File]' style='cursor:pointer;'>
		</TD>
	  </TR>  
	</TABLE>
</TD>
</TR>
</TABLE>
<div id="sheet2_div" style="height: auto; min-height:100px;width:100%; overflow: auto;height:100%">
	<script>createIBSheet('sheet2','100%', '450px');</script>
</div>
</form>