<%--
  - Author(s)  : Hoonseok choi
  - Date       : 2023.01.18
  - Description: 견적_계획 상세
  --%>
  
<%@ page contentType="text/html; charset=utf-8" %>
<%@page import="kr.co.hsnc.common.config.WAFConfig"%>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="com.udapsoft.waf.common.ui.*" %>
<%@ page import="kr.co.udapsoft.common.code.*" %>
<%@ page import="kr.co.hsnc.common.util.*"%>
<%@ page import="kr.co.hsnc.common.sql.*" %>
<%@ page import="com.udapsoft.waf.common.util.Formatter2"%>
<%@ page import="com.udapsoft.waf.common.util.StringUtils"%>
<%@ page import="kr.co.udapsoft.common.util.Crosscert"%>
<%@ 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 filein = storage.getValueObject("DOC_ETC_IN");
    ValueObject fileout = storage.getValueObject("DOC_ETC_OUT");
    
    String gwurl	=	"http://gw.sgcenc.co.kr/";
    
	String isModify = "";
	if(Order.get("quot_id").equals("")) {
		isModify = "false";
	} else {
		isModify = "true";
	}
	
	String today = DateUtil.formatDateTime(DateUtil.getToday(), "yyyyMMdd", "yyyyMMdd");
	
	//공통코드
	CommCodeManager commCodeManager = new CommCodeManager();
	InitCombo initCombo = new InitCombo();

	initCombo.makeComboData(commCodeManager.getCodeRowSet("QUOT_SUPP_SITEPARTI"), "NAME", "CODE");
	String BID_SUPP_SITEPARTI_CD = initCombo.getCode();
	String BID_SUPP_SITEPARTI_NM = initCombo.getCodeName();
	
	InitCombo initCombo2 = new InitCombo();

	initCombo2.makeComboData(commCodeManager.getCodeRowSet("QUOT_SUPP_SITEPARTI","CHG_CODE01","1"), "DETAILNM", "DETAILCD");
	String BID_SUPP_SITEPARTI_CD2 = initCombo2.getCode();
	String BID_SUPP_SITEPARTI_NM2 = initCombo2.getCodeName();
