📄 super_class.inc.php
字号:
<?php
function super_cs( $cut_sign, $date_num, $super_agent, $down_type, $start_time, $end_time )
{
global $conn;
$as = 0;
$bnum = 0;
$dmoney = 0;
$wins = 0;
$amoney = 0;
$smoney = 0;
$all_num = 0;
$spa = mysql_query( "select * from all_agent where super_agent='{$super_agent}' and deleted='0'", $conn );
$all_num = mysql_num_rows( $spa );
while ( $rp = mysql_fetch_array( $spa ) )
{
$all_agent = $rp['user_account'];
$all_profit = profits( $all_agent, 2 );
$sup_profit = profits( $super_agent, 3 );
$sprofit += $sup_profit - $all_profit;
$asp = sup_cs( $cut_sign, $date_num, $all_agent, $down_type, $start_time, $end_time );
$as = split( ",", $asp );
$bnum += $as[0];
$dmoney += $as[1];
$wins += $as[2];
$amoney += $as[3];
$smoney += $as[4];
unset( $as );
}
$pr = round( $sprofit / $all_num, 2 );
$av = $bnum.",".$dmoney.",".$wins.",".$amoney.",".$smoney.",".$pr;
return $av;
}
function sup_cs( $cut_sign, $date_num, $all_agent, $down_type, $start_time, $end_time )
{
global $conn;
if ( $down_type != "all" )
{
$sq = " and sign='{$down_type}'";
}
else
{
$sq = "";
}
if ( $date_num == "no" )
{
$sq = " and open_date>='{$start_time}' and open_date<='{$end_time}' and all_agent='{$all_agent}'";
}
else
{
$sq = " and drop_date='{$date_num}' and all_agent='{$all_agent}'";
}
$count_cuts = 0;
$ag_money = 0;
$wins = 0;
$sqlbm = mysql_query( "select * from drop_bill where cut_sign='{$cut_sign}' {$sq} ", $conn );
$bnum = mysql_num_rows( $sqlbm );
$sqlmoney = mysql_query( "select sum(drop_money) from drop_bill where cut_sign='{$cut_sign}' {$sq} ", $conn );
$mnum = mysql_fetch_array( $sqlmoney );
$money_count = $mnum[0];
if ( 1 <= $bnum )
{
$bnum_count += $bnum;
$all_money += $money_count;
$sqlad = mysql_query( "select * from drop_bill where cut_sign='{$cut_sign}' {$sq} ", $conn );
$count_cut = 0;
$cutct = 0;
while ( $rsc = mysql_fetch_array( $sqlad ) )
{
$wind = 0;
$cuts = $rsc['drop_money'] * $rsc['drop_cut'] * 0.01;
$cutd = count_cut( $rsc['cut_sign'], $rsc['drop_cut'], $rsc['drop_money'], $agent, $rsc['drop_plate'] );
$cutct += $cutd;
$count_cut += $cuts;
$wind = win_unit( $rsc['num_sign'], $rsc['drop_content'], $rsc['drop_type'], $rsc['drop_money'], $rsc['drop_rate'], $rsc['drop_details'], $rsc['drop_date'], $cuts );
$wins += $wind;
}
$a_cut += $cutct;
$count_cuts += $count_cut;
$win_count += $wins;
$a = split( ",", all_result( $all_agent, $date_num, $cut_sign, $down_type, $start_time, $end_time ) );
$ag_money = $a[0];
$all_cut = $a[1];
$profit = $a[2];
$all_cuts += $all_cut;
$all_money = round( $wins + $all_cut, 2 );
$all_moneys += $all_money;
$all_result = $wins * $profit * 0.01 - $all_cut;
$all_results += $all_result;
$sup_money = $ag_money - $all_result;
$sup_moneys += $sup_money;
}
$rv = $bnum.",".$money_count.",".$wins.",".$ag_money.",".$sup_money;
return $rv;
}
function super_cut( $super_agent, $date_num, $cut_sign, $down_type, $start_time, $end_time )
{
global $conn;
$rsa = 0;
$acut = 0;
$sqla = mysql_query( "select * from all_agent where super_agent='{$super_agent}' ", $conn );
while ( $rs = mysql_fetch_array( $sqla ) )
{
$all_agent = $rs['user_account'];
$acut += sup_cuts( $cut_sign, $super_agent, $all_agent, $date_num, $start_time, $end_time );
}
return $acut;
}
function sup_cuts( $cut_sign, $super_agent, $all_agent, $dates, $start_time, $end_time )
{
global $conn;
if ( $date_num == "no" )
{
$sq = " and open_date>='{$start_time}' and open_date<='{$end_time}'";
}
else
{
$sq = " and drop_date='{$dates}'";
}
$cuta = 0;
$sqlts = mysql_query( "select * from drop_bill where cut_sign='{$cut_sign}' and all_agent='{$all_agent}' {$sq}", $conn );
while ( $rs = mysql_fetch_array( $sqlts ) )
{
$signs = $rs['cut_sign'];
$drop_plate = $rs['drop_plate'];
$sqlall = mysql_query( "select * from agent_cut where user_account='{$super_agent}' and sign='{$signs}' and cut_plate='{$drop_plate}'", $conn );
$sqlagt = mysql_query( "select * from agent_cut where user_account='{$all_agent}' and sign='{$signs}' and cut_plate='{$drop_plate}'", $conn );
if ( mysql_num_rows( $sqlall ) != 0 && mysql_num_rows( $sqlagt ) != 0 )
{
$cutse = mysql_result( $sqlall, 0, "cut_num" ) - mysql_result( $sqlagt, 0, "cut_num" );
$cuta += $rs['drop_money'] * $cutse * 0.01;
}
else
{
$cuta = 0;
}
}
return $cuta;
}
include( "../inc/win_unit.php" );
include( "../inc/all_class.inc.php" );
echo "\r\n\r\n\r\n";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -