<%@page import="monfox.toolkit.snmp.agent.modules.SnmpV2Mib.SysOREntry"%>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.udapsoft.waf.system.*"%>
<%@ page import="com.udapsoft.waf.common.ui.*" %>
<%@ page import="com.udapsoft.waf.common.web.*" %>
<%@ page import="kr.co.hsnc.common.sql.*"%>
<%@ page import="kr.co.hsnc.common.util.*"%>
<%@ page import="kr.co.hsnc.common.sql.util.*"%>
<%@ page import="com.udapsoft.waf.system.HandlerStorage"%>
<%@ page import="kr.co.hsnc.common.util.ValueObject"%>
<%@ page import="kr.co.hsnc.common.message.WAFMessage"%>
<%@ page import="kr.co.udapsoft.ebid.buyer.common.file.FileManager"%>
<%@ page import="com.udapsoft.waf.common.util.StringUtils" %>
<%@ page import="kr.co.udapsoft.common.util.PCMSUtil" %>
<%@ page import="kr.co.hsnc.common.util.Formatter"%>
<%@ page import="com.udapsoft.waf.common.util.Formatter2"%>
<jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />

<%
	ctx.init(request, response);
	String link = ctx.getServerDomain();

    HandlerStorage storage = ctx.getHandlerStorage();
	ValueObject params = storage.getParams();

   	
	WAFMessage wafMessage = WAFMessage.getInstance();
	
	ValueObject BidMaster  = storage.getValueObject("bidmaster");
	RowSet suppinfo =  null;
	suppinfo = storage.getRowSet("suppinfo");
	
	ValueObject File_in  = storage.getValueObject(BidMaster.get("DOC_ETC_IN"));
	ValueObject File_out  = storage.getValueObject(BidMaster.get("DOC_ETC_OUT"));
	
	ValueObject sign_info = storage.getValueObject("SIGN_INFO");
	
	String gwurl	=	"http://gw.sgcenc.co.kr/";//WAFConfig.get("gw.url.address2");
%>

<br>

<TABLE width="709" border="0" cellspacing="0" cellpadding="0">
	<tbody>
    <TR>
        <TD>
            <TABLE width="709" cellspacing="0" cellpadding="1" bordercolordark="#FFFFFF" bordercolorlight="#AEAFAF" border="1">
	          <COLGROUP>
	            <COL width="50">
	            <COL width="50">
	            <COL width="35%">
	            <COL width="100">
				<COL/>
	          </COLGROUP>
	          	<tr>
	          		<td class="list_title4" nowrap colspan="2">의뢰부서</td>
	          		<td class="list_data" nowrap align="Left" >&nbsp;<%=BidMaster.get("REQ_DEPT_NM")%></td>
	          		<td class="list_title3" nowrap>작성일</td>
	          		<td class="list_data" nowrap align="Left">&nbsp;<%=BidMaster.get("CRE_DT")%></td>
	          	</tr>
	          	<tr>
	          		<td class="list_title3" nowrap colspan="2" style="maring-left:1px">작성자</td>
	          		<td class="list_data" nowrap align="Left">&nbsp;<%=BidMaster.get("CRE_NAME")%></td>
	          		<td class="list_title4" nowrap >사업주명</td>
	          		<td class="list_data" nowrap align="Left">&nbsp;<%=BidMaster.get("DEALER_NM")%></td>
	          	</tr>
	          	<tr>
	          		<td class="list_title" nowrap colspan="2" STYLE="LETTER-SPACING:2PX">PROJECT명</td>
	          		<td class="list_data" nowrap align="Left">&nbsp;<%=BidMaster.get("DEPT_NM")%></td>
	          		<td class="list_title4" nowrap >현장위치</td>
	          		<td class="list_data" nowrap align="Left">&nbsp;<%=BidMaster.get("DELI_END_PLACE")%></td>
	          	</tr>
<%
	String	sObcContYypeNm	=	"";
	if(BidMaster.get("OBC_CONT_TYPE_CD").equals("01"))
	{
		sObcContYypeNm	=	"도면견적";
	}else
	{
		sObcContYypeNm	=	"BM견적";
	}