%>
<SCRIPT language="JavaScript">
document.body.onresize = addEvent( document.body.onresize, "autoResize()");
	/*예약함수*/
	var sheet1 = new ibsheetObject();
	var sheet1Row;
	var sheet1PageNo = 1;
	var pageLastRowIndex = 1;
	var validationResult = false;
	var filterShow = false;
	var btn_act = "";
	var must_msg = "(은)는 필수 입력 항목입니다."; 
	function _onReady(){
		/**
		 *	IBSheet object initialize
		 */
		gridInit(sheet1);
		
		//견적요청,견적마감 이후에 버튼 숨김..
		if("<%=Order.get("STATUS_CD")%>" == "00"){
			$("#btn_Save").hide();
			$("#btn_Request").hide();
			$("#btn_del").hide();
			$("#btn_resend").hide();
			$("#btn_row_save").hide();
			$("#btn_back").hide();
			$("#btn_finish").hide();
		}else if("<%=Order.get("STATUS_CD")%>" == "01"){
			$("#btn_Create").text("견적복사");
			$("#btn_resend").hide();
			$("#btn_row_save").hide();
			$("#btn_back").hide();
			$("#btn_finish").hide();
		}else if("<%=Order.get("STATUS_CD")%>" == "02" || "<%=Order.get("STATUS_CD")%>" == "10"){
			$("#btn_Create").text("견적복사");
			$("#btn_Save").hide();
			$("#btn_Request").hide();
			$("#btn_del").hide();
			$("#corp_add").hide();
			$("#btn_row_del").hide();
			if("<%=Order.get("STATUS_CD")%>" == "10"){
				$("#btn_resend").hide();
				$("#btn_row_save").hide();
				$("#btn_back").hide();
				$("#btn_finish").hide();
			}
		}
		/**
		 *	Application Initialize
		 */
		 $("#sitedesc_flag_1").click(function() {
				$("#QUOT_SITEDESCDATE").attr("disabled",false);
				$("#QUOT_SITEDESCDATE_HH").attr("disabled",false);
				$("#QUOT_SITEDESCDATE_MI").attr("disabled",false);
				$("#QUOT_SITEDESCPLACE").attr("disabled",false);
				$("#calendar_sitedescdate").show();
			});
			
			$("#sitedesc_flag_2").click(function() {
				$("#QUOT_SITEDESCDATE").attr("disabled",true);
				$("#QUOT_SITEDESCDATE").val("");
				$("#QUOT_SITEDESCDATE_HH").attr("disabled",true);
				$("#QUOT_SITEDESCDATE_HH").val("");
				$("#QUOT_SITEDESCDATE_MI").attr("disabled",true);
				$("#QUOT_SITEDESCDATE_MI").val("");
				$("#QUOT_SITEDESCPLACE").attr("disabled",true);
				$("#QUOT_SITEDESCPLACE").val("");
				$("#calendar_sitedescdate").hide();
			});
		
		//라디오 박스 체크 여부 //  N 일경우 비활성화
		if($("#sitedesc_flag_2").attr("checked") == "checked")	$("#sitedesc_flag_2").click();
			
		 $("#btn_list").click(function() {
				jQuery("#fevent").val("");
				jQuery("#form1").attr("action", "/quot/outside/QuotPlanList.screen");
				jQuery("#form1").attr("target", "_self");
				jQuery("#form1").attr("method", "post");
				jQuery("#form1").submit();
		});

		 $("#btn_Create").click(function() {
			if(confirm("생성하시겠습니까?")){
				if(create_must_ck()){
					jQuery("#fevent").val("SAVE_QUOT_DETAIL"); 
		    		var f = document.form1;
					submitXmlRequest("/quot/outside/QuotPlan_form.screen", "SAVE_QUOT_DETAIL", f);
				}
	    	}		
		});
		 
		 $("#btn_Save").click(function() {
			var sRow = sheet1.FindStatusRow("D");
			if(sRow != ""){
				alert("저장시 업체 선택을 해지해 주십시오.");
				return;
			}
				
			if(confirm("저장하시겠습니까?")){
    			if(save_must_ck()){
    				jQuery("#fevent").val("UPDATE_QUOT_DETAIL");
    				jQuery("#STATUS_CD").val("01");
    				var f = document.form1;
					submitXmlRequest("/quot/outside/QuotPlan_form.screen", "UPDATE_QUOT_DETAIL", f);
    			}
    		}		
		});
		
		$("#btn_Request").click(function() {
			var sRow = sheet1.FindStatusRow("D");
			if(sRow != ""){
				alert("견적 요청시 업체 선택을 해지해 주십시오.");
				return;
			}
			
			if(confirm("견적 요청하시겠습니까?")){
    			if(save_must_ck()){
    				jQuery("#fevent").val("SEND_QUOT_DETAIL");
    				jQuery("#STATUS_CD").val("02");
    				var f = document.form1;
					submitXmlRequest("/quot/outside/QuotPlan_form.screen", "SEND_QUOT_DETAIL", f);
    			}
    		}		
		});
		
		$("#btn_del").click(function() {
			if (confirm("삭제 하시겠습니까?")){
				var f = document.form1;
				$("#fevent").val("FORM_DELETE");
				submitXmlRequest("/quot/outside/QuotPlan_form.screen", "FORM_DELETE", f);
			}
		});
		
		$("#btn_back").click(function() {
			if(confirm("견적 회수 하시겠습니까?")){
				jQuery("#fevent").val("STATUS_QUOT_DETAIL");
				jQuery("#STATUS_CD").val("01");
				var f = document.form1;
				submitXmlRequest("/quot/outside/QuotPlan_form.screen", "STATUS_QUOT_DETAIL", f);
    		}		
		});
		
		$("#btn_finish").click(function() {
			if(confirm("견적 마감하시겠습니까?")){
    			if(save_must_ck()){
    				jQuery("#fevent").val("STATUS_QUOT_DETAIL");
    				jQuery("#STATUS_CD").val("10");
    				var f = document.form1;
					submitXmlRequest("/quot/outside/QuotPlan_form.screen", "STATUS_QUOT_DETAIL", f);
    			}
    		}		
		});
		
		//견적의뢰일자 변경
		$("#REQUEST_DATE").change(function() {
			if($("#QUOT_BID_FROM_DT").val().length> 0){
				if($("#REQUEST_DATE").val()> $("#QUOT_BID_FROM_DT").val()){
					alert("견적의뢰일자는 견적제출일이전이어야 합니다.\n- 견적제출일:"+$("#QUOT_BID_FROM_DT").val());
					$("#REQUEST_DATE").val("");
					return;
				}
			}
			
			if($("#QUOT_SITEDESCDATE").val().length> 0){
				if($("#REQUEST_DATE").val()> $("#QUOT_SITEDESCDATE").val()){
					alert("견적의뢰일자는 견적설명일이전이어야 합니다.\n- 견적설명일:"+$("#QUOT_SITEDESCDATE").val());
					$("#REQUEST_DATE").val("");
					return;
				}
			}
		});
		//견적제출기간 변경
		$("#QUOT_BID_FROM_DT").change(function() {
			if($("#QUOT_SITEDESCDATE").val().length> 0){
				if($("#QUOT_BID_FROM_DT").val() < $("#QUOT_SITEDESCDATE").val()){
					alert("견적제출일자는 견적설명일 이전일수 없습니다.\n- 견적설명일:"+$("#QUOT_SITEDESCDATE").val());
					$("#QUOT_BID_FROM_DT").val("");
					return;
				}
			}
			if($("#REQUEST_DATE").val().length> 0){
				if($("#QUOT_BID_FROM_DT").val() < $("#REQUEST_DATE").val()){
					alert("견적제출기간은 견적의뢰일 이전 일 수 없습니다.\n- 견적의뢰일:"+$("#REQUEST_DATE").val());
					$("#QUOT_BID_FROM_DT").val("");
					return;
				}
			}
			if($("#QUOT_BID_TO_DT").val().length> 0){	
				if($("#QUOT_BID_TO_DT").val() < $("#QUOT_BID_FROM_DT").val()){
					alert("시작 또는 종료(마감) 일시가 잘못 입력되었습니다.");
					$("#QUOT_BID_FROM_DT").val("");
					return;
				}
			}
		});
		
		//견적제출기간 변경
		$("#QUOT_BID_TO_DT").change(function() {
			if($("#QUOT_SITEDESCDATE").val().length> 0){
				if($("#QUOT_BID_TO_DT").val() < $("#QUOT_SITEDESCDATE").val()){
					alert("견적제출일자는 견적설명일 이전일수 없습니다.\n- 견적설명일:"+$("#QUOT_SITEDESCDATE").val());
					$("#QUOT_BID_TO_DT").val("");
					return;
				}
			}
			if($("#QUOT_BID_FROM_DT").val().length> 0){	
				if($("#QUOT_BID_TO_DT").val() < $("#QUOT_BID_FROM_DT").val()){
					alert("시작 또는 종료(마감) 일시가 잘못 입력되었습니다.");
					$("#QUOT_BID_TO_DT").val("");
					return;
				}
			}
			if($("#REQUEST_DATE").val().length> 0){
				if($("#QUOT_BID_TO_DT").val() < $("#REQUEST_DATE").val()){
					alert("견적제출기간은 견적의뢰일 이전 일 수 없습니다.\n- 견적의뢰일:"+$("#REQUEST_DATE").val());
					$("#QUOT_BID_TO_DT").val("");
					return;
				}
			}
		});
		
		$("#QUOT_MAN_EMAIL").change(function() {
			if(!checkEmail($("#QUOT_MAN_EMAIL").val())){
				alert("이메일 형식이 올바르지 않습니다.");
				$("#QUOT_MAN_EMAIL").focus();
			}
		});
		
		$("#corp_add").click(function(){
			var f = document.form1;
			if(jQuery("#quot_id").val() == "") {
				alert("견적 생성 후 등록 할 수 있습니다.");
				return;
			}
			
			var win_id = "corp";			
			var outitem = "<%=Order.get("OUT_ITEM_CD")%>";
			var link = "/common/corp/SuppChoicePop.screen";
			link += "?pop_win_id="+win_id+"&MENU=QUOT&OUT_ITEM_CD="+outitem;
			fLayerPop(win_id, link, 800,400, '','', 'NO');
		});
		
		$.test = function(resultVal)
		{
		 	for(var i=0; i < resultVal[0].length; i++)
			{
		 		var rowcnt = sheet1.RowCount();
				if(rowcnt> 0){
					for(var r=0; r < rowcnt; r++)
					{
						var vendor_cd = sheet1.GetCellValue(r+1,"VENDOR_CD");
						
						if(vendor_cd == resultVal[0][i]){
							alert(resultVal[4][i]+"는 이미 등록된 업체입니다.");
							return;	
						}
					}
				}
		 		//sheetObj.DataAutoTrim = false;
				var row = sheet1.DataInsert(-1);
				sheet1.SetCellValue(row,"VENDOR_CD",resultVal[0][i]);
				sheet1.SetCellValue(row,"VENDOR_NO",resultVal[1][i]);
				sheet1.SetCellValue(row,"VENDOR_NAME",resultVal[2][i]);
				sheet1.SetCellValue(row,"REPRE_NO",resultVal[3][i]);
				sheet1.SetCellValue(row,"CHARGE_NAME",resultVal[4][i]);
				sheet1.SetCellValue(row,"TEL_NUM",resultVal[5][i]);
				sheet1.SetCellValue(row,"CHAGE_HP",resultVal[6][i]);
				sheet1.SetCellValue(row,"CHARGE_EMAIL",resultVal[7][i]);
				sheet1.SetCellValue(row,"ON_SUPP_YN","Y");
				sheet1.SetCellValue(row,"IN_OUT_DIV",resultVal[8][i]);
				sheet1.SetCellValue(row,"SITE_ATTEND_YN","");
				sheet1.SetCellValue(row,"SITEPARTI_YN","");
			}
		 	setGridSize();
		 	setTimeout(function(){fLayerPopClose('corp');},100);
		};

		$("#btn_row_del").click(function() {
			if(confirm("삭제 하시겠습니까?")){
				$("#fevent").val("SET_CORP_DELETE");
				var url = Modular.model.PageContext.CONTEXT_ROOT + "/quot/outside/QuotPlan_sheet.screen";
				var result = Modular.view.IBSheet7.doSave(sheet1, url, $("#form1"), false);
			}
		}); 
		
		$("#btn_resend").click(function() {
			var sRow = sheet1.FindStatusRow("D");
			if(sRow == ""){
				alert("업체를 선택하십시오");
				return;
			}
			if(confirm("견적 요청 SMS,E-MAIL을 재발송하시겠습까?")){
				jQuery("#fevent").val("RESEND_QUOT_DETAIL");
				var url = Modular.model.PageContext.CONTEXT_ROOT + "/quot/outside/QuotPlan_sheet.screen";
				var result = Modular.view.IBSheet7.doSave(sheet1, url, $("#form1"), false);
    		}		
		});
		
		$("#btn_row_save").click(function() {
			var sRow = sheet1.FindStatusRow("D");
			if(sRow != ""){
				alert("업체를 선택하지 마십시오.");
				return;
			}
			
			if(confirm("저장 하시겠습까?")){
				jQuery("#fevent").val("SAVE_DETAIL");
				var url = Modular.model.PageContext.CONTEXT_ROOT + "/quot/outside/QuotPlan_sheet.screen";
				var result = Modular.view.IBSheet7.doSave(sheet1, url, $("#form1"), false);
    		}		
		});
		
		doSearchSheet();
	}
	
	function SearchUser(NAME,CODE,DEPT_YN){
		var GB = "";
		if(CODE == "REQUEST_MAN_ID"){
			CODE = "";
			NAME = "";
			GB = "REQUEST";
		}else if(CODE == "QUOT_MAN_ID"){
			CODE = "";
			NAME = "";
			GB = "QUOT";
		}
		var win_id = "_searchUserPopup";
		var link = "/lib/dlgSearchUserPop.screen";
		    link += "?pop_win_id="+win_id;
		    link += "&NAME="+NAME;
		    link += "&CODE="+CODE;
		    link += "&GB="+GB;
		    if(DEPT_YN == "Y")
		    	link += "&deptNameYn=quotation";
		fLayerPop(win_id, link, 700,400, '', '', 'NO');
	}
	
	function SearchUserClose(result){
		if(result[10] == "REQUEST"){
			$("#REQUEST_MAN_ID").val(result[9])//ACCT_ID
			$("#REQUEST_MAN_NM").val(result[1])//이름
			$("#REQUEST_DEPT_CD").val(result[2])//부서코드
			$("#REQUEST_DEPT_NM").val(result[3])//부서명
		}else if(result[10] == "QUOT"){
			$("#QUOT_MAN_ID").val(result[9])//ACCT_ID
			$("#QUOT_MAN_NM").val(result[1])//이름
			$("#QUOT_MAN_TELNO").val(result[6])//연락처
			$("#QUOT_MAN_EMAIL").val(result[8])//이메일
		}
		setTimeout(function(){fLayerPopClose('_searchUserPopup');},100);
	}
	
	
	
	function sheet1_OnChange(Row, Col, Value) {
		if(Col == 8){//전화번호 형식 체크
			if(Value != ""){
				if(!checkTelno(Value)){
					alert("전화번호 형식이 올바르지 않습니다.");
					sheet1.SetCellValue(Row,Col,"");
				}
			}
		}
		if(Col == 9){//이메일 형식 체크
			if(Value != ""){
				if(!checkEmail(Value)){
					alert("이메일 형식이 올바르지 않습니다.");
					sheet1.SetCellValue(Row,Col,"");
				}
			}
		}
	}

	
	function searchAccDept(p_dept_cd, p_dept_nm){
		var win_id = "_searchDept";
		var link = "/lib/dlgSearchAccDept.screen";
		    link += "?pop_win_id="+win_id;
		    //link += "&{{query}}";
		fLayerPop(win_id, link, 600,400, '', '', 'NO');
	}
	function searchAccDeptClose(result){
		
		if( result == null ){
			p_dept_cd.value = "";   //부서코드
			p_dept_nm.value = "";   //부서명
		}else{
			p_dept_cd.value = result[0];   //부서코드
			p_dept_nm.value = result[1];   //부서명
		}
		setTimeout(function(){fLayerPopClose('_searchDept');},100);

	}

	function searchAccDept(p_dept_cd, p_dept_nm){
		var win_id = "_searchDept";
		var link = "/lib/dlgSearchAccDept.screen";
		    link += "?pop_win_id="+win_id;
		    //link += "&{{query}}";
		fLayerPop(win_id, link, 600,400, '', '', 'NO');
	}
	
	function searchAccDeptClose(result){
		if( result == null ){
		}else{
			sheet1.SetCellValue($("#TEMP_ROW").val(),"RECM_DEPT_ID",result[0]);   //부서코드
			sheet1.SetCellValue($("#TEMP_ROW").val(),"RECM_DEPT_NM", result[1]);   //부서명
		}
		
		setTimeout(function(){	fLayerPopClose('_searchDept');},100);

	}
	
	function doSearchSheet(){
		$("#fevent").val("GET_CORP_LIST");
		var url = Modular.model.PageContext.CONTEXT_ROOT + "/quot/outside/QuotPlan_sheet.screen";
		Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 30, "");
	}
	
	/**
	 *	IBSheet object initialize
	 */
	function gridInit(sheetName){
		var init_sheet = {};
		if(sheetName.id == "sheet1"){
			init_sheet.Cfg = {SearchMode:2, Page:30,	 MergeSheet:msHeaderOnly};
			init_sheet.Cols = [
			       			{Header:'선택',			Type:"DelCheck",	SaveName:"DEL_CHECK", 		Width:0, 		Align:"Center"},
			    			{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:"VENDOR_NO", 		Width:100,		Align:"Center", Format:"SaupNo", Edit:false},
			    			{Header:'업체명',			Type:"Text", 		SaveName:"VENDOR_NAME", 	Width:100, 		Align:"Left", Edit:false},
			    			{Header:'대표자명',		Type:"Text", 		SaveName:"REPRE_NO", 		Width:100, 		Align:"Center", Edit:false},
			    			{Header:'담당자명',		Type:"Text",	 	SaveName:"CHARGE_NAME", 	Width:100, 		Align:"Center"},
			    			{Header:'전화번호',		Type:"Text", 		SaveName:"TEL_NUM", 		Width:100, 		Align:"Center", Edit:false},
			    			{Header:'핸드폰',			Type:"Text", 		SaveName:"CHAGE_HP", 		Width:100, 		Align:"Center"},
			    			{Header:'이메일',			Type:"Text", 		SaveName:"CHARGE_EMAIL", 	Width:100, 		Align:"Left"},
			    			{Header:'참석의사',		Type:"Combo", 		SaveName:"SITE_ATTEND_YN",	Width:80, 		Align:"Center",		ComboText:"<%=BID_SUPP_SITEPARTI_NM%>", ComboCode:"<%=BID_SUPP_SITEPARTI_CD%>", Edit:false,	Cursor:"Pointer"},
			    			{Header:'참석여부',		Type:"Combo", 		SaveName:"SITEPARTI_YN",	Width:80, 		Align:"Center",		ComboText:"<%=BID_SUPP_SITEPARTI_NM2%>", ComboCode:"<%=BID_SUPP_SITEPARTI_CD2%>"},
			    			{Header:'최종견적제출시간',	Type:"Text", 		SaveName:"SUBMIT_DT", 		Width:100, 		Align:"Center", Edit:false},
			    			{Header:'견적금액(원)',	Type:"Text", 		SaveName:"ESTI_TOT_AMT", 	Width:100, 		Align:"Right", Edit:false,	Cursor:'pointer'},
			    			{Header:'파일다운',		Type:"Text", 		SaveName:"FILE_DOWN", 		Width:50, 		Align:"Center", Edit:false,	Cursor:'pointer'},
			    			{Header:'구분',			Type:"Text", 		SaveName:"IN_OUT_DIV_NM", 	Width:50, 		Align:"Center", Edit:false,	Cursor:'pointer'},
			    			{Header:'IN_OUT_DIV',	Type:"Text", 		SaveName:"IN_OUT_DIV",		Width:0, 		Align:"Center",	Hidden:"True"},
			    			{Header:'ON_SUPP_YN',	Type:"Text", 		SaveName:"ON_SUPP_YN",		Width:0, 		Align:"Center",	Hidden:"True"},
			    			{Header:'QUOT_BID_NO',	Type:"Text", 		SaveName:"QUOT_BID_NO",		Width:0, 		Align:"Center",	Hidden:"True"},
			    			{Header:'QUOT_BID_DEG',	Type:"Text", 		SaveName:"QUOT_BID_DEG",	Width:0, 		Align:"Center",	Hidden:"True"},
			    			{Header:'FILE_GB',		Type:"Text", 		SaveName:"FILE_GB",			Width:0, 		Align:"Center",	Hidden:"True"},
			    			{Header:'VENDOR_CD',	Type:"Text", 		SaveName:"VENDOR_CD",		Width:0, 		Align:"Center",	Hidden:"True"}
			];
		}
		init_sheet.HeaderMode = {Sort:1};
		IBS_InitSheet(sheetName, init_sheet);
		sheetName.SetDataAutoTrim(0);
		sheetName.SetImageList(1,"/img/buyer/button/bt_search_right.gif");
		//sheetName.SizeMode(0);
		setGridSize();
	}
	
	/**
	 *	IBSheet Event: Click
	 */
	function sheet1_OnClick(Row, Col, Value, CellX, CellY, CellW, CellH) {

	 }
	
	/**
	 *	IBSheet Event: Search End(IBSheet 데이터 조회 CallBack)
	 */
	function sheet1_OnSearchEnd(code, message) {
	    if(code == 0) {
	    	setGridSize();
			var rowcnt = sheet1.RowCount();
	    	
			if(rowcnt> 0){
				for(var r=0; r < rowcnt; r++)
				{
					if(sheet1.GetCellValue(r+1,"SUBMIT_DT") == "미제출"){
						sheet1.SetCellFont("FontColor", r+1, 10, r+1, 10, "red");
					}
					sheet1.SetCellFont("FontColor", r+1, 11, r+1, 11, "blue");
				}
			}
		} else {
			//조회 에러 수행
			alert(message);
		}
	}
	
	function save_detail_sheet() {
		jQuery("#fevent").val("SAVE_SUPP_DETAIL"); 
		var url = Modular.model.PageContext.CONTEXT_ROOT + "/quot/outside/QuotPlan_sheet.screen";
		var result = Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), false);	
	}
	
	/**
	 *	IBSheet size setting
	 */
	function setGridSize() {
		sheet1.FitColWidth();
	}
	
	function create_must_ck(){
		if(must_ck_val("QUOT_BID_MASTER_NM","견적명"))return false;
		if(must_ck_val("REQUEST_DATE","견적의뢰일자"))return false;
		if(must_ck_val("REQUEST_MAN_ID","견적의뢰자"))return false;
		if(must_ck_val("DEALER_NM","사업주"))return false;
		if(must_ck_val("WORK_PLACE","현장위치"))return false;
		if(must_ck_val("START_WORK_DATE","공사시작일"))return false;
		if(must_ck_val("END_WORK_DATE","공사마감일"))return false;
		if(must_ck_val("ITEM_NM","공종"))return false;
		
		if(must_ck_val("QUOT_BID_FROM_DT","견적제출일"))return false;
		if(time_ck("QUOT_BID_FROM_HH","HH"))return false;
		if(time_ck("QUOT_BID_FROM_MI","MI"))return false;
		if(must_ck_val("QUOT_BID_TO_DT","견적마감일"))return false;
		if(time_ck("QUOT_BID_TO_HH","HH"))return false;
		if(time_ck("QUOT_BID_TO_MI","MI"))return false;
		if(jQuery("#QUOT_BID_FROM_DT").val() == jQuery("#QUOT_BID_TO_DT").val()){
			var fromitme = jQuery("#QUOT_BID_FROM_HH").val()+jQuery("#QUOT_BID_FROM_MI").val();
			var toitme = jQuery("#QUOT_BID_TO_HH").val()+jQuery("#QUOT_BID_TO_MI").val();
			if(toitme <= fromitme){
				alert("견적제출기간 시작 또는 종료(마감) 일시가 잘못 입력되었습니다.");
				jQuery("#QUOT_BID_FROM_HH").focus();
				return false;
			}
		}
		if(must_ck_val("QUOT_MAN_ID","견적담당자"))return false;
		if(must_ck_val("QUOT_MAN_TELNO	","담당자 전화번호"))return false;
		if(must_ck_val("QUOT_MAN_EMAIL","담당자 E-Mail"))return false;		
		if(must_ck_radio("QUOT_SITEDESC_FLAG","견적설명여부"))return false;
		if($(':radio[name="QUOT_SITEDESC_FLAG"]:checked').val() == "Y"){
			if(must_ck_val("QUOT_SITEDESCDATE",""))return false;
			if(time_ck("QUOT_SITEDESCDATE_HH","HH"))return false;
			if(time_ck("QUOT_SITEDESCDATE_MI","MI"))return false;
			if(must_ck_val("QUOT_SITEDESCPLACE",""))return false;
		}
 		return true;
 	}
	
	function save_must_ck(){
		if(must_ck_val("QUOT_BID_MASTER_NM","견적명"))return false;
		if(must_ck_val("REQUEST_DATE","견적의뢰일자"))return false;
		if(must_ck_val("REQUEST_MAN_ID","견적의뢰자"))return false;
		if(must_ck_val("DEALER_NM","사업주"))return false;
		if(must_ck_val("WORK_PLACE","현장위치"))return false;
		if(must_ck_val("START_WORK_DATE","공사시작일"))return false;
		if(must_ck_val("END_WORK_DATE","공사마감일"))return false;
		if(must_ck_val("ITEM_NM","공종"))return false;

		if(must_ck_val("QUOT_BID_FROM_DT","견적제출일"))return false;
		if(time_ck("QUOT_BID_FROM_HH","HH"))return false;
		if(time_ck("QUOT_BID_FROM_MI","MI"))return false;
		if(must_ck_val("QUOT_BID_TO_DT","견적마감일"))return false;
		if(time_ck("QUOT_BID_TO_HH","HH"))return false;
		if(time_ck("QUOT_BID_TO_MI","MI"))return false;
		if(jQuery("#QUOT_BID_FROM_DT").val() == jQuery("#QUOT_BID_TO_DT").val()){
			var fromitme = jQuery("#QUOT_BID_FROM_HH").val()+jQuery("#QUOT_BID_FROM_MI").val();
			var toitme = jQuery("#QUOT_BID_TO_HH").val()+jQuery("#QUOT_BID_TO_MI").val();
			if(toitme <= fromitme){
				alert("견적제출기간 시작 또는 종료(마감) 일시가 잘못 입력되었습니다.");
				jQuery("#QUOT_BID_FROM_HH").focus();
				return false;
			}
		}
		if(must_ck_val("QUOT_MAN_ID","견적담당자"))return false;
		if(must_ck_val("QUOT_MAN_TELNO	","담당자 전화번호"))return false;
		if(must_ck_val("QUOT_MAN_EMAIL","담당자 E-Mail"))return false;		
		if(must_ck_radio("QUOT_SITEDESC_FLAG","견적설명여부"))return false;
		if($(':radio[name="QUOT_SITEDESC_FLAG"]:checked').val() == "Y"){
			if(must_ck_val("QUOT_SITEDESCDATE",""))return false;
			if(time_ck("QUOT_SITEDESCDATE_HH","HH"))return false;
			if(time_ck("QUOT_SITEDESCDATE_MI","MI"))return false;
			if(must_ck_val("QUOT_SITEDESCPLACE",""))return false;
		}
		
		if(must_ck_val("OUTER_REMARKS","특이사항"))return false;
		var rowcnt = sheet1.RowCount();
		if(rowcnt == 0){
			alert("견적 대상 업체가 1개 이상 이어야 합니다.");
			$("#sheet1_div").focus();
			return false;
		}

		var out_check = "N";
		for(var r=0; r < rowcnt; r++)
		{
			var in_out_div = sheet1.GetCellValue(r+1,"IN_OUT_DIV");
			if(in_out_div == "O"){
				out_check = "Y";
				continue;
			}
		}
		if(out_check == "Y" && $("#INNER_REMARKS").val().length == 0){
			if(!confirm("해외업체가 등록되어 있으나 특이사항(해외업체)가 등록되어 있지 않습니다.\n진행하시겠습니까?")){
				return false;
			}
		}
		
 		return true;
 	}
	
	// value 값 체크 
	function must_ck_val(obj,desc){
		if($("#"+obj).val().length == 0){
			if(desc.length> 0){
				alert(desc+must_msg);
			}else{
				alert($("#"+obj).attr("desc")+must_msg);
			}
			$("#"+obj).focus();
			return true;
		}
		return false;
	}
	
	// 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 time_ck(obj,type){
		if(must_ck_val(obj,""))return true;
		if(!isNumber($("#"+obj).val())){
			alert("숫자만 입력 가능합니다.");
			$("#"+obj).focus();
			return true;
		}else{
			var time = Number($("#"+obj).val());
			if(type == "HH"){
				if(time < -1 || time> 23){
					alert("0~23 까지 입력 가능합니다.");
					$("#"+obj).focus();
					return true;
				}
			}else if(type == "MI"){
				if(time < -1 || time> 59){
					alert("0~59 까지 입력 가능합니다.");
					$("#"+obj).focus();
					return true;
				}
			}
		}
		if($("#"+obj).val().length == 1){
			var timelength = $("#"+obj).val();
			$("#"+obj).val("0"+timelength); 
		}
		return false; 
	}
	
	//첨부파일   
	function doAttachFile(obj,No) {
		var file_div = "quot/outside/"+"<%=Order.get("QUOT_BID_NO")%>"+"/";
		var fileName = "견적_";
		var upLoadFlg = "Y";
		if(<%=Order.get("STATUS_CD")%> == "02" || <%=Order.get("STATUS_CD")%> == "10"){
			upLoadFlg = "N";
		}
		if(obj.value==''){
			alert("견적 생성 후, 파일을 첨부할 수가 있습니다.");
		}else if(obj != ''){
			if(No == 1){
				fileName += "내부자료";
				viewFileListNew("QUOT_FILE_IN_"+obj.value, obj.value, document.form1.p_AttachFile1, upLoadFlg, file_div, null, null, null, null, "N", fileName);
			}else{
				fileName += "첨부자료";
				viewFileListNew("QUOT_FILE_OUT_"+obj.value, obj.value, document.form1.p_AttachFile2, upLoadFlg, file_div, null, null, null, null, "N", fileName);
			}
		} 
	}
	
	function doResult(resultObj) {
		try {
			if( resultObj.getRequestEvent() == "SAVE_QUOT_DETAIL") {
				if( resultObj.getSuccess() ) {
					alert("생성 되었습니다.");
 					$("#btn_list").click();
				}
				else {
					dlgErrorMsg(resultObj);
				}
			}
			
			if( resultObj.getRequestEvent() == "UPDATE_QUOT_DETAIL") {
				if( resultObj.getSuccess() ) {
					alert("저장 되었습니다.");
					save_detail_sheet();
				}
				else {
					dlgErrorMsg(resultObj);
				}
			}
			
			if( resultObj.getRequestEvent() == "SEND_QUOT_DETAIL") {
				if( resultObj.getSuccess() ) {
					alert("전송 되었습니다.");
					save_detail_sheet();
				}
				else {
					alert("첨부자료를 등록하시기 바랍니다.");
					//dlgErrorMsg(resultObj);
					reSearch();
				}
			}
			
			if( resultObj.getRequestEvent() == "FORM_DELETE") {
				if( resultObj.getSuccess() ) {
					alert("삭제 되었습니다.");
 					$("#btn_list").click();
				}
				else {
					dlgErrorMsg(resultObj);
				}
			}
			
			if( resultObj.getRequestEvent() == "STATUS_QUOT_DETAIL") {
				if( resultObj.getSuccess() ) {
					alert("견적서 수정이 가능합니다.");
					reSearch();
				}
				else {
					dlgErrorMsg(resultObj);
				}
			}
			
			if( resultObj.getRequestEvent() == "FINISH_QUOT_DETAIL") {
				if( resultObj.getSuccess() ) {
					alert("견적 마감 되었습니다.");
					reSearch();
				}
				else {
					dlgErrorMsg(resultObj);
				}
			}
			
		} catch(errorObject) {
			showErrorDlg("doResult()", errorObject);
		}
	}
	
	function sheet1_OnSaveEnd(code, msg)
	{
		var event = $("#fevent").val();
		if(event == "SAVE_SUPP_DETAIL"){
			if(code>= "0"){
				reSearch();
			}else{
				alert(msg);
			}
		}else if(event == "SET_CORP_DELETE"){
			if(code>= "0"){
				alert("삭제 되었습니다.");
				reSearch();
			}else{
				alert(msg);
			}
		}else if( event == "RESEND_QUOT_DETAIL") {
			if(code>= "0"){
				alert("재전송 되었습니다.");
				reSearch();
			}else{
				alert(msg);
			}
		}else if( event == "SAVE_DETAIL") {
			if(code>= "0"){
				alert("수정 되었습니다.");
				reSearch();
			}else{
				alert(msg);
			}
		}
		else{
			if(code>= "0"){
				
			}else{
				alert("에러가 발생하였습니다.\n\n"+msg);
			}
		}
	}
	
	function reSearch() {
		jQuery("#fevent").val("GET_QUOT_DETAIL");
		jQuery("#form1").attr("action", "/quot/outside/QuotPlan.screen");
		jQuery("#form1").attr("target", "_self");
		jQuery("#form1").attr("method", "post");
		jQuery("#form1").submit();
	}
	
	function sheet1_OnSmartResize(Width, Height) { 
		sheet1.FitColWidth();
		autoResize();
	}

	function autoResize(){
		sheet1.SetSheetHeight(300); 
	}	
	
	function sheet1_OnDblClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
		 if(Row == 0)return;		 
		 
		 if(sheet1.ColSaveName(Col) == "SITE_ATTEND_YN"){
				if(sheet1.GetCellValue(Row,"SITE_ATTEND_YN") == "N") {
					$("#fevent").val("GET_QUOT_SUPP_DETAIL");
					 var win_id = "_QuotAmtPop";
					 var quot_id = jQuery("#quot_id").val();
				 	 var  link = "/quot/outside/QuotAmtPop.screen";
						link += "?pop_win_id="+win_id;
						link += "&ROW="+Row;
						link += "&VENDOR_CD="+sheet1.GetCellValue(Row,"VENDOR_CD");
						link += "&QUOT_ID="+quot_id;
						link += "&QUOT_BID_NO="+sheet1.GetCellValue(Row,"QUOT_BID_NO");
						link += "&QUOT_BID_DEG="+sheet1.GetCellValue(Row,"QUOT_BID_DEG");
						link += "&FILE_GB="+sheet1.GetCellValue(Row,"FILE_GB");
						link += "&VENDOR_NAME="+sheet1.GetCellValue(Row,"VENDOR_NAME");
						link += "&ESTI_TOT_AMT="+sheet1.GetCellValue(Row,"ESTI_TOT_AMT");
						link += "&SITE_ATTEND_YN="+sheet1.GetCellValue(Row,"SITE_ATTEND_YN");
						link += "&sModule=LM";

				       //fLayerPop(win_id, link, 1000,400, '', '', 'NO');
				       window.open(link,win_id,"toolbar=no, width=1000, height=400, top=50, left=40, toolbar=no,directories=no,status=no,scrollbars=yes,resize=no,menubar=no,target=new");
			 	}
		 	}
		 else if(sheet1.ColSaveName(Col) == "ESTI_TOT_AMT"){
			if(jQuery("#quot_id").val() == "") {
		 		alert("견적 생성 후 선택 할 수 있습니다.");
				return;
		 	}else if(sheet1.GetCellValue(Row,"ON_SUPP_YN") == "N" || sheet1.GetCellValue(Row,"IN_OUT_DIV") == "O"){	//견적용업체 및 해외업체인 경우
				//견적용 업체 
		 		$("#fevent").val("GET_QUOT_SUPP_DETAIL");
				 var win_id = "_QuotAmtPop";
				 var quot_id = jQuery("#quot_id").val();
			 	 var  link = "/quot/outside/QuotAmtPop.screen";
					link += "?pop_win_id="+win_id;
					link += "&ROW="+Row;
					link += "&VENDOR_CD="+sheet1.GetCellValue(Row,"VENDOR_CD");
					link += "&QUOT_ID="+quot_id;
					link += "&QUOT_BID_NO="+sheet1.GetCellValue(Row,"QUOT_BID_NO");
					link += "&QUOT_BID_DEG="+sheet1.GetCellValue(Row,"QUOT_BID_DEG");
					link += "&FILE_GB="+sheet1.GetCellValue(Row,"FILE_GB");
					link += "&VENDOR_NAME="+sheet1.GetCellValue(Row,"VENDOR_NAME");
					link += "&ESTI_TOT_AMT="+sheet1.GetCellValue(Row,"ESTI_TOT_AMT");
					link += "&SITE_ATTEND_YN="+sheet1.GetCellValue(Row,"SITE_ATTEND_YN");
					link += "&ON_SUPP_YN="+sheet1.GetCellValue(Row,"ON_SUPP_YN");
					link += "&IN_OUT_DIV="+sheet1.GetCellValue(Row,"IN_OUT_DIV");
					link += "&sModule=LM";

			       //fLayerPop(win_id, link, 1000,400, '', '', 'NO');
			       window.open(link,win_id,"toolbar=no, width=1000, height=460, top=50, left=40, toolbar=no,directories=no,status=no,scrollbars=yes,resize=no,menubar=no,target=new");
			}else if(sheet1.GetCellValue(Row,"SUBMIT_DT") == "미제출"){
				 alert("해당업체는 견적 미제출 상태입니다.");
				 return;
			}else if(sheet1.GetCellValue(Row,"SITE_ATTEND_YN") == "N"){
				 alert("해당업체는 견적 불참 업체입니다.");
				 return;
			}else{
				 $("#fevent").val("GET_QUOT_SUPP_DETAIL");
				 var win_id = "_QuotAmtPop";
				 var quot_id = jQuery("#quot_id").val();
			 	 var  link = "/quot/outside/QuotAmtPop.screen";
					link += "?pop_win_id="+win_id;
					link += "&ROW="+Row;
					link += "&VENDOR_CD="+sheet1.GetCellValue(Row,"VENDOR_CD");
					link += "&QUOT_ID="+quot_id;
					link += "&QUOT_BID_NO="+sheet1.GetCellValue(Row,"QUOT_BID_NO");
					link += "&QUOT_BID_DEG="+sheet1.GetCellValue(Row,"QUOT_BID_DEG");
					link += "&FILE_GB="+sheet1.GetCellValue(Row,"FILE_GB");
					link += "&VENDOR_NAME="+sheet1.GetCellValue(Row,"VENDOR_NAME");
					link += "&ESTI_TOT_AMT="+sheet1.GetCellValue(Row,"ESTI_TOT_AMT");
					link += "&SITE_ATTEND_YN="+sheet1.GetCellValue(Row,"SITE_ATTEND_YN");
					link += "&sModule=LM";

			       //fLayerPop(win_id, link, 1000,400, '', '', 'NO');
			       window.open(link,win_id,"toolbar=no, width=1000, height=400, top=50, left=40, toolbar=no,directories=no,status=no,scrollbars=yes,resize=no,menubar=no,target=new");
			 }
	 	}else if(sheet1.ColSaveName(Col) == "FILE_DOWN"){
	 		if(jQuery("#quot_id").val() == "") {
	 			alert("견적 생성 후 선택 할 수 있습니다.");
				return;
	 		}else if(sheet1.GetCellValue(Row,"SUBMIT_DT") == "미제출"){
				 alert("해당업체는 견적 미제출 상태입니다.");
				 return;
			}else{
				var file_name = sheet1.GetCellValue(Row,"QUOT_BID_NO")+"("+sheet1.GetCellValue(Row,"VENDOR_NAME")+")";
				fileDown(file_name, sheet1.GetCellValue(Row,"FILE_GB"));	 
			}
		}
	}

	function fileDown(file_id, file_gb){		
		var fileName = file_id;
		var url="/common/file/FileDownloadServlet";		
 		url += "?mode=zipDown";
 		url += "&fileName=" + encodeURIComponent(fileName);
	 	url += "&fileGB=" + file_gb;
	 	url += "&ID=<%=Order.get("quot_id")%>";
 		window.open(url, "_fileDown", "toolbar=no, width=400, height=100, top=500, left=400, toolbar=no,directories=no,status=no,scrollbars=yes,resize=no,menubar=no,target=new")
	}
	
	function textareaResize(obj) {
	  obj.style.height = "80px";
	  obj.style.height = obj.scrollHeight+"px";
	}
