<?xml version="1.0" encoding="UTF-8" ?>
<%@page import="kr.co.hsnc.common.util.ValueObject"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ 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);
	ValueObject user = ctx.getUser();
	
	HandlerStorage storage = ctx.getHandlerStorage();

	ValueObject params = ctx.getParams();

	RowSet notiRowSet = storage.getRowSet("notiRowSet");
	
	int rowSize = notiRowSet.size(); 
	
	if(rowSize > 5) {
		rowSize = 5;
	}
	
	
	ValueObject getResultTargetCnt = storage.getValueObject("getResultTargetCnt");
	ValueObject getBidCnt = storage.getValueObject("getBidCnt");
	ValueObject getSuppContCnt = storage.getValueObject("getSuppContCnt");
	ValueObject getPayCnt = storage.getValueObject("getPayCnt");
	
%>
<!-- Notice Style -->
<!-- <link rel="stylesheet" type="text/css" href="/css/supplier/notice.css" /> -->

<!-- Application Script -->
<script type="text/javascript">
	/**
	 *	Global variables
	 */
	
	/**
	 *	Application Init Function
	 */
	function _onReady(){
	    
	}
	
	$(document).ready(function(){
	    
	    
	    //실적증명
	    var result_target_cnt = "<%=getResultTargetCnt.get("result_target_cnt")%>";
	    var result_ing_cnt = "<%=getResultTargetCnt.get("result_ing_cnt")%>";
	    var result_end_cnt = "<%=getResultTargetCnt.get("result_end_cnt")%>";
	    
	    //전자입찰
	    var getBidCnt_1 = "<%=getBidCnt.get("CNT_1") %>";
	    var getBidCnt_2 = "<%=getBidCnt.get("CNT_2") %>";
	    var getBidCnt_3 = "<%=getBidCnt.get("CNT_3") %>";
	    var getBidCnt_4 = "<%=getBidCnt.get("CNT_4") %>";
	    
	    //전자계약
	    var getSuppContCnt_1 = "<%=getSuppContCnt.get("CNT_1") %>";
	    var getSuppContCnt_2 = "<%=getSuppContCnt.get("CNT_2") %>";
	    var getSuppContCnt_3 = "<%=getSuppContCnt.get("CNT_3") %>";
	    var getSuppContCnt_4 = "<%=getSuppContCnt.get("CNT_4") %>";
	    
	  	//대급지급
	    var getPayCnt_1 = "<%=getPayCnt.get("CNT_1") %>";
	    var getPayCnt_2 = "<%=getPayCnt.get("CNT_2") %>";
	    var getPayCnt_3 = "<%=getPayCnt.get("CNT_3") %>";
	    var getPayCnt_4 = "<%=getPayCnt.get("CNT_4") %>";
	    
	    //실적증명
	    if(result_target_cnt == "0")
        {
	        $("#result_target").addClass("blue");
        }
	    else
        {
	        $("#result_target").addClass("orange");	 
	        $("#result_target").css("cursor", "pointer");
        }
	    
	    if(result_ing_cnt == "0")
        {
	        $("#result_ing").addClass("blue");
        }
	    else
        {
	        $("#result_ing").addClass("orange");
	        $("#result_ing").css("cursor", "pointer");
        }
	    
	    if(result_end_cnt == "0")
        {
	        $("#result_end").addClass("blue");
        }
	    else
        {
	        $("#result_end").addClass("orange");
	        $("#result_end").css("cursor", "pointer");
        }
	    
	    
	    //전자입찰
	    if(getBidCnt_1 == "0")
        {
	        $("#getBidCnt_1").addClass("blue");
        }
	    else
        {
	        $("#getBidCnt_1").addClass("orange");	 
	        $("#getBidCnt_1").css("cursor", "pointer");
        }
	    
	    if(getBidCnt_2 == "0")
        {
	        $("#getBidCnt_2").addClass("blue");
        }
	    else
        {
	        $("#getBidCnt_2").addClass("orange");
	        $("#getBidCnt_2").css("cursor", "pointer");
        }
	    
	    if(getBidCnt_3 == "0")
        {
	        $("#getBidCnt_3").addClass("blue");
        }
	    else
        {
	        $("#getBidCnt_3").addClass("orange");
	        $("#getBidCnt_3").css("cursor", "pointer");
        }
	    
	    if(getBidCnt_4 == "0")
        {
	        $("#getBidCnt_4").addClass("blue");
        }
	    else
        {
	        $("#getBidCnt_4").addClass("orange");
	        $("#getBidCnt_4").css("cursor", "pointer");
        }
	    
	    
	    
	    
	    if(getSuppContCnt_1 == "0")
        {
	        $("#getSuppContCnt_1").addClass("blue");
        }
	    else
        {
	        $("#getSuppContCnt_1").addClass("orange");
	        $("#getSuppContCnt_1").css("cursor", "pointer");
        }
	    
	    if(getSuppContCnt_2 == "0")
        {
	        $("#getSuppContCnt_2").addClass("blue");
        }
	    else
        {
	        $("#getSuppContCnt_2").addClass("orange");
	        $("#getSuppContCnt_2").css("cursor", "pointer");
        }
	    
	    if(getSuppContCnt_3 == "0")
        {
	        $("#getSuppContCnt_3").addClass("blue");
        }
	    else
        {
	        $("#getSuppContCnt_3").addClass("orange");
	        $("#getSuppContCnt_3").css("cursor", "pointer");
        }
	    
	    if(getSuppContCnt_4 == "0")
        {
	        $("#getSuppContCnt_4").addClass("blue");
        }
	    else
        {
	        $("#getSuppContCnt_4").addClass("orange");
	        $("#getSuppContCnt_4").css("cursor", "pointer");
        }
	    
	    
	    
	    
	    
	    if(getPayCnt_1 == "0")
        {
	        $("#getPayCnt_1").addClass("blue");
        }
	    else
        {
	        $("#getPayCnt_1").addClass("orange");
	        $("#getPayCnt_1").css("cursor", "pointer");
        }
	    
	    if(getPayCnt_2 == "0")
        {
	        $("#getPayCnt_2").addClass("blue");
        }
	    else
        {
	        $("#getPayCnt_2").addClass("orange");
	        $("#getPayCnt_2").css("cursor", "pointer");
        }
	    
	    if(getPayCnt_3 == "0")
        {
	        $("#getPayCnt_3").addClass("blue");
        }
	    else
        {
	        $("#getPayCnt_3").addClass("orange");
	        $("#getPayCnt_3").css("cursor", "pointer");
        }
	    
	    if(getPayCnt_4 == "0")
        {
	        $("#getPayCnt_4").addClass("blue");
        }
	    else
        {
	        $("#getPayCnt_4").addClass("orange");
	        $("#getPayCnt_4").css("cursor", "pointer");
        }
	    
	    
	    
	    
	    
	    
	    
	    
	});
	
	$(function(){
	    
	    $("#myPage").click(function(){
	        $("#form1").attr("action", "/portal/own/MyInfo.screen");
	        $("#form1").attr("target", "_self");
			$("#form1").attr("method", "post");
			
	        $("#form1").submit();
	    });
	    
	    
	    
	    
	    $("#result_target").click(function(){
	        location.href="/portal/result/ResultTargetList.screen"; 
	    });
	    
	    $("#result_ing").click(function(){
	        location.href="/portal/result/ResultIngList.screen";
	    });
	    
	    $("#result_end").click(function(){
	        location.href="/portal/result/ResultTargetList.screen";
	    });
	    
	    
	    
	    
	    
	    $("#getBidCnt_1").click(function(){
	        location.href="/portal/bid/SiteExplanList.screen";
	    });
	    
	    $("#getBidCnt_2").click(function(){
	        location.href="/portal/bid/QuotRequestList.screen";
	    });
	    
	    $("#getBidCnt_3").click(function(){
	        location.href="/portal/bid/TBERequestList.screen";
	    });
	    
	    $("#getBidCnt_4").click(function(){
	        location.href="/portal/bid/SuppBidResultList.screen";
	    });
	    
	    
	    
	    
	    $("#getSuppContCnt_1").click(function(){
	        location.href="/portal/cont/SuppContList.screen";
	    });
	    
	    $("#getSuppContCnt_2").click(function(){
	        location.href="/portal/cont/SuppContResultList.screen";
	    });
	    
	    $("#getSuppContCnt_3").click(function(){
	        location.href="/portal/cont/SuppContList.screen";
	    });
	    
	    $("#getSuppContCnt_4").click(function(){
	        location.href="/portal/cont/SuppContResultList.screen";
	    });
	    
	    
	    
	    $("#getPayCnt_1").click(function(){
	        
	        var job_div = "<%=user.get("job_div")%>";
	        
	        if(job_div == "P")
            {
	            location.href="/portal/payment/BuyPrepaymentsList.screen";
            }
	        else
            {
	            location.href="/portal/payment/AdvencePayRequestList.screen";
            }
	        
	    });
	    
	    $("#getPayCnt_2").click(function(){
	        
			var job_div = "<%=user.get("job_div")%>";
	        
	        if(job_div == "P")
            {
	            location.href="/portal/payment/BuyPrepaymentsList.screen";
            }
	        else
            {
	            location.href="/portal/payment/AdvencePayRequestResultList.screen";
            }
	        
	    });
	    
	    
	    $("#getPayCnt_3").click(function(){
	        
			var job_div = "<%=user.get("job_div")%>";
	        
	        if(job_div == "P")
            {
	            location.href="/portal/payment/SuppPayRequestList.screen";
            }
	        else
            {
	            location.href="/portal/payment/ResolutionRequestList.screen";
            }
	        
	    });
	    
	    $("#getPayCnt_4").click(function(){
	        
			var job_div = "<%=user.get("job_div")%>";
	        
	        if(job_div == "P")
            {
	            location.href="/portal/payment/SuppPayResultList.screen";
            }
	        else
            {
	            location.href="/portal/payment/ResolutionResultList.screen";
            }
	    });
	    
	    
	    
	});
	
	function getNotiList() {
		var f = document.form1;
		f.fevent.value ="";
		f.layerYn.value = "N";
	    f.action = "/supplier/portal/center/SuppNotiList.screen";
	    f.target = "_self";
	    f.submit();
	}
	
	function getNotiDetail(seq) {
		var f = document.form1;
		f.fevent.value ="";
		f.layerYn.value = "N";
		f.seq.value = seq;
	    f.action = "/supplier/portal/center/SuppNotiDetail.screen";
	    f.target = "_self";
	    f.submit();
	}
	
