<!--#include file="QvodCms_Conn.asp"-->
<!--#include file="QvodCms_Check.asp"-->
<%
Dim action,class_id,class_bigid,server_id,shuxin_id,search_type,search_class,search_keyword,pagelink,order,startime,endtime, ListUrl,DataUrl,x
sql="":S1="":S2="":S3=""
x=Trim(Request.QueryString("x"))
allid=Trim(Request.Form("allid"))'批量ID
action=Trim(Request.QueryString("action"))
search_keyword=Trim(Request.QueryString("search_keyword"))'搜索关键字
page=QvodCms_CLng(Request.QueryString("page")):If page<=0 or page="" Then page=1'初始化分页参数
Call OpenConn()
Sub Card_sql'作用：处理SQL查询语句   
    If action="search" Then
		 If Config(1)="SQL" Then
		 sql="and cname like '%"&search_keyword&"%'"
		 Else'启用InStr,LCase函数过滤小日本
		 sql="and InStr(1,LCase(cname),LCase('"&search_keyword&"'),0)<>0"
		 End If
		 pagelink="qvodcms_card.asp?Action=search&search_type="&search_type&"&search_keyword="&search_keyword&"&" '分页路径
	Elseif x="" then
	    sql=""
	Else
	    sql="and csart="&x&""	   
	End If
	pagelink="qvodcms_card.asp?"'分页路径
	x="x="&x 
	sql = "Select * from qvodcms_card where cid>0 "&sql&" order by cid desc"
End Sub

Sub csart()'验证卡状态
   if rs("csart")=1 then
    Response.Write("<font color='red'>已冲值</font>")
   Else
    Response.Write "未冲值"
   End if		
End Sub

If action="delall" Then'批量删除
    If allid="" Then 
		Call QvodCms_Err("必要参数不能为空！")
		Response.End
	End if
    Call card_delall
End if	

Sub card_delall()
 conn.execute(" delete from qvodcms_card where cid in("&allid&")  ")'删除影片
End Sub
%>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<TITLE>卡号管理页面</TITLE>
<link href="skins/css/JaJa_main.css" rel="stylesheet" type="text/css" />
<script language = "javaScript" src = "QvodCms_All.js" type="text/javascript"></script>
</head>
<body>
<%if action="cardadd" then%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form action="?action=cardaddsave" method="post">
  <tr>
    <th colspan=5 style="text-align:center;"><strong>生成冲值卡号</strong></th>
  </tr>
  <tr>
    <td width="15%" class="td1">生成数量：</td>
    <td width="85%" class="td1" colspan="2"><label>
      <input name="cardhow" type="text" id="cardhow" value="10" size="17" maxlength="3" />
    * 一次生成不超过999张</label></td>
  </tr>
  <tr>
    <td class="td1">生成面值：</td>
    <td colspan="2" class="td1"><label>
      <select name="cardmoney" id="select">
        <option value="10">生成10元面值</option>
        <option value="30">生成30元面值</option>
        <option value="50">生成50元面值</option>
        <option value="100">生成100元面值</option>
      </select>
    </label> 说明：10元包月/50元半年/100元包年</td>
  </tr>
  <tr>
     <td colspan="3" class="td1" style=" text-align:left"><input type="submit" name="Submit" value="提交">&nbsp;&nbsp;<input type="reset" name="Submit2" value="重置"></td>
  </tr>
  </form>
</table>
<%Elseif action="cardaddsave" then '卡号生成选项结束^%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" >
    <tr class="title"> 
    <th colspan=5 style="text-align:center;"><strong>正 在 生 成 冲 值 卡</strong></th>
    
    </tr>
    <tr class="tdbg">
      <td height="23" class="td1" ><div align="left" class="b"><table width="527" border="0" align="center" cellpadding="1" cellspacing="0" style="height:0px;">
<tr> 
<td width="53" style="border:0px #006600 solid; height:0px;" class="td1" >生成进度</td>
<td ><img src="images/bar.gif" width=0 height=10 id=img2 name=img2 align=absmiddle></td>
<td width="49">&nbsp;<span id=txt2 name=txt2 style="font-size:9pt">0</span><span style="font-size:9pt">%</span></td>
</tr></table></div></td>
    </tr>
    <tr class="tdbg"> 
    <td height="23" align="center" class="td1" ><input name="Cancel" type="button" id="Cancel" value=" 点击返回 " onClick="window.location.href='qvodcms_card.asp'" style="cursor:hand;"></td>
    </tr>
