diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index 6e421beb5..85ee9ffe5 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -231,7 +231,12 @@ class CompanyStatementController extends ThinkController //上游 $this->display("viewCpStatement"); }else{ - $this->display("viewPcStatement"); + if($dbres["company_type"] == 1){ + $this->display("viewPcStatement"); + }else{ + $this->display("viewPuStatement"); + } + } } //编辑 diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php index 9ef0e726a..947eb621d 100644 --- a/Application/Admin/Controller/CompanyStatementSetController.class.php +++ b/Application/Admin/Controller/CompanyStatementSetController.class.php @@ -438,7 +438,7 @@ class CompanyStatementSetController extends Controller { return ; } //获取pc公司 - $tmpp = M("PromoteCompany","tab_")->field("id,company_name partner,settlement_contact link_man,contact_phone link_phone,address,bank_address payee_name,bank_card bank_account,fax_ratio,company_belong,company_type,ali_user,ali_account")->where(["id"=>['in',$pc_id]])->select(); + $tmpp = M("PromoteCompany","tab_")->field("id,uid,company_name partner,settlement_contact link_man,contact_phone link_phone,address,bank_address payee_name,bank_card bank_account,fax_ratio,company_belong,company_type,ali_user,ali_account")->where(["id"=>['in',$pc_id]])->select(); $pc =[]; foreach ($tmpp as $v) { $pc[$v['id']]=$v; @@ -462,22 +462,33 @@ class CompanyStatementSetController extends Controller { $RewardRecord = M("RewardRecord","tab_"); foreach($pcList as $k=>$v){ $add_data=[]; + $is_pu = ($add_data['company_type'] == 1 ? false :true);//是否是个人 //1.获取甲乙方信息 if($v['first_company_type'] == 1){ - //甲方上游 + //甲方合作 $pc[$v['first_company_id']]['invoice_type'] = $v['invoice_type']; $pc[$v['first_company_id']]['invoice_content'] = $v['invoice_content']; + if($is_pu){ + //个人获取外信息 + $pc[$v['first_company_id']] = $this->getCompanyOtherInfo($pc[$v['first_company_id']],$v['first_company_id']); + } + $add_data['first_party_info'] = json_encode($pc[$v['first_company_id']],JSON_UNESCAPED_UNICODE); $add_data['second_party_info'] = json_encode($our[$v['second_company_id']],JSON_UNESCAPED_UNICODE); $add_data['company_id'] = $v['first_company_id']; $add_data['company_name'] = $v['first_company_name']; }else{ - //乙方上游 + //乙方合作 $pc[$v['second_company_id']]['invoice_type'] = $v['invoice_type']; $pc[$v['second_company_id']]['invoice_content'] = $v['invoice_content']; + if($is_pu){ + //个人获取外信息 + $pc[$v['second_company_id']] = $this->getCompanyOtherInfo($pc[$v['second_company_id']],$v['second_company_id']); + } + $add_data['first_party_info'] = json_encode($our[$v['first_company_id']],JSON_UNESCAPED_UNICODE); $add_data['second_party_info'] = json_encode($pc[$v['second_company_id']],JSON_UNESCAPED_UNICODE); $add_data['company_id'] = $v['second_company_id']; @@ -499,7 +510,7 @@ class CompanyStatementSetController extends Controller { $company_belong = $pc[$add_data['company_id']]['company_belong']; $add_data['company_belong']=$company_belong; $add_data['company_type']=$pc[$add_data['company_id']]['company_type']; - $is_pu = ($add_data['company_type'] == 1 ? false :true);//是否是个人 + //游戏统计 foreach($v['list'] as $ke=>$va){ @@ -508,6 +519,12 @@ class CompanyStatementSetController extends Controller { $game['game_name'] =$va['game_name']; //获取比例 $game['relation_game_id']=$va['relation_game_id']; + + if($is_pu){ + //个人获取外信息 + $game['game_type_name'] = $this->getGameTypeName($va['relation_game_id']); + } + if($type == 1){ $tratio = getGamePromoteCompanyRadio($add_data['company_id'],$va['relation_game_id'],$endtime,$va['pay_amount'],true,$company_belong); }elseif($type == 0){ @@ -671,6 +688,27 @@ class CompanyStatementSetController extends Controller { $pcList[$k]['list'] = $v; } } + /** + * 获取公司额为信息 + */ + protected function getCompanyOtherInfo($company_info,$company_id) + { + $pl = M("promote_company","tab_") + ->alias('pc') + ->field("p.account,p.company_relation,IFNULL(s.nickname,'admin') nickname") + ->join("left join (select company_id,account,company_relation from tab_promote where level = 1 group by company_id ) p on p.company_id = pc.id")//获取会长 + ->join("left join sys_member s on s.uid = pc.uid") + ->where("pc.id = {$company_id}") + ->find(); + return array_merge($company_info,$pl); + + } + /** + * 获取游戏分类名称 + */ + protected function getGameTypeName($relation_game_id){ + return M("Game","tab_")->field("game_type_name")->where("relation_game_id = '{$relation_game_id}'")->find()['game_type_name']; + } /** * 重算接口 @@ -699,4 +737,5 @@ class CompanyStatementSetController extends Controller { $savedata['id'] = $dbres['id']; return $StatementDb->save($savedata); } + }