<!--#include file="../fy.Function.asp"-->
<!--#include file="../../fy_inc/cls_pageview.asp"-->
<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title>充值卡管理</title>
<link rel="stylesheet" type="text/css" href="../css/base.css">
<link rel="stylesheet" type="text/css" href="../css/content.css">
</head>
<body>
<div class="content"> 
	<div class="breadnav">当前位置：<a href="#">后台首页</a> >> 充值卡管理</div>
    <div class="opers">
 <a href="?">所有充值卡</a> 
<a href="?status=1" class="btn<%If Request("status")="1" Then echo " btn_primary" %>">未使用充值卡</a>
<a href="?status=2" class="btn<%If Request("status")="2" Then echo " btn_primary" %>">已使用充值卡</a> 
<a href="?status=3" class="btn<%If Request("status")="3" Then echo " btn_primary" %>">已失效充值卡</a>
<a href="?status=4" class="btn<%If Request("status")="4" Then echo " btn_primary" %>">未失效充值卡</a> 
<a href="?action=Add" class="btn<%If Request("action")="Add" Then echo " btn_primary" %>">添加充值卡</a> 
<a href="?action=AddMore" class="btn<%If Request("action")="AddMore" Then echo " btn_primary" %>">批量生成充值卡</a> 
    </div>
    
<%ConnectionDatabase
		dim MaxPerPage,RS,TotalPut,TotalPages,I,CurrentPage,SQL,ComeUrl
		  MaxPerPage=20
		ComeUrl=Cstr(Request.ServerVariables("HTTP_REFERER"))
		
		Select Case request("Action")
		 Case "Add","Edit"
		  Call Add()
		 Case  "DoAdd"
		  Call DoAdd()
		 Case "AddMore"
		  Call AddMore()
		 Case "DoAddMore"
		  Call DoAddMore()
		 Case "Del"
		  Call Del()
		 Case Else
		  Call CardList()
		End Select
	
	'点卡列表
	Sub CardList()
		%>
	
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <thead>
      <tr>
      <th>选中</th>
	  <th>充值卡名称</th>
	  <th>充值卡号</th>
	  <th>密码</th>
	  <th>面值</th>
	  <th>点数</th>
	  <th>过期时间</th>
	  <th>出售情况</th>
	  <th>使用情况</th>
	  <th>充值时间</th>
	  <th>使用者</th>
	  <th>操作</th>
	  </tr>
    </thead>
      
	  
 

  <%
  
  
  
  
  	Dim strLocalUrl
	strLocalUrl = request.ServerVariables("SCRIPT_NAME")
	
	Dim intPageNow
	intPageNow = request.QueryString("page")
	
	Dim intPageSize, arrinfo
	intPageSize = 30
	
	Dim  i,strPageInfo
	Dim sql, sqlCount,Sqls,pages
  CurrentPage	= ChkNumeric(request("page"))
  Dim Param:Param=" where 1=1"
  pages ="Status="&ChkNumeric(request("Status"))&"&page"
  Select Case  ChkNumeric(request("Status"))
   Case 1
     Param=Param & " And IsUsed=0"
   Case 2
     Param=Param & " And IsUsed=1"
   Case 3
     Param=Param & " And datediff('d',EndDate,"&NowString&")>0"
   Case 4
     Param=Param & " And datediff('d',EndDate,"&NowString&")<0"
  End Select
  
  	sql = "SELECT ID,CardNum,CardPass,Money,ValidNum,ValidUnit,AddDate,EndDate,UseDate,UserID,IsUsed,IsSale,title" & _
		" FROM [Card_fy]" &Param& _
		" ORDER BY [ID] DESC"
  	sqlCount = "SELECT Count([ID])" & _
			" FROM [Card_fy]"&Param
 			Dim clsRecordInfo
		Set clsRecordInfo = New Cls_PageView
			clsRecordInfo.intRecordCount = 2816
			clsRecordInfo.strSqlCount = sqlCount
			clsRecordInfo.strSql = sql
			clsRecordInfo.intPageSize = intPageSize
			clsRecordInfo.intPageNow = intPageNow
			clsRecordInfo.strPageUrl = strLocalUrl
			clsRecordInfo.strPageVar = pages
		clsRecordInfo.objConn = Conn		
		arrinfo = clsRecordInfo.arrinfo
		strPageInfo = clsRecordInfo.strPageInfo
		Set clsRecordInfo = nothing

 
