<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="ckeditor" uri="http://ckeditor.com" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="ct" tagdir="/WEB-INF/tags" %>

<style type="text/css">input.goalTotal {width: 20px;}</style>

<form:form commandName="reportSearchVO" name="searchForm" method="get">
	<input type="hidden" name="is" />
	
	<div class="search2">
		<ul>
		 	<li>
		 		<b><spring:message code="report.search.period" /></b>
		 	</li>
		 	<li class="form_search margin-left">
		 		<form:select path="year" cssClass="use">
					<c:forEach var="item" items="${yearList}" varStatus="status">
		 				<form:option value="${item}" label="${item}년"/>
					</c:forEach>
		 		</form:select>
		 	</li>
		 	<li class="form_search">
		 		<form:select path="month" cssClass="use">
					<c:forEach var="item" items="${monthList}" varStatus="status">
		 				<form:option value="${item}" label="${item}월"/>
					</c:forEach>
		 		</form:select>
		 	</li>
		 	<c:if test="${authAdmin > 0 and reportSearchVO.placeGroup != '' and reportSearchVO.placeGroup != null}">
			 	<li class="margin-left">
			 		<b><spring:message code="report.search.place" /></b>
			 	</li>
			 	<li class="form_search margin-left">
			 		<form:select path="placeGroup" cssClass="use">>
						<c:forEach var="item" items="${placeList}">
							<form:option value="${item.code2}" label="${item.codenm}" />
						</c:forEach>
					</form:select>	
			 	</li>
			 </c:if>
			 <li>
				<span class="btn_blue"> 
					<a href="javascript:search();"><spring:message code="button.goSearch" /></a>
				</span>
			</li>
		</ul>
	</div>
	
	<!-- 상위 버튼 -->
	<div class="pageinfo">
		<ul class="right btn-style">
			<c:if test="${authAdmin > 0 and reportSearchVO.placeGroup != '' and reportSearchVO.placeGroup != null}">
				<li><a class="btn_filter" href="javascript:showPlace();" alt="부서별보기"><spring:message code="button.showPlace" /></a></li>
			</c:if>
			<li><a class="btn_excel" href="javascript:getExcel();"><spring:message code="button.getExcel" /></a></li>
		</ul>
	</div>
</form:form>


