<%--
  - 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"));
    RowSet CODE911 = storage.getRowSet("CODE911");
    SimpleDateFormat sd = new SimpleDateFormat("yyyyMMdd");
    SimpleDateFormat sd2 = new SimpleDateFormat("yyyyMMddHHmm");
    String nowTime = sd.format(new Date());
    String to_yyyy = Order.get("BID_TO_DT").substring(0, 4);
    String to_MM = Order.get("BID_TO_DT").substring(5, 7);
    String to_dd = Order.get("BID_TO_DT").substring(8, 10);
    String to_hh = Order.get("BID_TO_DT").substring(11, 13);
    String to_mi = Order.get("BID_TO_DT").substring(14, 16);
    String nowTime_yyyy = nowTime.substring(0, 4);
    String nowTime_MM = nowTime.substring(4, 6);
    String nowTime_dd = nowTime.substring(6, 8);
    SimpleDateFormat SeverTime = new SimpleDateFormat("yyyy-MM-dd");
    String str = SeverTime.format(new Date());
%>
<SCRIPT language="JavaScript">
	var sheet1 = new ibsheetObject();
	var sheet2 = new ibsheetObject();
	var pageLastRowIndex = 1;
	var validationResult = false;
	var filterShow = false;
	var must_msg = "(은)는 필수 입력 항목입니다."; 
	var cost_point = 0;
	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() {
				$("#fevent").val("FORM_SELECT");
				//$("#form1").attr("action", "/bid/purchase/SuccessBid.screen");
				$("#form1").attr("action", "/portal/bid/QuotRequest.screen");
				$("#form1").attr("target", "_self");
				$("#form1").attr("method", "post");
				$("#form1").submit();
		});
		
		 $("#btn_signdata").click(function() {
			 if(makecheck()){
			 	fMakeItemInfo();
			 }
		});
		
		$("#btnExcelDown").click(function(){
				var params = { FileName : "(<%=Order.get("BID_NO")%>-<%=Order.get("BID_DEG")%>)견적서.xls",  SheetName : "(<%=Order.get("BID_NO")%>-<%=Order.get("BID_DEG")%>)견적서", SheetDesign:1 ,DownSum:false, DownCols:"MATERIAL_NAME|STD|UNIT_KIND|QTY|UNIT_COST|ROW_SUM_AMT"
					,	TitleText : "(<%=Order.get("BID_NO")%>-<%=Order.get("BID_DEG")%>) 견적서 \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);
		});
		
		if("<%=Order.get("PBC_DEFECT_CONDI2")%>"!=""||"<%=Order.get("CBC_DEFECT_DAY2")%>"!=""||"<%=Order.get("CBC_DERECT_TERM_CD2")%>"!=""){
			$("#addGuar").attr("checked", true);
			$(".checkAdd").show();
		}
		
		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);
		<%}%>
		$("#sheet2_div").hide();
		
		
		$("#CURRENCY_GB").change(function(){
			CURRENCY_change();
		});
		
		$("#paycondi_type_1").click(function(){
			$("#CBC_FIRST_RATE").val("<%=Order.get("CBC_FIRST_RATE")%>");
			$("#PBC_FIRST_CONDI").val("<%=Order.get("PBC_FIRST_CONDI")%>");
			$("#CPC_MID_RATE").val("<%=Order.get("CPC_MID_RATE")%>");
			$("#PBC_MID_CONDI").val("<%=Order.get("PBC_MID_CONDI")%>");
			$("#PBC_REST_RATE").val("<%=Order.get("PBC_REST_RATE")%>");
			$("#PBC_REST_CONDI").val("<%=Order.get("PBC_REST_CONDI")%>");
			
			$("#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);
		});
		
		
	}

	function doSearchSheet(){
		$("#fevent").val("GET_ITEM_LIST");
		var url = Modular.model.PageContext.CONTEXT_ROOT + "/portal/bid/OutEstmWrite_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:"Seq", 			SaveName:"NO",								Width:0, 			Align:"Center",		Hidden:"True"},
				    			{Header:'자재코드',				Type:"Text", 			SaveName:"MATERIAL_CD", 				Width:100, 			Align:"Left",			Hidden:"True"},
				    			{Header:'자재명',				Type:"Text", 			SaveName:"MATERIAL_NAME", 			Width:140, 			Align:"Left",			Edit:false},
				    			{Header:'규격',					Type:"Text", 			SaveName:"STD", 							Width:80, 			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:0},
				    			{Header:'금액',					Type:"AutoSum", 		SaveName:"ROW_SUM_AMT",			 	Width:80, 			Align:"Right", Edit:false,	CalcLogic:"|QTY|*|UNIT_COST|"}
				    			
				];
		}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",		Hidden:"True"},
				    			{Header:'자재코드',				Type:"Text", 			SaveName:"MATERIAL_CD", 				Width:60, 			Align:"Left",			Hidden:"True"},
				    			{Header:'자재명',				Type:"Text", 			SaveName:"MATERIAL_NAME", 			Width:220, 			Align:"Left",			Edit:false},
				    			{Header:'규격',					Type:"Text", 			SaveName:"STD", 							Width:70, 			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:3},
				    			{Header:'금액',					Type:"AutoSum", 		SaveName:"ROW_SUM_AMT",			 	Width:80, 			Align:"Right", Edit:false,	CalcLogic:"|QTY|*|UNIT_COST|"}
				    			
				];
		}
		init_sheet.HeaderMode = {Sort:1};
		IBS_InitSheet(sheetName, init_sheet);
		sheetName.SetDataAutoTrim(0);
		sheetName.SetFocusEditMode(1);
		sheetName.SetEditEnterBehavior("down");
		setGridSize();
	}
	
	function sheet2_OnLoadExcel(result) {
		CURRENCY_change();//cell 초기화
		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+4)+"행 수량이 변경 되었습니다.\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) {
    		
		} else {
			//조회 에러 수행
			alert(message);
		}
	    sheet1.FitColWidth();
	    CURRENCY_change();
	    //크롬 문제 
	    if(sheet1.GetSheetWidth() > 450){
	    	sheet1.SetSheetWidth(450);
	    	sheet1.SetSheetWidth($("#sheettable").width());
	    	sheet1.FitColWidth();
	    }
	    autoResize();
	}
	/**
	 *	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(','));
			}
 		}
	}
	
	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"){
				sheet1.SetCellValue(i+1,"UNIT_COST",Math.round(sheet1.GetCellValue(i+1,"UNIT_COST")));	//cell값 반올림
				sheet2.SetCellValue(i+1,"UNIT_COST",Math.round(sheet2.GetCellValue(i+1,"UNIT_COST")));
				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);
		}
	}
	
	 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) {
		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", "bid/outside/<%=Order.get("BID_NO")%>/<%=Order.get("VENDOR_CD")%>/");
		} 
	}
	
	function doResult(resultObj) {
		try {
			if( resultObj.getRequestEvent() == "FORM_UPDATE") {
				if( resultObj.getSuccess() ) {
					alert("저장 되었습니다.");
					history.back();
				}
				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";
		}else if(data == ""){
			data = "NULL";
		}else if(data == null){
			data = "NULL";
		}
		return data;
	}


	// 문자열 공백제거 함수
	String.prototype.stripspace = function() {
	 return this.replace(/ /g, '');
	}
	
	function autoResize(){
		var setheight = $("#table_a").height() - $("#table_b").height() -50;
		sheet1.SetSheetHeight(setheight);
		sheet1.SetSheetWidth($("#sheettable").width());
	}
	
	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;
	}
		
	// radio 박스 체크
	function must_ck_radio(obj,name){
		var value   = $(':radio[name='+obj+']:checked').val();
		if(value == undefined){
			alert("["+name+"] 항목에 견적포함여부 혹은 수용여부를 선택해주세요.");
			var id = $(':radio[name='+obj+']').attr("id");
			$("#"+id).focus();
			return true;
		}
 		return false;
	}
	
	function AddZero(str){
		
		if((str+"").length==1){
			return "0"+str;
		}	
		return str;
	}
	
	function fMakeItemInfo(){
		
			var sColumDelimiter = "┃";
			var sRowDelimiter		= "↕";
			var sRowDelimiter		= "↕";
			var sSumDelimiter		= "╂";
			var sEncDelimiter		= "⇔";
			var isNull	= "NULL";

			var	sItemInfo				=	"";
			var	sBidNo					=	"<%=Order.get("BID_NO")%>";			//	공고번호
			var	sBidDeg					=	"<%=Order.get("BID_DEG")%>";			//	입찰차수  var	sMainVendcd			=	"<%=Order.get("VENDOR_CD")%>";	//	원사업자번호
			var	sMainVendcd			=	$("#VENDOR_CD").val();	//	원사업자번호
			var	pTotSum					=	"";									//	견적제출금액
			var GrowCount = sheet1.LastRow();
			var sfileGB = $("#FILE_GB").val();
			 var bid_to_dt = "<%=Order.get("BID_TO_DT")%>";
			 var today = "<%=str%>";
			 var now = new Date();
		     hours = now.getHours();
		     if (hours < 10)
		         hours = "0" + hours;
		     minutes = now.getMinutes();
		     now = today + " " + hours + ":" + minutes;
		     var time = false;
			 if(bid_to_dt <= now){
				 time = true;
			 }
			var rowsum = 0;
			var costzero = false;
			 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;
			}
			if(sheet1.GetCellValue(GrowCount,"ROW_SUM_AMT") == "0" || sheet1.GetCellValue(GrowCount,"ROW_SUM_AMT") == "" || time){
				if((sheet1.GetCellValue(GrowCount,"ROW_SUM_AMT") == "0" || sheet1.GetCellValue(GrowCount,"ROW_SUM_AMT") == "") && time){	
					alert("다음과 같은 사유로 견적을\n 제출하실수 없습니다.\n* 견적마감시간 초과\n* 견적금액 0원");
				}else if(time){
					alert("다음과 같은 사유로 견적을\n 제출하실수 없습니다.\n* 견적마감시간 초과");
				}else if(sheet1.GetCellValue(GrowCount,"ROW_SUM_AMT") == "0" || sheet1.GetCellValue(GrowCount,"ROW_SUM_AMT") == ""){
					alert("다음과 같은 사유로 견적을\n 제출하실수 없습니다.\n* 견적금액 0원");
				}
				return;
			}
			
			for(var	i=1; i < 	GrowCount+1; i++)
			{
				
				var	pMaterial_cd			=	"";									//	아이템코드
				var	pQty						=	"";									//	수량
				var	PUnit_cost				=	"";									//	단가
				var	pRow_sum_amt		=	"";									//	합계
				var	pBasis_calcu			=	"";									//	산출근거
				var	pNoti						=	"";									//	비고
				
				pMaterial_cd = sheet1.GetCellValue(i,"MATERIAL_CD");
				if(pMaterial_cd.length > 0){
					pQty = sheet1.GetCellValue(i,"QTY");
					if(isEmptyVal(pQty))
						pQty = isNull;
					PUnit_cost = sheet1.GetCellValue(i,"UNIT_COST");
					if(isEmptyVal(PUnit_cost))
						PUnit_cost = isNull;
					pRow_sum_amt = sheet1.GetCellValue(i,"ROW_SUM_AMT");
					if(isEmptyVal(pRow_sum_amt))
						pRow_sum_amt = isNull;
					pNoti = sheet1.GetCellValue(i,"NOTI");
					if(isEmptyVal(pNoti))
						pNoti = isNull;
					pBasis_calcu = sheet1.GetCellValue(i,"BASIS_CALCU");
					if(isEmptyVal(pBasis_calcu))
						pBasis_calcu = isNull;
					if(isEmptyVal(pTotSum))
						pTotSum = isNull;
					
					sItemInfo	=	sItemInfo
										+	sBidNo	+	sColumDelimiter
										+	sBidDeg	+	sColumDelimiter
										+	sMainVendcd	+	sColumDelimiter
										+	pMaterial_cd	+	sColumDelimiter
										+	pQty	+	sColumDelimiter
										+	PUnit_cost	+	sColumDelimiter
										+	pRow_sum_amt +	sColumDelimiter
										+  pBasis_calcu +	sColumDelimiter
										+	pNoti	+	sRowDelimiter
				}
			}
			
	
			sItemInfo	=	sItemInfo + sSumDelimiter	+	sheet1.GetCellValue(GrowCount,"ROW_SUM_AMT") +	sSumDelimiter + sfileGB
							+ 	sSumDelimiter 
							+ 	valreturn($("#CURRENCY_GB_YN").val()) + sColumDelimiter
							+ 	valreturn($("#CURRENCY_GB").val()) + sColumDelimiter
							+	valreturn($(':radio[name="INSTALL_YN"]:checked').val()) + sColumDelimiter
							+  valreturn($(':radio[name="COMMISS_YN"]:checked').val()) + sColumDelimiter
							+	valreturn($(':radio[name="SPETOOL_YN"]:checked').val()) + sColumDelimiter
							+	valreturn($(':radio[name="TEST_YN"]:checked').val()) + sColumDelimiter
							+	valreturn($(':radio[name="DOC_YN"]:checked').val()) + sColumDelimiter
							+	valreturn($(':radio[name="PACK_YN"]:checked').val()) + sColumDelimiter
							+ 	valreturn($(':radio[name="LANDTRAN_YN"]:checked').val()) + sColumDelimiter
							+ 	valreturn($("#DELIVERY_CONDITION_YN").val()) + sColumDelimiter
							+ 	valreturn($("#DELIVERY_CONDITION").val()) + sColumDelimiter
							+ 	valreturn($("#FEE_NOTI").val()) + sColumDelimiter
							+ 	valreturn($("#OPTION_NOTI").val()) + sColumDelimiter
							+	valreturn($("#QUOT_NO").val()) + sColumDelimiter
							+ 	valreturn($(':radio[name="PAYCONDI_YN"]:checked').val()) + sColumDelimiter
							+	valreturn($("#PAYCONDI_NOT_NOTI").val()) + sColumDelimiter
							+ 	valreturn($(':radio[name="CONTFUL_YN"]:checked').val()) + sColumDelimiter
							+ 	valreturn($("#CONTFUL_NOT_NOTI").val()) + sColumDelimiter
							+ 	valreturn($(':radio[name="FRSTGUAR_YN"]:checked').val()) + sColumDelimiter
							+ 	valreturn($("#FRSTGUAR_NOT_NOTI").val()) + sColumDelimiter
							+ 	valreturn($(':radio[name="WARR_YN"]:checked').val()) + sColumDelimiter
							+	valreturn($("#WARR_NOT_NOTI").val()) + sColumDelimiter
							+ 	valreturn($(':radio[name="DEFECT_YN"]:checked').val()) + sColumDelimiter
							+ 	valreturn($("#DEFECT_NOT_NOTI").val()) + sColumDelimiter
							+	valreturn($("#BID_CONDI_NOTI").val()) + sColumDelimiter
							+	valreturn($("#CBC_FIRST_RATE").val()) + sColumDelimiter
							+	valreturn($("#PBC_FIRST_CONDI").val()) + sColumDelimiter
							+	valreturn($("#CPC_MID_RATE").val()) + sColumDelimiter
							+	valreturn($("#PBC_MID_CONDI").val()) + sColumDelimiter
							+	valreturn($("#PBC_REST_RATE").val()) + sColumDelimiter
							+	valreturn($("#PBC_REST_CONDI").val()) + sColumDelimiter;
			
			 $("#sItemInfo").val(sItemInfo);
			//alert($("#sItemInfo").val());
			 var confirmMsg = ""; 
			   var tot_amt = formatComma(sheet1.GetCellValue(GrowCount,"ROW_SUM_AMT"),0);
			   //tot_amt = tot_amt.replace(".00","");
			   tot_amt = $("#TOT_AMT").val();
			   
			 	confirmMsg = "견적총금액은 "+tot_amt+" (VAT별도)입니다.\n\n견적서를 제출하시겠습니까?";
			
			 if(confirm(confirmMsg)){
				 SignData();	 
			 }
			 
	}
	
	function sheet1_OnSaveEnd(code, msg)
	{
		var event = $("#fevent").val();
		if(event == "FORM_SAVE"){
			if(code >= "0"){
				
				alert("견적서를 제출하였습니다.\n견적서 제출마감시간까지 여러번 제출이 가능합니다.\n마지막으로 제출한 견적내역이 최종견적으로 반영됩니다.");
				
				historyback();
			}else{
				alert(msg);
			}
		}
	}
	function historyback(){
		$("#fevent").val("FORM_SELECT");
		$("#form1").attr("action", "/portal/bid/QuotRequest.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 dpTime2(){
	    var now = new Date();
	     hours = now.getHours();
	     minutes = now.getMinutes();
	     seconds = now.getSeconds();

	    /*  if (hours > 12){
	         hours -= 12;
	     	ampm = "오후 ";
	     }else{
	         ampm = "오전 ";
	     }
	     if (hours < 10)
	         hours = "0" + hours;
	     
	     if (minutes < 10)
	         minutes = "0" + minutes;
	     
	     if (seconds < 10)
	         seconds = "0" + seconds; */
	     
		//	document.getElementById("dpTime").innerHTML = ampm + hours + ":" + minutes + ":" + seconds;
			
			// 2010 년 6월 1일 (월은 0 ~ 11 월까지로 현재월 -1 값)

		    // 오후 6시 32분 35초 (시는 12 시간을 초과할 경우 12를 뺀 후 오후표시)

		    var day2= new Date(<%=to_yyyy%>,<%=to_MM%>,<%=to_dd%>,<%=to_hh%>,<%=to_mi%>,00);

		    // 2011 년 3월 1일 (월은 0 ~ 11 월까지로 현재월 -1 값)

		    // 오전 10시 15분 43초

		    var day1= new Date(<%=nowTime_yyyy%>,<%=nowTime_MM%>,<%=nowTime_dd%>,hours,minutes,seconds);

		    // 첫번째 날짜를 1/1000 값으로 환산

		    var ms1 = Date.parse(day1);

		//  alert(ms1);

		    // 두번째 날짜를 1/1000 값으로 환산

		    var ms2 = Date.parse(day2);

		//  alert(ms2);

		    var sep = (ms2-ms1)/1000; // 두 날짜간의 시간차 (1/1000 초 이므로 초로 환산)

		//  alert(sep);

		    var min = 60;

		    var hour= min * 60;

		    var day = hour * 24;

		    var sd  = parseInt(sep/day);

		    var sh  = parseInt((sep%day)/hour);

		    var sm  = parseInt((sep%hour)/min);

		    var ss  = sep%min+1;
			
		    var msg = "";
		    if(sd > 0){
		    	msg = sd+'일 '+sh+'시간 '+sm+'분 '+ss+'초 남았습니다. / 입찰진행중';
		    }else if(sd <= 0){
		    	if(sh <= 0){
		    		if(sm <= 0){
		    			msg = "입찰마감";
		    		}else{
		    			msg = sm+'분 '+ss+'초 남았습니다. / 입찰진행중';
		    		}
		    	}else{
		    		msg = sh+'시간 '+sm+'분 '+ss+'초 남았습니다. / 입찰진행중';
		    	}
		    }else{
		    	msg = "입찰마감";
		    }
		    document.getElementById('dpTime').innerHTML = msg;
	 }
		
	setInterval("dpTime2()",1000);
	document.body.onresize = addEvent( document.body.onresize, "autoResize()");