%>		

<%
  Dim InPoint,OutPoint
 %>
 <form name=selform method=post action=?action=Del>
 <%
If IsArray(arrinfo) Then
			For i = 0 to UBound(arrinfo, 2)
	%>
  <tr height="25"  >
    <td><input type="checkbox" name="id" value="<%=arrinfo(0,i)%>"></td>
    <td><%=arrinfo(12,i)%></td>
    <td><%=arrinfo(1,i)%></td>
    <td><%=arrinfo(2,i)%></td>
    <td><%=arrinfo(3,i)%>元</td>
    <td><%echo arrinfo(4,I)
	if arrinfo(5,I)=1 Then 
	 echo "点" 
	ELSEIf arrinfo(5,I)=2 Then 
	 echo "天" 
	elseif arrinfo(5,I)=3 Then
	 echo "元"
	end if%></td>
    <td><%echo formatdatetime(arrinfo(7,I),2)%></td>
    <td>
	<%
	IF arrinfo(11,I)=1 Then
	 echo "已售出"
	Else
	 echo "<font color=red>未出售</font>" 
	End If
	%></td>
    <td>
	<%
	IF arrinfo(10,I)=1 Then
	 echo "<font color='#a7a7a7'>已使用</font>"
	Else
	 echo "<font color=red>未使用</font>" 
	End If
	%></td>
    <td><%=fycms.UserM(arrinfo(9,I))%></td>
    <td>
	<%if Isdate(arrinfo(8,i)) then
	   echo formatdatetime(arrinfo(8,i),2)
	  end if%></td>
	<td>
	<%if arrinfo(11,I)<>1 and arrinfo(10,I)<>1 then%>
	<a href="?action=Edit&ID=<%=arrinfo(0,i)%>">修改</a> <a href="?action=Del&ID=<%=arrinfo(0,i)%>">删除</a>
	<%end if%>	</td>
  </tr>
  <%Next
	End If
  
  echo "<tr><td class='tl' colspan=12  >"
  echo "&nbsp;&nbsp;<input id=""chkAll"" onClick=""CheckAll(this.form)"" type=""checkbox"" value=""checkbox""  name=""chkAll""><label for=""chkAll"">全选&nbsp;&nbsp;</label><input class=""btn btn_primary"" type=""submit"" name=""Submit2"" value="" 删除选中的充值卡 "" onclick=""{if(confirm('此操作不可逆，确定要删除选中的记录吗?')){this.document.selform.submit();return true;}return false;}"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
   echo "</td></tr>"

 %>



    </table>
    <div class="pagelist">
		<%= strPageInfo%>
   </div>

