result_check.php
上传用户:m68239277
上传日期:2014-10-12
资源大小:824k
文件大小:10k
源码类别:

Web服务器

开发平台:

PHP

  1. <?php 
  2. session_start();
  3. set_time_limit(3600);
  4. include("checks.php");
  5. include("../inc/conn.php");
  6. include("../inc/profit.inc.php");
  7. include("../inc/win_unit.php");
  8. $dates=$_GET["dates"];
  9. $_SESSION["menus"]="查看$dates期开奖结算";
  10. $sql=mysql_query("select * from drop_bill where drop_date='$dates' order by ID asc",$conn); 
  11. ?>
  12. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  13. <link href="../css/css.CSS" rel="stylesheet" type="text/css">
  14. <style type="text/css">
  15. <!--
  16. .style1 {
  17. font-size: 16px;
  18. font-weight: bold;
  19. }
  20. body {
  21. margin-top: 5px;
  22. }
  23. -->
  24. </style>
  25. <body>
  26. <div align="center" class="style1"><?=$dates?>期 开奖结算总报表
  27. </div>
  28. [<a href="#" class="ags" onClick="document.execCommand('print','true','true')">打印</a>] [<a href="#" class="ags" onClick="javascript:window.close();">关闭窗口</a>]
  29. <table border="0" align="center" cellpadding="2" cellspacing="1" class="t12">
  30.   <tr class="t11">
  31.     <td rowspan="2" nowrap><div align="center" class="fw12">状态</div></td>
  32.     <td rowspan="2" nowrap><div align="center" class="fw12">单号</div></td>
  33.     <td rowspan="2" nowrap><div align="center" class="fw12">账号</div></td>
  34.     <td rowspan="2" nowrap><div align="center" class="fw12">退水</div> </td>
  35.     <td rowspan="2" nowrap><div align="center" class="fw12">期数</div>  </td>
  36.     <td rowspan="2" nowrap><div align="center" class="fw12">下注内容</div>  </td>
  37.     <td rowspan="2" nowrap><div align="center"></div>      
  38.     <div align="center" class="fw12">赔率</div>   </td>
  39.     <td rowspan="2" nowrap><div align="center" class="fw12">下注金额</div></td>
  40.     <td rowspan="2" nowrap><div align="center" class="fw12">退水</div></td>
  41.     <td rowspan="2" nowrap class="fw12">实际输赢</td>
  42.     <td rowspan="2" nowrap><div align="center" class="fw12">会员结果</div></td>
  43.     <td colspan="4" nowrap><div align="center" class="fw12">代理商</div></td>
  44.     <td rowspan="2" nowrap class="fw12">交总代理</td>
  45.     <td colspan="4" nowrap><div align="center" class="fw12">总代理</div></td>
  46.     <td rowspan="2" nowrap class="fw12">交股东</td>
  47.     <td colspan="4" nowrap><div align="center" class="fw12">股东</div></td>
  48.     <td rowspan="2" nowrap class="fw12">交管理员</td>
  49.     <td colspan="4" nowrap><div align="center" class="fw12">管理员</div></td>
  50.   </tr>
  51.   <tr class="t11">
  52.     <td nowrap class="fw12">退水</td>
  53.     <td nowrap class="fw12">金额</td>
  54.     <td nowrap class="fw12">占成</td>
  55.     <td nowrap class="fw12">结果</td>
  56.     <td nowrap class="fw12">退水</td>
  57.     <td nowrap class="fw12">金额</td>
  58.     <td nowrap class="fw12">占成</td>
  59.     <td nowrap class="fw12">结果</td>
  60.     <td nowrap class="fw12">退水</td>
  61.     <td nowrap class="fw12">金额</td>
  62.     <td nowrap class="fw12">占成</td>
  63.     <td nowrap class="fw12">结果</td>
  64.     <td nowrap class="fw12">退水</td>
  65.     <td nowrap class="fw12">金额</td>
  66.     <td nowrap class="fw12">占成</td>
  67.     <td nowrap class="fw12">结果</td>
  68.   </tr>
  69.   <?php
  70.      $deleted=0;
  71.   $i=0;
  72.   $n=0;
  73.   $s=0;
  74.    while($rs=mysql_fetch_array($sql))
  75.    { $super_agent_profit=0; 
  76.      $ID=$rs["ID"];
  77.      $dates=$rs["drop_date"];
  78.      $user_name=$rs["user_name"];
  79.      $agent=$rs["agent"];
  80.  $cut_sign=$rs["cut_sign"];
  81.  $drop_plate=$rs["drop_plate"];
  82.  $all_agent=$rs["all_agent"];
  83.  $drop_time=$rs["drop_time"];
  84.  $super_agent=$rs["super_agent"];
  85.  $drop_money=$rs["drop_money"];
  86.  $drop_cut=str_replace("&nbsp;","",$rs["drop_cut"]);
  87.  $num_sign=$rs["num_sign"];
  88.  $drop_content=$rs["drop_content"];
  89.  $drop_type=$rs["drop_type"];
  90.  $drop_rate=$rs["drop_rate"];
  91.  $drop_details=$rs["drop_details"];
  92.  $agent_profit=profits($agent,1)*0.01;    //代理成数
  93.  $agent_profit_all=profits($agent,4)*0.01;//代理中总代成数
  94.  $all_agent_profits=profits($all_agent,2)*0.01;//总代成数
  95.  $all_agent_profit=$all_agent_profits-$agent_profit;
  96.  $super_agent_profits=profits($super_agent,3)*0.01;//股东成数
  97.  $pg=$agent_profit_all+$agent_profit;
  98.  $pl=$super_agent_profits-$all_agent_profits;
  99. // echo $pg;
  100.  //echo $all_agent_profits;
  101.  if($pg<>$all_agent_profits)
  102.  {
  103.    $all_agent_profit=$agent_profit_all;
  104.    $oi=$all_agent_profits-$pg;
  105.    $super_agent_profit=$pl+$oi;
  106.  }else $super_agent_profit=$super_agent_profits-$all_agent_profits;
  107.  $manage_profit=1-$super_agent_profits;  //管理员成数
  108.  $agent_cut=$rs["drop_agent_cut"];//代理退水-------
  109.  $all_agent_cut=$rs["drop_all_agent_cut"];//总代退水------------
  110.  $super_agent_cut=$rs["drop_super_agent_cut"];//股东退水-------------
  111.      $user_cut=round($drop_money*trim($drop_cut)*0.01,2);
  112.  $cut_count+=round($user_cut,2);
  113.  $agent_cuts=round(($drop_money*$drop_cut-$drop_money*(1-$agent_profit)*$agent_cut)*0.01,2);
  114.      $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);
  115.      $super_agent_cuts=round(($drop_money*($super_agent_profit+$manage_profit)*$all_agent_cut-$drop_money*$manage_profit*$super_agent_cut)*0.01,2);
  116.  $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);  //管理员退水
  117.  if($deleted==0)
  118.  {
  119.  $win=win_unit($num_sign,$drop_content,$drop_type,$drop_money,$drop_rate,$drop_details,$dates,$user_cut);
  120.      }else $win=0;
  121.  $tok=$_SESSION["hnum"];//为和情况
  122.  if($tok==2)
  123.  {
  124.   $user_cut=0;
  125.   $agent_cuts=0;
  126.   $all_agent_cuts=0;
  127.   $super_agent_cuts=0;
  128.   $manage_cuts=0;
  129.  }
  130.  $win=round($win,2);
  131.  $wins+=$win;
  132.  $true_win=round($win-$user_cut,2);//实际win loser
  133.  $agent_money=round($true_win*$agent_profit,2);
  134.  $all_agent_money=round($true_win*$all_agent_profit,2);
  135.  $super_agent_money=round($true_win*$super_agent_profit,2);
  136.  $manage_money=round($true_win*$manage_profit,2);
  137.  $agent_profits=$agent_profit*100;  //代理占成
  138.  $all_agent_profits=$all_agent_profit*100;//总代占成
  139.  $super_agent_profits=$super_agent_profit*100;//股东占成
  140.  $manage_profits=$manage_profit*100;//管理员占成
  141.  $agent_result=round($agent_money+$agent_cuts,2);  //代理结果
  142.  $all_agent_result=round($all_agent_money+$all_agent_cuts,2);//总代结果
  143.  $super_agent_result=round($super_agent_money+$super_agent_cuts,2); //股东结果
  144.  $manage_result=round($manage_money+$manage_cuts,2);
  145.  $agent_submit=round($win-$agent_result,2);//交总代理
  146.  $all_agent_submit=round($agent_submit-$all_agent_result,2);//交股东
  147.  $super_agent_submit=round($all_agent_submit-$super_agent_result,2);//交管理员
  148.   //结算入库
  149.    $sqlok=mysql_query("update drop_bill set drop_time='$drop_time',user_true_win='$true_win',user_win='$win',
  150.    agent_cut='$agent_cuts',agent_money='$agent_money',agent_profit='$agent_profits',
  151.    agent_result='$agent_result',agent_submit='$agent_submit',all_agent_cut='$all_agent_cuts',
  152.    all_agent_money='$all_agent_money',all_agent_profit='$all_agent_profits',all_agent_result='$all_agent_result',
  153.    all_agent_submit='$all_agent_submit',super_agent_cut='$super_agent_cuts',super_agent_money='$super_agent_money',
  154.    super_agent_profit='$super_agent_profits',super_agent_result='$super_agent_result',super_agent_submit='$super_agent_submit',
  155.    manage_cut='$manage_cuts',manage_money='$manage_money',manage_profit='$manage_profits',manage_result='$manage_result' where ID='$ID'",$conn);
  156.   if($sqlok)
  157. { $n++;
  158.  }else
  159.  { 
  160.  $s++;
  161.  } 
  162.    //公开
  163.   mysql_query("update results set deleted='0' where dates='$dates'",$conn);
  164. $drop_money_count+=$drop_money;
  165. $user_cut_count+=$user_cut;
  166. $true_win_count+=$true_win;
  167. $win_count+=$win;
  168. $agent_cuts_count+=$agent_cuts;
  169. $agent_money_count+=$agent_money;
  170. $agent_result_count+=$agent_result;
  171. $agent_submit_count+=$agent_submit;
  172. $all_agent_cuts_count+=$all_agent_cuts;
  173. $all_agent_money_count+=$all_agent_money;
  174. $all_agent_result_count+=$all_agent_result;
  175. $all_agent_submit_count+=$all_agent_submit;
  176. $super_agent_cuts_count+=$super_agent_cuts;
  177. $super_agent_money_count+=$super_agent_money;
  178. $super_agent_profits_count+=$super_agent_profits;
  179. $super_agent_result_count+=$super_agent_result;
  180. $super_agent_submit_count+=$super_agent_submit;
  181. $manage_cuts_count+=$manage_cuts;
  182. $manage_money_count+=$manage_money;
  183. $manage_result_count+=$manage_result;
  184.   $i++;
  185.    }
  186.    mysql_query("update results set opens='0' where dates='$dates'",$conn);
  187.    ?>
  188.   <tr class="t13">
  189.     <td colspan="7" nowrap><div align="right"><strong>总计:</strong> 共 <strong><?=$i?></strong> 笔 成功 <strong><?=$n?></strong> 笔 失败 <strong><?=$s?></strong> 笔</div> </td>
  190.     <td align="right" nowrap><strong>
  191.       <?=$drop_money_count?>
  192.     </strong></td>
  193.     <td align="right" nowrap><strong>
  194.       <?=$user_cut_count?>
  195.     </strong></td>
  196.     <td align="right" nowrap><strong>
  197.       <?=$true_win_count?>
  198.     </strong></td>
  199.     <td align="right" nowrap><strong>
  200.       <?=$win_count?>
  201.     </strong></td>
  202.     <td align="right" nowrap><strong>
  203.       <?=$agent_cuts_count?>
  204.     </strong></td>
  205.     <td align="right" nowrap><strong>
  206.       <?=$agent_money_count?>
  207.     </strong></td>
  208.     <td align="right" nowrap>&nbsp;</td>
  209.     <td align="right" nowrap><strong>
  210.       <?=$agent_result_count?>
  211.     </strong></td>
  212.     <td align="right" nowrap><strong>
  213.       <?=$agent_submit_count?>
  214.     </strong></td>
  215.     <td align="right" nowrap><strong>
  216.       <?=$all_agent_cuts_count?>
  217.     </strong></td>
  218.     <td align="right" nowrap><strong>
  219.       <?=$all_agent_money_count?>
  220.     </strong></td>
  221.     <td align="right" nowrap>&nbsp;</td>
  222.     <td align="right" nowrap><strong>
  223.       <?=$all_agent_result_count?>
  224.     </strong></td>
  225.     <td align="right" nowrap><strong>
  226.       <?=$all_agent_submit_count?>
  227.     </strong></td>
  228.     <td align="right" nowrap><strong>
  229.       <?=$super_agent_cuts_count?>
  230.     </strong></td>
  231.     <td align="right" nowrap><strong>
  232.       <?=$super_agent_money_count?>
  233.     </strong></td>
  234.     <td align="right" nowrap><strong>
  235.     </strong></td>
  236.     <td align="right" nowrap><strong>
  237.       <?=$super_agent_result_count?>
  238.     </strong></td>
  239.     <td align="right" nowrap><strong>
  240.       <?=$super_agent_submit_count?>
  241.     </strong></td>
  242.     <td align="right" nowrap><strong>
  243.       <?=$manage_cuts_count?>
  244.     </strong></td>
  245.     <td align="right" nowrap><strong>
  246.       <?=$manage_money_count?>
  247.     </strong></td>
  248.     <td align="right" nowrap>&nbsp;</td>
  249.     <td align="right" nowrap><strong>
  250.       <?=$manage_result_count?>
  251.     </strong></td>
  252.   </tr>
  253. </table><br>
  254. <span class="fbred">------------------<?=$dates?>期 结算完毕,并写入报表,如果状态栏有打红X请重新点结算!
  255. </span>
  256. <img src="../img/ok.gif" width="20" height="20" align="absmiddle"><br>
  257. <br><br>
  258. </body>