</SCRIPT>


<SCRIPT LANGUAGE="JavaScript">
<!--


function SignData()
{
	var VendorCd = "<%=user.get("CORP_REG_NO")%>";
	var enc_cert = "<%=Order.get("KEY")%>";
	var sOrgnData = $("#sItemInfo").val();
	sOrgnData = encodeURI(sOrgnData);
	
	if( $("#sItemInfo").val() == null || $("#sItemInfo").val() == "" )
	{
		alert("서명할 데이타를 넣어주십시요");
		return;
	}
	
	if(enc_cert == "" || enc_cert == null)	//	서버인증서를 못 받은 경우
	{
		alert("견적서 제출을 할수 없습니다.\n\n관리자에게 문의하세요");
		return;
	}
	
	// 인증서 선택창 초기화 및 선택된 인증서의 DN 추출
	// DN은 인증기관에서 유니크한 것임.

	
	unisign.EncryptDataWithCert( sOrgnData, enc_cert, function( resultObj ) {
		if( !resultObj || resultObj.resultCode != 0 ){
			alert( resultObj.resultMessage  );
			return;
		}
		
		$("#signeddata").val(resultObj.encryptedData);
			
		unisign.SignDataNVerifyVID( resultObj.encryptedData, null, VendorCd, function( resultObject ) {
			if( !resultObject || resultObject.resultCode != 0 ){
				if( resultObject.resultCode == '14208'){
					alert("선택하신 인증서가 로그인한 사업자의 인증서가 아닙니다.\n[사업자번호 불일치]");		
				} else if( resultObject.resultCode == '999'){
					alert("사용자 DN 선택이 취소 되었습니다.");
				} else {
					alert( resultObject.resultMessage);
				}
				
				return;
			}
			
			var signeddata = resultObject.signedData;
			var userdn = resultObject.certAttrs.subjectName;
			
			$("#ESTI_SIGNDATA").val(signeddata);
			
			$("#fevent").val("FORM_SAVE");
			var url = Modular.model.PageContext.CONTEXT_ROOT + "/portal/bid/OutEstmWrite_sheet.screen";
			var result = Modular.view.IBSheet7.doSave(sheet1, url, $("#form1"), false);
			//submitXmlRequest("/portal/bid/OutEstmWrite_form.screen", "FORM_SAVE", f);
		});
	});
	
	
	
	
/* 	unisign.SignDataNVerifyVID( sOrgnData, null, VendorCd, function( resultObject ) {
		if( !resultObject || resultObject.resultCode != 0 ){
			if( resultObject.resultCode == '14208'){
				alert("선택하신 인증서가 로그인한 사업자의 인증서가 아닙니다.\n[사업자번호 불일치]");		
			} else if( resultObject.resultCode == '999'){
				alert("사용자 DN 선택이 취소 되었습니다.");
			} else {
				alert( resultObject.resultMessage);
			}
			
			return;
		}
		
		var signeddata = resultObject.signedData;
		var userdn = resultObject.certAttrs.subjectName;
		$("#signeddata").val(signeddata);
		
		unisign.EncryptDataWithCert( signeddata, enc_cert, function( resultObj) {
				if( !resultObj || resultObj.resultCode != 0 ){
					alert( resultObj.resultMessage  );
					return;
				}
				$("#ESTI_SIGNDATA").val(resultObj.encryptedData);
				
				$("#fevent").val("FORM_SAVE");
				var url = Modular.model.PageContext.CONTEXT_ROOT + "/portal/bid/OutEstmWrite_sheet.screen";
				var result = Modular.view.IBSheet7.doSave(sheet1, url, $("#form1"), false);
				//submitXmlRequest("/portal/bid/OutEstmWrite_form.screen", "FORM_SAVE", f);
			}
		);
	});
	 */
	
}
//-->
</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="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="<%=user.get("CORP_ID")%>">
<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="hdn_cur_ymd"	value="<%=nowTime%>">
<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(user.get("CORP_REG_NO")) %></TD>
	</TR>
	<TR height="25">     
		<TH style="text-align:left"> 업체명</TH>
		<TD><%=user.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>
		<TR height="25"> 
		<TH style="text-align:left"> 견적제출기간</TH>
		<TD><%=Order.get("BID_FROM_DT")%> ~<%=Order.get("BID_TO_DT")%> <font color='red'><b> (<span id="dpTime"></span>)</b></font></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" id="table_a" style="min-width:600px ">
	<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"))){%> &nbsp;(견적의뢰 통화 : <%=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>
	<%} if("Y".equals(Order.get("DELIVERY_CONDITION_YN"))){ %>
	<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", "", 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", "", 50, 50, "") %>	ex) per day $500
		</TD>
	</TR>
	<%} %>
	<TR height="25">	
		<TH style="text-align:left">Quotation No</TH>
		<TD>
		<%= InputText.get("QUOT_NO", "", 50, 50, "") %>
		</TD>
	</TR>
	<TR height="25">	
		<TH style="text-align:left">Payment Condition</TH>
		<TD colspan="2">
			<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 accept</LABEL>		
		<br>선급금 : <%= InputText.get("CBC_FIRST_RATE", Order.get("CBC_FIRST_RATE"), 5, 3, "Right,Number","Number") %>% <%= InputText.get("PBC_FIRST_CONDI", Order.get("PBC_FIRST_CONDI"), 20, 50, "") %>&nbsp;(계약금액 기준)
		<br>중도금 : <%= InputText.get("CPC_MID_RATE", Order.get("CPC_MID_RATE"), 5, 3, "Right,Number","Number") %>% <%= InputText.get("PBC_MID_CONDI", Order.get("PBC_MID_CONDI"), 20, 50, "") %>&nbsp;(계약금액 기준)
		<br>잔 &nbsp; 금 : <%= InputText.get("PBC_REST_RATE", Order.get("PBC_REST_RATE"), 5, 3, "Right,Number","Number") %>% <%= InputText.get("PBC_REST_CONDI", Order.get("PBC_REST_CONDI"), 20, 50, "") %>&nbsp;(계약금액 기준)
		<br><TEXTAREA name="PAYCONDI_NOT_NOTI" id="PAYCONDI_NOT_NOTI" style="width:91%;height:50px" rows="1" class="input"></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>
		<br/><TEXTAREA name="CONTFUL_NOT_NOTI" id="CONTFUL_NOT_NOTI" style="width:95%;height:30px" rows="1" class="input"></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>
		 <br/><TEXTAREA name="FRSTGUAR_NOT_NOTI" id="FRSTGUAR_NOT_NOTI" style="width:95%;height:30px" rows="1" class="input"></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>
		 <br/><TEXTAREA name="WARR_NOT_NOTI" id="WARR_NOT_NOTI" style="width:95%;height:30px" rows="1" class="input"></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") %> 
		<%if(!Order.get("CBC_DERECT_TERM_NM").isEmpty()){ %><%=Order.get("CBC_DERECT_TERM_NM") %>간<%}%>
		<span class="checkAdd" style="display:none;">&nbsp;or&nbsp;
		<input type="checkbox" id="addGuar" style="margin-top:2px; display:none;">
		<%=Order.get("PBC_DEFECT_CONDI2") %> <%=Order.get("CBC_DEFECT_DAY2")%>  
		<%if(Order.get("CBC_DERECT_TERM_CD2").equals("01")){%>
			<span>일 간 중 선도래일</span>
		<%}else if(Order.get("CBC_DERECT_TERM_CD2").equals("02")){%>
			<span>개월 간 중 선도래일</span>
		<%} %>
		</span>
		<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>
		</TD> 
		
		<%-- <TD>설치완료일로부터 <%=Order.get("CBC_DEFECT_DAY") %><%=Order.get("CBC_DERECT_TERM_NM") %>간
		<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>
		 <br/><TEXTAREA name="DEFECT_NOT_NOTI" id="DEFECT_NOT_NOTI" style="width:95%;height:30px;" rows="1" class="input"></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:95%;height:30px" rows="1" class="input"></TEXTAREA>
		</TD>
  </TR>
</TABLE>
</TD>
<TD style="padding-left:5px;" valign="top">
	<table id=sheettable 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 style="padding-left:5px;" valign="bottom" width="*">
<div class="application-info magT10" >
	<div class="application-sub-title">
		<span class="title">첨부파일</span>
	</div>
</div>
	<TABLE class="form-table" id="table_b">
		<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>



<div id="CONTROL_LAYER" style="position:absolute; z-index:10; visibility:hidden;">

<script src="/js/cont/cont_util.js"></script>

<script>

	
</script>
</div>


<!-- 전자인증 모듈 설정 //-->
<link rel="stylesheet" type="text/css" href="/CrossCert/CC_WSTD_home/unisignweb/rsrc/css/certcommon.css?v=1" />
<script type="text/javascript" src="/CrossCert/CC_WSTD_home/unisignweb/js/unisignwebclient.js?v=1"></script>
<script type="text/javascript" src="/CrossCert/UniSignWeb_Multi_Init_Nim.js?v=1"></script>
<!-- 전자인증 모듈 설정 //-->