</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="">
<!-- List Search -->
<INPUT type="hidden" name="p_dept_nm" id="p_dept_nm" value="<%= Order.get("dept_nm") %>">
<INPUT type="hidden" name="p_dept_cd" id="p_dept_cd" value="<%= Order.get("dept_cd") %>">
<!-- List Search -->  
<INPUT type='hidden' name="QUOT_BID_NO" value="<%=Order.get("QUOT_BID_NO")%>">
<INPUT type='hidden' name="QUOT_BID_DEG" value="<%=Order.get("QUOT_BID_DEG")%>">
<INPUT type='hidden' name="QUOT_TYPE" value="<%=Order.get("QUOT_TYPE")%>">
<INPUT type='hidden' name="STATUS_CD" value="<%=Order.get("STATUS_CD")%>">
<INPUT type="hidden" name="quot_id" value="<%= params.get("quot_id") %>">
<INPUT type='hidden' name="REQUEST_DEPT_CD" value="<%=Order.get("REQUEST_DEPT_CD")%>">
<INPUT type='hidden' name="QUOT_KIND" value="O">
<INPUT type='hidden' name="SAVE" value="">

<INPUT type='hidden' name="DOC_ETC_IN" value="<%=Order.get("DOC_ETC_IN")%>">
<INPUT type='hidden' name="DOC_ETC_OUT" value="<%=Order.get("DOC_ETC_OUT")%>">
<INPUT type='hidden' name="WARR_CONDI" value="견적의뢰일로 부터">
<!-- 제목 및 버튼 -->
<table width="100%">
	<colgroup>
		<col width="500" />
		<col width="*" />
	</colgroup>
	<tr>
   		<th>
			<div align="left" id="title">
			    <ul><li>외주_견적 계획 상세<font style="font-size:11px">(<%=Order.get("STATUS_NM")%>)</font></li></ul>
			</div> 
   		</th>
   		<td align="right">
			<span class="btnSearch center"><a href="javascript:void(0);" id="btn_Save">저장</a></span>
			<span class="btnSearch center"><a href="javascript:void(0);" id="btn_Request">견적요청</a></span>
			<span class="btnSearch center"><a href="javascript:void(0);" id="btn_Create">생성</a></span>
			<span class="btnSearch center"><a href="javascript:void(0);" id="btn_del">삭제</a></span>
			<span class="btnSearch center"><a href="javascript:void(0);" id="btn_back">견적회수</a></span>
			<span class="btnSearch center"><a href="javascript:void(0);" id="btn_finish">견적마감</a></span>
	        <span class="btnSearch center"><a href="javascript:void(0);" id="btn_list">목록</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">
	<colgroup>
		<col width="150"/>
		<col width="21%">
		<col width="150"/>
		<col width="20%">
		<col width="160"/>
		<col/>
	</colgroup>
  <TR height="25"> 
    <TH>현장</TH>
	<TD><%=Order.get("dept_nm") %></TD>
	<TH>견적번호</TH>
	<TD><%=Order.get("quot_bid_no") %></TD>
	<TH class="required">견적명</TH>
	<TD><%= InputText.get("QUOT_BID_MASTER_NM", Order.get("QUOT_BID_MASTER_NM"), 45, 300, "desc=견적명") %>	</TD>
  </TR>

  
  <TR height="25"> 
	<TH class="required">견적의뢰일자</TH>
	<TD><%= InputText.get("REQUEST_DATE", Order.get("REQUEST_DATE"), 10, 10, "desc=견적의뢰일자,center,readOnly") %>
	<IMG name="start_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('REQUEST_DATE');"></TD>
	<TH>견적의뢰부서</TH>
	<TD><%= InputText.get("REQUEST_DEPT_NM", Order.get("REQUEST_DEPT_NM"), 45, 70, "desc=견적의뢰부서,readOnly") %>	</TD> 	
	<TH class="required">견적의뢰자</TH>
	<TD><%= InputText.get("REQUEST_MAN_NM", Order.get("REQUEST_MAN_NM"), 21, 50, "desc=견적설명담당자,readOnly") %><INPUT type='hidden' name="REQUEST_MAN_ID" value="<%=Order.get("REQUEST_MAN_ID")%>">
		<IMG id="btn_request_man_id" src="/img/buyer/button/bt_search_right.gif" alt="담당자" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:SearchUser('REQUEST_MAN_NM','REQUEST_MAN_ID','N');">
	</TD>	
  </TR>
  
  <TR height="25"> 
	<TH class="required">사업주</TH>
	<TD><%= InputText.get("DEALER_NM", Order.get("DEALER_NM"), 45, 50, "desc=사업주") %>	</TD> 	
	<TH>CM/감리사</TH>
	<TD><%= InputText.get("SUPERVISOR", Order.get("SUPERVISOR"), 45, 50, "desc=CM/감리사") %>	</TD> 	
	<TH class="required">현장위치</TH>
	<TD><%= InputText.get("WORK_PLACE", Order.get("WORK_PLACE"), 45, 250, "desc=현장위치") %>	</TD> 		
  </TR> 
  
  <TR height="25"> 
	<TH class="required">공사기간</TH>
	<TD><%= InputText.get("START_WORK_DATE", Order.get("START_WORK_DATE"), 10, 10, "desc=공사기간,readOnly,center") %>
		<IMG name="start_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('START_WORK_DATE');">
		<%-- <%if(!Order.get("START_WORK_DATE").isEmpty()||!Order.get("END_WORK_DATE").isEmpty()){ %>~<%} %>  --%>
		~
		<%= InputText.get("END_WORK_DATE", Order.get("END_WORK_DATE"), 10, 10, "desc=공사기간,readOnly,center") %>
		<IMG name="start_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('END_WORK_DATE');">
	</TD>
	<TH>공사규모</TH>
	<TD><%= InputText.get("WORK_SIZE", Order.get("WORK_SIZE"), 45, 250, "desc=공사규모") %>	</TD> 	
	<TH class="required">공종</TH>
	<TD><%= InputText.get("ITEM_NM", Order.get("ITEM_NM"), 45, 150, "desc=공종") %>	</TD> 		
  </TR> 	
