|
|
|
@ -336,6 +336,7 @@ class MarketPercentageController extends ThinkController
|
|
|
|
|
|
|
|
|
|
public function personMarketStaffSettle($row = 10, $p = 1) {
|
|
|
|
|
|
|
|
|
|
// getDateMarket();die();
|
|
|
|
|
$map = [];
|
|
|
|
|
|
|
|
|
|
$map['group_id'] = ['in','11,12,21'];
|
|
|
|
@ -605,7 +606,7 @@ class MarketPercentageController extends ThinkController
|
|
|
|
|
->where($map)
|
|
|
|
|
->group("admin_id,pay_time")
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
// dump($data);die();
|
|
|
|
|
$all_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,
|
|
|
|
@ -732,7 +733,7 @@ class MarketPercentageController extends ThinkController
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$data[$key]['extend_commission'] +=$wait_amount[$value['admin_id'] . date("Y-m",strtotime("last month",strtotime($_REQUEST['pay_time'])))];
|
|
|
|
|
$data[$key]['extend_commission'] +=$wait_amount[$value['admin_id'] . date("Y-m",strtotime("last month",strtotime($value['pay_time'])))];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -744,6 +745,7 @@ class MarketPercentageController extends ThinkController
|
|
|
|
|
$insert['pay_amount'] = $data[$key]['pay_amount'];
|
|
|
|
|
$insert['extend_commission'] = $data[$key]['extend_commission'];
|
|
|
|
|
$insert['wait_commission'] = $data[$key]['wait_commission'];
|
|
|
|
|
// dump($insert['extend_commission']);
|
|
|
|
|
$insert['remark'] = "{$data[$key]['nickname']}发起提成发放";
|
|
|
|
|
if ($_REQUEST['all']) {
|
|
|
|
|
$insert['remark'] = '离职发放';
|
|
|
|
@ -774,6 +776,59 @@ class MarketPercentageController extends ThinkController
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//遍历统计数据
|
|
|
|
|
$data = M("market_altogether","tab_")
|
|
|
|
|
->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")
|
|
|
|
|
->where(['pay_time'=>$_REQUEST['pay_time'],'admin_id'=>$_REQUEST['admin_id']])
|
|
|
|
|
->select();
|
|
|
|
|
// dump($map['pay_time']);die();
|
|
|
|
|
|
|
|
|
|
foreach($data as $key => $value) {
|
|
|
|
|
|
|
|
|
|
$market_percentage = json_decode($value['market_percentage'],true);
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
|
|
|
|
|
if ($month == '01') {
|
|
|
|
|
$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'];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$data[$key]['extend_commission'] +=$wait_amount[$value['admin_id'] . date("Y-m",strtotime("last month",strtotime($_REQUEST['pay_time'])))];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$update['extend_commission'] = $data[$key]['extend_commission'];
|
|
|
|
|
|
|
|
|
|
M("market_altogether","tab_")
|
|
|
|
|
->where(['pay_time'=>$data[$key]['pay_time'],'admin_id'=>$data[$key]['admin_id']])
|
|
|
|
|
->save($update);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->ajaxReturn(['status'=>1,'msg'=>'发放成功']);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|