|
|
|
@ -285,7 +285,7 @@ class StatementWarningSetController extends Controller {
|
|
|
|
|
->join("tab_partner as p on g.partner_id = p.id")
|
|
|
|
|
->where(['g.id'=>['in',$game_ids]])
|
|
|
|
|
->group("g.partner_id")
|
|
|
|
|
->getField('p.id company_id,GROUP_CONCAT(g.id) game_ids,p.partner company_name',true);
|
|
|
|
|
->getField('p.id company_id,GROUP_CONCAT(g.id) game_ids,p.partner company_name,channel_rate,taxation_rate',true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -300,6 +300,10 @@ class StatementWarningSetController extends Controller {
|
|
|
|
|
foreach ($gameids as $gameid) {
|
|
|
|
|
$statementMoney += ($gamedata[$gameid]-0);
|
|
|
|
|
}
|
|
|
|
|
//上游需要计算祱费及渠道费用
|
|
|
|
|
if($value['channel_rate'] > 0 || $value['taxation_rate'] > 0){
|
|
|
|
|
$statementMoney=round($statementMoney*(100-$value['channel_rate'])*(100-$value['taxation_rate'])/(100*100), 2);//结算金额=平台总额*(1-渠道费)*分成比例*(1-税费费率)
|
|
|
|
|
}
|
|
|
|
|
$company[$key]['statement_money'] = $statementMoney;
|
|
|
|
|
unset($company[$key]['game_ids']);
|
|
|
|
|
}
|
|
|
|
@ -317,7 +321,7 @@ class StatementWarningSetController extends Controller {
|
|
|
|
|
'company_belong'=>0
|
|
|
|
|
])->getField("id company_id,company_name,develop_type",true);
|
|
|
|
|
|
|
|
|
|
$company = $this->getPromoteCompanyGameSpend($company);
|
|
|
|
|
$company = $this->getPromoteCompanyGameSpend($company,0);
|
|
|
|
|
$pcStatementAmount = $this->addStatementWarningInfo($company,0);
|
|
|
|
|
$savedata = [
|
|
|
|
|
'type'=>2,
|
|
|
|
@ -334,7 +338,7 @@ class StatementWarningSetController extends Controller {
|
|
|
|
|
$this->statementWarningModel->add($savedata);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private function getPromoteCompanyGameSpend($company)
|
|
|
|
|
private function getPromoteCompanyGameSpend($company,$companyBelong)
|
|
|
|
|
{
|
|
|
|
|
$where = [
|
|
|
|
|
'tab_spend.is_check'=>1,
|
|
|
|
@ -356,7 +360,7 @@ class StatementWarningSetController extends Controller {
|
|
|
|
|
|
|
|
|
|
foreach ($items as $key => $val) {
|
|
|
|
|
$relationGameId = $games[$val['relation_game_name']];
|
|
|
|
|
$radio = end($CompanyGameRatio->getGameRadio($val['company_id'],$relationGameId,0,$this->beginThismonth,$this->endThismonth));
|
|
|
|
|
$radio = end($CompanyGameRatio->getGameRadio($val['company_id'],$relationGameId,$companyBelong,$this->beginThismonth,$this->endThismonth));
|
|
|
|
|
$radio = $CompanyGameRatio->getTurnoverRatio($val['amount'],$radio['ratio'],$radio['turnover_ratio']);
|
|
|
|
|
$statementMoney =round($val['amount']*$radio/100,2);
|
|
|
|
|
if(isset($company[$val['company_id']]['statement_money'])){
|
|
|
|
@ -379,7 +383,7 @@ class StatementWarningSetController extends Controller {
|
|
|
|
|
|
|
|
|
|
$puStatementAmount = 0;
|
|
|
|
|
if($company) {
|
|
|
|
|
$company = $this->getPuSpecialStatement( $this->getPromoteCompanyGameSpend($company) );
|
|
|
|
|
$company = $this->getPuSpecialStatement( $this->getPromoteCompanyGameSpend($company,1) );
|
|
|
|
|
foreach ($company as $key => $value) {
|
|
|
|
|
if(!array_key_exists('statement_money',$value) ) {
|
|
|
|
|
unset($company[$key]);
|
|
|
|
|