</TABLE>

<!-- 견적정보 : 시작 -->
<div class="application-info magT10">
	<div class="application-sub-title">
		<span class="title">견적기본정보</span>
	</div>
</div>

<TABLE class="form-table">
	<colgroup>
		<col width="150"/>
		<col width="21%">
		<col width="150"/>
		<col width="20%">
		<col width="160"/>
		<col/>
	</colgroup>
  <TR height="25"> 
	<TH class="required">견적제출기간</TH>
	<TD><%= InputText.get("QUOT_BID_FROM_DT", Order.get("QUOT_BID_FROM_DT"), 10, 10, "desc=견적제출기간,readOnly,center") %>
		<IMG name="start_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('QUOT_BID_FROM_DT');">
		<%= InputText.get("QUOT_BID_FROM_HH", Order.get("QUOT_BID_FROM_HH"), 2, 2, "desc=견적제출기간,Time,center") %> :
		<%= InputText.get("QUOT_BID_FROM_MI", Order.get("QUOT_BID_FROM_MI"), 2, 2, "desc=견적제출기간,Time,center") %>
		~
		<%= InputText.get("QUOT_BID_TO_DT", Order.get("QUOT_BID_TO_DT"), 10, 10, "desc=견적제출기간,readOnly,center") %>
		<IMG name="start_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('QUOT_BID_TO_DT');">
		<%= InputText.get("QUOT_BID_TO_HH", Order.get("QUOT_BID_TO_HH"), 2, 2, "desc=견적제출기간,Time,center") %> :
		<%= InputText.get("QUOT_BID_TO_MI", Order.get("QUOT_BID_TO_MI"), 2, 2, "desc=견적제출기간,Time,center") %>
	</TD>
	<TH>견적유효기간</TH>
	<TD><%= InputText.get("QUOT_VALIDATE", Order.get("QUOT_VALIDATE"), 45, 50, "desc=공사규모") %>	</TD>
	<TH class="required">견적담당자</TH>
	<TD> 
	<%= InputText.get("QUOT_MAN_NM", Order.get("QUOT_MAN_NM"), 21, 30, "desc=견적담당자,readOnly") %><INPUT type='hidden' name="QUOT_MAN_ID" value="<%=Order.get("QUOT_MAN_ID")%>">
	<IMG id="btn_quot_man_id" src="/img/buyer/button/bt_search_right.gif" alt="담당자" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:SearchUser('QUOT_MAN_NM','QUOT_MAN_ID','Y');">
	</TD>
  </TR>
  
  <TR height="25"> 
	 <TH class="required">담당자 전화번호</TH>
	<TD><%= InputText.get("QUOT_MAN_TELNO", Order.get("QUOT_MAN_TELNO"), 15, 20, "desc=견적담당자 전화번호") %></TD> 
	<TH class="required">담당자 E-Mail</TH>
	<TD><%= InputText.get("QUOT_MAN_EMAIL", Order.get("QUOT_MAN_EMAIL"), 45, 50, "desc=견적담당자 E-Mail") %></TD>
	<TH>담당자 FAX</TH>
	<TD><%= InputText.get("QUOT_MAN_FAX", Order.get("QUOT_MAN_FAX"), 15, 20, "desc=견적담당자 FAX") %> 	
  </TR>
  
  <TR height="25"> 
	<TH class="required">견적설명회 여부</TH>
	<TD> 
		<LABEL for="sitedesc_flag_1"><INPUT id="sitedesc_flag_1" type="radio" name="QUOT_SITEDESC_FLAG" value="Y" desc="견적설명여부" <%=Order.get("QUOT_SITEDESC_FLAG").equals("Y") ? "checked=\"checked\"" : "" %>> 예</LABEL>
		<LABEL for="sitedesc_flag_2"><INPUT id="sitedesc_flag_2" type="radio" name="QUOT_SITEDESC_FLAG" value="N" desc="견적설명여부" <%=Order.get("QUOT_SITEDESC_FLAG").equals("N") ? "checked=\"checked\"" : "" %>> 아니오</LABEL>
	</TD>
	<TH>견적설명회 일시</TH>
	<TD>
	
	<%= InputText.get("QUOT_SITEDESCDATE", Order.get("QUOT_SITEDESCDATE"), 10, 10, "desc=견적설명회,readOnly,center") %>
	<IMG name="calendar_sitedescdate" id="calendar_sitedescdate" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('QUOT_SITEDESCDATE');">
	<%= InputText.get("QUOT_SITEDESCDATE_HH", Order.get("QUOT_SITEDESCDATE_HH"), 2, 2, "desc=견적설명회,Time,center") %> :
	<%= InputText.get("QUOT_SITEDESCDATE_MI", Order.get("QUOT_SITEDESCDATE_MI"), 2, 2, "desc=견적설명회,Time,center") %>
	</TD>
	<TH>견적설명회 장소</TH>
	<TD><%= InputText.get("QUOT_SITEDESCPLACE", Order.get("QUOT_SITEDESCPLACE"), 15, 20, "desc=견적설명회 장소") %>	</TD>
  </TR>
  
