diff --git a/Application/Admin/Controller/AggregateFinanceStatementController.class.php b/Application/Admin/Controller/AggregateFinanceStatementController.class.php index 0c21874a8..cd9fd1bca 100644 --- a/Application/Admin/Controller/AggregateFinanceStatementController.class.php +++ b/Application/Admin/Controller/AggregateFinanceStatementController.class.php @@ -640,8 +640,11 @@ class AggregateFinanceStatementController extends ThinkController if($data['pay_type'] == 0){ //甲-乙 $data['pay_company'] = $data['second_party_info']; + $data['invoice'] = $data['first_party_info']; + }else{ $data['pay_company'] = $data['first_party_info']; + $data['invoice'] = $data['second_party_info']; } $this->doAddOperationLog($id,"导出"); $relation = M("company_relation","tab_")->where("(first_company_id={$data['channel_id']} and first_company_type=3) or (second_company_id = {$data['channel_id']} and second_company_type=3)")->find(); @@ -754,14 +757,14 @@ class AggregateFinanceStatementController extends ThinkController $objPHPExcel->getActiveSheet()->getRowDimension(($line+6))->setRowHeight($address_height*$height); //开票信息 - $invoice_data = "发票类型:".$data['pay_company']['invoice_type']; - $invoice_data .= "\n发票抬头:".$data['pay_company']['partner']; - $invoice_data .= "\n纳税人识别号:".$data['pay_company']['company_tax_no']; - - $invoice_data .= "\n开户银行:".$data['pay_company']['opening_bank']; - $invoice_data .= "\n开户账号:".$data['pay_company']['bank_account']; - $invoice_data .= "\n开票内容:".$data['pay_company']['invoice_item']; - $invoice_data .= "\n注册地址及电话:".$data['pay_company']['register_address'].",".$data['second_party_info']['register_phone']; + $invoice_data = "发票类型:".$data['invoice']['invoice_type']; + $invoice_data .= "\n发票抬头:".$data['invoice']['partner']; + $invoice_data .= "\n纳税人识别号:".$data['invoice']['company_tax_no']; + + $invoice_data .= "\n开户银行:".$data['invoice']['opening_bank']; + $invoice_data .= "\n开户账号:".$data['invoice']['bank_account']; + $invoice_data .= "\n开票内容:".$data['invoice']['invoice_item']; + $invoice_data .= "\n注册地址及电话:".$data['invoice']['register_address'].",".$data['second_party_info']['register_phone']; $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+7), $invoice_data);//乙方 diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index 602f22066..d6b84bc75 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -1455,6 +1455,8 @@ class CompanyStatementController extends ThinkController $statement_data = []; $company_data = M("promote_company","tab_")->where(['id'=>$value['company_id']])->find(); +// dump($company_data);die(); + $company_type = M("company_relation","tab_")->where("first_company_id={$value['company_id']} or second_company_id={$value['company_id']}")->find(); $insert['is_payment'] = $company_type['is_payment']; @@ -1473,7 +1475,7 @@ class CompanyStatementController extends ThinkController $proCompany_info['link_man'] = $company_data['settlement_contact']; $proCompany_info['link_phone'] =$company_data['contact_phone']; $proCompany_info['address'] = $company_data['address']; - $proCompany_info['payee_name'] =$company_data['company_name']; + $proCompany_info['payee_name'] =$company_data['bank_address']; $proCompany_info['bank_account'] = $company_data['bank_card']; $proCompany_info['opening_bank'] =$company_data['bank_name']; diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index 993f19158..e9be8af63 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -294,6 +294,11 @@ class CompanyStatementPoolController extends ThinkController $v['statement_money'] = "=ROUND("; } + + + $handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line); + + $v['statement_info'] = $handle_data; $row = 0; foreach($v['statement_info'] as $ke=>&$va){ $va['row'] = count($va['game_list']); @@ -336,15 +341,13 @@ class CompanyStatementPoolController extends ThinkController $v['statement_money'] .= "N{$line}+"; }else{ $count['platform_amount'] += $val['pay_amount']; - $count['sum_money'] += $val['sum_money']; +// $count['sum_money'] += $val['sum_money']; } + } + $count['week_money'] += $va['week_amount']; + $count['sum_money'] += $va['week_amount']; } - - $handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line); - - $v['statement_info'] = $handle_data; - $v['row'] = $row; if($is_export){ if($v['withdraw_type'] != 3) { @@ -388,6 +391,10 @@ class CompanyStatementPoolController extends ThinkController $v['statement_money'] = "=ROUND("; } + $handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line); + + $v['statement_info'] = $handle_data; + $row = 0; foreach($v['statement_info'] as $ke=>&$va){ $va['row'] = count($va['game_list']); @@ -430,15 +437,13 @@ class CompanyStatementPoolController extends ThinkController $v['statement_money'] .= "N{$line}+"; }else{ $count['platform_amount'] += $val['pay_amount']; - $count['sum_money'] += $val['sum_money']; +// $count['sum_money'] += $val['sum_money']; } } + $count['week_money'] += $va['week_amount']; + $count['sum_money'] += $va['week_amount']; } - $handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line); - - $v['statement_info'] = $handle_data; - $v['row'] = $row; if($is_export){ if($v['withdraw_type'] != 3) { @@ -484,7 +489,7 @@ class CompanyStatementPoolController extends ThinkController $v['statement_money'] = "=ROUND("; } $handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line); - +// dump($handle_data); $v['statement_info'] = $handle_data; $row = 0; foreach($v['statement_info'] as $ke=>&$va){ @@ -515,17 +520,19 @@ class CompanyStatementPoolController extends ThinkController if($v['withdraw_type'] != 3) { $val['sum_money'] = "=ROUND((K{$line}-L{$line})*(M{$line}+N{$line}),2)"; } else { - $val['sum_money'] = "=ROUND(K{$line}*(N{$line}),2)"; + $val['sum_money'] = "=ROUND((K{$line}-L{$line})*(N{$line}),2)"; } $v['statement_money'] .= "S{$line}+"; }else{ $count['platform_amount'] += $val['pay_amount']; - $count['week_money'] += $val['sum_money']; - $count['sum_money'] += $val['sum_money']; + +// $count['sum_money'] += $val['sum_money']; } } + $count['week_money'] += $va['week_amount']; + $count['sum_money'] += $va['week_amount']; } - +// dump($count); $v['row'] = $row; @@ -598,7 +605,7 @@ class CompanyStatementPoolController extends ThinkController //周结算金额计算 for ($i=0;;$i++) { if ($sv[$i]['sum_money']) { - $game_data['week_amount'] += $sv[$i]['sum_money']; + $game_data['week_amount'] += $sv[$i]['sum_money']- $sv[$i]['withhold']; $game_data['withhold_amount'] += $sv[$i]['withhold']; $game_data['fine'] += $sv[$i]['fine']; $game_data['reward'] += $sv[$i]['reward']; @@ -696,7 +703,7 @@ class CompanyStatementPoolController extends ThinkController } } - +// dump($handle_data); return $handle_data?$handle_data:[]; } @@ -1699,7 +1706,7 @@ class CompanyStatementPoolController extends ThinkController $statement_amount = 0; $statement_lack_amount = 0; -// dump($increment_ratio); + foreach ($increment_ratio as $key => $value) { $statement_info = array(); @@ -1732,12 +1739,12 @@ class CompanyStatementPoolController extends ThinkController $statement_info[$k]['game_list'][$gk]['sum_money'] = $sum_money[$key][$v['account']][$gk]; - $amount += $sum_money[$key][$v['account']][$gk]; + $amount += $sum_money[$key][$v['account']][$gk] - $statement_info[$k]['game_list'][$gk]['withhold']; if ($st[$key][$akey] == 1) { - $statement_amount += $sum_money[$key][$v['account']][$gk]; + $statement_amount += $sum_money[$key][$v['account']][$gk]-$statement_info[$k]['game_list'][$gk]['withhold']; } else { - $statement_lack_amount += $sum_money[$key][$v['account']][$gk]; + $statement_lack_amount += $sum_money[$key][$v['account']][$gk]-$statement_info[$k]['game_list'][$gk]['withhold']; } } diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php index 55cd1331c..6d5278671 100644 --- a/Application/Admin/Controller/CompanyStatementSetController.class.php +++ b/Application/Admin/Controller/CompanyStatementSetController.class.php @@ -998,6 +998,7 @@ class CompanyStatementSetController extends Controller { if(empty($list)){continue;} + foreach($list as $k=>$v){ try { @@ -2188,8 +2189,6 @@ class CompanyStatementSetController extends Controller { */ protected function getModuleRatioGame($company_id,$relation_game_ids,$begintime,$endtime){ - - $where = [ "relation_game_id"=>["in",$relation_game_ids], "company_id"=>$company_id, @@ -2210,9 +2209,41 @@ class CompanyStatementSetController extends Controller { } if(is_string($relation_game_ids)) $relation_game_ids = explode(",",$relation_game_ids); - + + $array_mer = []; + + foreach ($relation_game_ids as $key => $value) { + $turnover_type = $this->getTurnoverType($value,$company_id,$begintime,$endtime); + + if ($turnover_type == 3 || $turnover_type == 4) { + + $mercy_game = M("game",'tab_')->field("original_package_name")->where(['relation_game_id'=>$value])->find()['original_package_name']; + + $original_game_id = M("game",'tab_') + ->field("relation_game_id") + ->where(['original_package_name'=>$mercy_game,'relation_game_id'=>['neq',$value]]) + ->group("relation_game_id") + ->select(); + + foreach ($original_game_id as $k => $v) { + + if(!in_array($v['relation_game_id'], $relation_game_ids)){ + + $array_mer[] = $v['relation_game_id']; + + } + + } + + } + + } + + $relation_game_ids = array_merge($relation_game_ids,$array_mer); + + if(empty($dbres)){ - return implode(",",$relation_game_ids);; + return implode(",",$relation_game_ids); }else{ $dbres = array_column($dbres,"relation_game_id"); $diff = array_diff($relation_game_ids,$dbres); diff --git a/Application/Admin/Controller/OldCountController.class.php b/Application/Admin/Controller/OldCountController.class.php index f510d5dc3..49cb28cdd 100644 --- a/Application/Admin/Controller/OldCountController.class.php +++ b/Application/Admin/Controller/OldCountController.class.php @@ -10,6 +10,40 @@ namespace Admin\Controller; class OldCountController extends \Think\Controller { + public function oldRewardChange() { + + $data = M("company_statement_info","tab_") + ->where("(fine > 0 or reward > 0) and company_type = 2") + ->select(); + + foreach ($data as $key => $value) { + + $statement_info = json_decode($value['statement_info'],true); + $statement_info[0]['game_list'][0]['fine'] = $value['fine']; + $statement_info[0]['game_list'][0]['reward'] = $value['reward']; + $statement_info = json_encode($statement_info); + + M("company_statement_info","tab_")->where(['id'=>$value['id']])->save(['statement_info'=>$statement_info]); + + } + + + $pool_data = M("company_statement_pool",'tab_')->where(['id'=>['in',[22,27]]])->select(); + foreach ($pool_data as $key => $value) { + + $save = json_decode($value['verify_log'],true); + $save['firstverify_user'] = $save['verify_user']; + $save['firstverify_time'] = $save['verify_time']; + $save = json_encode($save); + + M('company_statement_pool','tab_')->where(['id'=>$value['id']])->save(['verify_log'=>$save]); + + } + + echo "success"; + + } + public function changeCompanyGameidToPromoteGameid() { //默认设为 diff --git a/Application/Admin/View/CompanyStatementPool/editPuPool.html b/Application/Admin/View/CompanyStatementPool/editPuPool.html index b40ab82ba..778e15be9 100644 --- a/Application/Admin/View/CompanyStatementPool/editPuPool.html +++ b/Application/Admin/View/CompanyStatementPool/editPuPool.html @@ -174,8 +174,11 @@