@ -20,6 +20,7 @@ class MarketPercentageController extends ThinkController
$_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']?($map['company_id'] = $_REQUEST['company_id']):'';
$admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
$map['admin_id'] = $admin_id;
@ -87,7 +88,7 @@ class MarketPercentageController extends ThinkController
// var_dump($map);die();
$data = M("settleup_marketorder","tab_")
->field("pay_time,promote_account,company_belong,member.real_name,develop_type,game_name,
->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")
->join("left join sys_member member on member.uid=admin_id");
@ -225,11 +226,8 @@ class MarketPercentageController extends ThinkController
die();
}
}
$search_date = [];
if (isset($_REQUEST['time_start']) & & isset($_REQUEST['time_end'])) {
@ -308,12 +306,21 @@ class MarketPercentageController extends ThinkController
->where($map)
->count();
$page = set_pagination($ count, $row);
$page = set_pagination(count($data) , $row);
if ($page) {
$this->assign('_page', $page);
}
$this->checkListOrCountAuthRestMap($map,[]);
if(IS_ROOT){
$this->assign('market_check',true);
$this->assign('finance_check',true);
}else {
$exportRule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME . "_market_check");
$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')));
}
$all_data = M("market_altogether","tab_")
// ->where($map)
@ -333,9 +340,18 @@ class MarketPercentageController extends ThinkController
$sum['commission'] = 0;
$sum['extend_commission'] = 0;
$sum['wait_commission'] = 0;
$admin = $_SESSION['onethink_admin']['user_auth']['username'];
foreach ($data as $key => $value) {
if ($_REQUEST['export'] & & session('user_group_id') == 23) {
if (!$value['market_check'] || !$value['finance_check']) {
unset($data[$key]);
continue;
}
}
$data[$key]['start_time'] = date("Y-m-1",strtotime($value['pay_time']));
$data[$key]['end_time'] = date("Y-m-t",strtotime($value['pay_time']));
@ -347,6 +363,19 @@ class MarketPercentageController extends ThinkController
$data[$key]['level'] = '高级';
}
if(!$value['market_check']) {
$data[$key]['market_check_detail'] = "市场部未确认({$admin}) < br > ".date("Y-m-d H:m:s",time());
}
if (!$value['finance_check']) {
$data[$key]['finance_check_detail'] = "财务部未审批({$admin}) < br > ".date("Y-m-d H:m:s",time());
}
if ($_REQUEST['export']) {
$data[$key]['market_check_detail'] = str_replace("< br > ",'',$data[$key]['market_check_detail']);
$data[$key]['finance_check_detail'] = str_replace("< br > ",'',$data[$key]['finance_check_detail']);
}
$market_percentage = json_decode($value['market_percentage'],true);
//开发业绩提成比例
$data[$key]['develop_commission_ratio'] = $market_percentage['develop_commission_ratio'];
@ -505,7 +534,9 @@ class MarketPercentageController extends ThinkController
'achievement_bonus' => '绩效考核奖金',
'commission' => '当月合计',
'extend_commission' => '应发金额',
'wait_commission' => '待发金额'];
'wait_commission' => '待发金额',
'market_check_detail' => '市场部确认',
'finance_check_detail' => '财务部审批'];
foreach ($data as $key => $value) {
$line = $key+2;
@ -1151,5 +1182,50 @@ class MarketPercentageController extends ThinkController
}
}
//市场部确认操作
public function doMarketCheck() {
$ids = $_REQUEST['ids'];
if (!$ids) {
$this->ajaxReturn(['status'=>0,'info'=>'操作失败,id不能为空']);
}
$admin = $_SESSION['onethink_admin']['user_auth']['username'];
$market_check_detail = "市场部已确认({$admin}) < br > ".date("Y-m-d H:m:s",time());
$is_save = M("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'=>1,'info'=>'市场部确认成功']);
}
//财务部审批操作
public function doFinanceCheck() {
$ids = $_REQUEST['ids'];
if (!$ids) {
$this->ajaxReturn(['status'=>0,'info'=>'操作失败,id不能为空']);
}
$admin = $_SESSION['onethink_admin']['user_auth']['username'];
$finance_check_detail = "财务部已确认({$admin}) < br > ".date("Y-m-d H:m:s",time());
$is_save = M("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'=>1,'info'=>'市场部确认成功']);
}
}