<!--#include file="tgzcm_Conn.asp"-->
<!--#include file="tgzcm_Check.asp"-->
<!--#include file="../tgzcm.Cache/tgzcm.Admin.asp"-->
<!--#include file="../tgzcm.Cache/tgzcm.Html.asp"-->
<%
Dim action,class_id,class_bigid,server_id,shuxin_id,search_type,search_class,search_keyword,pagelink,order,startime,endtime, ListUrl,DataUrl
tgzcmPath = left(tgzcmpath,instrrev(tgzcmpath, "/")-1)'获取安装目录
tgzcmPath = left(tgzcmpath,instrrev(tgzcmpath, "/"))'获取安装目录
startime=Timer():sql="":S1="":S2="":S3=""
allid=tgzcm_replace(Trim(Request.Form("allid")))'批量ID
action=Trim(Request.QueryString("action"))
search_keyword=Trim(Request.QueryString("search_keyword"))'搜索关键字
page=PE_CLng(Request.QueryString("page")):If page<=0 or page="" Then page=1'初始化分页参数
Sub Product_sql'作用：处理SQL查询语句   
    If action="search" Then
		 If tgzcm(4)="SQL" Then
		 sql="and pname like '%"&search_keyword&"%'"
		 Else'启用InStr,LCase函数过滤小日本
		 sql="and InStr(1,LCase(pname),LCase('"&search_keyword&"'),0)<>0"
		 End If
		 pagelink="tgzcm_product.asp?Action=search&search_type="&search_type&"&search_keyword="&search_keyword&"&" '分页路径
	Else
	    sql=""	   
	End If
	pagelink="tgzcm_product.asp"'分页路径
	sql = "Select * from tgzcm_product where pid>0 "&sql&" order by pid desc"
End Sub

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

Sub Pros()'验证数量
   if rs("pj")=rs("ps") Then
    Response.Write "0"
   Else
    Response.Write rs("pj")-rs("ps")
   End If	
End Sub

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

Sub card_delall()
 conn.execute(" delete from tgzcm_product where pid in("&allid&")  ")'删除影片
End Sub
%>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<TITLE>产品管理页面</TITLE>
<link href="skins/css/tgzcm_main.css" rel="stylesheet" type="text/css" />
<script language = "javaScript" src = "tgzcm_All.js" type="text/javascript"></script>
</head>
<body>


<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> 
<th colspan=8 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="tgzcm_Product.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="94"  class="td2">添加时间</td>
<td width="94"  class="td2">常规操作</td>
</tr>
<form name='myform' method='Post' action=''>
<%
Set rs = Server.CreateObject("adodb.recordset")
Call Product_sql
rs.Open sql, Conn, 1, 1
If not(rs.bof And rs.eof) Then
	rs.pagesize=tgzcmId(9)'每页数据
	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='#E3E1D7'" onMouseOut="javascript:this.bgColor='#FFFFFF'" style="text-align:center;">
  <td >
  <input name='allid' type='checkbox' value='<%=rs("pid")%>' style="border:none">  </td>
  <td ><%=rs("pid")%></td>
  <td style="text-align:left;"><%Call GetProductLinkPath(rs("pid"))%><a href="<%=DataUrl%>" target="_blank"><%=GetColor(left(rs("pname"),50),rs("pcolor"))%></a></td>
  <td ><%=Trim(rs("pjf"))%></td>
  <td ><%=rs("pj")%></td>
  <td ><% Call Pros()%></td>
  <td ><%=formatdatetime(rs("ptime"),2)%></td>
  <td ><a href="tgzcm_Product_edit.asp?pid=<%=rs("pid")%>">修改</a> <a href="tgzcm_Product_save.asp?action=del&pid=<%=rs("pid")%>" onClick="return confirm('删除后将不能恢复,确定要删除吗?');">删除</a></td>
</tr>
<%
	rs.movenext  
	loop 
%>
<tr >
  <td colspan="8" 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;</td>
    </tr>
</table></td>
  </tr>
</form> 
<tr> 
<th colspan=8 style="text-align:center; padding:5px;"><%=ShowPage(pagelink&Product,m, z, page, True, True, "个", False)%></th>
</tr>
</table>
<%
Else
    Call tgzcm_err_c("暂无数据！")
End If
rs.Close
Set rs=nothing
endtime=timer()
%>
<div style="text-align:center; margin-top:5px; color: #0066FF">页面执行时间：<%=FormatNumber((endtime-startime)*1000,3)%> 毫秒</div>
</body>
</html>