优化结算

master
chenzhi 4 years ago
parent 013801556a
commit 9631a26d40

@ -107,7 +107,7 @@ class GameMarginController extends AdminController
$count['jh_margin_amount'] += $v['jh_margin_amount']; $count['jh_margin_amount'] += $v['jh_margin_amount'];
} }
$count['cp_ratio'] = round( $count['cp_statement_amount']/$count['pay_amount'] ,4)*100; // $count['cp_ratio'] = round( $count['cp_statement_amount']/$count['pay_amount'] ,4)*100;
$count['pu_ratio'] = round( $count['pu_statement_amount']/$count['pu_pay_amount'] ,4)*100; $count['pu_ratio'] = round( $count['pu_statement_amount']/$count['pu_pay_amount'] ,4)*100;
$count['pu_margin_ratio'] = round( $count['pu_margin_amount']/$count['pu_pay_amount'] ,4)*100; $count['pu_margin_ratio'] = round( $count['pu_margin_amount']/$count['pu_pay_amount'] ,4)*100;
@ -129,7 +129,7 @@ class GameMarginController extends AdminController
$line = 3; $line = 3;
foreach ($marginInfo as &$v) { foreach ($marginInfo as &$v) {
$v["cp_ratio"] = "=ROUND(G{$line}/D{$line},4)"; // $v["cp_ratio"] = "=ROUND(G{$line}/D{$line},4)";
if($v["pc_pay_amount"] > 0){ if($v["pc_pay_amount"] > 0){
$v["pc_ratio"] ="=ROUND(M{$line}/K{$line},4)"; $v["pc_ratio"] ="=ROUND(M{$line}/K{$line},4)";
@ -159,7 +159,7 @@ class GameMarginController extends AdminController
$count = [ $count = [
"pay_amount"=>"=SUM(D3:D{$line})", "pay_amount"=>"=SUM(D3:D{$line})",
"cp_ratio"=>"=ROUND(G{$countLine}/D{$countLine},4)", // "cp_ratio"=>"=ROUND(G{$countLine}/D{$countLine},4)",
"cp_statement_amount"=>"=SUM(G3:G{$line})", "cp_statement_amount"=>"=SUM(G3:G{$line})",
"cp_rebate_amount"=>"=SUM(I3:I{$line})", "cp_rebate_amount"=>"=SUM(I3:I{$line})",
"cp_other_amount"=>"=SUM(J3:J{$line})", "cp_other_amount"=>"=SUM(J3:J{$line})",

@ -61,8 +61,8 @@ class GameMarginSetController extends Controller {
{ {
$this->getInsideCompanyid(); $this->getInsideCompanyid();
$this->getAllGameSpend(); $this->getAllGameSpend();
$this->getCpStatement();
$this->getJuheStatement(); $this->getJuheStatement();
$this->getCpStatement();
$this->getPuStatement(); $this->getPuStatement();
$this->getPcStatement(); $this->getPcStatement();
$this->setMarginCount(); $this->setMarginCount();
@ -91,7 +91,7 @@ class GameMarginSetController extends Controller {
"is_refund"=>0, "is_refund"=>0,
"payed_time"=>["between",[$this->beginThismonth,$this->endThismonth]] "payed_time"=>["between",[$this->beginThismonth,$this->endThismonth]]
]; ];
$this->adddata = M("Spend","tab_")->where($where)->group("relation_game_name")->getField("substring_index(game_name, '(', 1) relation_game_name,SUM(pay_amount) pay_amount",true); $this->adddata = M("Spend","tab_")->where($where)->group("relation_game_name")->order("pay_amount desc")->getField("substring_index(game_name, '(', 1) relation_game_name,SUM(pay_amount) pay_amount",true);
} }
/** /**
* 获取聚合数据 * 获取聚合数据
@ -347,13 +347,15 @@ class GameMarginSetController extends Controller {
if( !array_key_exists($game,$this->adddata) ){ if( !array_key_exists($game,$this->adddata) ){
continue; continue;
} }
$statement_money = round( $this->adddata[$game]['pay_amount'] / $val['pay_amount'] * $val['sum_money'],2); $ratio = $val['first_ratio'];
$statement_money = round( $this->adddata[$game]['pay_amount'] * $ratio / 100,2);
if( array_key_exists("cp_statement_amount",$this->adddata[$game]) ){ if( array_key_exists("cp_statement_amount",$this->adddata[$game]) ){
$this->adddata[$game]['cp_statement_amount'] += $statement_money; $this->adddata[$game]['cp_statement_amount'] += $statement_money;
}else{ }else{
$this->adddata[$game]['cp_statement_amount'] = $statement_money; $this->adddata[$game]['cp_statement_amount'] = $statement_money;
} }
$this->adddata[$game]['cp_promote_ratio'] = $val['promote_ratio']; $this->adddata[$game]['cp_promote_ratio'] = $val['promote_ratio'];
$this->adddata[$game]['cp_ratio'] = $ratio;
} }
} }
} }
@ -437,7 +439,7 @@ class GameMarginSetController extends Controller {
$pay_amount = 0; $pay_amount = 0;
foreach ($this->adddata as &$v) { foreach ($this->adddata as &$v) {
foreach ($baseCell as $bkey=>$bval) array_key_exists($bkey,$v) ?: $v[$bkey] = $bval; foreach ($baseCell as $bkey=>$bval) array_key_exists($bkey,$v) ?: $v[$bkey] = $bval;
$v["cp_ratio"] = round($v["cp_statement_amount"]/$v['pay_amount'],4)*100; // $v["cp_ratio"] = round($v["cp_statement_amount"]/$v['pay_amount'],4)*100;
if($v["pc_pay_amount"] > 0){ if($v["pc_pay_amount"] > 0){
$v["pc_ratio"] = round($v["pc_statement_amount"]/$v['pc_pay_amount'],4)*100; $v["pc_ratio"] = round($v["pc_statement_amount"]/$v['pc_pay_amount'],4)*100;

@ -162,7 +162,7 @@
<td>{$margin["relation_game_name"]}</td> <td>{$margin["relation_game_name"]}</td>
<td>{$margin["pay_amount"]}</td> <td>{$margin["pay_amount"]}</td>
<td>{$margin["cp_promote_ratio"]}%</td> <td>{$margin["cp_promote_ratio"]}%</td>
<td>{$margin["cp_ratio"]}{$percent}</td> <td>{$margin["cp_ratio"]}%</td>
<td>{$margin["cp_statement_amount"]}</td> <td>{$margin["cp_statement_amount"]}</td>
<td>{$margin["cp_rebate_ratio"]}%</td> <td>{$margin["cp_rebate_ratio"]}%</td>
<td>{$margin["cp_rebate_amount"]}</td> <td>{$margin["cp_rebate_amount"]}</td>
@ -198,7 +198,7 @@
<td>小计</td> <td>小计</td>
<td>{$count["pay_amount"]}</td> <td>{$count["pay_amount"]}</td>
<td></td> <td></td>
<td>{$count["cp_ratio"]}{$percent}</td> <td></td>
<td>{$count["cp_statement_amount"]}</td> <td>{$count["cp_statement_amount"]}</td>
<td></td> <td></td>
<td>{$count["cp_rebate_amount"]}</td> <td>{$count["cp_rebate_amount"]}</td>

Loading…
Cancel
Save