<%--
  - Author(s)  : Hyung min Son
  - Date       : 2014.07.25
  - Description: 기술검토서팝업
  --%>
  
<%@page import="monfox.toolkit.snmp.agent.modules.SnmpV2Mib.SysOREntry"%>
<%@page import="monfox.toolkit.snmp.agent.modules.SnmpV2Mib.SysOREntry"%>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="com.udapsoft.waf.system.*" %>
<%@ page import="com.udapsoft.waf.common.*" %>
<%@ page import="com.udapsoft.waf.common.ui.*" %>
<%@ page import="com.udapsoft.waf.common.util.StringUtils"%>
<%@ page import="kr.co.hsnc.common.util.*"%>
<%@ page import="kr.co.hsnc.common.sql.*" %>
<%@ page import="kr.co.udapsoft.common.*" %>
<%@ page import="kr.co.udapsoft.ebid.buyer.common.file.FileManager"%>
<%@ include file="/jsp/work/taglib.jsp" %>
<jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
<%
    ctx.init(request, response);

    HandlerStorage storage = ctx.getHandlerStorage();
    ValueObject user       = ctx.getUser();
    ValueObject params     = storage.getParams();
    String event           = storage.getEvent();
    String BID_NO =   (String) storage.get("BID_NO");
	String BID_DEG =   (String) storage.get("BID_DEG");
	String RTN_YN =   (String) storage.get("RTN_YN");
	String pop_win_id =   (String) storage.get("pop_win_id");
    ValueObject Order = storage.getValueObject("Order");
    ValueObject filetot = storage.getValueObject(Order.get("TOT_FILE_GB"));
    RowSet Tbe_info = storage.getRowSet("TBE_INFO");
%>

<SCRIPT language="JavaScript">
	document.onkeydown 		= closePopupWindow;
	document.body.onload = _onReady;
	var act_rtn = false;
	
	function _onReady(){
		$("#table_rtn").hide();
		$("#btn_cancel").hide();
		$("#t1").hide();
		if("<%=RTN_YN%>" == "Y"){
			$("#t1").show();	
		}
	}
	function rtn_calcel(){
		$("#table_rtn").hide();
		$("#btn_cancel").hide();
		act_rtn = false;
	}
	
	function rtn_table(){
		if(act_rtn){//반려
			rtn_save();
			return;
		}else{
			$("#table_rtn").show();
			$("#btn_cancel").show();
			act_rtn = true;
			return;
		}
	}

	function rtn_save(){
		if($("#RTN_REASON").val().length > 0){
			if(confirm("반려 하시겠습니까?")){
				var f = document.form1;
				submitXmlRequest("/bid/outside/TBECheckPop_from.screen", "RTN_UPDATE", f);
			}
		}else{
			alert("반려사유는 필수 입니다.");
			$("#RTN_REASON").focus();
		}
	}
	
	function doAttachFileListSet(){
		
	}
	
	
	//첨부파일   
	function doAttachFile(obj,No) {
		 var file_div = "bid/outside/<%=BID_NO%>/TBE";
		 if(obj==''){
			alert("After you have saved, you can attach a file.");
		}
		else if(obj != ''){ 
			viewFileListNew('<%=Order.get("TOT_FILE_GB")%>', obj.value, document.form1.p_AttachFile1, "N", file_div);
			//viewFileList('<%=Order.get("TOT_FILE_GB")%>', obj.value, document.form1.p_AttachFile1, "N", file_div,'_viewFileList');
		}
	}
	
	function doResult(resultObj) {
		try {
			if( resultObj.getRequestEvent() == "RTN_UPDATE") {
				document.form1.isSubmit = false;
				returnValue = new Array(1,"반려 되었습니다.");
				parent.PopClose("<%=pop_win_id%>",returnValue);				
			}
		} catch(errorObject) {
			showErrorDlg("doResult()", errorObject);
		}
	}