%>
	          	<tr height="23">
	          		<td class="list_title6" nowrap colspan="2">발주의뢰번호</td>
	          		<td class="list_data" nowrap align="Left">&nbsp;
	          			<span onclick="doSignFile('<%=sign_info.get("doc_id") %>', '<%=sign_info.get("year") %>');" class="button" style="color:#4b70fd;text-decoration:underline;"><%=BidMaster.get("BID_NO")%></span>	          			
	          			<%-- <IMG src="<%=link %>/img/buyer/button/bt_attach_file.gif" id="bt_attach_file" alt="발주의뢰문서" align="top" valign="top" onClick="doSignFile('<%=sign_info.get("doc_id") %>', '<%=sign_info.get("year") %>');" class="button"> --%>
	          		</td>
	          		<td class="list_title4" nowrap>입찰방식</td>
	          		<td class="list_data" nowrap align="Left">&nbsp;<%=BidMaster.get("BID_TYPE")%>/<%=sObcContYypeNm%></td>
	          	</tr>	          	
	          	<tr height="23">
	          		<td class="list_title3" nowrap colspan="2">입찰명</td>
	          		<td class="list_data" align="Left" >&nbsp;<%=BidMaster.get("BID_MASTER_NM")%></td>
	          		<td class="list_title7" nowrap>시행결의요청일</td>
	          		<td class="list_data" align="Left" >&nbsp;<%=BidMaster.get("CONT_APP_REQ_DATE")%></td>
	          	</tr>
	          	<tr height="23">
	          		<td class="list_title4" nowrap colspan="2">실행예산</td>
	          		<td class="list_data" nowrap align="right">&nbsp;<%=Formatter2.currency(BidMaster.get("ACT_AMT"),0)%>&nbsp;</td>
	          		<td class="list_title4" nowrap>외주예산</td><!-- 2015.3.2 외주예산추가 MKLEE -->	
	          		<td class="list_data" nowrap align="right">&nbsp;<%=Formatter2.currency(BidMaster.get("PUR_AMT"),0)%>&nbsp;</td>	          		
	          	</tr>
	          	<tr height="23">
	          		<td class="list_title7" nowrap colspan="2">입찰설명 예정일</td>
	          		<td class="list_data" nowrap align="Left">&nbsp;<%=BidMaster.get("SITEDESCDATE")%></td>
	          		<td class="list_title6" nowrap >입찰설명 장소</td>
	          		<td class="list_data" nowrap align="Left">&nbsp;<%=BidMaster.get("SITEDESCPLACE")%></td>
	          	</tr>
	          	<tr height="23">
	          		<td class="list_title4" nowrap colspan="2">계약기간</td>
	          		<td class="list_data" nowrap align="Left">&nbsp;<%if(!BidMaster.get("DELI_FROM_DY").isEmpty()){%><%=BidMaster.get("DELI_FROM_DY")%> ~<%} %> <%=BidMaster.get("DELI_TO_DY")%></td>
	          	    <td class="list_title5" nowrap>입찰마감일</td>
	          		<td class="list_data" nowrap align="Left">&nbsp;<%=BidMaster.get("BID_TO_DT")%></td>
	          	</tr>
				<tr height="23">
	          		<td class="list_title" nowrap rowspan="3">지 불<br>조 건</td>
	          		<td class="list_title" nowrap>선급금</td>
	          		<td class="list_data" nowrap align="Left" colspan="3"><%if(!BidMaster.get("OBC_FRST_CONT_RATE").isEmpty()){%>&nbsp;계약금액의 <%=BidMaster.get("OBC_FRST_CONT_RATE")%>%<%} %></td>
	          	</tr>
				<tr height="23">
	          		<td class="list_title" nowrap>기성금</td>
	          		<td class="list_data" nowrap align="Left" colspan="3"><%if(!BidMaster.get("CPC_MID_RATE").isEmpty()){%>&nbsp;계약금액의 <%=BidMaster.get("CPC_MID_RATE")%>% (선급금 포함), <%} %><%if(!BidMaster.get("OBC_MID_PAYDAY").isEmpty()){%><%=BidMaster.get("OBC_MID_PAYDAY") %>일  <%} %><%if(!BidMaster.get("OBC_MID_CASH_RATE").isEmpty()){%>현금 <%=BidMaster.get("OBC_MID_CASH_RATE") %>%<%} %> <%if(!BidMaster.get("OBC_MID_BILL_RATE").isEmpty()){%>어음 <%=BidMaster.get("OBC_MID_BILL_RATE") %>%<%} %> 지급</td>
	          	</tr>
				<tr height="23">
	          		<td class="list_title" nowrap>준공금</td>
	          		<td class="list_data" nowrap align="Left" colspan="3"><%if(!BidMaster.get("PBC_REST_RATE").isEmpty()){%>&nbsp;계약금액의 <%=BidMaster.get("PBC_REST_RATE") %>% (선급금 포함), <%} %><%if(!BidMaster.get("OBC_FIN_PAYDAY").isEmpty()){%><%=BidMaster.get("OBC_FIN_PAYDAY") %>일  <%} %><%if(!BidMaster.get("OBC_FIN_CASH_RATE").isEmpty()){%>현금 <%=BidMaster.get("OBC_FIN_CASH_RATE") %>%<%} %> <%if(!BidMaster.get("OBC_FIN_BILL_RATE").isEmpty()){%>어음 <%=BidMaster.get("OBC_FIN_BILL_RATE")%>%<%} %> 지급</td>
	          	</tr>
			</TABLE>