</TABLE>

<div class="application-info magT20">
	<div class="application-sub-title">
		<span class="title">견적조건</span>
	</div>
</div>

<TABLE class="form-table" style="margin-top:5px">
	<colgroup>
		<col width="150"/>
		<col width="50%"/>
		<col width="150"/>
		<col width="*"/>
		<!-- <col width="29%"/>
		<col width="145"/>
		<col/> -->
	</colgroup>
  <TR height="100"> 
	<TH class="required">특이사항</TH>
	<TD>
	 	<textarea name="OUTER_REMARKS" id="OUTER_REMARKS" style="width:98%; height:80px; overflow-y:auto" maxlength="1000" class="input byteChk ctrlTarget" onkeyup="textareaResize(this)"><%=Order.get("OUTER_REMARKS")%></textarea>            
	</TD>
	<TH>특이사항<br>(해외업체)</TH>
	<TD>
		<textarea name="INNER_REMARKS" id="INNER_REMARKS" style="width:98%; height:80px; overflow-y:auto" maxlength="1000" class="input byteChk ctrlTarget" onkeyup="textareaResize(this)"><%=Order.get("INNER_REMARKS")%></textarea> 
    </TD>
  </TR>
  <TR height="100"> 
    <%-- <TH>내부자료</TH>
	<TD colspan="2"> 
	 <TEXTAREA name="p_AttachFile1" id="p_AttachFile1" style="width:85%;height:80px" rows="1" class="input" readOnly><%=filein.get("DOC_ETC_IN") %></TEXTAREA>
	                    <IMG id='search_spot_button' onClick="doAttachFile(document.form1.quot_id,1);" src='/img/buyer/button/bt_change.gif' border='0'  align="top" align='absmiddle' alt='[Attach File]' style='cursor:pointer;'>
    </TD> --%>
	<TH class="required">첨부자료</TH>
	<TD colspan="3">
	<TEXTAREA name="p_AttachFile2" id="p_AttachFile2" style="width:85%;height:80px" rows="1" class="input" readOnly><%=fileout.get("DOC_ETC_OUT") %></TEXTAREA>
	                    <IMG id='search_spot_button' onClick="doAttachFile(document.form1.quot_id,2);" src='/img/buyer/button/bt_change.gif' border='0'  align="top" align='absmiddle' alt='[Attach File]' style='cursor:pointer;'>
	</TD>
  </TR>  
  <TR height="10"> 
	<!-- <TH colspan="3"> 
    </TH> -->
	<TH>대용량파일 link</TH>
	<TD colspan="3"><%= InputText.get("URL_COL", Order.get("URL_COL"), 150, 150, "desc=대용량파일 링크주소") %></TD> 
  </TR>  
</TABLE>

<table id=copr_list width="100%">
	<colgroup>
		<col width="500" />
		<col width="*" />
	</colgroup>
	<tr>
   		<th>
   		<div class="application-info magT20">
			<div class="application-sub-title">
				<span class="title">견적대상업체</span>
			</div>
		</div>
   		</th>
   		<td align="right">
            <span class="btnSearch center"><a href="javascript:void(0);" id="corp_add">추가</a></span>
			<span class="btnSearch center"><a href="javascript:void(0);" id="btn_row_del">삭제</a></span>
			<span class="btnSearch center"><a href="javascript:void(0);" id="btn_row_save">저장</a></span>
			<span class="btnSearch center"><a href="javascript:void(0);" id="btn_resend">재전송</a></span>
   		</td>
  	</tr>
</table>
	<div id="sheet1_div" style="padding-top:5px;height: auto; min-height: 200px; overflow: auto;">
		<script>createIBSheet('sheet1','100%', '200px');</script>
	</div> 
	
</form>
