diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php
index 0a724f3dc..77f8e064d 100644
--- a/Application/Admin/Controller/MarketPercentageController.class.php
+++ b/Application/Admin/Controller/MarketPercentageController.class.php
@@ -16,42 +16,43 @@ class MarketPercentageController extends ThinkController
protected function _initialize()
{
- $coefficient_data = M("coefficient","tab_")->where("1=1")->select();
+ $coefficient_data = M("coefficient", "tab_")->where("1=1")->select();
foreach ($coefficient_data as $key => $value) {
- $this->coefficient[$value['pay_time']][$value['admin_id']] = $value['coefficient']/100;
+ $this->coefficient[$value['pay_time']][$value['admin_id']] = $value['coefficient'] / 100;
}
parent::_initialize();
}
- public function index($row = 10, $p = 1){
+ public function index($row = 10, $p = 1)
+ {
$map = [];
// $_REQUEST['pay_time']?($map['pay_time'] = $_REQUEST['pay_time']):'';
- $_REQUEST['promote_id']?($map['promote_id'] = $_REQUEST['promote_id']):'';
- $_REQUEST['relation_game_id']?($map['relation_game_id'] = $_REQUEST['relation_game_id']):'';
+ $_REQUEST['promote_id'] ? ($map['promote_id'] = $_REQUEST['promote_id']) : '';
+ $_REQUEST['relation_game_id'] ? ($map['relation_game_id'] = $_REQUEST['relation_game_id']) : '';
// $_REQUEST['sdk_version']?($map['sdk_version'] = $_REQUEST['sdk_version']):'';
- $_REQUEST['admin_id']?($map['admin_id'] = $_REQUEST['admin_id']):'';
- ($_REQUEST['company_id']||$_REQUEST['company_id']=='0')?($map['company_id'] = $_REQUEST['company_id']):'';
+ $_REQUEST['admin_id'] ? ($map['admin_id'] = $_REQUEST['admin_id']) : '';
+ ($_REQUEST['company_id'] || $_REQUEST['company_id'] == '0') ? ($map['company_id'] = $_REQUEST['company_id']) : '';
$admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
$map['admin_id'] = $admin_id;
$map['is_settlement'] = 1;
- if(is_administrator()||session('user_group_id') == 15||session('user_group_id') == 14||session('user_group_id') == 19||session('user_group_id') == 23) {
+ if (is_administrator() || session('user_group_id') == 15 || session('user_group_id') == 14 || session('user_group_id') == 19 || session('user_group_id') == 23) {
unset($map['admin_id']);
$admin_data = M("member")
->field("access.uid admin_id")
->join("left join sys_auth_group_access access on sys_member.uid = access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")
- ->where(['group_id'=>['in','11,12,21']])
+ ->where(['group_id' => ['in', '11,12,21']])
->select();
if ($admin_data) {
- $map['admin_id'] = ['in',array_column($admin_data,'admin_id')];
+ $map['admin_id'] = ['in', array_column($admin_data, 'admin_id')];
}
- $_REQUEST['admin_id']?($map['admin_id'] = $_REQUEST['admin_id']):'';
+ $_REQUEST['admin_id'] ? ($map['admin_id'] = $_REQUEST['admin_id']) : '';
}
$search_date = [];
@@ -64,7 +65,7 @@ class MarketPercentageController extends ThinkController
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
@@ -72,14 +73,14 @@ class MarketPercentageController extends ThinkController
} elseif (isset($_REQUEST['time_start'])) {
- $end = date("Y-m",time());
+ $end = date("Y-m", time());
$start = $_REQUEST['time_start'];
$i = 0;
do {
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
@@ -94,7 +95,7 @@ class MarketPercentageController extends ThinkController
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
@@ -103,7 +104,7 @@ class MarketPercentageController extends ThinkController
// dump($map);die();
// var_dump($map);die();
- $data = SM("settleup_marketorder","tab_")
+ $data = SM("settleup_marketorder", "tab_")
->field("pay_time,promote_account,company_name,company_belong,real_name,develop_type,game_name,
sum(pay_amount) pay_amount,sum(cp_amount) cp_amount,sum(promote_amount) promote_amount,
sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit");
@@ -121,14 +122,14 @@ class MarketPercentageController extends ThinkController
->select();
}
- $sum = SM("settleup_marketorder","tab_")
+ $sum = SM("settleup_marketorder", "tab_")
->field("pay_time,promote_account,company_belong,real_name,develop_type,game_name,
sum(pay_amount) pay_amount,sum(cp_amount) cp_amount,sum(promote_amount) promote_amount,
sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit")
->where($map)
->find();
- $this->assign("sum",$sum);
+ $this->assign("sum", $sum);
foreach ($data as $key => $value) {
@@ -156,7 +157,7 @@ class MarketPercentageController extends ThinkController
if ($_REQUEST['export']) {
$title = ['pay_time' => '时间',
- 'company_name'=>'公司名称',
+ 'company_name' => '公司名称',
'promote_account' => '会长账号',
'company_belong' => '内外团',
'real_name' => '所属市场专员',
@@ -170,7 +171,7 @@ class MarketPercentageController extends ThinkController
'company_profit' => '税后毛利额'];
foreach ($data as $key => $value) {
- $data[$key]['pay_time'] = '`'.$data[$key]['pay_time'];
+ $data[$key]['pay_time'] = '`' . $data[$key]['pay_time'];
}
$sum['pay_time'] = '';
@@ -180,12 +181,12 @@ class MarketPercentageController extends ThinkController
$sum['develop_type'] = '';
$sum['game_name'] = '';
- $data = array_merge($data,[$sum]);
+ $data = array_merge($data, [$sum]);
- data2csv($data,'市场毛利统计',$title);
+ data2csv($data, '市场毛利统计', $title);
}
- $count = SM("settleup_marketorder","tab_")
+ $count = SM("settleup_marketorder", "tab_")
->field("promote_id,game_name,pay_time,admin_id")
->where($map)
->group("promote_id,game_name,pay_time,admin_id")
@@ -197,39 +198,40 @@ class MarketPercentageController extends ThinkController
if ($page) {
$this->assign('_page', $page);
}
- $this->checkListOrCountAuthRestMap($map,[]);
+ $this->checkListOrCountAuthRestMap($map, []);
- $this->assign("list_data",$data);
+ $this->assign("list_data", $data);
$this->display();
}
- public function indexuncaculate($row = 10, $p = 1){
+ public function indexuncaculate($row = 10, $p = 1)
+ {
$map = [];
// $_REQUEST['pay_time']?($map['pay_time'] = $_REQUEST['pay_time']):'';
- $_REQUEST['promote_id']?($map['promote_id'] = $_REQUEST['promote_id']):'';
- $_REQUEST['relation_game_id']?($map['relation_game_id'] = $_REQUEST['relation_game_id']):'';
- $_REQUEST['sdk_version']?($map['sdk_version'] = $_REQUEST['sdk_version']):'';
- $_REQUEST['admin_id']?($map['admin_id'] = $_REQUEST['admin_id']):'';
- ($_REQUEST['company_id']||$_REQUEST['company_id']=='0')?($map['company_id'] = $_REQUEST['company_id']):'';
+ $_REQUEST['promote_id'] ? ($map['promote_id'] = $_REQUEST['promote_id']) : '';
+ $_REQUEST['relation_game_id'] ? ($map['relation_game_id'] = $_REQUEST['relation_game_id']) : '';
+ $_REQUEST['sdk_version'] ? ($map['sdk_version'] = $_REQUEST['sdk_version']) : '';
+ $_REQUEST['admin_id'] ? ($map['admin_id'] = $_REQUEST['admin_id']) : '';
+ ($_REQUEST['company_id'] || $_REQUEST['company_id'] == '0') ? ($map['company_id'] = $_REQUEST['company_id']) : '';
$admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
$map['admin_id'] = $admin_id;
$map['is_settlement'] = 0;
- if(is_administrator()||session('user_group_id') == 15||session('user_group_id') == 14||session('user_group_id') == 19||session('user_group_id') == 23) {
+ if (is_administrator() || session('user_group_id') == 15 || session('user_group_id') == 14 || session('user_group_id') == 19 || session('user_group_id') == 23) {
unset($map['admin_id']);
$admin_data = M("member")
->field("access.uid admin_id")
->join("left join sys_auth_group_access access on sys_member.uid = access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")
- ->where(['group_id'=>['in','11,12,21']])
+ ->where(['group_id' => ['in', '11,12,21']])
->select();
if ($admin_data) {
- $map['admin_id'] = ['in',array_column($admin_data,'admin_id')];
+ $map['admin_id'] = ['in', array_column($admin_data, 'admin_id')];
}
- $_REQUEST['admin_id']?($map['admin_id'] = $_REQUEST['admin_id']):'';
+ $_REQUEST['admin_id'] ? ($map['admin_id'] = $_REQUEST['admin_id']) : '';
}
$search_date = [];
@@ -242,7 +244,7 @@ class MarketPercentageController extends ThinkController
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
@@ -250,14 +252,14 @@ class MarketPercentageController extends ThinkController
} elseif (isset($_REQUEST['time_start'])) {
- $end = date("Y-m",time());
+ $end = date("Y-m", time());
$start = $_REQUEST['time_start'];
$i = 0;
do {
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
@@ -272,7 +274,7 @@ class MarketPercentageController extends ThinkController
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
@@ -281,7 +283,7 @@ class MarketPercentageController extends ThinkController
// dump($map);die();
// var_dump($map);die();
- $data = M("settleup_marketorder","tab_")
+ $data = M("settleup_marketorder", "tab_")
->field("pay_time,promote_account,company_name,company_belong,member.real_name,develop_type,game_name,
sum(pay_amount) pay_amount,sum(cp_amount) cp_amount,sum(promote_amount) promote_amount,
sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit")
@@ -300,14 +302,14 @@ class MarketPercentageController extends ThinkController
->select();
}
- $sum = M("settleup_marketorder","tab_")
+ $sum = M("settleup_marketorder", "tab_")
->field("pay_time,promote_account,company_belong,real_name,develop_type,game_name,
sum(pay_amount) pay_amount,sum(cp_amount) cp_amount,sum(promote_amount) promote_amount,
sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit")
->where($map)
->find();
- $this->assign("sum",$sum);
+ $this->assign("sum", $sum);
foreach ($data as $key => $value) {
@@ -335,7 +337,7 @@ class MarketPercentageController extends ThinkController
if ($_REQUEST['export']) {
$title = ['pay_time' => '时间',
- 'company_name'=>'公司名称',
+ 'company_name' => '公司名称',
'promote_account' => '会长账号',
'company_belong' => '内外团',
'real_name' => '所属市场专员',
@@ -349,7 +351,7 @@ class MarketPercentageController extends ThinkController
'company_profit' => '税后毛利额'];
foreach ($data as $key => $value) {
- $data[$key]['pay_time'] = '`'.$data[$key]['pay_time'];
+ $data[$key]['pay_time'] = '`' . $data[$key]['pay_time'];
}
$sum['pay_time'] = '';
@@ -359,12 +361,12 @@ class MarketPercentageController extends ThinkController
$sum['develop_type'] = '';
$sum['game_name'] = '';
- $data = array_merge($data,[$sum]);
+ $data = array_merge($data, [$sum]);
- data2csv($data,'市场毛利统计(不结算)',$title);
+ data2csv($data, '市场毛利统计(不结算)', $title);
}
- $count = M("settleup_marketorder","tab_")
+ $count = M("settleup_marketorder", "tab_")
->where($map)
->group("promote_id,game_name,pay_time,admin_id")
->select(false);
@@ -375,17 +377,18 @@ class MarketPercentageController extends ThinkController
if ($page) {
$this->assign('_page', $page);
}
- $this->checkListOrCountAuthRestMap($map,[]);
+ $this->checkListOrCountAuthRestMap($map, []);
- $this->assign("list_data",$data);
+ $this->assign("list_data", $data);
$this->display();
}
- public function addcoefficient() {
+ public function addcoefficient()
+ {
- $batch = date('Ymd').date('His').sp_random_num(3);
- $this->assign("batch",$batch);
+ $batch = date('Ymd') . date('His') . sp_random_num(3);
+ $this->assign("batch", $batch);
$this->meta_title = 'EXCEL导入';
$this->display();
@@ -398,12 +401,12 @@ class MarketPercentageController extends ThinkController
// $batch = $p['batch'];
$checkarr = $p['checkarr'];
//循环获取添加
- if(count($checkarr) < 1){
- $this->ajaxReturn(["status"=>1,"msg"=>"ok"]);
+ if (count($checkarr) < 1) {
+ $this->ajaxReturn(["status" => 1, "msg" => "ok"]);
}
$data = M("auth_group")
- ->where(['title'=>['like','%市场专员%']])
+ ->where(['title' => ['like', '%市场专员%']])
->select(false);
$member = M("auth_group_access")
@@ -415,46 +418,46 @@ class MarketPercentageController extends ThinkController
$handle_member = [];
- foreach($member as $key => $value) {
+ foreach ($member as $key => $value) {
$handle_member[$value['real_name']] = $value;
}
$save = [];
- $coefficient = M('coefficient',"tab_");
+ $coefficient = M('coefficient', "tab_");
foreach ($checkarr as $k => $v) {
- if(!strtotime($v['pay_time'])) {
- $this->ajaxReturn(["status"=>0,"msg"=>"导入失败,序号{$v['sort']}行日期格式错误"]);
+ if (!strtotime($v['pay_time'])) {
+ $this->ajaxReturn(["status" => 0, "msg" => "导入失败,序号{$v['sort']}行日期格式错误"]);
}
if ($handle_member[$v['nickname']]) {
- if ($save[$v['nickname'].$v['pay_time']]) {
- $this->ajaxReturn(["status"=>0,"msg"=>"导入失败,序号{$v['sort']}行存在重复记录"]);
+ if ($save[$v['nickname'] . $v['pay_time']]) {
+ $this->ajaxReturn(["status" => 0, "msg" => "导入失败,序号{$v['sort']}行存在重复记录"]);
}
$hav_coefficient = $coefficient
- ->where(['admin_id'=>$handle_member[$v['nickname']]['uid'],'pay_time'=>$v['pay_time']])
+ ->where(['admin_id' => $handle_member[$v['nickname']]['uid'], 'pay_time' => $v['pay_time']])
->find();
if ($hav_coefficient) {
- $this->ajaxReturn(["status"=>0,"msg"=>"导入失败,日期{$v['pay_time']}市场员{$handle_member[$v['nickname']]['real_name']}已经存在,请勿重复导入"]);
+ $this->ajaxReturn(["status" => 0, "msg" => "导入失败,日期{$v['pay_time']}市场员{$handle_member[$v['nickname']]['real_name']}已经存在,请勿重复导入"]);
}
- $save[$v['nickname'].$v['pay_time']]['pay_time'] = $v['pay_time'];
- $save[$v['nickname'].$v['pay_time']]['real_name'] = $handle_member[$v['nickname']]['real_name'];
- $save[$v['nickname'].$v['pay_time']]['admin_id'] = $handle_member[$v['nickname']]['uid'];
- $save[$v['nickname'].$v['pay_time']]['nickname'] = $handle_member[$v['nickname']]['nickname'];
- $save[$v['nickname'].$v['pay_time']]['coefficient'] = $v['coefficient']*100;
+ $save[$v['nickname'] . $v['pay_time']]['pay_time'] = $v['pay_time'];
+ $save[$v['nickname'] . $v['pay_time']]['real_name'] = $handle_member[$v['nickname']]['real_name'];
+ $save[$v['nickname'] . $v['pay_time']]['admin_id'] = $handle_member[$v['nickname']]['uid'];
+ $save[$v['nickname'] . $v['pay_time']]['nickname'] = $handle_member[$v['nickname']]['nickname'];
+ $save[$v['nickname'] . $v['pay_time']]['coefficient'] = $v['coefficient'] * 100;
if ($v['coefficient'] > 1) {
- $this->ajaxReturn(["status"=>0,"msg"=>"导入失败,序号{$v['sort']}行系数错误,系数超过最大值1"]);
+ $this->ajaxReturn(["status" => 0, "msg" => "导入失败,序号{$v['sort']}行系数错误,系数超过最大值1"]);
}
} else {
- $this->ajaxReturn(["status"=>0,"msg"=>"导入失败,导入的市场员{$v['nickname']}不存在"]);
+ $this->ajaxReturn(["status" => 0, "msg" => "导入失败,导入的市场员{$v['nickname']}不存在"]);
}
}
@@ -462,87 +465,87 @@ class MarketPercentageController extends ThinkController
$save = array_values($save);
if ($coefficient->addAll($save)) {
- $this->ajaxReturn(["status"=>1,"msg"=>"导入成功"]);
+ $this->ajaxReturn(["status" => 1, "msg" => "导入成功"]);
}
}
- public function coefficientSave() {
+ public function coefficientSave()
+ {
- $pay_time =date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));
+ $pay_time = date('Y-m', strtotime(date('Y', time()) . '-' . (date('m', time()) - 1) . '-01'));
if ($_REQUEST['is_get']) {
unset($_GET['is_get']);
$data = $_GET;
- $if_coefficientSave = M("market_altogether","tab_")
+ $if_coefficientSave = M("market_altogether", "tab_")
->where([
- 'pay_time'=>$pay_time,
- 'market_check'=>1
+ 'pay_time' => $pay_time,
+ 'market_check' => 1
])
->find();
if ($if_coefficientSave) {
- $this->ajaxReturn(['status'=>0,'msg'=>"市场部已确认,绩效系数再不可修改"]);
+ $this->ajaxReturn(['status' => 0, 'msg' => "市场部已确认,绩效系数再不可修改"]);
}
$admin = $_SESSION['onethink_admin']['user_auth']['username'];
- $coefficient_check_detail = "已审批({$admin})
".date("Y-m-d H:i:s",time());
+ $coefficient_check_detail = "已审批({$admin})
" . date("Y-m-d H:i:s", time());
$marketSave['coefficient_check'] = 1;
$marketSave['coefficient_check_detail'] = $coefficient_check_detail;
foreach ($data as $key => $value) {
//解析键值信息
- $info = explode('-',$key);
+ $info = explode('-', $key);
$save['nickname'] = $info[0];
$save['admin_id'] = $info[1];
$save['real_name'] = $info[2];
- $save['coefficient'] = $value*100;
+ $save['coefficient'] = $value * 100;
$save['pay_time'] = $pay_time;
- $is_hav = M("coefficient","tab_")
+ $is_hav = M("coefficient", "tab_")
->where([
- 'pay_time'=>$save['pay_time'],
- 'admin_id'=>$save['admin_id']
+ 'pay_time' => $save['pay_time'],
+ 'admin_id' => $save['admin_id']
])
->find();
if ($is_hav) {
if ($is_hav['coefficient'] != $save['coefficient']) {
$save['update_time'] = time();
- M("coefficient","tab_")
+ M("coefficient", "tab_")
->where([
- 'pay_time'=>$save['pay_time'],
- 'admin_id'=>$save['admin_id']
- ])->save(['coefficient'=>$save['coefficient']]);
+ 'pay_time' => $save['pay_time'],
+ 'admin_id' => $save['admin_id']
+ ])->save(['coefficient' => $save['coefficient']]);
}
- M("market_altogether","tab_")->where([
- 'pay_time'=>$save['pay_time'],
- 'admin_id'=>$save['admin_id']
+ M("market_altogether", "tab_")->where([
+ 'pay_time' => $save['pay_time'],
+ 'admin_id' => $save['admin_id']
])->save($marketSave);
-
} else {
$save['create_time'] = time();
- M("coefficient","tab_")->add($save);
- M("market_altogether","tab_")->where([
- 'pay_time'=>$save['pay_time'],
- 'admin_id'=>$save['admin_id']
+ M("coefficient", "tab_")->add($save);
+ M("market_altogether", "tab_")->where([
+ 'pay_time' => $save['pay_time'],
+ 'admin_id' => $save['admin_id']
])->save($marketSave);
}
}
- $this->ajaxReturn(['status'=>1,'msg'=>"绩效系数编辑成功"]);
+ $this->ajaxReturn(['status' => 1, 'msg' => "绩效系数编辑成功"]);
} else {
$data = M("auth_group")
- ->where(['title'=>['like','%市场专员%']])
+ ->where(['title' => ['like', '%市场专员%']])
->select(false);
$data = M("auth_group_access")
@@ -553,49 +556,50 @@ class MarketPercentageController extends ThinkController
->where("auth.title is not null")
->select();
- $this->assign('list_data',$data);
+ $this->assign('list_data', $data);
$this->display("coefficient");
}
}
- public function marketStaffSettle($row = 10, $p = 1) {
+ public function marketStaffSettle($row = 10, $p = 1)
+ {
$map = [];
- $map['group_id'] = ['in','11,12,21'];
+ $map['group_id'] = ['in', '11,12,21'];
//获取权限
$marketPercentage = M("auth_group")->where($map)->getField("id,market_percentage");
// $_REQUEST['pay_time']?($map['pay_time'] = $_REQUEST['pay_time']):'';
- $_REQUEST['admin_id']?($map['admin_id'] = $_REQUEST['admin_id']):'';
- $_REQUEST['group_id']?($map['level'] = $_REQUEST['group_id']):'';
+ $_REQUEST['admin_id'] ? ($map['admin_id'] = $_REQUEST['admin_id']) : '';
+ $_REQUEST['group_id'] ? ($map['level'] = $_REQUEST['group_id']) : '';
$admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
$map['admin_id'] = $admin_id;
- if(is_administrator()||session('user_group_id') == 15||session('user_group_id') == 14||session('user_group_id') == 19||session('user_group_id') == 23) {
+ if (is_administrator() || session('user_group_id') == 15 || session('user_group_id') == 14 || session('user_group_id') == 19 || session('user_group_id') == 23) {
unset($map['admin_id']);
- $markerData = M("ucenter_member")->field("id")->where(['work_status'=>1])->select();
+ $markerData = M("ucenter_member")->field("id")->where(['work_status' => 1])->select();
if ($markerData) {
- $admin_map['sys_member.uid'] = ['not in',array_column($markerData,'id')];
+ $admin_map['sys_member.uid'] = ['not in', array_column($markerData, 'id')];
}
$admin_data = M("member")
->field("access.uid admin_id")
->join("left join sys_auth_group_access access on sys_member.uid = access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")
- ->where(['group_id'=>['in','11,12,21']])
+ ->where(['group_id' => ['in', '11,12,21']])
->where($admin_map)
->select();
if ($admin_data) {
- $map['admin_id'] = ['in',array_column($admin_data,'admin_id')];
+ $map['admin_id'] = ['in', array_column($admin_data, 'admin_id')];
}
- if (!in_array($_REQUEST['admin_id'],array_column($markerData,'id'))) {
- $_REQUEST['admin_id']?($map['admin_id'] = $_REQUEST['admin_id']):'';
+ if (!in_array($_REQUEST['admin_id'], array_column($markerData, 'id'))) {
+ $_REQUEST['admin_id'] ? ($map['admin_id'] = $_REQUEST['admin_id']) : '';
} else {
$this->display("marketstaffsettle");
die();
@@ -613,7 +617,7 @@ class MarketPercentageController extends ThinkController
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
@@ -621,14 +625,14 @@ class MarketPercentageController extends ThinkController
} elseif (isset($_REQUEST['time_start'])) {
- $end = date("Y-m",time());
+ $end = date("Y-m", time());
$start = $_REQUEST['time_start'];
$i = 0;
do {
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
@@ -643,20 +647,20 @@ class MarketPercentageController extends ThinkController
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
}
}
- $_REQUEST['time_start']?($start_time = date("Y-m-1",strtotime($_REQUEST['time_start']))):'';
- $_REQUEST['time_end']?($end_time = date("Y-m-t",strtotime($_REQUEST['time_end']))):'';
+ $_REQUEST['time_start'] ? ($start_time = date("Y-m-1", strtotime($_REQUEST['time_start']))) : '';
+ $_REQUEST['time_end'] ? ($end_time = date("Y-m-t", strtotime($_REQUEST['time_end']))) : '';
- $this->assign('start_time',$start_time);
- $this->assign('end_time',$end_time);
+ $this->assign('start_time', $start_time);
+ $this->assign('end_time', $end_time);
- $data = SM("market_altogether","tab_")
+ $data = SM("market_altogether", "tab_")
->where($map);
@@ -673,7 +677,7 @@ class MarketPercentageController extends ThinkController
->select();
}
- $count = SM("market_altogether","tab_")
+ $count = SM("market_altogether", "tab_")
->where($map)
->count();
@@ -681,32 +685,32 @@ class MarketPercentageController extends ThinkController
if ($page) {
$this->assign('_page', $page);
}
- $this->checkListOrCountAuthRestMap($map,[]);
+ $this->checkListOrCountAuthRestMap($map, []);
- if(IS_ROOT){
- $this->assign('coefficient_check',true);
- $this->assign('market_check',true);
- $this->assign('finance_check',true);
- $this->assign('coefficient_in_check',true);
- }else {
+ if (IS_ROOT) {
+ $this->assign('coefficient_check', true);
+ $this->assign('market_check', true);
+ $this->assign('finance_check', true);
+ $this->assign('coefficient_in_check', true);
+ } else {
$exportRule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME . "_coefficient_check");
- $this->assign('coefficient_check',$this->checkRule($exportRule,array('in','1,2')));
+ $this->assign('coefficient_check', $this->checkRule($exportRule, array('in', '1,2')));
$exportRule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME . "_market_check");
- $this->assign('market_check',$this->checkRule($exportRule,array('in','1,2')));
+ $this->assign('market_check', $this->checkRule($exportRule, array('in', '1,2')));
$exportRule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME . "_finance_check");
- $this->assign('finance_check',$this->checkRule($exportRule,array('in','1,2')));
+ $this->assign('finance_check', $this->checkRule($exportRule, array('in', '1,2')));
$exportRule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME . "_coefficient_in_check");
- $this->assign('coefficient_in_check',$this->checkRule($exportRule,array('in','1,2')));
+ $this->assign('coefficient_in_check', $this->checkRule($exportRule, array('in', '1,2')));
}
- $all_data = SM("market_altogether","tab_")
+ $all_data = SM("market_altogether", "tab_")
// ->where($map)
->select();
$wait_amount = [];
foreach ($all_data as $key => $value) {
- $wait_amount[$value['admin_id'].$value['pay_time'].'performance_commission'] = $value['wait_performance_commission'];
- $wait_amount[$value['admin_id'].$value['pay_time'].'achievement_bonus'] = $value['wait_achievement_commission'] * ($this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1);
+ $wait_amount[$value['admin_id'] . $value['pay_time'] . 'performance_commission'] = $value['wait_performance_commission'];
+ $wait_amount[$value['admin_id'] . $value['pay_time'] . 'achievement_bonus'] = $value['wait_achievement_commission'] * ($this->coefficient[$value['pay_time']][$value['admin_id']] ? $this->coefficient[$value['pay_time']][$value['admin_id']] : 1);
}
@@ -721,12 +725,12 @@ class MarketPercentageController extends ThinkController
foreach ($data as $key => $value) {
$level = $value['level'];
- if(isset($marketPercentage[$level])){
+ if (isset($marketPercentage[$level])) {
$value['market_percentage'] = $marketPercentage[$level];
}
$Rule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME . "_export_show_check");
- if ($_REQUEST['export'] && $this->checkRule($Rule,array('in','1,2'))) {
+ if ($_REQUEST['export'] && $this->checkRule($Rule, array('in', '1,2'))) {
if (!$value['market_check'] || !$value['finance_check']) {
unset($data[$key]);
@@ -734,8 +738,8 @@ class MarketPercentageController extends ThinkController
}
}
- $data[$key]['start_time'] = date("Y-m-1",strtotime($value['pay_time']));
- $data[$key]['end_time'] = date("Y-m-t",strtotime($value['pay_time']));
+ $data[$key]['start_time'] = date("Y-m-1", strtotime($value['pay_time']));
+ $data[$key]['end_time'] = date("Y-m-t", strtotime($value['pay_time']));
if ($value['level'] == 21) {
$data[$key]['level'] = '初级';
@@ -745,7 +749,7 @@ class MarketPercentageController extends ThinkController
$data[$key]['level'] = '高级';
}
- if(!$value['market_check']) {
+ if (!$value['market_check']) {
$data[$key]['market_check_detail'] = "-----";
}
@@ -758,12 +762,12 @@ class MarketPercentageController extends ThinkController
}
if ($_REQUEST['export']) {
- $data[$key]['market_check_detail'] = str_replace("
",'',$data[$key]['market_check_detail']);
- $data[$key]['finance_check_detail'] = str_replace("
",'',$data[$key]['finance_check_detail']);
- $data[$key]['coefficient_check_detail'] = str_replace("
",'',$data[$key]['coefficient_check_detail']);
+ $data[$key]['market_check_detail'] = str_replace("
", '', $data[$key]['market_check_detail']);
+ $data[$key]['finance_check_detail'] = str_replace("
", '', $data[$key]['finance_check_detail']);
+ $data[$key]['coefficient_check_detail'] = str_replace("
", '', $data[$key]['coefficient_check_detail']);
}
- $market_percentage = json_decode($value['market_percentage'],true);
+ $market_percentage = json_decode($value['market_percentage'], true);
//开发业绩提成比例
$data[$key]['develop_commission_ratio'] = $market_percentage['develop_commission_ratio'];
//维护业绩提成比例
@@ -773,24 +777,24 @@ class MarketPercentageController extends ThinkController
//维护奖金考核比例
$data[$key]['maintain_appraisal_bonuses_ratio'] = $market_percentage['maintain_appraisal_bonuses_ratio'];
- $data[$key]['coefficient'] = $this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1;
+ $data[$key]['coefficient'] = $this->coefficient[$value['pay_time']][$value['admin_id']] ? $this->coefficient[$value['pay_time']][$value['admin_id']] : 1;
- $month = date("m",strtotime($value['pay_time']));
- $yes = date("Y",strtotime($value['pay_time']));
+ $month = date("m", strtotime($value['pay_time']));
+ $yes = date("Y", strtotime($value['pay_time']));
$achievement_bonus = number_format($data[$key]['achievement_bonus'], 2, '.', '');
//绩效系数计算
- $data[$key]['achievement_bonus'] = number_format($data[$key]['achievement_bonus'] * ($this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1), 2, '.', '');
+ $data[$key]['achievement_bonus'] = number_format($data[$key]['achievement_bonus'] * ($this->coefficient[$value['pay_time']][$value['admin_id']] ? $this->coefficient[$value['pay_time']][$value['admin_id']] : 1), 2, '.', '');
$data[$key]['commission'] = number_format($data[$key]['performance_commission'] + $data[$key]['achievement_bonus'], 2, '.', '');
- $data[$key]['wait_commission'] = number_format($value['wait_performance_commission'] + $value['wait_achievement_commission']*($this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1), 2, '.', '');
+ $data[$key]['wait_commission'] = number_format($value['wait_performance_commission'] + $value['wait_achievement_commission'] * ($this->coefficient[$value['pay_time']][$value['admin_id']] ? $this->coefficient[$value['pay_time']][$value['admin_id']] : 1), 2, '.', '');
$data[$key]['extend_commission'] = $data[$key]['commission'] - $data[$key]['wait_commission'];
// dump($data[$key]['commission']);
//两个起提流水都没达到时,不展示税后毛利
$sum_amount = $value['performance_revenue'] + $value['appraisal_bonuses'];
- if ($sum_amount<$market_percentage['performance_revenue']&&$sum_amount<$market_percentage['appraisal_bonuses']) {
+ if ($sum_amount < $market_percentage['performance_revenue'] && $sum_amount < $market_percentage['appraisal_bonuses']) {
$data[$key]['company_profit'] = "0.00";
$value['company_profit'] = "0.00";
}
@@ -798,71 +802,70 @@ class MarketPercentageController extends ThinkController
if ($market_percentage['time'] == 1) {
if ($month == '07') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'.'performance_commission'];
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '01' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '02' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '03' . 'performance_commission'];
// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'04'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'.'performance_commission'];
- } elseif($month == '10') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'04'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'.'performance_commission'];
+ } elseif ($month == '10') {
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '04' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '05' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '06' . 'performance_commission'];
// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'07'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'08'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'09'.'performance_commission'];
- } elseif($month == '04') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'10'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'.'performance_commission'];
+ } elseif ($month == '04') {
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'performance_commission'];
// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'.'performance_commission'];
- } elseif($month == '01') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'07'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'.'performance_commission'];
+ } elseif ($month == '01') {
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09' . 'performance_commission'];
// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'10'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'.'performance_commission'];
}
- } elseif($market_percentage['time'] == 2) {
+ } elseif ($market_percentage['time'] == 2) {
if ($month == '07') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'.'performance_commission'] +
- $wait_amount[$value['admin_id'].$yes.'-'.'04'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'.'performance_commission'];
- } elseif($month == '01') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'07'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'.'performance_commission'] +
- $wait_amount[$value['admin_id'].($yes-1).'-'.'10'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'.'performance_commission'];
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '01' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '02' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '03' . 'performance_commission'] +
+ $wait_amount[$value['admin_id'] . $yes . '-' . '04' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '05' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '06' . 'performance_commission'];
+ } elseif ($month == '01') {
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09' . 'performance_commission'] +
+ $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'performance_commission'];
}
- } elseif($market_percentage['time'] == 3) {
+ } elseif ($market_percentage['time'] == 3) {
if ($month == '01') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '01'.'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '02'.'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '03'.'performance_commission'] +
- $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '04'.'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '05'.'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '06'.'performance_commission'] +
- $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07'.'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08'.'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09'.'performance_commission'] +
- $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10'.'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11'.'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12'.'performance_commission'];
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '01' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '02' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '03' . 'performance_commission'] +
+ $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '04' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '05' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '06' . 'performance_commission'] +
+ $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09' . 'performance_commission'] +
+ $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'performance_commission'];
}
} else {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] .date("Y-m",strtotime("last month",strtotime($value['pay_time']))).'performance_commission'];
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . date("Y-m", strtotime("last month", strtotime($value['pay_time']))) . 'performance_commission'];
}
if ($market_percentage['remain_time'] == 1) {
if ($month == '07') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'.'achievement_bonus'];
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '01' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '02' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '03' . 'achievement_bonus'];
// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'04'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'.'achievement_bonus'];
// dump($data[$key]['extend_commission']);die();
- } elseif($month == '10') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'04'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'.'achievement_bonus'];
+ } elseif ($month == '10') {
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '04' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '05' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '06' . 'achievement_bonus'];
// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'07'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'08'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'09'.'achievement_bonus'];
- } elseif($month == '04') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'10'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'.'achievement_bonus'];
+ } elseif ($month == '04') {
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'achievement_bonus'];
// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'.'achievement_bonus'];
- }
- elseif($month == '01') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'07'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'.'achievement_bonus'];
+ } elseif ($month == '01') {
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09' . 'achievement_bonus'];
// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'10'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'.'achievement_bonus'];
}
- } elseif($market_percentage['remain_time'] == 2) {
+ } elseif ($market_percentage['remain_time'] == 2) {
if ($month == '07') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'.'achievement_bonus'] +
- $wait_amount[$value['admin_id'].$yes.'-'.'04'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'.'achievement_bonus'];
- } elseif($month == '01') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'07'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'08'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'09'.'achievement_bonus'] +
- $wait_amount[$value['admin_id'].($yes-1).'-'.'10'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'.'achievement_bonus'];
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '01' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '02' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '03' . 'achievement_bonus'] +
+ $wait_amount[$value['admin_id'] . $yes . '-' . '04' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '05' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '06' . 'achievement_bonus'];
+ } elseif ($month == '01') {
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09' . 'achievement_bonus'] +
+ $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'achievement_bonus'];
}
- } elseif($market_percentage['remain_time'] == 3) {
+ } elseif ($market_percentage['remain_time'] == 3) {
if ($month == '01') {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '01'.'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '02'.'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '03'.'achievement_bonus'] +
- $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '04'.'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '05'.'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '06'.'achievement_bonus'] +
- $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07'.'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08'.'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09'.'achievement_bonus'] +
- $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10'.'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11'.'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12'.'achievement_bonus'];
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '01' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '02' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '03' . 'achievement_bonus'] +
+ $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '04' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '05' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '06' . 'achievement_bonus'] +
+ $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09' . 'achievement_bonus'] +
+ $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'achievement_bonus'];
}
} else {
- $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] .date("Y-m",strtotime("last month",strtotime($value['pay_time']))).'achievement_bonus'];
+ $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . date("Y-m", strtotime("last month", strtotime($value['pay_time']))) . 'achievement_bonus'];
}
// $data[$key]['extend_commission'] = number_format($data[$key]['extend_commission'], 2, '.', '');
//
@@ -871,35 +874,34 @@ class MarketPercentageController extends ThinkController
if ($market_percentage['time'] == 1) {
if ($month == '07') {
- $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'04'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'.'performance_commission'];
- } elseif($month == '10') {
- $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'07'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'08'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'09'.'performance_commission'];
- } elseif($month == '04') {
- $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'.'performance_commission'];
- } elseif($month == '01') {
- $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'10'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'.'performance_commission'];
+ $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '04' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '05' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '06' . 'performance_commission'];
+ } elseif ($month == '10') {
+ $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '07' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '08' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '09' . 'performance_commission'];
+ } elseif ($month == '04') {
+ $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '01' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '02' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '03' . 'performance_commission'];
+ } elseif ($month == '01') {
+ $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'performance_commission'];
}
}
if ($market_percentage['remain_time'] == 1) {
if ($month == '07') {
- $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'04'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'.'achievement_bonus'];
+ $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '04' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '05' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '06' . 'achievement_bonus'];
// dump($data[$key]['extend_commission']);die();
- } elseif($month == '10') {
- $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'07'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'08'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'09'.'achievement_bonus'];
- } elseif($month == '04') {
- $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'.'achievement_bonus'];
- }
- elseif($month == '01') {
- $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'10'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'.'achievement_bonus'];
+ } elseif ($month == '10') {
+ $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '07' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '08' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '09' . 'achievement_bonus'];
+ } elseif ($month == '04') {
+ $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '01' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '02' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '03' . 'achievement_bonus'];
+ } elseif ($month == '01') {
+ $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'achievement_bonus'];
}
}
- $data[$key]['extend_commission'] = number_format($data[$key]['extend_commission'],2,'.','');
- $data[$key]['wait_commission'] = number_format($data[$key]['wait_commission'],2,'.','');
+ $data[$key]['extend_commission'] = number_format($data[$key]['extend_commission'], 2, '.', '');
+ $data[$key]['wait_commission'] = number_format($data[$key]['wait_commission'], 2, '.', '');
- $data[$key]['achievement_bonus'] = $achievement_bonus;
+ $data[$key]['achievement_bonus'] = $achievement_bonus;
$sum['performance_revenue'] += $data[$key]['performance_revenue'];
$sum['appraisal_bonuses'] += $data[$key]['appraisal_bonuses'];
@@ -910,7 +912,6 @@ class MarketPercentageController extends ThinkController
$sum['company_profit'] += $data[$key]['company_profit'];
-
}
$sum['wait_commission'] = '-------';
$sum['pay_time'] = '总计';
@@ -922,26 +923,26 @@ class MarketPercentageController extends ThinkController
'level' => '级别',
'performance_revenue' => '开发总流水',
'appraisal_bonuses' => '维护总流水',
- 'develop_commission_ratio'=>'开发业绩提成比例(%)',
- 'maintain_commission_ratio'=>'维护业绩提成比例(%)',
- 'appraisal_bonuses_ratio'=>'开发考核奖金比例(%)',
- 'maintain_appraisal_bonuses_ratio'=>'维护奖金考核比例(%)',
- 'achievement_profit'=>'开发税后毛利',
- 'performance_profit'=>'维护税后毛利',
+ 'develop_commission_ratio' => '开发业绩提成比例(%)',
+ 'maintain_commission_ratio' => '维护业绩提成比例(%)',
+ 'appraisal_bonuses_ratio' => '开发考核奖金比例(%)',
+ 'maintain_appraisal_bonuses_ratio' => '维护奖金考核比例(%)',
+ 'achievement_profit' => '开发税后毛利',
+ 'performance_profit' => '维护税后毛利',
'performance_commission' => '业绩提成',
'achievement_bonus' => '绩效考核奖金',
- 'coefficient'=>'绩效系数',
+ 'coefficient' => '绩效系数',
'commission' => '当月合计',
'extend_commission' => '应发金额',
'wait_commission' => '待发金额',
- 'coefficient_check_detail'=>'绩效确认',
+ 'coefficient_check_detail' => '绩效确认',
'market_check_detail' => '市场部确认',
'finance_check_detail' => '财务部审批'];
foreach ($data as $key => $value) {
- $line = $key+2;
+ $line = $key + 2;
// $develop_commission_ratio = $value['develop_commission_ratio']/100;
- $data[$key]['pay_time'] = '`'.$data[$key]['pay_time'];
+ $data[$key]['pay_time'] = '`' . $data[$key]['pay_time'];
$data[$key]['performance_commission'] = "=ROUND(";
$data[$key]['achievement_bonus'] = "=ROUND(";
@@ -966,7 +967,6 @@ class MarketPercentageController extends ThinkController
}
-
// $data[$key]['achievement_bonus'] .= "J{$line}*(H{$line}/100)";
} else {
$data[$key]['performance_commission'] .= ',2)';
@@ -974,8 +974,6 @@ class MarketPercentageController extends ThinkController
}
-
-
// if ($value['achievement_profit'] != "0.00") {
// if ($data[$key]['performance_commission'] == "=ROUND(") {
// $data[$key]['performance_commission'] .= "K{$line}*(G{$line}/100),2)";
@@ -1006,37 +1004,38 @@ class MarketPercentageController extends ThinkController
$data[$key]['commission'] = "=ROUND(L{$line}+M{$line}*N{$line},2)";
}
- $data = array_merge($data,[$sum]);
+ $data = array_merge($data, [$sum]);
- data2csv($data,'市场业绩提成',$title);
+ data2csv($data, '市场业绩提成', $title);
}
$arraypage = $p;
$size = $row;//每页显示的记录数
$data = array_slice($data, ($arraypage - 1) * $size, $size);
- $this->assign("sum",$sum);
- $this->assign("list_data",$data);
+ $this->assign("sum", $sum);
+ $this->assign("list_data", $data);
$this->display("marketstaffsettle");
}
- public function personMarketStaffSettle($row = 10, $p = 1) {
+ public function personMarketStaffSettle($row = 10, $p = 1)
+ {
// var_dump(getMarketAdmin());
$map = [];
- $map['group_id'] = ['in','11,12,21'];
+ $map['group_id'] = ['in', '11,12,21'];
//获取权限
$marketPercentage = M("auth_group")->where($map)->getField("id,market_percentage");
// $_REQUEST['pay_time']?($map['pay_time'] = $_REQUEST['pay_time']):'';
// $_REQUEST['admin_id']?($map['admin_id'] = $_REQUEST['admin_id']):'';
- $_REQUEST['group_id']?($map['group_id'] = $_REQUEST['group_id']):'';
- ($_REQUEST['status']||$_REQUEST['status']=='0')?($map['tab_market_altogether.status'] = $_REQUEST['status']):'';
+ $_REQUEST['group_id'] ? ($map['group_id'] = $_REQUEST['group_id']) : '';
+ ($_REQUEST['status'] || $_REQUEST['status'] == '0') ? ($map['tab_market_altogether.status'] = $_REQUEST['status']) : '';
- if($_REQUEST['status']||$_REQUEST['status']=='0') {
- if( $_REQUEST['status'] == '1') {
- $map['tab_market_altogether.status'] = ['egt',1];
+ if ($_REQUEST['status'] || $_REQUEST['status'] == '0') {
+ if ($_REQUEST['status'] == '1') {
+ $map['tab_market_altogether.status'] = ['egt', 1];
} else {
$map['tab_market_altogether.status'] = $_REQUEST['status'];
}
@@ -1044,20 +1043,20 @@ class MarketPercentageController extends ThinkController
$admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
$map['admin_id'] = $admin_id;
- if(is_administrator()||session('user_group_id') == 15||session('user_group_id') == 14||session('user_group_id') == 19||session('user_group_id') == 23) {
+ if (is_administrator() || session('user_group_id') == 15 || session('user_group_id') == 14 || session('user_group_id') == 19 || session('user_group_id') == 23) {
unset($map['admin_id']);
$admin_data = M("member")
->field("access.uid admin_id")
->join("left join sys_auth_group_access access on sys_member.uid = access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")
- ->where(['group_id'=>['in','11,12,21']])
+ ->where(['group_id' => ['in', '11,12,21']])
->select();
if ($admin_data) {
- $map['admin_id'] = ['in',array_column($admin_data,'admin_id')];
+ $map['admin_id'] = ['in', array_column($admin_data, 'admin_id')];
}
- $_REQUEST['admin_id']?($map['admin_id'] = $_REQUEST['admin_id']):'';
+ $_REQUEST['admin_id'] ? ($map['admin_id'] = $_REQUEST['admin_id']) : '';
}
$search_date = [];
@@ -1070,7 +1069,7 @@ class MarketPercentageController extends ThinkController
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
@@ -1078,14 +1077,14 @@ class MarketPercentageController extends ThinkController
} elseif (isset($_REQUEST['time_start'])) {
- $end = date("Y-m",time());
+ $end = date("Y-m", time());
$start = $_REQUEST['time_start'];
$i = 0;
do {
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
@@ -1100,14 +1099,14 @@ class MarketPercentageController extends ThinkController
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
}
}
- $data = SM("market_altogether","tab_")
+ $data = SM("market_altogether", "tab_")
->field("*")
->where($map);
@@ -1122,7 +1121,7 @@ class MarketPercentageController extends ThinkController
->select();
}
- $count = SM("market_altogether","tab_")
+ $count = SM("market_altogether", "tab_")
->where($map)
->count();
@@ -1130,7 +1129,7 @@ class MarketPercentageController extends ThinkController
if ($page) {
$this->assign('_page', $page);
}
- $this->checkListOrCountAuthRestMap($map,[]);
+ $this->checkListOrCountAuthRestMap($map, []);
$sum['performance_revenue'] = 0;
$sum['appraisal_bonuses'] = 0;
@@ -1143,14 +1142,14 @@ class MarketPercentageController extends ThinkController
foreach ($data as $key => $value) {
$level = $value['level'];
- if(isset($marketPercentage[$level])){
+ if (isset($marketPercentage[$level])) {
$value['market_percentage'] = $marketPercentage[$level];
}
- $data[$key]['start_time'] = date("Y-m-1",strtotime($value['pay_time']));
- $data[$key]['end_time'] = date("Y-m-t",strtotime($value['pay_time']));
+ $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);
+ $market_percentage = json_decode($value['market_percentage'], true);
if ($value['level'] == 21) {
$data[$key]['level'] = '初级';
@@ -1168,20 +1167,20 @@ class MarketPercentageController extends ThinkController
//两个起提流水都没达到时,不展示税后毛利
$sum_amount = $value['performance_revenue'] + $value['appraisal_bonuses'];
- if ($sum_amount<$market_percentage['performance_revenue']&&$sum_amount<$market_percentage['appraisal_bonuses']) {
+ if ($sum_amount < $market_percentage['performance_revenue'] && $sum_amount < $market_percentage['appraisal_bonuses']) {
$data[$key]['company_profit'] = "0.00";
$value['company_profit'] = "0.00";
}
- $data[$key]['coefficient'] = $this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1;
+ $data[$key]['coefficient'] = $this->coefficient[$value['pay_time']][$value['admin_id']] ? $this->coefficient[$value['pay_time']][$value['admin_id']] : 1;
$data[$key]['wait_commission'] =
- number_format($value['wait_performance_commission'] + $value['wait_achievement_commission']*($this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1), 2, '.', '');
+ number_format($value['wait_performance_commission'] + $value['wait_achievement_commission'] * ($this->coefficient[$value['pay_time']][$value['admin_id']] ? $this->coefficient[$value['pay_time']][$value['admin_id']] : 1), 2, '.', '');
$achievement_bonus = number_format($data[$key]['achievement_bonus'], 2, '.', '');
//绩效系数计算
- $data[$key]['achievement_bonus'] = number_format($data[$key]['achievement_bonus'] * ($this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1), 2, '.', '');
+ $data[$key]['achievement_bonus'] = number_format($data[$key]['achievement_bonus'] * ($this->coefficient[$value['pay_time']][$value['admin_id']] ? $this->coefficient[$value['pay_time']][$value['admin_id']] : 1), 2, '.', '');
$data[$key]['commission'] = number_format($data[$key]['performance_commission'] + $data[$key]['achievement_bonus'], 2, '.', '');;
$data[$key]['extend_commission'] = $data[$key]['commission'] - $data[$key]['wait_commission'];
@@ -1195,7 +1194,7 @@ class MarketPercentageController extends ThinkController
$sum['performance_commission'] += $value['performance_commission'];
$sum['achievement_bonus'] += $data[$key]['achievement_bonus'];
$sum['commission'] += $data[$key]['commission'];
- $sum['extend_commission'] += $data[$key]['extend_commission'] ;
+ $sum['extend_commission'] += $data[$key]['extend_commission'];
$sum['wait_commission'] += $data[$key]['wait_commission'];
}
@@ -1210,7 +1209,7 @@ class MarketPercentageController extends ThinkController
$sum['extend_commission'] = number_format($sum['extend_commission'], 2, '.', '');
$sum['wait_commission'] = number_format($sum['wait_commission'], 2, '.', '');
- $this->assign("sum",$sum);
+ $this->assign("sum", $sum);
if ($_REQUEST['export']) {
@@ -1220,33 +1219,34 @@ class MarketPercentageController extends ThinkController
'level' => '级别',
'performance_revenue' => '开发总流水',
'appraisal_bonuses' => '维护总流水',
- 'company_profit'=>'税后毛利',
+ 'company_profit' => '税后毛利',
'performance_commission' => '业绩提成',
'achievement_bonus' => '绩效考核奖金',
- 'coefficient'=>'绩效系数',
+ 'coefficient' => '绩效系数',
'commission' => '当月总提成',
'extend_commission' => '本月发放',
'wait_commission' => '本月未发',
- 'is_send'=>'剩余金额发放状态'];
+ 'is_send' => '剩余金额发放状态'];
- $data = array_merge($data,[$sum]);
+ $data = array_merge($data, [$sum]);
foreach ($data as $key => $value) {
- $data[$key]['pay_time'] = '`'.$data[$key]['pay_time'];
+ $data[$key]['pay_time'] = '`' . $data[$key]['pay_time'];
}
- data2csv($data,'个人总提成列表',$title);
+ data2csv($data, '个人总提成列表', $title);
}
$arraypage = $p;
$size = $row;//每页显示的记录数
$data = array_slice($data, ($arraypage - 1) * $size, $size);
- $this->assign("list_data",$data);
+ $this->assign("list_data", $data);
$this->display("personmarketstaffsettle");
}
- public function sendBonus() {
+ public function sendBonus()
+ {
$map['pay_time'] = $_REQUEST['pay_time'];
@@ -1254,33 +1254,33 @@ class MarketPercentageController extends ThinkController
->field("access.uid admin_id")
->join("left join sys_auth_group_access access on sys_member.uid = access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")
- ->where(['group_id'=>['in','11,12,21']])
+ ->where(['group_id' => ['in', '11,12,21']])
->select();
if ($admin_data) {
- $map['admin_id'] = ['in',array_column($admin_data,'admin_id')];
+ $map['admin_id'] = ['in', array_column($admin_data, 'admin_id')];
}
$map['admin_id'] = $_REQUEST['admin_id'];
- if (!$_REQUEST['pay_time']||!$_REQUEST['admin_id']) {
- $this->ajaxReturn(['status'=>0,'msg'=>'数据错误']);
+ if (!$_REQUEST['pay_time'] || !$_REQUEST['admin_id']) {
+ $this->ajaxReturn(['status' => 0, 'msg' => '数据错误']);
}
- $check_data = SM("market_altogether","tab_")
- ->where(['pay_time'=>$_REQUEST['pay_time'],'admin_id'=>$_REQUEST['admin_id']])
+ $check_data = SM("market_altogether", "tab_")
+ ->where(['pay_time' => $_REQUEST['pay_time'], 'admin_id' => $_REQUEST['admin_id']])
->find();
//正常发放添加判断,不让他重新发放
- if (!$_REQUEST['all']&&$check_data) {
+ if (!$_REQUEST['all'] && $check_data) {
- if ($check_data['status'] >0) {
- $this->ajaxReturn(['status'=>0,'msg'=>'已经发放过,请勿重复操作']);
+ if ($check_data['status'] > 0) {
+ $this->ajaxReturn(['status' => 0, 'msg' => '已经发放过,请勿重复操作']);
}
}
//判断是否已经离职发放过
- if($_REQUEST['all']) {
- if ($check_data['status']==2) {
- $this->ajaxReturn(['status'=>0,'msg'=>'离职发放已经发放过']);
+ if ($_REQUEST['all']) {
+ if ($check_data['status'] == 2) {
+ $this->ajaxReturn(['status' => 0, 'msg' => '离职发放已经发放过']);
}
}
@@ -1292,19 +1292,20 @@ class MarketPercentageController extends ThinkController
$save['remark'] = '离职发放';
}
- $is_save = SM("market_altogether","tab_")
+ $is_save = SM("market_altogether", "tab_")
->where($map)
->save($save);
if ($is_save) {
- $this->ajaxReturn(['status'=>1,'msg'=>'发放成功']);
+ $this->ajaxReturn(['status' => 1, 'msg' => '发放成功']);
} else {
- $this->ajaxReturn(['status'=>0,'msg'=>'发放失败']);
+ $this->ajaxReturn(['status' => 0, 'msg' => '发放失败']);
}
}
- public function reCaculateBonus() {
+ public function reCaculateBonus()
+ {
$pay_time = $_REQUEST['pay_time'];
@@ -1315,16 +1316,17 @@ class MarketPercentageController extends ThinkController
// var_dump("cd ".ROOTTT.";php admin.php timing/caculateMarketStream/time/{$pay_time} > /dev/null &");die();
- exec("source /etc/profile;cd ".ROOTTT.";php ".SUBSITE_INDEX." timing/caculateMarketStream/time/{$pay_time} > /dev/null &");
+ exec("source /etc/profile;cd " . ROOTTT . ";php " . SUBSITE_INDEX . " timing/caculateMarketStream/time/{$pay_time} > /dev/null &");
- $this->ajaxReturn(['status'=>1]);
+ $this->ajaxReturn(['status' => 1]);
}
- public function showBonusList($row = 10, $p = 1) {
+ public function showBonusList($row = 10, $p = 1)
+ {
//排序
- if(!array_key_exists("time_start",$_REQUEST)){
- $this->redirect(ACTION_NAME, array('time_start' => date('Y-m',strtotime('-1 month')),"time_end"=>date('Y-m',strtotime('-1 month'))));
+ if (!array_key_exists("time_start", $_REQUEST)) {
+ $this->redirect(ACTION_NAME, array('time_start' => date('Y-m', strtotime('-1 month')), "time_end" => date('Y-m', strtotime('-1 month'))));
}
$map = [];
@@ -1333,16 +1335,16 @@ class MarketPercentageController extends ThinkController
->field("access.uid admin_id")
->join("left join sys_auth_group_access access on sys_member.uid = access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")
- ->where(['group_id'=>['in','11,12,21']])
+ ->where(['group_id' => ['in', '11,12,21']])
->select();
if ($admin_data) {
- $map['tab_market_altogether.admin_id'] = ['in',array_column($admin_data,'admin_id')];
+ $map['tab_market_altogether.admin_id'] = ['in', array_column($admin_data, 'admin_id')];
}
- $_REQUEST['pay_time']?$map['tab_market_altogether.pay_time'] = $_REQUEST['pay_time']:'';
- $_REQUEST['real_name']?$map['tab_market_altogether.real_name'] = $_REQUEST['real_name']:'';
- $_REQUEST['nickname']?$map['tab_market_altogether..nickname'] = $_REQUEST['nickname']:'';
- $_REQUEST['level']?$map['level'] = $_REQUEST['level']:'';
+ $_REQUEST['pay_time'] ? $map['tab_market_altogether.pay_time'] = $_REQUEST['pay_time'] : '';
+ $_REQUEST['real_name'] ? $map['tab_market_altogether.real_name'] = $_REQUEST['real_name'] : '';
+ $_REQUEST['nickname'] ? $map['tab_market_altogether..nickname'] = $_REQUEST['nickname'] : '';
+ $_REQUEST['level'] ? $map['level'] = $_REQUEST['level'] : '';
$search_date = [];
@@ -1355,7 +1357,7 @@ class MarketPercentageController extends ThinkController
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['tab_market_altogether.pay_time'] = ['in', $search_date];
@@ -1363,14 +1365,14 @@ class MarketPercentageController extends ThinkController
} elseif (isset($_REQUEST['time_start'])) {
- $end = date("Y-m",time());
+ $end = date("Y-m", time());
$start = $_REQUEST['time_start'];
$i = 0;
do {
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['tab_market_altogether.pay_time'] = ['in', $search_date];
@@ -1385,19 +1387,19 @@ class MarketPercentageController extends ThinkController
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
- }while ($date < date('Y-m', strtotime("{$end}")));
+ } while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['tab_market_altogether.pay_time'] = ['in', $search_date];
}
}
- if($_REQUEST['pay_time']) {
- if (in_array($_REQUEST['pay_time'],$search_date)) {
+ if ($_REQUEST['pay_time']) {
+ if (in_array($_REQUEST['pay_time'], $search_date)) {
$map['tab_market_altogether.pay_time'] = $_REQUEST['pay_time'];
- } elseif(isset($_REQUEST['time_start']) || isset($_REQUEST['time_end'])) {
- $this->checkListOrCountAuthRestMap($map,[]);
- $this->assign("list_data",[]);
+ } elseif (isset($_REQUEST['time_start']) || isset($_REQUEST['time_end'])) {
+ $this->checkListOrCountAuthRestMap($map, []);
+ $this->assign("list_data", []);
$this->display("showbonuslist");
die();
} else {
@@ -1405,7 +1407,7 @@ class MarketPercentageController extends ThinkController
}
}
- $data = SM("market_altogether","tab_")
+ $data = SM("market_altogether", "tab_")
->field("max(tab_market_altogether.pay_time) pay_time,tab_market_altogether.real_name,tab_market_altogether.admin_id,tab_market_altogether.nickname,level,sum(pay_amount) pay_amount,sum(extend_commission) extend_commission,
sum(performance_commission) performance_commission,sum(achievement_bonus* IF(coefficient is not NULL, coefficient, 100)/100) achievement_bonus,
sum(wait_performance_commission)+sum(wait_achievement_commission) wait_amount,
@@ -1442,7 +1444,7 @@ class MarketPercentageController extends ThinkController
$sum['extend_commission'] = 0;
$sum['wait_commission'] = 0;
- foreach($data as $key => $value) {
+ foreach ($data as $key => $value) {
// dump($value);
if ($value['level'] == 21) {
$data[$key]['level'] = '初级';
@@ -1461,8 +1463,8 @@ class MarketPercentageController extends ThinkController
// number_format($value['wait_performance_commission'] + $value['wait_achievement_commission']*($this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1), 2, '.', '');
$data[$key]['extend_commission'] = number_format($data[$key]['commission'] - $data[$key]['wait_commission'], 2, '.', '');
- $data[$key]['pay_amount'] = number_format($data[$key]['pay_amount'] , 2, '.', '');
- $data[$key]['wait_commission'] = number_format($data[$key]['wait_commission'] , 2, '.', '');
+ $data[$key]['pay_amount'] = number_format($data[$key]['pay_amount'], 2, '.', '');
+ $data[$key]['wait_commission'] = number_format($data[$key]['wait_commission'], 2, '.', '');
// $data[$key]['all_commission'] = $data[$key]['wait_amount'] + ;
$sum['pay_amount'] += $data[$key]['pay_amount'];
@@ -1476,10 +1478,10 @@ class MarketPercentageController extends ThinkController
$sum['extend_commission'] = number_format($sum['extend_commission'], 2, '.', '');;
$sum['wait_commission'] = number_format($sum['wait_commission'], 2, '.', '');;
- $_REQUEST['time_start']?($start_time = date("Y-m-1",strtotime($_REQUEST['time_start']))):$start_time = date("Y-m-1",strtotime(''));
- $_REQUEST['time_end']?($end_time = date("Y-m-t",strtotime($_REQUEST['time_end']))):'';
- $this->assign('start_time',$start_time);
- $this->assign('end_time',$end_time);
+ $_REQUEST['time_start'] ? ($start_time = date("Y-m-1", strtotime($_REQUEST['time_start']))) : $start_time = date("Y-m-1", strtotime(''));
+ $_REQUEST['time_end'] ? ($end_time = date("Y-m-t", strtotime($_REQUEST['time_end']))) : '';
+ $this->assign('start_time', $start_time);
+ $this->assign('end_time', $end_time);
if ($_REQUEST['export']) {
@@ -1487,16 +1489,16 @@ class MarketPercentageController extends ThinkController
'nickname' => '账号',
'level' => '级别',
'pay_amount' => '总流水',
- 'commission'=>'总提成',
+ 'commission' => '总提成',
'extend_commission' => '已发放总提成',
- 'wait_commission'=>'剩余未发放总提成'];
+ 'wait_commission' => '剩余未发放总提成'];
- $data = array_merge($data,[$sum]);
+ $data = array_merge($data, [$sum]);
- data2csv($data,'提成汇总结算单',$title);
+ data2csv($data, '提成汇总结算单', $title);
}
- $count = SM("market_altogether","tab_")
+ $count = SM("market_altogether", "tab_")
->field("admin_id")
->where($map)
->group("admin_id")
@@ -1512,15 +1514,16 @@ class MarketPercentageController extends ThinkController
$size = $row;//每页显示的记录数
$data = array_slice($data, ($arraypage - 1) * $size, $size);
- $this->checkListOrCountAuthRestMap($map,[]);
+ $this->checkListOrCountAuthRestMap($map, []);
- $this->assign("sum",$sum);
- $this->assign("list_data",$data);
+ $this->assign("sum", $sum);
+ $this->assign("list_data", $data);
$this->display("showbonuslist");
}
- public function editTaxRatio() {
+ public function editTaxRatio()
+ {
if (IS_POST) {
@@ -1536,91 +1539,96 @@ class MarketPercentageController extends ThinkController
$data['time'] = strtotime($data['timestart']);
$data['create_time'] = time();
- $is_hav = M("tax_radio","tab_")
- ->where(['time'=>strtotime($data['timestart'])])
+ $is_hav = M("tax_radio", "tab_")
+ ->where(['time' => strtotime($data['timestart'])])
->find();
- M("tax_radio","tab_")
- ->where(['time'=>['gt',strtotime($data['timestart'])]])
+ M("tax_radio", "tab_")
+ ->where(['time' => ['gt', strtotime($data['timestart'])]])
->delete();
if ($is_hav) {
- $is_save = M("tax_radio","tab_")
- ->where(['time'=>strtotime($data['timestart'])])
+ $is_save = M("tax_radio", "tab_")
+ ->where(['time' => strtotime($data['timestart'])])
->save($data);
} else {
- $is_save = M("tax_radio","tab_")->add($data);
+ $is_save = M("tax_radio", "tab_")->add($data);
}
- $this->success("保存成功",U("index"));
+ $this->success("保存成功", U("index"));
} else {
- $data = M("tax_radio","tab_")
+ $data = M("tax_radio", "tab_")
->field("tax_radio,time timestart")
->order("create_time DESC")
->find();
- $data['timestart'] = Date("Y-m",$data['timestart']);
+ $data['timestart'] = Date("Y-m", $data['timestart']);
- $this->assign('data',$data);
+ $this->assign('data', $data);
$this->display("edittaxratio");
}
}
+
//市场部确认操作
- public function doMarketCheck() {
+ public function doMarketCheck()
+ {
$ids = $_REQUEST['ids'];
if (!$ids) {
- $this->ajaxReturn(['status'=>0,'info'=>'操作失败,id不能为空']);
+ $this->ajaxReturn(['status' => 0, 'info' => '操作失败,id不能为空']);
}
$admin = $_SESSION['onethink_admin']['user_auth']['username'];
- $market_check_detail = "市场部已确认({$admin})
".date("Y-m-d H:i:s",time());
+ $market_check_detail = "市场部已确认({$admin})
" . date("Y-m-d H:i:s", time());
- $is_save = SM("market_altogether","tab_")
- ->where(['id'=>['in',$ids],'market_check'=>0])
- ->save(['market_check'=>1,'market_check_detail'=>$market_check_detail]);
+ $is_save = SM("market_altogether", "tab_")
+ ->where(['id' => ['in', $ids], 'market_check' => 0])
+ ->save(['market_check' => 1, 'market_check_detail' => $market_check_detail]);
if (!$is_save) {
- $this->ajaxReturn(['status'=>0,'info'=>'操作失败']);
+ $this->ajaxReturn(['status' => 0, 'info' => '操作失败']);
}
- $this->ajaxReturn(['status'=>1,'info'=>'市场部确认成功']);
+ $this->ajaxReturn(['status' => 1, 'info' => '市场部确认成功']);
}
+
//财务部审批操作
- public function doFinanceCheck() {
+ public function doFinanceCheck()
+ {
$ids = $_REQUEST['ids'];
if (!$ids) {
- $this->ajaxReturn(['status'=>0,'info'=>'操作失败,id不能为空']);
+ $this->ajaxReturn(['status' => 0, 'info' => '操作失败,id不能为空']);
}
$admin = $_SESSION['onethink_admin']['user_auth']['username'];
- $finance_check_detail = "财务部已审批({$admin})
".date("Y-m-d H:i:s",time());
+ $finance_check_detail = "财务部已审批({$admin})
" . date("Y-m-d H:i:s", time());
- $is_save = SM("market_altogether","tab_")
- ->where(['id'=>['in',$ids],'finance_check'=>0])
- ->save(['finance_check'=>1,'finance_check_detail'=>$finance_check_detail]);
+ $is_save = SM("market_altogether", "tab_")
+ ->where(['id' => ['in', $ids], 'finance_check' => 0])
+ ->save(['finance_check' => 1, 'finance_check_detail' => $finance_check_detail]);
if (!$is_save) {
- $this->ajaxReturn(['status'=>0,'info'=>'操作失败']);
+ $this->ajaxReturn(['status' => 0, 'info' => '操作失败']);
}
- $this->ajaxReturn(['status'=>1,'info'=>'财务部审批成功']);
+ $this->ajaxReturn(['status' => 1, 'info' => '财务部审批成功']);
}
- public function companybelonggame($row = 10, $p = 1) {
+ public function companybelonggame($row = 10, $p = 1)
+ {
if ($_REQUEST['relation_game_id']) {
$game_id = $_REQUEST['relation_game_id'];
- $where['game_ids'] = ['like',"%,{$game_id},%"];
+ $where['game_ids'] = ['like', "%,{$game_id},%"];
}
@@ -1628,17 +1636,17 @@ class MarketPercentageController extends ThinkController
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$time_start = strtotime($_REQUEST['time_start']);
- $time_end = strtotime($_REQUEST['time_end'])+ 86399;
- $where["_string"] = "(begin_time BETWEEN {$time_start} AND {$time_end}) OR (end_time BETWEEN {$time_start} AND {$time_end}) OR (begin_time <= {$time_end} AND end_time >= {$time_end}) OR (begin_time >0 AND end_time = 0)";
+ $time_end = strtotime($_REQUEST['time_end']) + 86399;
+ $where["_string"] = "(begin_time BETWEEN {$time_start} AND {$time_end}) OR (end_time BETWEEN {$time_start} AND {$time_end}) OR (begin_time <= {$time_end} AND end_time >= {$time_end}) OR (begin_time >0 AND end_time = 0)";
} elseif (isset($_REQUEST['time_start'])) {
$time_start = strtotime($_REQUEST['time_start']);
- $where["_string"] = "end_time >= {$time_start} OR end_time = 0";
+ $where["_string"] = "end_time >= {$time_start} OR end_time = 0";
} elseif (isset($_REQUEST['time_end'])) {
- $time_end = strtotime($_REQUEST['time_end'])+ 86399;
- $where["_string"] = "begin_time <= {$time_end}";
+ $time_end = strtotime($_REQUEST['time_end']) + 86399;
+ $where["_string"] = "begin_time <= {$time_end}";
}
- $data = M("company_belong_game","tab_")
+ $data = M("company_belong_game", "tab_")
->where($where)
->page($p, $row)
->order("begin_time DESC")
@@ -1646,12 +1654,12 @@ class MarketPercentageController extends ThinkController
foreach ($data as $key => $value) {
- $data[$key]["begin_time"] = date("Y.m.d",$value['begin_time']);
+ $data[$key]["begin_time"] = date("Y.m.d", $value['begin_time']);
- if($value['end_time'] == 0) {
+ if ($value['end_time'] == 0) {
$data[$key]["end_time"] = "永久";
- } else{
- $data[$key]["end_time"] = date("Y.m.d",$value['end_time']);
+ } else {
+ $data[$key]["end_time"] = date("Y.m.d", $value['end_time']);
}
$where_game = $value['game_ids'];
@@ -1662,9 +1670,9 @@ class MarketPercentageController extends ThinkController
$game = [];
if ($where_game) {
- $game = M("game","tab_")
+ $game = M("game", "tab_")
->field("original_package_name,relation_game_name,relation_game_id,game_type_name")
- ->where(['relation_game_id'=>['in',$where_game]])
+ ->where(['relation_game_id' => ['in', $where_game]])
->group("relation_game_id")
->select();
}
@@ -1673,7 +1681,7 @@ class MarketPercentageController extends ThinkController
}
- $count = M("company_belong_game","tab_")
+ $count = M("company_belong_game", "tab_")
->where($where)
->count();
@@ -1682,14 +1690,14 @@ class MarketPercentageController extends ThinkController
$this->assign('_page', $page);
}
- $this->assign("gameList",D("Game")->getRelationGameLits());
- $this->assign("data",$data);
+ $this->assign("gameList", D("Game")->getRelationGameLits());
+ $this->assign("data", $data);
$this->display();
}
- public function addcompanybelonggame() {
-
+ public function addcompanybelonggame()
+ {
if (IS_POST) {
@@ -1697,45 +1705,45 @@ class MarketPercentageController extends ThinkController
$data = $_POST;
if (!$data['begin_time']) {
- $this->ajaxReturn(['msg'=>"起始时间必填","status"=>0]);
+ $this->ajaxReturn(['msg' => "起始时间必填", "status" => 0]);
}
if (!$data['game_ids']) {
- $this->ajaxReturn(['msg'=>"请选择推广游戏","status"=>0]);
+ $this->ajaxReturn(['msg' => "请选择推广游戏", "status" => 0]);
}
- $data['game_ids'] = explode(',',$data['game_ids']);
- $data['game_ids'] = array_merge([''],$data['game_ids'],['']);
- $data['game_ids'] = implode(',',$data['game_ids']);
+ $data['game_ids'] = explode(',', $data['game_ids']);
+ $data['game_ids'] = array_merge([''], $data['game_ids'], ['']);
+ $data['game_ids'] = implode(',', $data['game_ids']);
$data['begin_time'] = strtotime($data['begin_time']);
$data['end_time'] = strtotime($data['end_time']);
$time_start = $data['begin_time'];
- if($data['end_time']) {
+ if ($data['end_time']) {
$time_end = $data['end_time'];
} else {
$time_end = 99999999999;
}
- $last_month = strtotime(date('Y-m-t',strtotime("-2 month")));
+ $last_month = strtotime(date('Y-m-t', strtotime("-2 month")));
if ($data['begin_time'] < $last_month) {
- $this->ajaxReturn(['msg'=>"已经结算过的时间不能添加","status"=>0]);
+ $this->ajaxReturn(['msg' => "已经结算过的时间不能添加", "status" => 0]);
}
- $belong_game = M("company_belong_game","tab_")
+ $belong_game = M("company_belong_game", "tab_")
->where("((begin_time<={$time_start} and (end_time >={$time_start} or end_time=0)) or (begin_time<={$time_end} and end_time >={$time_end}) or (end_time>={$time_start} and end_time <={$time_end}))")
->select();
if ($belong_game) {
- $this->ajaxReturn(['msg'=>"重复时间段,请勿重复添加","status"=>0]);
+ $this->ajaxReturn(['msg' => "重复时间段,请勿重复添加", "status" => 0]);
}
- M("company_belong_game","tab_")->add($data);
+ M("company_belong_game", "tab_")->add($data);
- $this->ajaxReturn(['msg'=>"添加成功,请到对应时间段市场业绩重新结算,否则数据可能无法对上","status"=>1]);
+ $this->ajaxReturn(['msg' => "添加成功,请到对应时间段市场业绩重新结算,否则数据可能无法对上", "status" => 1]);
} else {
$this->display();
@@ -1744,7 +1752,8 @@ class MarketPercentageController extends ThinkController
}
- public function editcompanybelonggame() {
+ public function editcompanybelonggame()
+ {
$id = $_REQUEST["id"];
@@ -1752,16 +1761,16 @@ class MarketPercentageController extends ThinkController
$data = $_POST;
if (!$data['begin_time'] && !$data['is_start']) {
- $this->ajaxReturn(['msg'=>"起始时间必填","status"=>0]);
+ $this->ajaxReturn(['msg' => "起始时间必填", "status" => 0]);
}
if (!$data['game_ids']) {
- $this->ajaxReturn(['msg'=>"请选择推广游戏","status"=>0]);
+ $this->ajaxReturn(['msg' => "请选择推广游戏", "status" => 0]);
}
// $data['game_ids'] = json_encode($data['game_ids']);
- $data['game_ids'] = explode(',',$data['game_ids']);
+ $data['game_ids'] = explode(',', $data['game_ids']);
foreach ($data['game_ids'] as $key => $value) {
if ($value == "0") {
@@ -1769,14 +1778,14 @@ class MarketPercentageController extends ThinkController
}
}
- $data['game_ids'] = array_merge([''],$data['game_ids'],['']);
- $data['game_ids'] = implode(',',$data['game_ids']);
+ $data['game_ids'] = array_merge([''], $data['game_ids'], ['']);
+ $data['game_ids'] = implode(',', $data['game_ids']);
$time_start = strtotime($data['begin_time']);
- if($data['end_time']) {
+ if ($data['end_time']) {
$time_end = strtotime($data['end_time']);
} else {
$time_end = 99999999999;
@@ -1785,34 +1794,31 @@ class MarketPercentageController extends ThinkController
$data['begin_time'] = strtotime($data['begin_time']);
$data['end_time'] = strtotime($data['end_time']);
- $company_belong_game_data = M("company_belong_game","tab_")->where(['id'=>$id])->find();
+ $company_belong_game_data = M("company_belong_game", "tab_")->where(['id' => $id])->find();
if ($data['is_start']) {
$time_start = $company_belong_game_data['begin_time'];
$data['begin_time'] = $company_belong_game_data['begin_time'];
}
- $last_month = strtotime(date('Y-m-t',strtotime("-2 month")));
+ $last_month = strtotime(date('Y-m-t', strtotime("-2 month")));
- if ($company_belong_game_data['end_time'] > $last_month && $data['end_time'] < $last_month)
- {
+ if ($company_belong_game_data['end_time'] > $last_month && $data['end_time'] < $last_month) {
$time_end = $last_month;
$data['end_time'] = $last_month;
// $this->ajaxReturn(['msg'=>"过去已结算过的比例不能修改","status"=>0]);
}
- $last_month_first = strtotime(date('Y-m-1',strtotime("-1 month")));
- if ($company_belong_game_data['begin_time'] > $last_month && $data['begin_time'] < $last_month)
- {
+ $last_month_first = strtotime(date('Y-m-1', strtotime("-1 month")));
+ if ($company_belong_game_data['begin_time'] > $last_month && $data['begin_time'] < $last_month) {
// $time_end = $last_month;
$data['begin_time'] = $last_month_first;
// $this->ajaxReturn(['msg'=>"过去已结算过的比例不能修改","status"=>0]);
}
-
if ($data['begin_time'] < $last_month && $data['end_time'] <= $last_month) {
- if($company_belong_game_data['end_time']<= $last_month) {
+ if ($company_belong_game_data['end_time'] <= $last_month) {
$data['end_time'] = $company_belong_game_data['end_time'];
} else {
$data['end_time'] = $last_month;
@@ -1821,11 +1827,11 @@ class MarketPercentageController extends ThinkController
}
if ($_POST['end_time']) {
- $belong_game = M("company_belong_game","tab_")
+ $belong_game = M("company_belong_game", "tab_")
->where("((begin_time<={$time_start} and (end_time >={$time_start} or end_time=0)) or (begin_time<={$time_end} and end_time >={$time_end}) or (end_time>={$time_start} and end_time <={$time_end})) and id != {$id}")
->select();
} else {
- $belong_game = M("company_belong_game","tab_")
+ $belong_game = M("company_belong_game", "tab_")
->where("(begin_time>={$time_start} or (end_time >={$time_start})) and id != {$id}")
->select();
}
@@ -1833,114 +1839,116 @@ class MarketPercentageController extends ThinkController
if ($belong_game) {
- $this->ajaxReturn(['msg'=>"重复时间段,请勿重复添加","status"=>0]);
+ $this->ajaxReturn(['msg' => "重复时间段,请勿重复添加", "status" => 0]);
}
- M("company_belong_game","tab_")->where(['id'=>$id])->save($data);
+ M("company_belong_game", "tab_")->where(['id' => $id])->save($data);
- $this->ajaxReturn(['msg'=>"编辑成功,请到对应时间段市场业绩重新结算,否则数据可能无法对上","status"=>1]);
+ $this->ajaxReturn(['msg' => "编辑成功,请到对应时间段市场业绩重新结算,否则数据可能无法对上", "status" => 1]);
} else {
- $data = M("company_belong_game","tab_")
- ->where(['id'=>$id])
+ $data = M("company_belong_game", "tab_")
+ ->where(['id' => $id])
->find();
// $data['game_ids'] = json_encode(explode(',',$data['game_ids']));
- $game_ids = explode(',',$data['game_ids']);
+ $game_ids = explode(',', $data['game_ids']);
- $data['game_ids'] = explode(',',$data['game_ids']);
+ $data['game_ids'] = explode(',', $data['game_ids']);
- foreach($game_ids as $key => $value) {
+ foreach ($game_ids as $key => $value) {
if ($value == "\"") {
unset($game_ids[$key]);
} else {
- $game_ids[$key] = $value-0;
+ $game_ids[$key] = $value - 0;
}
}
$data['is_start'] = 0;
- if($data['begin_time']field("relation_game_name")
- ->where(['relation_game_id'=>['in',$data['ids']]])
+ $game = M("game", "tab_")->field("relation_game_name")
+ ->where(['relation_game_id' => ['in', $data['ids']]])
->group("relation_game_id")
->select();
$span_str = "";
foreach ($game as $key => $value) {
$span_str .= "{$value['relation_game_name']}";
- if (($key+1)%5 == 0) {
+ if (($key + 1) % 5 == 0) {
$span_str .= "
";
}
}
$data['span_str'] = $span_str;
}
- $this->assign("data",$data);
+ $this->assign("data", $data);
$this->display();
}
}
- public function delcompanybelonggame() {
+ public function delcompanybelonggame()
+ {
$id = $_REQUEST["id"];
if (!$id) {
- $this->ajaxReturn(['msg'=>"参数传递错误","status"=>0]);
+ $this->ajaxReturn(['msg' => "参数传递错误", "status" => 0]);
}
- $data = M("company_belong_game","tab_")
- ->where(['id'=>$id])
+ $data = M("company_belong_game", "tab_")
+ ->where(['id' => $id])
->find();
- if (date("m",$data['begin_time']) < date("m",strtotime('-1 month'))) {
- $this->ajaxReturn(['msg'=>"过去已结算过的比例不能删除","status"=>0]);
+ if (date("m", $data['begin_time']) < date("m", strtotime('-1 month'))) {
+ $this->ajaxReturn(['msg' => "过去已结算过的比例不能删除", "status" => 0]);
}
- $is_del = M("company_belong_game","tab_")
- ->where(['id'=>$id])
+ $is_del = M("company_belong_game", "tab_")
+ ->where(['id' => $id])
->delete();
if ($is_del) {
- $this->ajaxReturn(['msg'=>"删除成功,请到对应时间段市场业绩重新结算,否则数据可能无法对上","status"=>1]);
+ $this->ajaxReturn(['msg' => "删除成功,请到对应时间段市场业绩重新结算,否则数据可能无法对上", "status" => 1]);
} else {
- $this->ajaxReturn(['msg'=>"删除失败","status"=>0]);
+ $this->ajaxReturn(['msg' => "删除失败", "status" => 0]);
}
}
- public function showGame() {
+ public function showGame()
+ {
$data = $_REQUEST;
if (!$data['game_ids']) {
- $this->ajaxReturn(['msg'=>"请选择游戏后点击确定","status"=>0]);
+ $this->ajaxReturn(['msg' => "请选择游戏后点击确定", "status" => 0]);
}
- $game_data = M("game","tab_")
+ $game_data = M("game", "tab_")
->field("relation_game_name,relation_game_id,game_type_name")
- ->where(['relation_game_id'=>['in',$data['game_ids']]])
+ ->where(['relation_game_id' => ['in', $data['game_ids']]])
->group("relation_game_id")
->select();
- $this->ajaxReturn(['msg'=>"选择游戏成功","status"=>1,"data"=>$game_data]);
+ $this->ajaxReturn(['msg' => "选择游戏成功", "status" => 1, "data" => $game_data]);
}
@@ -1956,7 +1964,7 @@ class MarketPercentageController extends ThinkController
$games = M('game', 'tab_')
->field('relation_game_id id,relation_game_name game_name,short')
- ->where(['game_status'=>1])
+ ->where(['game_status' => 1])
->group("relation_game_id")
->select();
$data['data']['game_list'] = empty($games) ? '' : $games;
@@ -1969,4 +1977,32 @@ class MarketPercentageController extends ThinkController
}
}
+ //模板导出
+ public function downloadCoefficient()
+ {
+ header("Content-type: text/html; charset=utf-8");
+ error_reporting(E_ALL);
+ ini_set('display_errors', TRUE);
+ ini_set('display_startup_errors', TRUE);
+
+ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
');
+
+ Vendor("PHPExcel.PHPExcel");
+ $objPHPExcel = new \PHPExcel();
+ $objReader = \PHPExcel_IOFactory::createReader('Excel2007');
+
+ //设置模板文件
+ $objPHPExcel = $objReader->load("Public/Admin/excel/coefficient.xlsx");
+
+ $fileName = "绩效导入模板";
+
+ ob_end_clean();//清除缓冲区,避免乱码
+ header('pragma:public');
+ header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls');
+ header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印
+ $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+ $objWriter->save('php://output');
+ exit;
+ }
+
}
diff --git a/Application/Admin/View/MarketPercentage/addcoefficient.html b/Application/Admin/View/MarketPercentage/addcoefficient.html
index 15f0f19e1..1e3af9780 100644
--- a/Application/Admin/View/MarketPercentage/addcoefficient.html
+++ b/Application/Admin/View/MarketPercentage/addcoefficient.html
@@ -104,6 +104,9 @@
+
+ 下载模板
+
返回
diff --git a/Application/Payment/Controller/ExcelPaymentController.class.php b/Application/Payment/Controller/ExcelPaymentController.class.php
index 67571effc..65c35b158 100644
--- a/Application/Payment/Controller/ExcelPaymentController.class.php
+++ b/Application/Payment/Controller/ExcelPaymentController.class.php
@@ -534,4 +534,32 @@ class ExcelPaymentController extends BaseController
}
+ //模板导出
+ public function downloadTemplate()
+ {
+ header("Content-type: text/html; charset=utf-8");
+ error_reporting(E_ALL);
+ ini_set('display_errors', TRUE);
+ ini_set('display_startup_errors', TRUE);
+
+ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
');
+
+ Vendor("PHPExcel.PHPExcel");
+ $objPHPExcel = new \PHPExcel();
+ $objReader = \PHPExcel_IOFactory::createReader('Excel2007');
+
+ //设置模板文件
+ $objPHPExcel = $objReader->load("Public/Admin/excel/underPayment.xlsx");
+
+ $fileName = "线下打款导入模板";
+
+ ob_end_clean();//清除缓冲区,避免乱码
+ header('pragma:public');
+ header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls');
+ header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印
+ $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+ $objWriter->save('php://output');
+ exit;
+ }
+
}
diff --git a/Application/Payment/View/ExcelPayment/add.html b/Application/Payment/View/ExcelPayment/add.html
index 62e13cf36..cffad901b 100644
--- a/Application/Payment/View/ExcelPayment/add.html
+++ b/Application/Payment/View/ExcelPayment/add.html
@@ -53,6 +53,9 @@
+
+ 下载模板
+
返回
diff --git a/Public/Admin/excel/coefficient.xlsx b/Public/Admin/excel/coefficient.xlsx
new file mode 100644
index 000000000..aa1f865fc
Binary files /dev/null and b/Public/Admin/excel/coefficient.xlsx differ
diff --git a/Public/Admin/excel/underPayment.xlsx b/Public/Admin/excel/underPayment.xlsx
new file mode 100644
index 000000000..3bd460b5a
Binary files /dev/null and b/Public/Admin/excel/underPayment.xlsx differ