result_check.php
资源名称:Nsix.rar [点击查看]
上传用户:m68239277
上传日期:2014-10-12
资源大小:824k
文件大小:10k
源码类别:
Web服务器
开发平台:
PHP
- <?php
- session_start();
- set_time_limit(3600);
- include("checks.php");
- include("../inc/conn.php");
- include("../inc/profit.inc.php");
- include("../inc/win_unit.php");
- $dates=$_GET["dates"];
- $_SESSION["menus"]="查看$dates期开奖结算";
- $sql=mysql_query("select * from drop_bill where drop_date='$dates' order by ID asc",$conn);
- ?>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <link href="../css/css.CSS" rel="stylesheet" type="text/css">
- <style type="text/css">
- <!--
- .style1 {
- font-size: 16px;
- font-weight: bold;
- }
- body {
- margin-top: 5px;
- }
- -->
- </style>
- <body>
- <div align="center" class="style1"><?=$dates?>期 开奖结算总报表
- </div>
- [<a href="#" class="ags" onClick="document.execCommand('print','true','true')">打印</a>] [<a href="#" class="ags" onClick="javascript:window.close();">关闭窗口</a>]
- <table border="0" align="center" cellpadding="2" cellspacing="1" class="t12">
- <tr class="t11">
- <td rowspan="2" nowrap><div align="center" class="fw12">状态</div></td>
- <td rowspan="2" nowrap><div align="center" class="fw12">单号</div></td>
- <td rowspan="2" nowrap><div align="center" class="fw12">账号</div></td>
- <td rowspan="2" nowrap><div align="center" class="fw12">退水</div> </td>
- <td rowspan="2" nowrap><div align="center" class="fw12">期数</div> </td>
- <td rowspan="2" nowrap><div align="center" class="fw12">下注内容</div> </td>
- <td rowspan="2" nowrap><div align="center"></div>
- <div align="center" class="fw12">赔率</div> </td>
- <td rowspan="2" nowrap><div align="center" class="fw12">下注金额</div></td>
- <td rowspan="2" nowrap><div align="center" class="fw12">退水</div></td>
- <td rowspan="2" nowrap class="fw12">实际输赢</td>
- <td rowspan="2" nowrap><div align="center" class="fw12">会员结果</div></td>
- <td colspan="4" nowrap><div align="center" class="fw12">代理商</div></td>
- <td rowspan="2" nowrap class="fw12">交总代理</td>
- <td colspan="4" nowrap><div align="center" class="fw12">总代理</div></td>
- <td rowspan="2" nowrap class="fw12">交股东</td>
- <td colspan="4" nowrap><div align="center" class="fw12">股东</div></td>
- <td rowspan="2" nowrap class="fw12">交管理员</td>
- <td colspan="4" nowrap><div align="center" class="fw12">管理员</div></td>
- </tr>
- <tr class="t11">
- <td nowrap class="fw12">退水</td>
- <td nowrap class="fw12">金额</td>
- <td nowrap class="fw12">占成</td>
- <td nowrap class="fw12">结果</td>
- <td nowrap class="fw12">退水</td>
- <td nowrap class="fw12">金额</td>
- <td nowrap class="fw12">占成</td>
- <td nowrap class="fw12">结果</td>
- <td nowrap class="fw12">退水</td>
- <td nowrap class="fw12">金额</td>
- <td nowrap class="fw12">占成</td>
- <td nowrap class="fw12">结果</td>
- <td nowrap class="fw12">退水</td>
- <td nowrap class="fw12">金额</td>
- <td nowrap class="fw12">占成</td>
- <td nowrap class="fw12">结果</td>
- </tr>
- <?php
- $deleted=0;
- $i=0;
- $n=0;
- $s=0;
- while($rs=mysql_fetch_array($sql))
- { $super_agent_profit=0;
- $ID=$rs["ID"];
- $dates=$rs["drop_date"];
- $user_name=$rs["user_name"];
- $agent=$rs["agent"];
- $cut_sign=$rs["cut_sign"];
- $drop_plate=$rs["drop_plate"];
- $all_agent=$rs["all_agent"];
- $drop_time=$rs["drop_time"];
- $super_agent=$rs["super_agent"];
- $drop_money=$rs["drop_money"];
- $drop_cut=str_replace(" ","",$rs["drop_cut"]);
- $num_sign=$rs["num_sign"];
- $drop_content=$rs["drop_content"];
- $drop_type=$rs["drop_type"];
- $drop_rate=$rs["drop_rate"];
- $drop_details=$rs["drop_details"];
- $agent_profit=profits($agent,1)*0.01; //代理成数
- $agent_profit_all=profits($agent,4)*0.01;//代理中总代成数
- $all_agent_profits=profits($all_agent,2)*0.01;//总代成数
- $all_agent_profit=$all_agent_profits-$agent_profit;
- $super_agent_profits=profits($super_agent,3)*0.01;//股东成数
- $pg=$agent_profit_all+$agent_profit;
- $pl=$super_agent_profits-$all_agent_profits;
- // echo $pg;
- //echo $all_agent_profits;
- if($pg<>$all_agent_profits)
- {
- $all_agent_profit=$agent_profit_all;
- $oi=$all_agent_profits-$pg;
- $super_agent_profit=$pl+$oi;
- }else $super_agent_profit=$super_agent_profits-$all_agent_profits;
- $manage_profit=1-$super_agent_profits; //管理员成数
- $agent_cut=$rs["drop_agent_cut"];//代理退水-------
- $all_agent_cut=$rs["drop_all_agent_cut"];//总代退水------------
- $super_agent_cut=$rs["drop_super_agent_cut"];//股东退水-------------
- $user_cut=round($drop_money*trim($drop_cut)*0.01,2);
- $cut_count+=round($user_cut,2);
- $agent_cuts=round(($drop_money*$drop_cut-$drop_money*(1-$agent_profit)*$agent_cut)*0.01,2);
- $all_agent_cuts=round(($drop_money*(1-$agent_profit)*$agent_cut-$drop_money*(1-($all_agent_profit+$agent_profit))*$all_agent_cut)*0.01,2);
- $super_agent_cuts=round(($drop_money*($super_agent_profit+$manage_profit)*$all_agent_cut-$drop_money*$manage_profit*$super_agent_cut)*0.01,2);
- $manage_cuts=round((($drop_money*$super_agent_cut*$manage_profit)-($drop_money*$super_agent_cut-$drop_money*$super_agent_cut)*(1-$super_agent_profit))*0.01,2); //管理员退水
- if($deleted==0)
- {
- $win=win_unit($num_sign,$drop_content,$drop_type,$drop_money,$drop_rate,$drop_details,$dates,$user_cut);
- }else $win=0;
- $tok=$_SESSION["hnum"];//为和情况
- if($tok==2)
- {
- $user_cut=0;
- $agent_cuts=0;
- $all_agent_cuts=0;
- $super_agent_cuts=0;
- $manage_cuts=0;
- }
- $win=round($win,2);
- $wins+=$win;
- $true_win=round($win-$user_cut,2);//实际win loser
- $agent_money=round($true_win*$agent_profit,2);
- $all_agent_money=round($true_win*$all_agent_profit,2);
- $super_agent_money=round($true_win*$super_agent_profit,2);
- $manage_money=round($true_win*$manage_profit,2);
- $agent_profits=$agent_profit*100; //代理占成
- $all_agent_profits=$all_agent_profit*100;//总代占成
- $super_agent_profits=$super_agent_profit*100;//股东占成
- $manage_profits=$manage_profit*100;//管理员占成
- $agent_result=round($agent_money+$agent_cuts,2); //代理结果
- $all_agent_result=round($all_agent_money+$all_agent_cuts,2);//总代结果
- $super_agent_result=round($super_agent_money+$super_agent_cuts,2); //股东结果
- $manage_result=round($manage_money+$manage_cuts,2);
- $agent_submit=round($win-$agent_result,2);//交总代理
- $all_agent_submit=round($agent_submit-$all_agent_result,2);//交股东
- $super_agent_submit=round($all_agent_submit-$super_agent_result,2);//交管理员
- //结算入库
- $sqlok=mysql_query("update drop_bill set drop_time='$drop_time',user_true_win='$true_win',user_win='$win',
- agent_cut='$agent_cuts',agent_money='$agent_money',agent_profit='$agent_profits',
- agent_result='$agent_result',agent_submit='$agent_submit',all_agent_cut='$all_agent_cuts',
- all_agent_money='$all_agent_money',all_agent_profit='$all_agent_profits',all_agent_result='$all_agent_result',
- all_agent_submit='$all_agent_submit',super_agent_cut='$super_agent_cuts',super_agent_money='$super_agent_money',
- super_agent_profit='$super_agent_profits',super_agent_result='$super_agent_result',super_agent_submit='$super_agent_submit',
- manage_cut='$manage_cuts',manage_money='$manage_money',manage_profit='$manage_profits',manage_result='$manage_result' where ID='$ID'",$conn);
- if($sqlok)
- { $n++;
- }else
- {
- $s++;
- }
- //公开
- mysql_query("update results set deleted='0' where dates='$dates'",$conn);
- $drop_money_count+=$drop_money;
- $user_cut_count+=$user_cut;
- $true_win_count+=$true_win;
- $win_count+=$win;
- $agent_cuts_count+=$agent_cuts;
- $agent_money_count+=$agent_money;
- $agent_result_count+=$agent_result;
- $agent_submit_count+=$agent_submit;
- $all_agent_cuts_count+=$all_agent_cuts;
- $all_agent_money_count+=$all_agent_money;
- $all_agent_result_count+=$all_agent_result;
- $all_agent_submit_count+=$all_agent_submit;
- $super_agent_cuts_count+=$super_agent_cuts;
- $super_agent_money_count+=$super_agent_money;
- $super_agent_profits_count+=$super_agent_profits;
- $super_agent_result_count+=$super_agent_result;
- $super_agent_submit_count+=$super_agent_submit;
- $manage_cuts_count+=$manage_cuts;
- $manage_money_count+=$manage_money;
- $manage_result_count+=$manage_result;
- $i++;
- }
- mysql_query("update results set opens='0' where dates='$dates'",$conn);
- ?>
- <tr class="t13">
- <td colspan="7" nowrap><div align="right"><strong>总计:</strong> 共 <strong><?=$i?></strong> 笔 成功 <strong><?=$n?></strong> 笔 失败 <strong><?=$s?></strong> 笔</div> </td>
- <td align="right" nowrap><strong>
- <?=$drop_money_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$user_cut_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$true_win_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$win_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$agent_cuts_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$agent_money_count?>
- </strong></td>
- <td align="right" nowrap> </td>
- <td align="right" nowrap><strong>
- <?=$agent_result_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$agent_submit_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$all_agent_cuts_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$all_agent_money_count?>
- </strong></td>
- <td align="right" nowrap> </td>
- <td align="right" nowrap><strong>
- <?=$all_agent_result_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$all_agent_submit_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$super_agent_cuts_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$super_agent_money_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$super_agent_result_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$super_agent_submit_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$manage_cuts_count?>
- </strong></td>
- <td align="right" nowrap><strong>
- <?=$manage_money_count?>
- </strong></td>
- <td align="right" nowrap> </td>
- <td align="right" nowrap><strong>
- <?=$manage_result_count?>
- </strong></td>
- </tr>
- </table><br>
- <span class="fbred">------------------<?=$dates?>期 结算完毕,并写入报表,如果状态栏有打红X请重新点结算!
- </span>
- <img src="../img/ok.gif" width="20" height="20" align="absmiddle"><br>
- <br><br>
- </body>