</script>

<form name="form1" id="form1" method="post" action="" >
	<input type="hidden" name="user_id" id="user_id" value="<%=user.get("user_id") %>" />
	<input type="hidden" name="p_user_id" id="p_user_id" value="<%=user.get("user_id") %>" />
	<input type="hidden" name="corp_id" id="corp_id" value="<%=user.get("corp_id") %>" />
	<input type="hidden" name="corp_reg_no" id="corp_reg_no" value="<%=user.get("corp_reg_no") %>" />
	<input type="hidden" name="job_idv" id="job_idv" value="<%=user.get("job_div") %>" />
	<input type="hidden" name="seq" id="seq" />
	<INPUT type="hidden" name="fevent" id="fevent" value="">
	<INPUT type="hidden" name="layerYn" id="layerYn">
</form>


<div id="main-banner">
	<img src="/img/supplier/main_banner.gif" />
</div>
<div id="main-notice">
	<div class="notice">
		<table width="100%">
			
			<!-- 
			<thead><a href="#"><img src="/img/supplier/main_notice_title.gif" /></a></thead>
			<colgroup>
				<col width="10" />
				<col width="470"/>
				<col width="*" />
			</colgroup>
			<tbody>
				<tr>
					<th colspan="3" height="8"></th>
				</tr>
				<tr>
					<td align="left"><img src="/img/supplier/ico/blue_a.gif" /></td>
					<td align="left"><a href="#">SGC이앤씨 협력업체 포털 시스템을 오픈하였습니다.</a></td>
					<td align="right">2014-05-29</td>
				</tr>
				<tr>
					<td align="left"><img src="/img/supplier/ico/blue_a.gif" /></td>
					<td align="left"><a href="#">SGC이앤씨 협력업체 포털 시스템을 오픈하였습니다.</a></td>
					<td align="right">2014-05-29</td>
				</tr>
				<tr>
					<td align="left"><img src="/img/supplier/ico/blue_a.gif" /></td>
					<td align="left"><a href="#">SGC이앤씨 협력업체 포털 시스템을 오픈하였습니다.</a></td>
					<td align="right">2014-05-29</td>
				</tr>
				<tr>
					<td align="left"><img src="/img/supplier/ico/blue_a.gif" /></td>
					<td align="left"><a href="#">SGC이앤씨 협력업체 포털 시스템을 오픈하였습니다.</a></td>
					<td align="right">2014-05-29</td>
				</tr>
				<tr>
					<td align="left" height="22"><img src="/img/supplier/ico/blue_a.gif" /></td>
					<td align="left"><a href="#">SGC이앤씨 협력업체 포털 시스템을 오픈하였습니다.</a></td>
					<td align="right">2014-05-29</td>
				</tr>
			</tbody>
			 -->
			
			<thead>
					<a onClick="javascript:getNotiList();"><img src="/img/supplier/main_notice_title.gif" style="cursor: pointer;"/></a>
				</thead>
				<colgroup>
					<col width="10" />
					<col width="470"/>
					<col width="*" />
				</colgroup>
				<tbody>
					<tr>
						<th colspan="3" height="8"></th>
					</tr>
						<%
							for( int i=0; i<rowSize; i++ ) {	
						%>
							<tr>
								<td align="left">
									<img src="/img/supplier/ico/blue_a.gif" />
								</td>
								<td align="left"><a onClick="javascript:getNotiDetail(<%= notiRowSet.getRow(i).get("seq") %>);" style="cursor: pointer;">
											<%
												if( notiRowSet.getRow(i).get("title").length() > 22 ) {
											%>
													<%=notiRowSet.getRow(i).get("title").substring(0, 22) + "..."%>
											<%
												}
												else {
											%>
													<%=notiRowSet.getRow(i).get("title")%>
											<%		
												}
											%>
									</a>
								</td>
								<td align="right">
											<%= notiRowSet.getRow(i).get("noti_dy").substring(0,4) + "-" + 
											notiRowSet.getRow(i).get("noti_dy").substring(4,6) + "-" + 
											notiRowSet.getRow(i).get("noti_dy").substring(6,8) %>
								</td>
							</tr>
						<%
							}
						%>
					</tr>
				</tbody>
			
			
		</table>
	</div>
	<div class="userInfo">
		<div><img src="/img/supplier/main_userinfo_title.gif" id="myPage" name="myPage" style="cursor: pointer;"/></div>
		<table width="100%">
			<colgroup>
				<col width="10" />
				<col width="80" />
				<col width="*" />
			</colgroup>
			<tr>
				<th align="left"><img src="/img/supplier/ico/blue_b.gif" /></th>
				<th align="left">성명</th>
				<td align="left"><%=user.get("user_name") %></td>
			</tr>
			<tr>
				<th align="left"><img src="/img/supplier/ico/blue_b.gif" /></th>
				<th align="left">전화번호</th>
				<td align="left"><%=user.get("tel_num") %></td>
			</tr>
			<tr>
				<th align="left"><img src="/img/supplier/ico/blue_b.gif" /></th>
				<th align="left">핸드폰</th>
				<td align="left"><%=user.get("hp1") + "-" + user.get("hp2") + "-" + user.get("hp3") %></td>
			</tr>
			<tr>
				<th align="left"><img src="/img/supplier/ico/blue_b.gif" /></th>
				<th align="left">이메일</th>
				<td align="left"><%=user.get("email") %></td>
			</tr>
		</table>
	</div>
