<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
function giftOnchange() {
var selectText = $("#gift_given").val();
if (selectText == "all") {
$("td[class=‘0‘]").parent().show();
$("td[class=‘1‘]").parent().show();
} else if (selectText == 1) {
$("td[class=‘0‘]").parent().hide();
$("td[class=‘1‘]").parent().show();
} else {
$("td[class=‘1‘]").parent().hide();
$("td[class=‘0‘]").parent().show();
}
}
function saveCode() {
//alert("${pageContext.request.contextPath}");
//window.location.href="${pageContext.request.contextPath}"+"/PoiExport"
window.location.href="PoiExport";
}
function actOnchange(){
var selectItem=$("#actnum option:selected").val();
$("tr[actid=‘"+selectItem+"‘]").show();
$("tr[actid!=‘"+selectItem+"‘]").not(":first").hide();
var ling=$("td[class=‘1‘]:visible").length;
var weiLing=$("td[class=‘0‘]:visible").length;
var yi_yi = $("td[dep=‘1-1‘]:visible").length;
var yi_er = $("td[dep=‘1-2‘]:visible").length;
var yi_san = $("td[dep=‘1-3‘]:visible").length;
var yi_si = $("td[dep=‘1-4‘]:visible").length;
var er_yi = $("td[dep=‘2-1‘]:visible").length;
var er_er = $("td[dep=‘2-2‘]:visible").length;
var er_san = $("td[dep=‘2-3‘]:visible").length;
var er_si = $("td[dep=‘2-4‘]:visible").length;
var san_yi = $("td[dep=‘3-1‘]:visible").length;
var san_er = $("td[dep=‘3-2‘]:visible").length;
var san_san = $("td[dep=‘3-3‘]:visible").length;
var san_si = $("td[dep=‘3-4‘]:visible").length;
alert(yi_er);
}
</script>
<title></title>
</head>
<body>
<div>
<select id="gift_given" onchange="giftOnchange()">
<option value="all">全部</option>
<option value="1">领过奖品</option>
<option value="0">未领过奖品</option>
</select>
<input type="button" value="导出 Excel" onclick="saveCode()">
<sql:setDataSource var="ds" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/yxdb" user="root"
password="admin" />
<sql:query var="result" sql="select distinct activity_id from sign;" dataSource="${ds}">
</sql:query>
<select id="actnum" onchange="actOnchange()">
<c:forEach var="row" items="${result.rows}">
<option value="${row.activity_id}">${row.activity_id}</option>
</c:forEach>
</select>
<sql:query var="rs" sql="select a.activity_id,a.member_name,a.member_number,a.gift_taken,b.department,b.gender,b.nation,b.dues,b.join_date from sign a,member b where a.member_number = b.member_number;" dataSource="${ds}">
</sql:query>
<div id="tableExcel">
<table id="table_members" border="1" >
<tr style="background:green;color:#fff">
<th>活动编号</th>
<th>用户名</th>
<th>员工号</th>
<th>部门</th>
<th>领奖情况</th>
<th>性别</th>
<th>名族</th>
<th>所交会费</th>
<th>加入公司时间</th>
</tr>
<c:forEach var="row" items="${rs.rows}">
<tr actid="${row.activity_id}">
<td>${row.activity_id}</td>
<td>${row.member_name}</td>
<td>${row.member_number}</td>
<td dep="${row.department}">${row.department}</td>
<td class="${row.gift_taken}"><c:choose>
<c:when test="${row.gift_taken==‘0‘}">
未领
</c:when>
<c:otherwise>已领</c:otherwise>
</c:choose></td>
<td>${row.gender}</td>
<td>${row.nation}</td>
<td>${row.dues}</td>
<td>${row.join_date}</td>
</tr>
</c:forEach>
</table>
</div>
</div>
</body>
</html>