<?php
	!defined('DIRCMS_MANAGE') && exit('Access Denied!');
?>
<!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>
<title>交易记录</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" type="text/css" href="admin/template/css/style.css" />
<script type="text/javascript" src="images/js/jquery.min.js"></script>
<script type="text/javascript" src="admin/template/js/admin.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
	$("#field").val('<?php echo isset($field)?$field:'username';?>');
	$("#type").val('<?php echo isset($type)?$type:'';?>');
});
</script>
</head>
<body>
<div id="wrap">
	<div class="tab">
		<ul>
			<li><a href="javascript:void(0);" class="on">交易记录</a></li>		
		</ul>
	</div>
	<div class="main">
		<div class="search">
			<form action="?" method="get" name="search">
			<input type="hidden" name="file" value="<?php echo $file;?>"> 
			<input type="hidden" name="action" value="<?php echo $action;?>"> 
				<fieldset>
					<legend>记录查找</legend>
						搜索条件：
						<select name="field" id="field">
							<option value="username">会员名</option>
							<option value="inputer">操作员</option>
						</select>
						&nbsp;
						<select name="type" id="type">
							<option value=''>交易类型</option>
							<option value='amount'>资金</option>
							<option value='point'>点数</option>
						</select>
						&nbsp;&nbsp;
						会员名：
						<input type="text" name="k" size="35" value="<?php echo $k?htmlspecialchars(stripslashes($k)):'';?>" />
						<input type="submit" class="button" value="开始查找" />
				</fieldset>
			</form>
		</div>
		<table cellspacing="0" class="datalist" id="list">
		<tr>
			<th width="6%" class="firstcol">选中</th>
			<th width="10%">会员</th>
			<th width="6%">类型</th>
            <th width="10%">数量</th> 
			<th width="11%">余额</th>
            <th width="9%">操作员</th>
			<th width="20%">交易时间</th>
			<th width="11%">交易IP</th>
			<th width="17%">说明</th>  
		</tr>
		<form action="" method="post" name="myform">
		<input type="hidden" name="do_submit" value="1" />
		<?php if($result){foreach($result as $val){?>
		<tr>
			<td align="center"><input type="checkbox" class="checkbox" name="id[]" value="<?php echo $val['id'];?>" /></td>
            <td align="center" style="padding-left:5px"><?php echo $val['username'];?></td>
            <td align="center">
			<?php 
				if($val['type']=='point')
				{
					echo $val['number']>0?'<font color="#FF3300">充点</font>':'<font color="#0000FF">扣点</font>';
				}
				else
				{
					echo $val['number']>0?'<font color="#FF3300">入款</font>':'<font color="#0000FF">扣款</font>';
				}
			?>
			</td>
			<td align="center"><?php echo $val['number'];?> <?php echo $val['type']=='point'?'点':'元';?></td>
            <td align="center"><?php echo $val['blance'];?> <?php echo $val['type']=='point'?'点':'元';?></span></td>
			<td align="center"><?php echo $val['inputer']?$val['inputer']:'系统';?></td>
            <td align="center"><?php echo date('Y-m-d H:i:s',$val['time']);?></td>
			<td align="center"><?php echo $val['ip'];?></td>
            <td align="left" style="padding:5px"><?php echo $val['note'];?></td>
		</tr>
		<?php }?>
		<tr>
			<td width="6%" align="center">
			<input type="checkbox" name="chkall2" value="1" class="checkbox" onclick="check_all(this)" /></td>
			<td colspan="8" align="left">
			<input type="button" onfocus="blur();" class="button" onclick="if(confirm('确实要删除所选交易记录?删除后不可恢复!')){this.form.action='?file=<?php echo $file;?>&action=delete';this.form.submit();}"  value="删除记录" />
			</td>
		</tr>
		</form>
		<?php }else{?>
		<tr><td colspan="9">目前尚未发现交易记录...</td></tr>	
		<?php }?>
		<tr>
			<td colspan="9"><?php echo $pages;?></td>
		</tr>
		</table>
	</div>
</div>
</body>
</html>