<%if(!"01".equals(BidMaster.get("CMPT_CD"))){ %>
<BR/>
<TABLE border=0 cellSpacing=0 cellPadding=0 width=709>
<tr>
<td height="30px">
<b style="font-size:10pt">* 입찰대상업체</b>
</td>
</tr>
</table>
	            <TABLE width="709" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF" bordercolorlight="#AEAFAF" border="1">
						  <COLGROUP>
							<COL width="60">
							<COL width="120">
							<COL width="60">
							<COL width="80">
							<COL width="150">
							<COL width="*">
							<COL/>
						  </COLGROUP>
							<tr height="50px">
								<td class="list_title_2" nowrap>추천부서</td>
								<td class="list_title_2" nowrap>입찰업체명</td>
								<!-- <td class="list_title_2" nowrap>담당자명</td>
								<td class="list_title_2" nowrap>담당자핸드폰</td> -->
								<td class="list_title_2" nowrap>신용평가<br/>등급</td>
								<td class="list_title_2" nowrap>당사평가<br/>등급</td>
								<td class="list_title_2" nowrap>추천사유</td>
								<td class="list_title_2" nowrap>당사 거래실적</td>
							</tr>
 							<% if(suppinfo.size() > 0){
 								String	sCreditGrade	=	"";
 								String	sCstDocName		=	"";
									for(int i=0; i < suppinfo.size();i++){ %>
							<tr height="23">
								<td class="list_data_small" nowrap>&nbsp;<%=suppinfo.getRow(i).get("RECM_DEPT_NM")%></td>
								<td class="list_data_small" nowrap align="Left">&nbsp;<%=suppinfo.getRow(i).get("VENDOR_NAME")%></td>
								<%-- <td class="list_data_small" nowrap><%=suppinfo.getRow(i).get("CHARGE_NAME")%></td>
								<td class="list_data_small" nowrap><%=suppinfo.getRow(i).get("CHAGE_HP")%></td> --%>
<%
	
	if(suppinfo.getRow(i).get("CREDIT_GRADE") != null && suppinfo.getRow(i).get("CREDIT_GRADE").length() > 0)
	{
		sCreditGrade	=	suppinfo.getRow(i).get("CREDIT_GRADE");
	}else
	{
		sCreditGrade	=	"N/A";
	}
%>								
								
								
								<td class="list_data_small" nowrap align="Center">&nbsp;<%=sCreditGrade%></td>
								<td class="list_data_small" nowrap align="Center">&nbsp;<%=suppinfo.getRow(i).get("ITEM_STD")%></td><!-- 당사 평가 등급 -->
								<td class="list_data_small" nowrap align="Left">&nbsp;<%=suppinfo.getRow(i).get("RECOMMEND_REASON")%></td>
<%
	if(suppinfo.getRow(i).get("VENDOR_NO").equals("4178113681"))
	{
		sCstDocName	=	"평택외 다수";
	}else
	{
		sCstDocName	=	suppinfo.getRow(i).get("CST_DOC_NAME");
	}
%>								
								<td class="list_data_small" nowrap align="Left">&nbsp;<%=sCstDocName%></td>
							</tr>
							<%}//for end
	          					}//if End
%>
</TABLE>								
<%
          				}//if end
				%>
				<br/>
<TABLE border=0 cellSpacing=0 cellPadding=0 width=709>
<tr>
<td height="30px">
<b style="font-size:10pt">* 특기사항 및 첨부서류</b>
</td>
</tr>
</table>			
	<TABLE width="709" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF" bordercolorlight="#AEAFAF" border="1">
		<COLGROUP>
			<COL width="100px"/>
			<COL width="100px"/>
		    <COL/>
		</COLGROUP>
		<tr height="23">
			<td class="list_title" rowspan="4">내부 보고</td>
			<td class="list_title" nowrap>주요발주내용</td>
      		<td class="list_data" align="Left" valign="top"><%=StringUtils.cvtHTML(BidMaster.get("MAIN_PR_CONTENTS"))%>&nbsp;</td>
		</tr>
		<tr height="23">
			<td class="list_title" nowrap>입찰업체선정사유</td>
      		<td class="list_data" align="Left" valign="top"><%=StringUtils.cvtHTML(BidMaster.get("BID_SUPP_SELECT_REASON"))%>&nbsp;</td>
		</tr>
		<tr height="23">
			<td class="list_title" nowrap>특기사항</td>
      		<td class="list_data" align="Left" valign="top"><%=StringUtils.cvtHTML(BidMaster.get("INNER_REMARKS"))%>&nbsp;</td>
		</tr>
		<tr>
			<td class="list_title" nowrap>첨부서류</td>
			<td class="list_data" nowrap align="Left">
	        	<div>
	        		<%
	        		String textDocEtcIn = FileManager.getFileListForSpan(BidMaster.get("DOC_ETC_IN"), BidMaster.get("DEMANDED_ID")); 
			    	if(textDocEtcIn.length() == 11){
			    	%>
			    		&nbsp;
			    	<%}else{%>
			    		<%=textDocEtcIn%>
			    	<%}%>
	        	</div>
	       	</td>
		</tr>		
	</table>
	        </TD>
	    </TR>
	  </tbody>
	</TABLE>
<br/>
<table><tr><td style="display:none;" id=doctitle_1  class=FIELD><%=BidMaster.get("doctitle")%></td></tr></table>
<br>
