<!--#include file="Config.asp" -->
<div class='menu'>&nbsp;查看 &gt; 抽奖名单</div>
<%
eims = "Lottery"
eTable = Prefix&eims
ListUrl = eims&".asp?eims="&eims&"&TypeID="&TypeID
%>
<div class="title">
<form method='post' name='sForm' action="<%=ListUrl%>">
  <table width="100%" border="0" cellspacing="1" cellpAdding="1">
    <tr>
      <td>

<table align="left" border="0" cellspacing="0" cellpadding="0">
  <tr align="center">
    <td><input type='button' value='清空抽奖记录' onClick="if(confirm('确定要清空吗？清空后不可恢复！')){location.href='?Action=Reset&TypeID=<%=TypeID%>'}"></td>
	<td width="11"></td>	
    <td>姓名<input type='text' name='x1' id="x1" size="8"></td>
    <td>电话<input type='text' name='x2' id="x2" size="12"></td>
    <td><input type='button' value=' 添加 ' onClick="location.href='?Action=Add&x1='+x1.value+'&x2='+x2.value+'&TypeID=<%=TypeID%>'"></td>
	<td width="22"></td>	
	<td><input type='button' value='查看中奖名单' onClick="location.href='?Action=st&TypeID=<%=TypeID%>'"></td>
  </tr>
</table>
<%
if Action="Add" then
if trim(request("x1"))="" or trim(request("x2"))="" then WtMsg("输入错误")

set crs=conn.execute("select ItemID from [eims_Lottery] where ItemRec=1 and Tel='"&trim(request("x2"))&"' and TypeID="&TypeID&" ")
if not crs.eof then WtMsg("此号码已存在，请不要重复添加！")

conn.execute("insert into [eims_Lottery] (UserName,Tel,ItemRec,TypeID,AddDate,st1,st2,st3) values ('"&trim(request("x1"))&"','"&trim(request("x2"))&"','1','"&TypeID&"','"&now&"','0','0','1')")
end if

if Action="Reset" then
conn.execute("update [eims_Lottery] set st1=0,st2=0,st3=1 where TypeID="&TypeID&" ")
end if
%>
	  
	  </td>
      <td align="right"><!-- Search Begin -->
        手机号<input type='text' name='Tel'>
        <input type='submit' value='搜索' name='submit'>
		<input type='submit' value='删除' name='submit' onClick="return confirm('确定要删除吗？')">
		<input type="hidden" name="del" value="yes">
        <!-- Search end -->
      </td>
    </tr>
  </table>
</div>
<div class="content" align="center">
<table width="100%" border="0" cellspacing="1" cellpAdding="1">
  <tr bgcolor="#FFFFFF" align="center">    
	<td width='60'><div class='title'>ID</div></td>
	<td><div class='title'>姓名</div></td>
    <td><div class='title'>手机号</div></td>
    <td width="60"><div class='title'>是否中奖</div></td>
	<td width="60"><div class='title'>中奖顺序</div></td>
	<td width="150"><div class='title'>提交日期</div></td>
	<td width='35'><div class='title'><input type='checkbox' name='chkall' onClick='CheckAll(this.form)' value='ON'> </div></td>
  </tr>
<%
fField="ItemID,UserName,Tel,st1,AddDate,st2,st3,ItemRec"
OrderBy="ItemID desc"

Condition="ItemID>0 and TypeID="&TypeID

if Action="st" then 
Condition=Condition&" and st1=1 and st2=1 and st3>1"
OrderBy="st3 asc"
end if

If Trim(Request("Tel"))<>"" Then Condition=Condition&" and Tel like '%"&Trim(Request("Tel"))&"%'"

Sql="Select "&fField&" From ["&eTable&"] Where "&Condition&" Order By "&OrderBy&" "
Set Rs=Server.CreateObject("Adodb.RecordSet")
Rs.Open Sql,Conn,1,1
totalnumber=rs.recordcount'总记录数
if not (rs.eof and rs.bof) then'有记录
rs.PageSize=pagenum
maxpage=rs.pageCount'总页数
page=cint(request("page"))'接收页面传来的参数
if page<1 then page=1
If page>maxpage then page=maxpage
rs.Absolutepage=Page
for i=1 to rs.PageSize
if rs.eof then exit for
%>
  <tr onMouseOver='trOver(this)' onMouseOut='trOut(this)' align="center">
	<td><%=Int(Rs(0))%></td>
    <td><%=Trim(Rs(1))%></td>
	<td><%=Trim(Rs(2))%></td>
	<td><%=Trim(Rs(3))%></td>
	<td><%=Trim(Rs(6))%></td>
	<td><%=Trim(Rs(4))%></td>
	<td><input name='BoxID' type='checkbox' value='<%=Int(Rs(0))%>'></td>
  </tr>
<% 
Rs.MoveNext
next
end if
Rs.Close
Set Rs=nothing
%>
</table>
</form>
<div class="page"><%showpage Page,totalnumber,pagenum,ReUrl() %></div>
</div>
</body></html>
<%Call CloseConn()%>