</div>
<div id="main-todo">
	<div class="title"><img src="/img/supplier/main_todo_title.gif" /></div>
	<table width="100%">
		<colgroup>
			<col width="1%" />
			<col width="10%" />
			<col width="42%"/>
			<col width="3%" />
			<col width="1%" />
			<col width="9%" />
			<col width="40%" />
		</colgroup>
		<tbody>
			<tr>
				<th colspan="3"><img src="/img/supplier/btn/bid.gif" /></th>
				<th style="border-style: none;"></th>
				<th colspan="3"><img src="/img/supplier/btn/contract.gif" /></th>
			</tr>
			<tr>
				<td><img src="/img/supplier/ico/blue_a.gif" /></td>
				<%if(user.get("job_div").equals("P")){ %>
				<td class="bold">구매</td>
				<td>
					입찰공고<span class="bold" id="getBidCnt_1">(<%=getBidCnt.get("CNT_1") %>)</span>
					&gt;
					견적제출<span class="bold" id="getBidCnt_2">(<%=getBidCnt.get("CNT_2") %>)</span>
					&gt;
					기술검토자료제출<span class="bold" id="getBidCnt_3">(<%=getBidCnt.get("CNT_3") %>)</span>
					&gt;
					입찰결과<span class="bold" id="getBidCnt_4">(<%=getBidCnt.get("CNT_4") %>)</span>
				</td>
				<%}else{ %>
				<td class="bold">외주</td>
				<td>
					입찰공고<span class="bold" id="getBidCnt_1">(<%=getBidCnt.get("CNT_1") %>)</span>
					&gt;
					견적제출<span class="bold" id="getBidCnt_2">(<%=getBidCnt.get("CNT_2") %>)</span>
					&gt;
					기술검토자료제출<span class="bold" id="getBidCnt_3">(<%=getBidCnt.get("CNT_3") %>)</span>
					&gt;
					입찰결과<span class="bold" id="getBidCnt_4">(<%=getBidCnt.get("CNT_4") %>)</span>
				</td>
				<%} %>
				
				<td style="border-style: none;"></td>
				
				<td><img src="/img/supplier/ico/blue_a.gif" /></td>
				<td class="bold">신규계약</td>
				<td>
					진행중<span class="bold" id="getSuppContCnt_1">(<%=getSuppContCnt.get("CNT_1") %>)</span>
					&gt;
					계약완료<span class="bold" id="getSuppContCnt_2">(<%=getSuppContCnt.get("CNT_2") %>)</span>
				</td>
			</tr>
			<tr>
				<td style="border-style: none;"></td>
				<td style="border-style: none;"></td>
				<td style="border-style: none;"></td>
				
				<td style="border-style: none;"></td>
				
				<td><img src="/img/supplier/ico/blue_a.gif" /></td>
				<td class="bold">변경계약</td>
				<td>
					진행중<span class="bold" id="getSuppContCnt_3">(<%=getSuppContCnt.get("CNT_3") %>)</span>
					&gt;
					계약완료<span class="bold" id="getSuppContCnt_4">(<%=getSuppContCnt.get("CNT_4") %>)</span>
				</td>
			</tr>
			<tr>
				<th colspan="3"><img src="/img/supplier/btn/payment.gif" /></th>
				<%if(user.get("job_div").equals("P")){ %>
				<th colspan="4" style="border-style: none;"></th>
				<%}else{ %>
				<th style="border-style: none;"></th>
				<th colspan="3"><img src="/img/supplier/btn/Verification.gif" /></th>
				<%} %>
			</tr>
			<tr>
				<td><img src="/img/supplier/ico/blue_a.gif" /></td>
				<%if(user.get("job_div").equals("P")){ %>
				<td class="bold">구매_선급금</td>
				<td>
					진행중<span class="bold" id="getPayCnt_1">(<%=getPayCnt.get("CNT_1") %>)</span>
					&gt;
					완료<span class="bold" id="getPayCnt_2">(<%=getPayCnt.get("CNT_2") %>)</span>
				</td>
				<%}else{ %>
				<td class="bold">외주_선급금</td>
				<td>
					진행중<span class="bold" id="getPayCnt_1">(<%=getPayCnt.get("CNT_1") %>)</span>
					&gt;
					완료<span class="bold" id="getPayCnt_2">(<%=getPayCnt.get("CNT_2") %>)</span>
				</td>
				<%} %>
				<td style="border-style: none;"></td>
				
				<%if(user.get("job_div").equals("P")){ %>
<!-- 				<td></td> -->
<!-- 				<td></td> -->
<!-- 				<td></td> -->
				<%}else{ %>
				<td><img src="/img/supplier/ico/blue_a.gif" /></td>
				<td class="bold">실적증명</td>
				<td>
					발급대상<span class="bold" id="result_target">(<%=getResultTargetCnt.get("result_target_cnt") %>)</span>
					&gt;
					진행중<span class="bold" id="result_ing">(<%=getResultTargetCnt.get("result_ing_cnt") %>)</span>
					&gt;
					발급완료<span class="bold" id="result_end">(<%=getResultTargetCnt.get("result_end_cnt") %>)</span>
				</td>
				<%} %>
			</tr>
			<tr>
				<td><img src="/img/supplier/ico/blue_a.gif" /></td>
				<%if(user.get("job_div").equals("P")){ %>
				<td class="bold">구매_대금지급</td>
				<td>
					진행중<span class="bold" id="getPayCnt_3">(<%=getPayCnt.get("CNT_3") %>)</span>
					&gt;
					완료<span class="bold" id="getPayCnt_4">(<%=getPayCnt.get("CNT_4") %>)</span>
				</td>
				<%}else{ %>
				<td class="bold">외주_기성</td>
				<td>
					진행중<span class="bold" id="getPayCnt_3">(<%=getPayCnt.get("CNT_3") %>)</span>
					&gt;
					완료<span class="bold" id="getPayCnt_4">(<%=getPayCnt.get("CNT_4") %>)</span>
				</td>
				
				<td style="border-top-style: none;"></td>
				
				<td></td>
				<td class="bold"></td>
				<td></td>
				<%} %>
				
			</tr>
		</tbody>
	</table>
</div>
