diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index eb905d90c..4a067a160 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -360,7 +360,11 @@ class CompanyStatementPoolController extends ThinkController if ($_REQUEST['type']) { $this->editSpecialPuPool($infolist,$is_export); } else { - $this->editPuPool($infolist,$is_export); + if($pool_info['company_type'] == 2) { + $this->editPuPool($infolist,$is_export); + } else { + $this->editPcPool($infolist, $is_export); + } } } @@ -387,8 +391,6 @@ class CompanyStatementPoolController extends ThinkController $v['statement_money'] = "=ROUND("; } - - $handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line); $v['statement_info'] = $handle_data; @@ -400,13 +402,7 @@ class CompanyStatementPoolController extends ThinkController foreach($va['game_list'] as $key=>&$val){ $line ++; if($v['withdraw_type'] != 3) { -// if(!$val['ratio']&&!$val['increment_ratio']) { -// if(isset($val['ratio'])){ -// $val['increment_ratio'] = 0; -// }else{ -// $val['ratio'] = 0; -// } -// } + if (!$val['increment_ratio']) { $val['increment_ratio'] = 0; } @@ -418,11 +414,7 @@ class CompanyStatementPoolController extends ThinkController if (!$val['refund']) { $val['refund'] = 0; } -// if(isset($val['ratio'])){ -// $val['increment_ratio'] = 0; -// }else{ -// $val['ratio'] = 0; -// } + } if($is_export){ @@ -434,7 +426,6 @@ class CompanyStatementPoolController extends ThinkController $v['statement_money'] .= "N{$line}+"; }else{ $count['platform_amount'] += $val['pay_amount']; -// $count['sum_money'] += $val['sum_money']; } } @@ -450,19 +441,113 @@ class CompanyStatementPoolController extends ThinkController } } } -// dump($infolist);die(); if($is_export){ $count["platform_amount"] = "=ROUND(SUM(K2:K".$line."),2)"; $count["sum_money"] = "=ROUND(SUM(Q2:Q".$line."),2)"; } -// dump($infolist); + $this->assign("data",$infolist); $this->assign("count",$count); $this->assign("is_export",$is_export); $this->display("CompanyStatementPool/editPuPool"); } + //下游汇总结算查看 + public function editPcPool(&$infolist,$is_export){ + + $line = 1; + $count = []; + + foreach($infolist as $k=>&$v){ + + $v['statement_info'] = json_decode($v['statement_info'],true); + $v['company_info'] = json_decode($v['company_info'],true); + $v['statement_begin_time'] = date('Y.m.d',$v['statement_begin_time']); + $v['statement_end_time'] = date('Y.m.d',$v['statement_end_time']); + if( isset($v['verify_status'])){ + if( $v['verify_status'] ==2 ){ + $v['is_payment'] = 2; //不打款 + }else{ + $v['is_payment'] = 1; + } + } + + $cline = $line+1; + + $handle_data = $this->changeDataStructVc($v['statement_info'],$is_export,$cline); + $v['statement_info'] = $handle_data; +// dump($handle_data); + + foreach($v['statement_info'] as $ke=>&$va){ + $line ++; + + if($v['withdraw_type'] != 3) { + if (isset($va['ratio'])) { + $va['increment_ratio'] = 0; + } else { + $va['ratio'] = 0; + } + } + + if($is_export){ + + if($v['withdraw_type'] != 3) { + $va['d_statement_money'] = "=ROUND(D{$line}*(1-G{$line})*(E{$line}+F{$line}),2)"; + } else { + $va['d_statement_money'] = "=ROUND(D{$line}*(F{$line}),2)"; + } + }else{ + if ($v['withdraw_type'] != 3) { + $va['d_statement_money'] = round($va['pay_amount']*($va['ratio']+$va['increment_ratio'])*(100-$va['fax_ratio'])/100/100,2); + + $count['platform_amount'] += $va['pay_amount']; + + $count['d_statement_money'] += $va['d_statement_money']; + } else { + $va['d_statement_money'] = round(($va['pay_amount']*($va['increment_ratio']))/100,2); + + $count['platform_amount'] += $va['pay_amount']; + + $count['d_statement_money'] += $va['d_statement_money']; + } + } + } + + $v['settlement_contact'] = $v['company_info']['link_man']; + + if($is_export){ + + if ($v['withdraw_type'] != 3) { + $v['statement_money'] = "=ROUND(SUM(H{$cline}:H{$line})+J{$cline}-I{$cline},2)"; + } + + }else{ + $count['fine'] += $v['fine']; + $count['reward'] += $v['reward']; + $count['statement_money'] += $v['statement_money']; + } + $v['statement_count'] = count($v['statement_info']); + if($v['statement_count'] == '0'){ + $v['statement_count'] = 1; + } + + } + if($is_export){ + $count["platform_amount"] = "=ROUND(SUM(D2:D".$line."),2)"; + $count["d_statement_money"] = "=ROUND(SUM(H2:H".$line."),2)"; + $count["fine"] = "=ROUND(SUM(I2:I".$line."),2)"; + $count["reward"] = "=ROUND(SUM(J2:J".$line."),2)"; + $count["statement_money"] = "=ROUND(SUM(K2:K".$line."),2)"; + } + + $this->assign("data",$infolist); + $this->assign("count",$count); + $this->assign("is_export",$is_export); + $this->display("CompanyStatementPool/editPcPool"); + + } + public function editSpecialPuPool(&$infolist,$is_export) { $line = 1; $count = []; @@ -1013,7 +1098,7 @@ class CompanyStatementPoolController extends ThinkController $substract++; } else { $handle_data[$lk-$substract]['row'] += 1; - $handle_data[$lk-$substract]['week_amount'] += $lv['d_statement_money']; + $handle_data[$lk-$substract]['week_amount'] += $lv['sum_money']; if ($is_export) { $handle_data[$lk-$substract]['week_amount'] = "=ROUND(SUM(I{$cline}:I{$nline}),2)"; @@ -1027,7 +1112,7 @@ class CompanyStatementPoolController extends ThinkController } else { $lv['row'] = 1; - $lv['week_amount'] = $lv['d_statement_money']; + $lv['week_amount'] = $lv['sum_money']; $nline++; if ($is_export) { $lv['week_amount'] = "=ROUND(SUM(I{$cline}}:I{$nline}),2)"; @@ -1807,23 +1892,36 @@ class CompanyStatementPoolController extends ThinkController $optist = ["viewPool","reCount","cancelPool"]; break; case '1': - $optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher","editPayment","setUlPayment"]; + $optist = ["viewPool", +// "addRemark","viewRemark","editRemark", + "viewVoucher","editVoucher","uploadVoucher","editPayment","setUlPayment"]; break; case '2': - $optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher"]; + $optist = ["viewPool", +// "addRemark","viewRemark","editRemark", + "viewVoucher","editVoucher","uploadVoucher"]; break; case '3': - $optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher","viewPayment"]; + $optist = ["viewPool", +// "addRemark","viewRemark","editRemark", + "viewVoucher","editVoucher","uploadVoucher","viewPayment"]; break; case '4': - $optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher","viewPayment"]; + $optist = ["viewPool", +// "addRemark","viewRemark","editRemark", + "viewVoucher","editVoucher","uploadVoucher","viewPayment"]; break; case '5': - $optist = ["viewPool","addRemark","viewRemark","editRemark","reCount","cancelPool"]; + $optist = ["viewPool", +// "addRemark","viewRemark","editRemark", + "reCount","cancelPool"]; break; case '6': - $optist = ["viewPool","addRemark","viewRemark","editRemark","reCount","cancelPool"]; + $optist = ["viewPool", +// "addRemark","viewRemark","editRemark", + "reCount","cancelPool"]; // ,"setPayment"]; + break; default: break; @@ -1855,9 +1953,9 @@ class CompanyStatementPoolController extends ThinkController } } - if($info['company_type'] == 2 && ($info['verify_status'] == '6' || $info['verify_status'] == '0') &&$info['withdraw_type'] != "特殊补点") { +// if(($info['verify_status'] == '6' || $info['verify_status'] == '0') &&$info['withdraw_type'] != "特殊补点") { array_push($optist,"editPool"); - } +// } if(empty($info['ext_file'])){ //未上传凭证 diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index 2c4d69bcf..b115eb277 100644 --- a/Application/Admin/Controller/MarketPercentageController.class.php +++ b/Application/Admin/Controller/MarketPercentageController.class.php @@ -1184,6 +1184,8 @@ class MarketPercentageController extends ThinkController $value['company_profit'] = "0.00"; } + !($this->leavePercentage->isSettlement($value['pay_time'],$value['admin_id']))?$data[$key]['achievement_bonus']=0:''; + $data[$key]['coefficient'] = $this->coefficient[$value['pay_time']][$value['admin_id']] ? $this->coefficient[$value['pay_time']][$value['admin_id']] : 1; $data[$key]['wait_commission'] = @@ -1421,15 +1423,16 @@ class MarketPercentageController extends ThinkController $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(performance_commission) performance_commission,IF(leave_time!=0 and unix_timestamp(now())-leave_time>86400*30,0,sum(achievement_bonus* IF(coefficient is not NULL, coefficient, 100)/100)) achievement_bonus, sum(wait_performance_commission)+sum(wait_achievement_commission) wait_amount, - sum(if(status > 0, wait_performance_commission, '0.00')) + sum(if(status > 0, wait_achievement_commission,'0.00') * IF(coefficient is not NULL, coefficient, 100)/100 ) wait_extend_commission, - sum(if(status = 0, wait_performance_commission, '0.00')) + round(sum(if(status = 0, wait_achievement_commission,'0.00') * IF(coefficient is not NULL, coefficient, 100)/100),2) wait_commission, remark,status") + sum(if(tab_market_altogether.status > 0, wait_performance_commission, '0.00')) + sum(if(tab_market_altogether.status > 0, wait_achievement_commission,'0.00') * IF(coefficient is not NULL, coefficient, 100)/100 ) wait_extend_commission, + sum(if(tab_market_altogether.status = 0, wait_performance_commission, '0.00')) + round(sum(if(tab_market_altogether.status = 0, wait_achievement_commission,'0.00') * IF(coefficient is not NULL, coefficient, 100)/100),2) wait_commission, remark,tab_market_altogether.status") ->where($map); if ($_REQUEST['export']) { $data = $data ->join("left join tab_coefficient on tab_market_altogether.admin_id=tab_coefficient.admin_id and tab_coefficient.pay_time=tab_market_altogether.pay_time") + ->join("left join sys_ucenter_member on tab_market_altogether.admin_id=sys_ucenter_member.id") ->order("tab_market_altogether.pay_time DESC,company_profit DESC") ->group("tab_market_altogether.admin_id,tab_market_altogether.pay_time") ->select(false); @@ -1437,6 +1440,7 @@ class MarketPercentageController extends ThinkController $data = $data // ->page($p, $row) ->join("left join tab_coefficient on tab_market_altogether.admin_id=tab_coefficient.admin_id and tab_coefficient.pay_time=tab_market_altogether.pay_time") + ->join("left join sys_ucenter_member on tab_market_altogether.admin_id=sys_ucenter_member.id") ->order("tab_market_altogether.pay_time DESC,company_profit DESC") ->group("tab_market_altogether.admin_id,tab_market_altogether.pay_time") ->select(false);