<% End Sub

 '删除充值卡
 Sub Del()
  Dim ID:ID=Replace(request("ID"),"Card_fy.asp?action=Add","Card_fy.asp?action=Add")
  Conn.Execute("Delete From Card_fy Where ID In(" & ID &") and IsSale=0 and IsUsed=0")
  echo "<script>alert('删除成功！');location.href='" & Request.Servervariables("http_referer") & "';</script>"
 End Sub
		
		'批量添加充值卡
		Sub AddMore()
		%>
		
   <form method='post' action='?' name='myform'>
    <div class="divtable"> 
        <dl>
            <dt>批量生成充值卡</dt>
         </dl>
        
        <dl>
            <dt>充值卡名称：</dt>
            <dd>
               <input name='Title' type='text' class='Ainput'  id='Title' size='20' value="" maxlength='30'>如推销卡等等
             </dd>
         </dl>
        <dl>
            <dt>充值卡数量：</dt>
            <dd>
               <input name='Nums' type='text' class='Ainput'  value='100' size='10' maxlength='10'>
        张
             </dd>
         </dl>
 
        <dl>
            <dt>充值卡号码前缀：</dt>
            <dd>
               <input name='CardNumPrefix' type='text' class='Ainput'  id='CardNumPrefix' value='ACT2007' size='10' maxlength='10'>
             例如：2006,Act2007等固定不变的字母或数字</dd>
         </dl>
 
        <dl>
            <dt>充值卡号码位数：</dt>
            <dd>
               <input name='CardNumLen' type='text' class='Ainput'  id='CardNumLen' value='12' size='10' maxlength='10'>
        <font color='#0000FF'>建议设为10-15位</font> 请输入包含前缀字符在内的总位数  建议设为10-15位
             </dd>
         </dl>
 
        <dl>
            <dt>充值卡密码位数：</dt>
            <dd>
               <input name='PasswordLen' type='text' class='Ainput'  id='PasswordLen' value='6' size='10' maxlength='10'>
        <font color='#0000FF'>建议设为6-10位</font>
             </dd>
         </dl>
 
        <dl>
            <dt>卡密码构成方式：</dt>
            <dd>
              <input type="radio" name="zhtype" value="1" checked>纯数字 <input type="radio" name="zhtype" value="2">数字与字母随机组合 
             </dd>
         </dl>
 
        <dl>
            <dt>充值卡面值：</dt>
            <dd>
               <input name='Money' type='text' class='Ainput'  id='Money' value='50' size='10'>
      元 即购买人需要花费的实际金额
             </dd>
         </dl>
 
        <dl>
            <dt>充值卡点数、资金或有效期：</dt>
            <dd>
               <input name='ValidNum' type='text' class='Ainput'  id='ValidNum' value='50' size='10' maxlength='10'>
        <select name='ValidUnit' id='ValidUnit'>
               <option value='1' selected>点</option>
          <option value='2'>天</option>
          <option value='3'>元</option>
          <option value='4'>积分</option>
        </select>
             </dd>
         </dl>
 
        <dl>
            <dt>允许使用此充值卡的用户组：</dt>
            <dd>
               <%= fycms.GetGroup_CheckBox("allgroupid","",5)  %>  不限制请留空或全部选中。
             </dd>
         </dl>
 
        <dl>
            <dt>充值后自动归入的用户组：</dt>
            <dd>
                 <select name="grGroupID" id="grGroupID">
 	  <%= fycms.GetGroup_select("")  %>	
      </select>
             </dd>
         </dl>
 
        <dl>
            <dt>到期后自动归入的用户组：</dt>
            <dd>
                  <select name="ExpireGroupID" id="ExpireGroupID">
	  <%= fycms.GetGroup_select("")  %>	
      </select>  指用户选择充值卡为账户充值后,当账户里的点券,有效天数或资金用完后(具体根据该卡是点券卡,有数天数卡或资金卡而定)。将过期的用户自动归入低一级的用户级别。
             </dd>
         </dl>
 
        <dl>
            <dt>充值截止期限：</dt>
            <dd>
               <input name='EndDate' type='text' class='Ainput'  id='EndDate' value='<%=now+365%>' size='10' maxlength='10'>购买人必须在此日期前进行充值，否则自动失效
             </dd>
         </dl>
 
 
            <dl>
            <dt class="vhid">提交：</dt>
            <dd>
			<input name='Action' type='hidden' id='Action' value='DoAddMore'> 
        <input  class="btn btn_primary" type='submit' name='Submit' value=' 开始生成 ' style='cursor:hand;'> 
        &nbsp; <input class="btn " name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick="window.location.href='?'" style='cursor:hand;'>



            </dd>
         </dl>
        
    </div>
    </form>






 
		<%
		End Sub	
		'添加充值卡
		Sub Add()
		  Dim CardNum,PassWord,IsSale,IsUsed,Money,ValidNum,ValidUnit,EndDate,action1,allgroupid,Title,grGroupID,ExpireGroupID
		  Dim ID:ID=ChkNumeric(request("ID"))
		  if request("action")="Edit" then
		    Dim RS:Set RS=Server.CreateObject("adodb.recordset")
			rs.open "select * from Card_fy where ID=" & ID,conn,1,1
			if rs.bof and rs.eof then
			  rs.close:set rs=nothing
			  Call fycms.Alert("参数传递出错！","Card_fy.asp?action=Add")
			  Exit sub
			end if
			CardNum=rs("CardNum")
			PassWord=rs("CardPass")
			Money=rs("money")
			ValidNum=rs("ValidNum")
			ValidUnit=rs("ValidUnit")
			EndDate=rs("EndDate")
			IsSale=rs("IsSale")
			IsUsed=rs("IsUsed")
			Title=rs("Title")
			allgroupid=rs("allgroupid")
			grGroupID=rs("grGroupID")
			ExpireGroupID=rs("ExpireGroupID")
			action1="Edit"
			
		  else
		   IsSale=0:IsUsed=0:Money=50:ValidNum=50:ValidUnit=1:EndDate=Now+365
		  end if
		%>

		<form method='post' action='?action1=<%=action1%>&id=<%=ID%>' name='myform'>
    <div class="divtable"> 
        <dl>
            <dt>充值卡名称：</dt>
            <dd>
               <input name='Title' type='text' class='Ainput'  id='Title' size='20' value="<%=Title%>" maxlength='30'>如推销卡等等   
            </dd>
         </dl>
        
        <dl  <%if request("action")="Edit" Then echo " style='display:none'"%>>
            <dt>添加方式：</dt>
            <dd>
               <input name='AddType' type='radio' value='0' checked onClick="trSingle1.style.display='';trSingle2.style.display='';trBatch.style.display='none';"> 单张充值卡&nbsp;&nbsp;&nbsp;&nbsp;<input name='AddType' type='radio' value='1' onClick="trSingle1.style.display='none';trSingle2.style.display='none';trBatch.style.display='';">批量添加充值卡
             </dd>
         </dl>
       <dl id='trSingle1'>
            <dt>充值卡卡号：</dt>
            <dd>
               <input name='CardNum' type='text' class='Ainput'  id='CardNum' size='20' value="<%=CardNum%>" maxlength='30'>
        <font color='#0000FF'>建议设为10-15位</font>
             </dd>
         </dl>
       <dl id='trSingle2'>
            <dt>充值卡密码：</dt>
            <dd>
               <input name='Password' type='text' class='Ainput'  id='Password' size='20' value="<%=PassWord%>" maxlength='30'>
        <font color='#0000FF'>建议设为6-10位 </font>
             </dd>
         </dl>
       <dl id='trBatch' style='display:none'>
             <dd>
               <b>格式文本：</b><br><font color='red'>请按照每行一张卡，每张卡按“卡号＋分隔符＋密码”的格式录入</font><br>
      例：734534759|Actf15f4ag5te（以“|”作为分隔符）</td>
      <td><textarea name='CardList' rows='10' cols='50'></textarea>
             </dd>
         </dl>
       <dl>
            <dt>充值卡面值：</dt>
            <dd>
                即购买人需要花费的实际金额</td>
      <td width='60%'><input name='Money' type='text' class='Ainput'  id='Money' value='<%=Money%>' size='10'>
      元
             </dd>
         </dl>
       <dl>
            <dt>充值卡点数、资金或有效期：</dt>
            <dd>
              <input name='ValidNum' value="<%=ValidNum%>" type='text' class='Ainput'  id='ValidNum'  size='10' maxlength='10'>
        <select name='ValidUnit' id='ValidUnit'>
          <option value='1' <%if ValidUnit="1" then echo " selected"%>>点</option>
          <option value='2' <%if ValidUnit="2" then echo " selected"%>>天</option>
          <option value='3' <%if ValidUnit="3" then echo " selected"%>>元</option>
          <option value='4' <%if ValidUnit="4" then echo " selected"%>>积分</option>
        </select>购买人可以得到的点数、资金或有效期
             </dd>
         </dl>
       <dl>
            <dt>充值截止期限：</dt>
            <dd>
               <input name='EndDate' type='text' class='Ainput'  id='EndDate' value='<%=EndDate%>' size='10' maxlength='10'> 购买人必须在此日期前进行充值，否则自动失效
             </dd>
         </dl>
  <dl>
            <dt>允许使用此充值卡的用户组：</dt>
            <dd>
               <%= fycms.GetGroup_CheckBox("allgroupid",allgroupid,5)  %>  不限制请留空或全部选中。
             </dd>
         </dl>
  <dl>
            <dt>充值后自动归入的用户组：</dt>
            <dd>
                 <select name="grGroupID" id="grGroupID">
 	  <%= fycms.GetGroup_select(grGroupID)  %>	
      </select>
      
             </dd>
         </dl>
  <dl>
            <dt>到期后自动归入的用户组：</dt>
            <dd>
                <select name="ExpireGroupID" id="ExpireGroupID">
	  <%= fycms.GetGroup_select(ExpireGroupID)  %>	
      </select>   指用户选择充值卡为账户充值后,当账户里的点券,有效天数或资金用完后(具体根据该卡是点券卡,有数天数卡或资金卡而定)。将过期的用户自动归入低一级的用户级别。
             </dd>
         </dl>
   <dl>
            <dt>是否出售：</dt>
            <dd>
               <input name='issale' type='radio' id='issale' value='0'<%if issale=0 then echo " checked"%>>未出售 <input name='issale' type='radio' id='issale' value='1'<%if issale=1 then echo " checked"%>>已出售   添加新充值卡，请选项未出售
             </dd>
         </dl>
  <dl>
            <dt>是否使用：</dt>
            <dd>
               <input name='isused' type='radio' id='isused' value='0'<%if isused=0 then echo " checked"%>>未使用 <input name='isused' type='radio' id='isused' value='1'<%if isused=1 then echo " checked"%>>已使用 添加新充值卡，请选项未使用
             </dd>
         </dl>
 

            <dl>
            <dt class="vhid">提交：</dt>
            <dd>

