<?php 
if(!isset($_SESSION['admin_name'])){
   exit; 
}
?>
<div style="text-align: center;">
<br>
<p style="padding-bottom:9px;font-size: 20px;font-weight: bold;color:#6A6A6A;">
财务明细
</p>
<div class="guanli">
<form action="tixian/del_caiwu_mingxi.php" method="get">
<table style="width:1020px;margin:0 auto;" cellspacing="0">
<tr style="background: #009999;height: 30px;">
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 1px;color: #fff;">全选</td>
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 0px; color: #fff;">ID</td>
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 0px; color: #fff;">ip地址</td>
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 0px; color: #fff;">ip地名</td>
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 0px;color: #fff;">单价</td>
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 0px;color: #fff;">用户名称</td>
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 0px;color: #fff;">时间</td>
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 0px;color: #fff;">删除</td>
</tr>
<?php
$length=10;
$totsql="select count(*) from user_mingxi";
$totrst=mysql_query($totsql);
$totarr=mysql_fetch_row($totrst);
//总页数
$totpage=ceil($totarr[0]/$length);
//当前页
$pagenum=@$_GET['page']?@$_GET['page']:1;
//限制最大页数
if($pagenum>=$totpage){$pagenum=$totpage;}
//offset算法
$offset=($pagenum-1)*$length;
$zhuan_sql="select user_mingxi.*,user.username from user_mingxi left join user on user_mingxi.uid=user.id order by id desc limit {$offset},{$length}";
$zhuan_rst=mysql_query($zhuan_sql);
$biaoti=10;

while($zhuan_row=@mysql_fetch_assoc($zhuan_rst)){
    echo "<tr align='center' style='height:50px;background:#FAFFFF;'>"; 
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 1px;'><input type='checkbox' name='checkbox[]' class='checkall' value='{$zhuan_row['id']}'/></td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'>{$zhuan_row['id']}</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'>{$zhuan_row['ip']}</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'>{$zhuan_row['dizhi']}</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'><span style='color:red;'>{$zhuan_row['jiage']}</span>元</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'>{$zhuan_row['username']}</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'>".date("Y/m/d H:i:s",$zhuan_row['time'])."</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'><a href='tixian/del_caiwu_mingxi.php?id={$zhuan_row['id']}&hid=1' onclick=\"c=confirm('确定删除吗？');if(!c){return false;}\"><img style='border:0px;' src='image/shan.png'></a></td>";
    echo "</tr>";
    
}

$prevpage=$pagenum-1;
$nextpage=$pagenum+1;

?> 
</table>
<input type="hidden" name="hid" value="2"/>
<p><input style="margin:20px 0px 0px 0px;" type="checkbox" name="all" onclick="check_all(this,'checkbox[]')" />
<span >全选</span>&nbsp;<input onclick="var b=confirm('确定要删除吗？');if(!b){return false;}" type="submit" value="全部删除"/></p>
</form>
<br/>
<?php
echo "<a href='index.php?ye=caiwu_mingxi&page=1'>首页</a>&nbsp;<a href='index.php?ye=caiwu_mingxi&page={$prevpage}'>&lt;上一页</a>";
echo "&nbsp;<a style='color:#009999;' href='index.php?ye=caiwu_mingxi&page={$pagenum}'>{$pagenum}</a>&nbsp;/&nbsp;<span>{$totpage}</span>";
echo "<a href='index.php?ye=caiwu_mingxi&page={$nextpage}'>&nbsp;下一页&gt;</a>&nbsp;<a href='index.php?ye=caiwu_mingxi&page={$totpage}'>尾页</a>";
@mysql_free_result($zhuan_rst);
@mysql_free_result($totrst);
mysql_close($con);
?>

</div>
</div>
<script>

$(".shenhetongguo").click(function(){
    var uid=$(this).attr("shenhetongguoid");

    $.post("tixian/tixian_shenhe.php",{"suid":uid},function(data){

        if(data=="yes"){alert("审核成功");}else{alert("审核失败");}
        
    })
    return false;
})


$(".shenheweiguo").click(function(){
    var wuid=$(this).attr("shenheweiguoid");

    $.post("tixian/tixian_shenhe_weiguo.php",{"wuid":wuid},function(data){

        if(data=="yes"){alert("审核成功");}else{alert("审核失败");}
        
    })
    return false;
})

function check_all(obj,cName) 
{ 
    var checkboxs = document.getElementsByName(cName); 
    for(var i=0;i<checkboxs.length;i++){checkboxs[i].checked = obj.checked;} 
}
</script>