<?php
/*
'**************************************************************************************************
' 软件名称: 盘锦DJ舞曲网CMS Content Management PjRen.Net
' 版本编号: Version 2.5
' 盘锦舞曲: http://www.pj57.com
' 官方网站: http://www.pjren.net
' 小说网站: http://www.hx39.com
' 0427DJ网: http://www.0427dj.net
' 官方论坛: http://www.tianjiazhen.com
' 版权所有: 盘锦舞曲开发团队    盘锦人(QQ:814006710)
' 郑重声明:
'    1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；
'    2、盘锦网络事业部保留此软件的法律追究权利
'**************************************************************************************************
*/
include "../../include/conn.php";
include "../../include/function.php";
include "../admin_loginstate.php";
include "../admin_version.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>定单管理</title>
<link  href="../images/style.css" rel="stylesheet" type="text/css" />
<link href="../images/alerts.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript">var tentpath='<?php echo S_SitePath?>';</script>
<script src="../js/jquery.js"></script>
<script src="../js/alerts.js"></script>
<script language="javascript">
$(document).ready(function(){
$("#ChkAll").click(function(){
		if($(this).attr("checked")==true){
			$("input[name='S_ID[]']").each(function(){
				$(this).attr("checked",true);									 
			})							
		}else{
			$("input[name='S_ID[]']").each(function(){
				$(this).attr("checked",false);									 
			})							
		}
});


$("#submit11").click(function(){
	var S_Name=$("#SearchStr").val();
	$("#SearchStr").css("border-color","#666 #ccc #ccc #666");
	if(S_Name==""){
		$("#SearchStr").css("border","1px solid red");
		return false;
		}
	})

})
function turnback(){
	window.history.go(-1);
	};
function del(id){
	jConfirm('您确定要删除吗?', '操作提示', function(r) {
		if(r==true){
			window.location='?action=del&S_ID='+id;
			}
				});
};
function delall(){
	jConfirm('您确定要执行操作吗?', '操作提示', function(r) {
		if(r==true){form2.submit();}
		});
};
function isEmail(str){
 res = /^[0-9a-zA-Z_\-\.]+@[0-9a-zA-Z_\-]+(\.[0-9a-zA-Z_\-]+)*$/;
 var re = new RegExp(res);
 return !(str.match(re) == null);
};
function isID(str){
	res = /^(?!_)(?!.*?_$)[a-zA-Z0-9\u4e00-\u9fa5]+$/;
	var re = new RegExp(res);
	return !(str.match(re) == null);
};
function len(s) {
	var l = 0;
	var a = s.split("");
	for (var i=0;i<a.length;i++) {
	if (a[i].charCodeAt(0)<299) {
		l++;
		}
	else{
   l+=2;
		}
	}
	return l;
}
</script>

</head>
<body>
<?php
SystemPer(9);
$ac=SafeRequest("action","get");
if($ac=="del"){return Del();}
if($ac=="delall"){ return DelAll();}
if($ac==""){
               $sql="select * from s_pay Order by S_ID asc";
}elseif($ac=="cg"){
               $sql="select * from s_pay where S_Vid=1 Order by S_ID asc";
}elseif($ac=="sb"){
               $sql="select * from s_pay where S_Vid=0 Order by S_ID asc";
}
		global $db;
		$Arr=getpagerow($sql,30);//sql,每页显示条数
		$result=$db->query($Arr[2]);
		$action=SafeRequest("action","get");
?>
	<table class="tb_style" width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
        <td colspan="10" class="td_title">&nbsp;&nbsp;充值定单管理&nbsp;&nbsp;<a href="?action=sb">失败定单</a>&nbsp;&nbsp;<a href="?action=cg">成功定单</a></td>
	</tr>
<form action="?action=delall" method="post" name="form2">
	<tr>
        <td height="30" bgcolor="#FFFFFF" class="td_btop3" width="7%">&nbsp;编号</td>
        <td  height="30" bgcolor="#FFFFFF" class="td_btop3" align="center" width="27%">定单号</td>
        <td  height="30" bgcolor="#FFFFFF" class="td_btop3" align="center" width="14%">会员</td>
        <td  height="30" bgcolor="#FFFFFF" class="td_btop3" align="center" width="14%">金额</td>
        <td  height="30" bgcolor="#FFFFFF" class="td_btop3" align="center" width="10%">状态</td>
        <td  height="30" bgcolor="#FFFFFF" class="td_btop3" align="center" width="20%">时间</td> 
        <td width="25%"  height="30" align="center" bgcolor="#FFFFFF" class="td_btop3">操作</td>
	</tr>
<?php
$numdate="a";
if($result){
	while ($row = $db ->fetch_array($result)){
		$numdate="b";
?>
        <tr>
        <td height="30" class="td_border">
        <input type="checkbox" value="<?php echo $row["S_ID"]?>" name="S_ID[]" class="checkbox"/><?php echo $row["S_ID"]?>.</td>
        <td height="30" class="td_border"><?php echo $row["S_Payid"]?></td>
        <td height="30" align="center" class="td_border"><?php echo $row["S_Payuser"]?></td>
        <td height="30" align="center" class="td_border">￥<?php echo $row["S_Payrmb"]?>.00</td>
        <td height="30" class="td_border" align="center">
<?php 
if($row["S_Vid"]==0){
?>
<font color="#ff0000">失败</font>
<?php
}else{
?>
<font color="#0000ff">成功</font>
<?php
}
?></td>
        <td height="30" class="td_border" align="center"><?php echo $row["S_Paytime"]?></td>
        <td height="30" class="td_border" align="center"><a style="cursor:pointer;" onclick="del(<?php echo $row["S_ID"]?>)">删除</a></td>
    </tr>
<?php
	}
}
if($numdate=="a"){
		echo("<tr><td height='30' align='center' class='td_border' colspan='10'><b>暂无定单！</b></td></tr>");
}
?>
        <tr>
    <td colspan="6" style="padding-top:5px; padding-bottom:5px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td class="td_border">
            &nbsp;<input type="checkbox" name="ChkAll" id="ChkAll" ids="S_ID" class="checkbox"/>
    全选&nbsp;&nbsp; <input type="button" value="删除所选定单" class="rb1" onclick="delall()"/></td>
          </tr>
        <tr>
          <td height="40" align="right" >
            <?php echo $Arr[0];?>
          </tr> 
      </table></td>
    </tr>
    </form>
</table>
<?php
function Del(){
	global $db;
	$S_ID = SafeRequest("S_ID","get");
	$sql="delete from s_pay where S_ID=".$S_ID;
	if($db->query($sql)){
		die("<script>window.location='admin_pay.php'</script>");
		}
	else{
		die("<script>jAlert('删除失败!','操作提示',function(R){history.back();})</script>");
		}
}

function DelAll(){
	global $db;
	$S_ID=RequestBox("S_ID");
	$S_ID=explode(",",$S_ID);
	for($i=0;$i<count($S_ID);$i++){
		$sql="delete from s_pay where S_ID=".$S_ID[$i];
		$db->query($sql);
		}
	die("<script>window.location='admin_pay.php'</script>");
}
?>
<div class="bottom">
<?php

include "../admin_bottom.php";
?>
 
</div>
</body>
</html>