<input name='Action' type='hidden' id='Action' value='DoAdd'> 
        <input class="btn btn_primary" type='submit' name='Submit' value=' <% if request("action")="Edit" then echo "确定修改" Else echo "开始生成" %> ' style='cursor:hand;'> 
        &nbsp; <input class="btn"  name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick="window.location.href='?'" style='cursor:hand;'>


            </dd>
         </dl>
        
    </div>
    </form>



 

<%
		End Sub
		
		'开始生成充值卡
		Sub DoAdd()
		 Dim AddType:AddType=request("AddType")
		 Dim CardNum:CardNum=RSQL(request("CardNum"))
		 Dim Password:Password=request("Password")
		 Dim CardList:CardList=request("CardList")
		 Dim Money:Money=ChkNumeric(request("Money"))
		 Dim ValidNum:ValidNum=ChkNumeric(request("ValidNum"))
		 Dim ValidUnit:ValidUnit=request("ValidUnit")
		 Dim EndDate:EndDate=request("EndDate")
		 Dim IsUsed:IsUsed=request("IsUsed")
		 Dim ISSale:IsSale=ChkNumeric(request("IsSale"))
		 Dim title:title=request("title")
		 
		 Dim allgroupid:allgroupid=request("allgroupid")
		 Dim grGroupID:grGroupID=ChkNumeric(request("grGroupID"))
		 Dim ExpireGroupID:ExpireGroupID=ChkNumeric(request("ExpireGroupID"))
	 
		 
 		 IF Money=0 Then Call fycms.Alert("充值卡面值，必须大于0","Card_fy.asp?action=Add"):exit sub
		 IF ValidNum=0 Then Call fycms.Alert("充值卡点数，必须大于0","Card_fy.asp?action=Add"):exit sub
		 If Not IsDate(EndDate) Then Call fycms.Alert("充值截止期限格式不正确!","Card_fy.asp?action=Add"):exit sub
          If AddType=0 or request("action1")="Edit" then
		    if CardNum="" then call fycms.Alert("你没有输入充值卡号!","Card_fy.asp?action=Add"):exit sub
			if PassWord=" "then call fycms.Alert("你没有输入充值卡密码","Card_fy.asp?action=Add"):exit sub
			
			   Dim RS:Set RS=Server.CreateObject("adodb.recordset")
			    if request("action1")="Edit" then
				 rs.open "select * from Card_fy where id=" & ChkNumeric(request("id")),conn,1,3
				else
					if not conn.execute("select cardnum from Card_fy where cardnum='" & cardnum & "'").eof then
					  call fycms.Alert("你输入的充值卡号已存在，请重输!","Card_fy.asp?action=Add"):exit sub
					end if
				   rs.open "select * from Card_fy",conn,1,3
				   rs.addnew
				   rs("AddDate")=now
			   end if
				 rs("cardnum")=CardNum
				 rs("cardpass")=PassWord
				 rs("money")=money
				 rs("ValidNum")=ValidNum
				 rs("ValidUnit")=ValidUnit
				 rs("enddate")=EndDate
				 rs("isused")=isused
				 rs("isSale")=isSale
				 rs("title")=title
				 rs("allgroupid")=allgroupid
				 rs("grGroupID")=grGroupID
				 rs("ExpireGroupID")=ExpireGroupID
 			   rs.update
			   rs.close:set rs=nothing
		  else 
		    if CardList="" then call fycms.Alert("你没有输入充值卡号!","Card_fy.asp?action=Add"):exit sub
			Dim i,j,CardAndPass,CardArr:CardArr=Split(CardList,vbcrlf)
			For I=0 to Ubound(CardArr)
			   CardAndPass=Split(CardArr(I),"|")
			   if not conn.execute("select cardnum from Card_fy where cardnum='" & CardAndPass(0) & "'").eof then
					 call fycms.Alert("你输入的充值卡号已存在，请重输!","Card_fy.asp?action=Add"):exit sub
			   else
				   Set RS=Server.CreateObject("adodb.recordset")
				   rs.open "select * from Card_fy",conn,1,3
				   rs.addnew
					 rs("cardnum")=CardAndPass(0)
					 rs("cardpass")=CardAndPass(1)
					 rs("money")=money
					 rs("ValidNum")=ValidNum
					 rs("ValidUnit")=ValidUnit
					 rs("AddDate")=now
					 rs("enddate")=EndDate
					 rs("isused")=isused
					 rs("isSale")=issale
					 rs("title")=title
				 rs("allgroupid")=allgroupid
				 rs("grGroupID")=grGroupID
				 rs("ExpireGroupID")=ExpireGroupID
				   rs.update
				   rs.close:set rs=nothing
			  end if
			Next
		  end if
		  if request("action1")="Edit" then
			   echo "<script>alert('修改充值卡成功！');location.href='?';</script>"
		  else
			   echo "<script>alert('添加充值卡成功！');location.href='?';</script>"
		  end if
		End Sub
		'批量生成充值卡操作
		Sub DoAddMore()
		 Dim Nums:Nums=ChkNumeric(request("Nums"))
		 Dim CardNumPrefix:CardNumPrefix=request("CardNumPrefix")
		 Dim CardNumLen:CardNumLen=ChkNumeric(request("CardNumLen"))
		 Dim PasswordLen:PasswordLen=ChkNumeric(request("PasswordLen"))
		 Dim zhtype:zhtype=request("zhtype")
		 Dim Money:Money=ChkNumeric(request("money"))
		 Dim ValidNum:ValidNum=ChkNumeric(request("ValidNum"))
		 Dim ValidUnit:ValidUnit=request("ValidUnit")
		 Dim EndDate:EndDate=request("EndDate")
		 Dim title:title=request("title")
		 Dim allgroupid:allgroupid=request("allgroupid")
		 Dim grGroupID:grGroupID=ChkNumeric(request("grGroupID"))
		 Dim ExpireGroupID:ExpireGroupID=ChkNumeric(request("ExpireGroupID"))
		 
		 IF Nums=0 Then Call fycms.Alert("生成充值卡数量，必须大于0","Card_fy.asp?action=Add"):exit sub
		 IF CardNumLen=0 Then Call fycms.Alert("充值卡号码长度，必须大于0","Card_fy.asp?action=Add"):exit sub
		 IF PasswordLen=0 Then Call fycms.Alert("充值卡密码长度，必须大于0","Card_fy.asp?action=Add"):exit sub
		 IF Money=0 Then Call fycms.Alert("充值卡面值，必须大于0","Card_fy.asp?action=Add"):exit sub
		 IF ValidNum=0 Then Call fycms.Alert("充值卡点数，必须大于0","Card_fy.asp?action=Add"):exit sub
		 If Not IsDate(EndDate) Then Call fycms.Alert("充值截止期限格式不正确!","Card_fy.asp?action=Add"):exit sub
		 %>
		 		  
				   
				   <br>
			  <table width='300'  border='0' align='center' cellpadding='2' cellspacing='1' class='table'>
				<tr  class="bg_tr">
				  <td colspan='2' align='center'><strong>本次生成的点卡信息如下：</strong></td>
				</tr>
				<tr >
				  <td width='100'>充值卡数量：</td>
				  <td><%=nums%> 张</td>
				</tr>
				<tr >
				  <td width='100'>充值卡面值：</td>
				  <td><%=money%> 元</td>
				</tr>
				<tr >
				  <td width='100'>
				  <% select case ValidUnit
					case 1:echo "充值卡点数："
					case 2:echo "充值卡有效天数："
					case 3:echo "充值卡金额："
					end select
					%></td>
				  <td>
				  <% echo ValidNum
				  select case validunit
				   case 1:echo " 点"
				   case 2:echo " 天"
				   case 3:echo " 元"
				  end select
				  %>
			      </td>
				</tr>
				<tr >
				  <td width='100'>充值截止日期：</td>
				  <td><%=enddate%></td>
				</tr>
				