</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="BID_NO" value="<%=BID_NO%>">
<INPUT type='hidden' name="BID_DEG" value="<%=BID_DEG%>">
<INPUT type='hidden' name="STATUS_CD" value="<%=Order.get("STATUS_CD")%>">
<INPUT type='hidden' name="TOT_FILE_ID" value="<%=Order.get("TOT_FILE_ID")%>">
<INPUT type='hidden' name="TBE_FILE_GB" value="<%=Order.get("TOT_FILE_GB")%>"> 
<TABLE class="screen_title_table">
  <TR height="2"><TD colspan="2"></TD>
  </TR>
  <TR height="25"><TD>
  	<!-- 제목 및 버튼 -->
   	<table id="t1" width="100%" class="ftit_table">
		<colgroup>
			<col width="*" />
			<col width="150" />
		</colgroup>
	<tr>
	   	<th>
	   </th>
	   <td align="right">
	        <span class="btnSearch center" id="btn_cancel"><a href="javascript:rtn_calcel();">반려취소</a></span>
	        <%if (Order.get("STATUS_CD").equals("10")) { %>
			<span class="btnSearch center" id="btn_rtn"><a href="javascript:rtn_table();">반려</a></span>
			<%} %>
	   </td>
   	</tr>
   	</table>
    </TD>
  </TR>
  </TABLE>
  
<!-- 발주의뢰정보 : 시작 -->
<TABLE class="form-table" id="table_rtn" style="margin-bottom:15px" >
	<colgroup>
		<col width="145"/>
		<col />
	</colgroup>
  <TR height="50"> 
    <TH class="required">반려사유</TH>
	<TD> 
	 <textarea name="RTN_REASON" id="RTN_REASON" style="width:98%; height:50px; overflow-y:auto" maxlength="100" class="input byteChk ctrlTarget"></textarea>
    </TD>
  </TR>
</TABLE>  
  
<TABLE class="list-form-table">
	<colgroup>
		<col width="145"/>
		<col width="145"/>
		<col width="200"/>
		<col />
	</colgroup>
  <TR height="25">
    <th>사업자번호</TD>
	<th>업체명</TD>
	<th>평과결과</TD>
	<th>평가의견</TD>
  </TR>
<%
  	 if(Tbe_info.size() > 0){
  		for(int i=0;i < Tbe_info.size();i++){
  %>
  <TR height="25">
    <TD class="search_table_data" style="text-align:center"><%=StringUtils.getBizNo(Tbe_info.getRow(i).get("VENDOR_NO"))%><INPUT type="hidden"  id="VENDOR_CD" name="VENDOR_CD" value="<%=Tbe_info.getRow(i).get("VENDOR_CD")%>"></TD>
	<TD class="search_table_data" style="text-align:center"><%=Tbe_info.getRow(i).get("VENDOR_NAME")%></TD>
	<TD class="search_table_data" style="text-align:center"><%if (Order.get("STATUS_CD").equals("10")) { %><%=Tbe_info.getRow(i).get("EVAL_RESULT_NM") %><%} %></TD>
	<TD class="search_table_data" style="vertical-align: top"><%=StringUtils.cvtHTML(Tbe_info.getRow(i).get("EVAL_OPIN"))%></TD>
  </TR>
  <%		} %>
  <TR  height="30">
  <th>종합의견</TH>
  <TD class="search_table_data" colspan="2"><TEXTAREA name="p_AttachFile1" id="p_AttachFile1" style="width:85%;height:40px" rows="1" class="input" readOnly><%=filetot.get(Order.get("TOT_FILE_GB")) %></TEXTAREA>
	                    <IMG id='search_spot_button' onClick="doAttachFile(document.form1.TOT_FILE_ID,3);" src='/img/buyer/button/bt_change.gif' border='0'  align="top" align='absmiddle' alt='[Attach File]' style='cursor:pointer;'></TD>
  <TD class="search_table_data" style="vertical-align: top"><%=StringUtils.cvtHTML(Order.get("TOT_OPIN"))%></TD>
  <%	}else{%>
  		<TR height="25">
    <TD class="search_table_data" colspan="4" style="text-align:center">기술 검토 대상 업체가 없습니다.</TD>
  </TR>
  <%}%> 
</TABLE>
</form>