<!-- List -->
<div id="table">	
	<table class="tbl_list" width="100%" border="0" cellpadding="0" cellspacing="0" summary="게시판 목록을 확인 할 수 있습니다.">
		<caption class="hidden">목표 관리 목록</caption>
		<colgroup>
			<col width="50"/>
			<col width="180"/>
			<col width="77"/>
			<col width="77"/>
			<col width="77"/>
			<col width="77"/>
			<col width="77"/>
			<col width="77"/>
			<col width="77"/>
			<col width="77"/>
			<col width="77"/>
			<col width="77"/>
		</colgroup>
		<thead>
			<tr>
				<th align="center" rowspan="2"><spring:message code="report.goal.no" /></th>
				<th align="center" rowspan="2"><spring:message code="report.goal.name" /></th>
				<th align="center" colspan="2" class="tbl_list_col"><spring:message code="report.goal.agent" /></th>
				<th align="center" colspan="2" class="tbl_list_col"><spring:message code="report.goal.foreignCoop" /></th>
				<th align="center" colspan="2" class="tbl_list_col"><spring:message code="report.goal.infoCoop" /></th>
				<th align="center" colspan="2" class="tbl_list_col"><spring:message code="report.goal.reportAgent" /></th>
				<th align="center" colspan="2" class="tbl_list_col"><spring:message code="report.goal.sum" /></th>
			</tr>
			<tr>
				<th align="center"><spring:message code="report.goal.result" /></th>
				<th align="center"><spring:message code="report.goal.goal" /></th>
				<th align="center"><spring:message code="report.goal.result" /></th>
				<th align="center"><spring:message code="report.goal.goal" /></th>
				<th align="center"><spring:message code="report.goal.result" /></th>
				<th align="center"><spring:message code="report.goal.goal" /></th>
				<th align="center"><spring:message code="report.goal.result" /></th>
				<th align="center"><spring:message code="report.goal.goal" /></th>
				<th align="center"><spring:message code="report.goal.result" /></th>
				<th align="center"><spring:message code="report.goal.goal" /></th>
			</tr>
		</thead>
		<tbody>
		
		<c:forEach var="item" items="${goalStats}" varStatus="status">
			<tr>
				<td align="center">
					<c:out value="${item.RN}"/>
				</td>
				<td align="left">
					<c:if test="${reportSearchVO.placeGroup != '' and reportSearchVO.placeGroup != null}">
						<c:out value="${item.NAME}"/>
					</c:if>
					<c:if test="${reportSearchVO.placeGroup == '' or reportSearchVO.placeGroup == null}">
						<a href="<c:url value="/report/goalStats.do">
								<c:param name="placeGroup" value="${item.CODE}" />
								<c:param name="year" value="${reportSearchVO.year}" />
								<c:param name="month" value="${reportSearchVO.month}" />
							</c:url>"><span><c:out value="${item.NAME}"/></span></a>
					</c:if>
				</td>
				
				<!-- 전종요원 -->
				<td align="center">
					<c:if test="${item.RESULT1 < item.GOAL1}"><span class="text_red"><c:out value="${item.RESULT1}"/></span></c:if>
					<c:if test="${item.RESULT1 >= item.GOAL1}"><span class="text_blue"><c:out value="${item.RESULT1}"/></span></c:if>
				</td>
				<td align="center">
					<c:out value="${item.GOAL1}" />
				</td>
				
				<!-- 대외협력 -->
				<td align="center">
					<c:if test="${item.RESULT2 < item.GOAL2}"><span class="text_red"><c:out value="${item.RESULT2}"/></span></c:if>
					<c:if test="${item.RESULT2 >= item.GOAL2}"><span class="text_blue"><c:out value="${item.RESULT2}"/></span></c:if>
				</td>
				<td align="center">
					<c:out value="${item.GOAL2}" />
				</td>
				
				<!-- 정보협력 -->
				<td align="center">
					<c:if test="${item.RESULT3 < item.GOAL3}"><span class="text_red"><c:out value="${item.RESULT3}"/></span></c:if>
					<c:if test="${item.RESULT3 >= item.GOAL3}"><span class="text_blue"><c:out value="${item.RESULT3}"/></span></c:if>
				</td>
				<td align="center">
					<c:out value="${item.GOAL3}" />
				</td>
				
				<!-- 신고요원 -->
				<td align="center">
					<c:if test="${item.RESULT4 < item.GOAL4}"><span class="text_red"><c:out value="${item.RESULT4}"/></span></c:if>
					<c:if test="${item.RESULT4 >= item.GOAL4}"><span class="text_blue"><c:out value="${item.RESULT4}"/></span></c:if>
				</td>
				<td align="center">
					<c:out value="${item.GOAL4}" />
				</td>
				
				<!-- 계 -->
				<td align="center">
					<c:if test="${item.RESULT_TOTAL < item.GOAL_TOTAL}"><span class="text_red"><c:out value="${item.RESULT_TOTAL}"/></span></c:if>
					<c:if test="${item.RESULT_TOTAL >= item.GOAL_TOTAL}"><span class="text_blue"><c:out value="${item.RESULT_TOTAL}"/></span></c:if>
				</td>
				<td align="center">
					<c:out value="${item.GOAL_TOTAL}" />
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
</div>
<!-- /List -->

<script type="text/javascript">
<!--
	function showPlace() {
		$('form[name=searchForm]').attr("action", "<c:out value="/report/goalStatsPlace.do" />");
		$('form[name=searchForm]').submit();
	}
	function search() {
		$('form[name=searchForm]').attr("action", "<c:out value="/report/goalStats.do" />");
		$('form[name=searchForm]').submit();
	}
	function getExcel() {
		$('form[name=searchForm]').attr("action", "<c:out value="/report/goalStatsExcel.do" />");
		$('form[name=searchForm]').submit();
	}
/*
	$(document).ready(function(){
		
		$('#year').change(function(){
			$('form[name=searchForm]').submit();
		});
		
		$('#month').change(function(){
			$('form[name=searchForm]').submit();
		});
		
		$('#placeGroup').change(function(){
			$('form[name=searchForm]').submit();
		});
	});
*/
-->
</script>