</table>
			<br>
			<table width='300' border='0' align='center' cellpadding='2' cellspacing='1' class="table">
		  <tr align='center' class="bg_tr">
			<td  width=150 height='22'><strong> 卡 号 </strong></td>
			<td  width=150 height='22'><strong> 密 码 </strong></td>
		  </tr>
		 <%
		 Dim n,currcard,CurrCardPass
		 For N=1 To Nums
		   CurrCard=fycms.MakeRandom(CardNumLen-len(CardNumPrefix))
		   CurrCard=CardNumPrefix & CurrCard
		   If ZhType=2 then
		     CurrCardPass=fycms.GetRandomize(PasswordLen)
		   Else
		     CurrCardPass=fycms.MakeRandom(PasswordLen)
		   End If
		   Do While not Conn.execute("select CardNum From Card_fy Where CardNum='" & CurrCard & "'").eof 
			   CurrCard=fycms.MakeRandom(CardNumLen-len(CardNumPrefix))
			   CurrCard=CardNumPrefix & CurrCard
		   loop
		   
		   echo "<tr align='center' >" & vbcrlf
		   echo "<td height='22'>" & CurrCard & "</td>" & vbcrlf
		   echo "<td>" & CurrCardPass & "</td>" & vbcrlf
		   echo "</tr>" & vbcrlf
		   Dim RS:Set RS=Server.CreateObject("adodb.recordset")
		   rs.open "select * from Card_fy",conn,1,3
		   rs.addnew
		     rs("cardnum")=CurrCard
			 rs("cardpass")=CurrCardPass
			 rs("money")=money
			 rs("ValidNum")=ValidNum
			 rs("ValidUnit")=ValidUnit
			 rs("AddDate")=now
			 rs("enddate")=EndDate
			 rs("isused")=0
			 rs("isSale")=0
			 rs("title")=title
				 rs("allgroupid")=allgroupid
				 rs("grGroupID")=grGroupID
				 rs("ExpireGroupID")=ExpireGroupID
		   rs.update
		   rs.close:set rs=nothing
		   %>
		   
		   <%
		 Next
		 		   echo "</table>"

		End SUb	
 		  
%> 
<script language="javascript">

function CheckAll(form)
		  {  
		 for (var i=0;i<form.elements.length;i++)  
			{  
			   var e = selform.elements[i];  
			   if (e.name != 'chkAll'&&e.type=="checkbox")  
			   e.checked = selform.chkAll.checked;  
		   }  
	  }function overColor(Obj)
{
	var elements=Obj.childNodes;
	for(var i=0;i<elements.length;i++)
	{
		elements[i].className="tdbg1"
		Obj.bgColor="";
	}
	
}
function outColor(Obj)
{
	var elements=Obj.childNodes;
	for(var i=0;i<elements.length;i++)
	{
		elements[i].className="tdbg";
		Obj.bgColor="";
	}
}
function overColor(Obj)
{
	var elements=Obj.childNodes;
	for(var i=0;i<elements.length;i++)
	{
		elements[i].className="tdbg1"
		Obj.bgColor="";
	}
	
}
</script>


</div>
</body>
</html>
