Merge pull request '优化导出错误' (#361) from feature/more_payment into master

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/361
master
廖金灵 4 years ago
commit cd33286900

@ -171,12 +171,16 @@ class GameMarginController extends AdminController
private function moreMarginExport($info)
{
$line = 3;
$dateBing = 3;
$excelData = [];
$countLineArr = [];
foreach ($info as $index => $date) {
$marginInfo = json_decode($date['margin_info'],true);
foreach ($marginInfo as $v) {
foreach ($marginInfo as $k=>$v) {
// $v["cp_ratio"] = "=ROUND(G{$line}/D{$line},4)";
if($k == 0){
$dateBing = $line;
}
if($v["pc_pay_amount"] > 0){
$v["pc_ratio"] ="=ROUND(M{$line}/K{$line},2)";
@ -214,33 +218,33 @@ class GameMarginController extends AdminController
"count_year" => $date['count_year'],
'count_month' => $date['count_month'],
'relation_game_name'=>"小计",
"pay_amount"=>"=SUM(D3:D{$line})",
"pay_amount"=>"=SUM(D{$dateBing}:D{$line})",
"cp_statement_amount"=>"=SUM(G3:G{$line})",
"cp_rebate_amount"=>"=SUM(I3:I{$line})",
"cp_other_amount"=>"=SUM(J3:J{$line})",
"cp_statement_amount"=>"=SUM(G{$dateBing}:G{$line})",
"cp_rebate_amount"=>"=SUM(I{$dateBing}:I{$line})",
"cp_other_amount"=>"=SUM(J{$dateBing}:J{$line})",
"pc_pay_amount"=>"=SUM(K3:K{$line})",
"pc_pay_amount"=>"=SUM(K{$dateBing}:K{$line})",
"pc_ratio"=>"=ROUND(M{$countLine}/K{$countLine},4)",
"pc_statement_amount"=>"=SUM(M3:M{$line})",
"pc_margin_amount"=>"=SUM(N3:N{$line})",
"pc_statement_amount"=>"=SUM(M{$dateBing}:M{$line})",
"pc_margin_amount"=>"=SUM(N{$dateBing}:N{$line})",
"pc_margin_ratio"=>"=ROUND(N{$countLine}/K{$countLine},4)",
"pu_pay_amount"=>"=SUM(P3:P{$line})",
"pu_statement_amount"=>"=SUM(R3:R{$line})",
"pu_pay_amount"=>"=SUM(P{$dateBing}:P{$line})",
"pu_statement_amount"=>"=SUM(R{$dateBing}:R{$line})",
"pu_ratio"=>"=ROUND(R{$countLine}/P{$countLine},4)",
"pu_margin_amount"=>"=SUM(S3:S{$line})",
"pu_margin_amount"=>"=SUM(S{$dateBing}:S{$line})",
"pu_margin_ratio"=>"=ROUND(S{$countLine}/P{$countLine},4)",
"platform_margin_ratio"=>"=ROUND((D{$countLine}-V{$countLine}-G{$countLine}-I{$countLine}-J{$countLine}-M{$countLine}-R{$countLine})/(D{$countLine}-V{$countLine}),4)",
"jh_pay_amount"=>"=SUM(V3:V{$line})",
"jh_statement_amount"=>"=SUM(X3:X{$line})",
"jh_pay_amount"=>"=SUM(V{$dateBing}:V{$line})",
"jh_statement_amount"=>"=SUM(X{$dateBing}:X{$line})",
"jh_ratio"=>"=ROUND(X{$countLine}/V{$countLine},4)",
"jh_margin_amount"=>"=SUM(Y3:Y{$line})",
"jh_margin_amount"=>"=SUM(Y{$dateBing}:Y{$line})",
"jh_margin_ratio"=>"=ROUND(Y{$countLine}/V{$countLine},4)",
"margin_ratio"=>"=ROUND(AB{$countLine}/D{$countLine},4)",
"margin_amount"=>"=SUM(AB3:AB{$line})",
"margin_amount"=>"=SUM(AB{$dateBing}:AB{$line})",
];
$line += 2;
@ -318,6 +322,7 @@ class GameMarginController extends AdminController
$allCountData['margin_amount'] = rtrim($allCountData['margin_amount'], ",").")";
$excelData[] = $allCountData;
// dd($excelData);
$this->exportExcel($excelData,"毛利分析表汇总");
}
private function exportExcel($arr,$title)

Loading…
Cancel
Save