|
|
|
@ -128,8 +128,8 @@ class MarketPercentageController extends ThinkController
|
|
|
|
|
// dump(getMarketAdmin());die();
|
|
|
|
|
$data = M("settleup_marketorder","tab_")
|
|
|
|
|
->field("pay_time,promote_account,company_belong,member.real_name,develop_type,game_name,
|
|
|
|
|
sum(pay_amount) pay_amount,sum(company_profit) company_profit,group_id,market_percentage,
|
|
|
|
|
sum(if(develop_type = 1, pay_amount, 0)) performance_revenue,sum(if(develop_type = 2, pay_amount, 0)) appraisal_bonuses")
|
|
|
|
|
sum(pay_amount) pay_amount,sum(company_profit) company_profit,group_id,market_percentage,admin_id,
|
|
|
|
|
sum(if((develop_type = 1 or develop_type = 2), pay_amount, 0)) performance_revenue,sum(if(develop_type = 3, pay_amount, 0)) appraisal_bonuses")
|
|
|
|
|
->join("left join sys_auth_group_access access on admin_id=access.uid")
|
|
|
|
|
->join("left join sys_auth_group auth on access.group_id=auth.id")
|
|
|
|
|
->join("left join sys_member member on access.uid=member.uid");
|
|
|
|
@ -140,15 +140,12 @@ class MarketPercentageController extends ThinkController
|
|
|
|
|
->order("pay_time DESC")
|
|
|
|
|
->select();
|
|
|
|
|
} else {
|
|
|
|
|
$data = $data->page($p, $row)
|
|
|
|
|
->where($map)
|
|
|
|
|
$data = $data->where($map)
|
|
|
|
|
->group("admin_id,pay_time")
|
|
|
|
|
->order("pay_time DESC")
|
|
|
|
|
->select();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// var_dump($data);die();
|
|
|
|
|
|
|
|
|
|
$count = M("settleup_marketorder","tab_")
|
|
|
|
|
->field("pay_time,promote_account,company_belong,real_name,develop_type,game_name,
|
|
|
|
|
sum(pay_amount) pay_amount,sum(company_profit) company_profit,group_id,market_percentage")
|
|
|
|
@ -165,7 +162,7 @@ class MarketPercentageController extends ThinkController
|
|
|
|
|
}
|
|
|
|
|
$this->checkListOrCountAuthRestMap($map,[]);
|
|
|
|
|
|
|
|
|
|
// dump($data);die();
|
|
|
|
|
$wait_amount = [];
|
|
|
|
|
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
|
|
|
|
@ -179,6 +176,9 @@ class MarketPercentageController extends ThinkController
|
|
|
|
|
|
|
|
|
|
$sum_amount = $value['performance_revenue'] + $value['appraisal_bonuses'];
|
|
|
|
|
|
|
|
|
|
$data[$key]['start_time'] = date("Y-m-1",strtotime($value['pay_time']));
|
|
|
|
|
$data[$key]['end_time'] = date("Y-m-t",strtotime($value['pay_time']));
|
|
|
|
|
|
|
|
|
|
$market_percentage = json_decode($value['market_percentage'],true);
|
|
|
|
|
// $data[$key]['performance_revenue'] = number_format($market_percentage['performance_revenue'], 2, '.', '');
|
|
|
|
|
// $data[$key]['appraisal_bonuses'] = number_format($market_percentage['appraisal_bonuses'], 2, '.', '');
|
|
|
|
@ -198,9 +198,68 @@ class MarketPercentageController extends ThinkController
|
|
|
|
|
//应发金额
|
|
|
|
|
$data[$key]['extend_commission'] =
|
|
|
|
|
number_format($data[$key]['performance_commission'] * ($market_percentage['performance_monthly_ratio']/100)+
|
|
|
|
|
$data[$key]['performance_commission'] * ($market_percentage['month_bonus_ratio']/100), 2, '.', '');
|
|
|
|
|
$data[$key]['achievement_bonus'] * ($market_percentage['month_bonus_ratio']/100), 2, '.', '');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$month = date("m",strtotime($value['pay_time']));
|
|
|
|
|
$yes = date("Y",strtotime($value['pay_time']));
|
|
|
|
|
if ($market_percentage['time'] == 1) {
|
|
|
|
|
if ($month == '07') {
|
|
|
|
|
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'];
|
|
|
|
|
} elseif($month == '10') {
|
|
|
|
|
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'04'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'];
|
|
|
|
|
} elseif($month == '04') {
|
|
|
|
|
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'10'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'];
|
|
|
|
|
} elseif($month == '01') {
|
|
|
|
|
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'07'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'];
|
|
|
|
|
}
|
|
|
|
|
} elseif($market_percentage['time'] == 2) {
|
|
|
|
|
if ($month == '07') {
|
|
|
|
|
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'] +
|
|
|
|
|
$wait_amount[$value['admin_id'].$yes.'-'.'04'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'];
|
|
|
|
|
} elseif($month == '01') {
|
|
|
|
|
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'07'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'] +
|
|
|
|
|
$wait_amount[$value['admin_id'].($yes-1).'-'.'10'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'];
|
|
|
|
|
}
|
|
|
|
|
} elseif($market_percentage['time'] == 3) {
|
|
|
|
|
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'01'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'02'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'03'] +
|
|
|
|
|
$wait_amount[$value['admin_id'].($yes-1).'-'.'04'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'05'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'06'] +
|
|
|
|
|
$wait_amount[$value['admin_id'].($yes-1).'-'.'07'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'] +
|
|
|
|
|
$wait_amount[$value['admin_id'].($yes-1).'-'.'10'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//待发金额
|
|
|
|
|
$data[$key]['wait_commission'] = number_format($data[$key]['commission'] - $data[$key]['extend_commission'], 2, '.', '');
|
|
|
|
|
$wait_amount[$value['admin_id'].$value['pay_time']] = $data[$key]['wait_commission'];
|
|
|
|
|
|
|
|
|
|
if ($market_percentage['remain_time'] == 1) {
|
|
|
|
|
if ($month == '07') {
|
|
|
|
|
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'04'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'];
|
|
|
|
|
} elseif($month == '10') {
|
|
|
|
|
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'07'] + $wait_amount[$value['admin_id'].$yes.'-'.'08'] + $wait_amount[$value['admin_id'].$yes.'-'.'09'];
|
|
|
|
|
} elseif($month == '04') {
|
|
|
|
|
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'];
|
|
|
|
|
} elseif($month == '01') {
|
|
|
|
|
$data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'10'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'];
|
|
|
|
|
}
|
|
|
|
|
} elseif($market_percentage['remain_time'] == 2) {
|
|
|
|
|
// if ($month == '07') {
|
|
|
|
|
// $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'] +
|
|
|
|
|
// $wait_amount[$value['admin_id'].$yes.'-'.'04'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'];
|
|
|
|
|
// } elseif($month == '01') {
|
|
|
|
|
// $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'07'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'] +
|
|
|
|
|
// $wait_amount[$value['admin_id'].($yes-1).'-'.'10'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'];
|
|
|
|
|
// }
|
|
|
|
|
} elseif($market_percentage['remain_time'] == 3) {
|
|
|
|
|
// $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'01'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'02'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'03'] +
|
|
|
|
|
// $wait_amount[$value['admin_id'].($yes-1).'-'.'04'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'05'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'06'] +
|
|
|
|
|
// $wait_amount[$value['admin_id'].($yes-1).'-'.'07'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'] +
|
|
|
|
|
// $wait_amount[$value['admin_id'].($yes-1).'-'.'10'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($_REQUEST['export']) {
|
|
|
|
@ -219,6 +278,10 @@ class MarketPercentageController extends ThinkController
|
|
|
|
|
data2csv($data,'市场结算管理',$title);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$arraypage = $p;
|
|
|
|
|
$size = $row;//每页显示的记录数
|
|
|
|
|
$data = array_slice($data, ($arraypage - 1) * $size, $size);
|
|
|
|
|
|
|
|
|
|
$this->assign("list_data",$data);
|
|
|
|
|
$this->display();
|
|
|
|
|
|
|
|
|
@ -240,7 +303,7 @@ class MarketPercentageController extends ThinkController
|
|
|
|
|
$data = M("settleup_marketorder","tab_")
|
|
|
|
|
->field("tab_settleup_marketorder.id,pay_time,promote_account,company_belong,member.real_name,develop_type,game_name,
|
|
|
|
|
sum(pay_amount) pay_amount,sum(company_profit) company_profit,group_id,market_percentage,nickname,admin_id,
|
|
|
|
|
sum(if(develop_type = 1, pay_amount, 0)) performance_revenue,sum(if(develop_type = 2, pay_amount, 0)) appraisal_bonuses")
|
|
|
|
|
sum(if((develop_type = 1 or develop_type = 2), pay_amount, 0)) performance_revenue,sum(if(develop_type = 3, pay_amount, 0)) appraisal_bonuses")
|
|
|
|
|
->join("left join sys_auth_group_access access on admin_id=access.uid")
|
|
|
|
|
->join("left join sys_auth_group auth on access.group_id=auth.id")
|
|
|
|
|
->join("left join sys_member member on access.uid=member.uid");
|
|
|
|
@ -321,7 +384,7 @@ class MarketPercentageController extends ThinkController
|
|
|
|
|
//应发金额
|
|
|
|
|
$data[$key]['extend_commission'] =
|
|
|
|
|
number_format($data[$key]['performance_commission'] * ($market_percentage['performance_monthly_ratio']/100)+
|
|
|
|
|
$data[$key]['performance_commission'] * ($market_percentage['month_bonus_ratio']/100), 2, '.', '');
|
|
|
|
|
$data[$key]['achievement_bonus'] * ($market_percentage['month_bonus_ratio']/100), 2, '.', '');
|
|
|
|
|
$sum['extend_commission'] += $data[$key]['extend_commission'];
|
|
|
|
|
//待发金额
|
|
|
|
|
$data[$key]['wait_commission'] = number_format($data[$key]['commission'] - $data[$key]['extend_commission'], 2, '.', '');
|
|
|
|
|