</table>
<%
cardhow=Request.Form("cardhow")
cardmoney=Request.Form("cardmoney")
For i= 1 to cardhow
Randomize
Set cardrs=Server.CreateObject("adodb.recordSet")
cardrs.open"select * from qvodcms_card ",conn,1,3
cardrs.addnew
cardrs("cname")=year(date())&""&int(1234567890*rnd+1)&""
cardrs("cpass")=""&int(1234567890*rnd+1/3-2*192/5)&""
cardrs("cvip")=cardmoney
cardrs.update
Response.Write "<script>img2.width=" & Fix((i/cardhow) * 400) & ";" & VbCrLf
Response.Write "txt2.innerHTML=""" & FormatNumber(i/cardhow*100) & """;" & VbCrLf
Response.Write "</script>" & VbCrLf
Response.Flush
next
cardrs.close
set cardrs=nothing
Else
%>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> 
<th colspan=7 style="text-align:center;"><table width="100%" border="0">
    <tr>
      <td><table width="611" border="0" align="left" cellpadding="0" cellspacing="0">
        <tr>
          <form method="get" action="qvodcms_Card.asp">
            <input type="hidden" name="action" value="search">
            <td width="71" style="color: #990000; text-align:right;">卡号搜索：</td>
            <td width="458"><input name="search_keyword" type="text" style="width:450px; text-align:left" onFocus="if(this.value=='关键字')this.value='';" value="卡号"></td>
            <td width="82"><input type="submit" name="Submit" value="提交搜索" /></td>
          </form>
        </tr>
      </table></td>
      </tr>
  </table>
<!-- --></th>
</tr>
<tr style="text-align:center;">
<td width="32" class="td2">选中</td>
<td width="37" class="td2">ID</td>
<td width="211" class="td2">卡号</td>
<td width="139" class="td2">卡密码</td>
<td width="87"  class="td2">卡状态</td>
<td width="87"  class="td2">卡面值</td>
<td width="188"  class="td2">生成时间</td>
</tr>
<form name='myform' method='Post' action=''>
<%
Set rs = Server.CreateObject("adodb.recordset")
Call Card_sql
rs.Open sql, Conn, 1, 1
If not(rs.bof And rs.eof) Then
	rs.pagesize=Clng(AdminId(19))'每页数据
	rs.AbsolutePage=page
	m=rs.recordcount     '总记录
	n=rs.PageCount       '总页数
	z=rs.pagesize        '每页数量
	i=0
	Do While Not rs.eof and i<rs.pagesize
	i=i+1
%>
<tr bgcolor="#FFFFFF" onMouseOver="javascript:this.bgColor='#ecf5f8'" onMouseOut="javascript:this.bgColor='#FFFFFF'" style="text-align:center;">
  <td >
  <input name='allid' type='checkbox' value='<%=rs("cid")%>' style="border:none">  </td>
  <td ><%=rs("cid")%></td>
  <td style="text-align:left;"><%=rs("cname")%></td>
  <td ><%=Trim(rs("cpass"))%></td>
  <td ><% Call csart()%></td>
  <td ><%=Clng(rs("cvip"))%></td>
  <td ><%=Trim(rs("ctime"))%></td>
  </tr>
<%
	rs.movenext  
	loop 
%>
<tr >
  <td colspan="7" class="td2" style="text-align:left; height:30px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form)' value='checkbox' style="border:none">
      全选
        <input name='submit1' type='submit' value='批量删除' onClick="document.myform.action='?action=delall';">&nbsp;<input name='submit1' type='submit' value='已冲值卡号' onClick="document.myform.action='?x=1';">&nbsp;<input name='submit1' type='submit' value='未冲值卡号' onClick="document.myform.action='?x=0';"></td>
    </tr>
</table></td>
  </tr>
</form> 
<tr> 
<th colspan=7 style="text-align:center; padding:5px;"><%=ShowPage(pagelink&x,m, z, page, True, True, "张", False)%></th>
</tr>
</table>
<%
Else
    Call QvodCms_Err("暂无数据！")
End If
rs.Close:Set rs=nothing:Call CloseConn()
End if
%>
<div style="text-align:center; margin-top:5px; color: #FF0000">页面执行时间：<%=GetRunTime()%>秒</div>
</body>
</html>