Merge branch 'feature/add_item' of wmtx/platform into release

11月功能提交
master
万盟天下 4 years ago committed by Gogs
commit 41ab9703a9

@ -2236,6 +2236,26 @@ function excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_al
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+9), $data['receive_company']['bank_account']."\t");//银行账号
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+10), $data['receive_company']['opening_bank']);//开户行
$height = 20;
$font_size = 56;
if (strlen($data['pay_company']['partner'])<strlen($data['receive_company']['partner'])) {
$partner_height = intval(strlen($data['receive_company']['partner'])/$font_size)+1;
} else {
$partner_height = intval(strlen($data['pay_company']['partner'])/$font_size)+1;
}
$address_height = intval(strlen($data['receive_company']['address'])/$font_size)+1;
$payee_name_height = intval(strlen($data['receive_company']['payee_name'])/$font_size)+1;
$opening_bank_height = intval(strlen($data['receive_company']['opening_bank'])/$font_size)+1;
$objPHPExcel->getActiveSheet()->getStyle("E".($line+3).":E".($line+10))->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle("B".($line+3).":B".($line+7))->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getRowDimension(($line+3))->setRowHeight($height*$partner_height);
$objPHPExcel->getActiveSheet()->getRowDimension(($line+6))->setRowHeight($address_height*$height);
$objPHPExcel->getActiveSheet()->getRowDimension(($line+8))->setRowHeight($payee_name_height*$height);
$objPHPExcel->getActiveSheet()->getRowDimension(($line+10))->setRowHeight($opening_bank_height*$height);
$fileName = "{$data['company_name']}&{$data['my_company']}-对账单{$statement_begin_time}-{$statement_end_time}";
// dd($fileName);
ob_end_clean();//清除缓冲区,避免乱码
@ -2340,7 +2360,7 @@ function getGameCpRadio($game_id,$amount,$type) {
*/
function getGamePromoteCompanyRadio($company_id,$relation_game_id,$endtime,$amount,$type,$company_belong=false) {
//判断是否有生效
$rwhere = "(end_time = 0 OR end_time >= '{$endtime}') and company_id='{$company_id}' and relation_game_id='{$relation_game_id}'";
$rwhere = "(end_time = 0 OR end_time >= '{$endtime}') and company_id='{$company_id}' and relation_game_id='{$relation_game_id}' and company_belong = {$company_belong} ";
$cgr_res = M("CompanyGameRatio","tab_")->where($rwhere)->find();
// dump( M("CompanyGameRatio","tab_")->where($rwhere)->select(false));
if(empty($cgr_res)){

@ -734,6 +734,25 @@ class AggregateFinanceStatementController extends ThinkController
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+5), $data['second_party_info']['link_phone']);//联系电话
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+6), $data['second_party_info']['address']);//邮寄地址
$height = 20;
$font_size = 56;
if (strlen($data['second_party_info']['partner'])<strlen($data['first_party_info']['partner'])) {
$partner_height = intval(strlen($data['first_party_info']['partner'])/$font_size)+1;
} else {
$partner_height = intval(strlen($data['second_party_info']['partner'])/$font_size)+1;
}
if (strlen($data['second_party_info']['address'])<strlen($data['first_party_info']['address'])) {
$address_height = intval(strlen($data['first_party_info']['address'])/$font_size)+1;
} else {
$address_height = intval(strlen($data['second_party_info']['address'])/$font_size)+1;
}
$objPHPExcel->getActiveSheet()->getStyle("E".($line+3).":E".($line+6))->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle("B".($line+3).":B".($line+6))->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getRowDimension(($line+3))->setRowHeight($height*$partner_height);
$objPHPExcel->getActiveSheet()->getRowDimension(($line+6))->setRowHeight($address_height*$height);
//开票信息
$invoice_data = "发票类型:".$data['pay_company']['invoice_type'];
$invoice_data .= "\n发票抬头".$data['pay_company']['partner'];
@ -831,6 +850,25 @@ class AggregateFinanceStatementController extends ThinkController
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+5), $data['second_party_info']['link_phone']);//联系电话
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+6), $data['second_party_info']['address']);//邮寄地址
$height = 20;
$font_size = 56;
if (strlen($data['second_party_info']['partner'])<strlen($data['first_party_info']['partner'])) {
$partner_height = intval(strlen($data['first_party_info']['partner'])/$font_size)+1;
} else {
$partner_height = intval(strlen($data['second_party_info']['partner'])/$font_size)+1;
}
if (strlen($data['second_party_info']['address'])<strlen($data['first_party_info']['address'])) {
$address_height = intval(strlen($data['first_party_info']['address'])/$font_size)+1;
} else {
$address_height = intval(strlen($data['second_party_info']['address'])/$font_size)+1;
}
$objPHPExcel->getActiveSheet()->getStyle("E".($line+3).":E".($line+6))->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle("B".($line+3).":B".($line+6))->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getRowDimension(($line+3))->setRowHeight($height*$partner_height);
$objPHPExcel->getActiveSheet()->getRowDimension(($line+6))->setRowHeight($address_height*$height);
//开票信息
// $invoice_data = "发票类型:".$data['second_party_info']['invoice_type'];
// $invoice_data .= "\n发票抬头".$data['second_party_info']['partner'];

@ -26,6 +26,17 @@ class CompanyGameRatioController extends AdminController
$this->DBModel = M("company_game_ratio","tab_");
parent::_initialize();
}
public function setCompanyBelong($company_belong = 0) {
if($company_belong == '0') {
return '内团';
} elseif($company_belong == '1') {
return '外团';
} else {
return '外团-分发';
}
}
public function index()
{
$params = I('get.');
@ -43,9 +54,9 @@ class CompanyGameRatioController extends AdminController
$where['m.relation_game_id'] = $params['relation_game_id'];
}
$pwhere = false;
if(isset($params['company_belong'])){
$pwhere = " and p.company_belong = {$params['company_belong']}";
}
// if(isset($params['company_belong'])){
// $pwhere = " and p.company_belong = {$params['company_belong']}";
// }
if(isset($params['company_id'])){
$where['m.company_id'] = $params['company_id'];
@ -96,24 +107,39 @@ class CompanyGameRatioController extends AdminController
}
$gameres = M("game","tab_")->field("tab_game.relation_game_id,tab_game.relation_game_name,IF(tab_game.original_package_name='','未配置',tab_game.original_package_name) original_package_name,tab_game_type.type_name game_type_name")->where($gamewhere)->join("tab_game_type on tab_game.game_type_id = tab_game_type.id")->group("tab_game.relation_game_id")->select(false);
$dbres = M("company_game_ratio","tab_")
->alias('m')
->field("m.*,g.*,p.company_name,p.company_belong,IFNULL(r.settlement_type,-1) settlement_type,group_concat(turnover_type ORDER BY begin_time ASC SEPARATOR '|') turnover_type,group_concat(ratio ORDER BY begin_time ASC SEPARATOR '|') ratio,group_concat(begin_time ORDER BY begin_time ASC SEPARATOR '|') begin_time,group_concat(end_time ORDER BY begin_time ASC SEPARATOR '|') end_time,group_concat(m.turnover_ratio ORDER BY begin_time ASC SEPARATOR '|') turnover_ratio,group_concat(m.id ORDER BY begin_time ASC SEPARATOR '|') operate_id")
->field("g.game_type_name,g.original_package_name,g.relation_game_name,m.company_id,p.company_name,(CASE WHEN p.company_belong is not null THEN p.company_belong ELSE m.company_belong END) company_belong,IFNULL(r.settlement_type,-1) settlement_type,group_concat(turnover_type ORDER BY begin_time ASC SEPARATOR '|') turnover_type,group_concat(ratio ORDER BY begin_time ASC SEPARATOR '|') ratio,group_concat(begin_time ORDER BY begin_time ASC SEPARATOR '|') begin_time,group_concat(end_time ORDER BY begin_time ASC SEPARATOR '|') end_time,group_concat(m.turnover_ratio ORDER BY begin_time ASC SEPARATOR '|') turnover_ratio,group_concat(m.id ORDER BY begin_time ASC SEPARATOR '|') operate_id")
->join("JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")
->join("JOIN tab_promote_company p ON ( m.company_id = p.id".$pwhere.")")
->join("left JOIN tab_company_relation r ON (r.first_company_type =2 AND r.first_company_id = m.company_id) OR (r.second_company_type =2 AND r.second_company_id = m.company_id)");
->join("left JOIN tab_promote_company p ON ( m.company_id = p.id".$pwhere.")")
->join("left JOIN tab_company_relation r ON (r.first_company_type =2 AND r.first_company_id = m.company_id) OR (r.second_company_type =2 AND r.second_company_id = m.company_id)")
->where($where)->group("company_id,m.relation_game_id,p.company_belong")
->select(false);
if(isset($params['company_belong'])){
$secwhere['company_belong'] = $params['company_belong'];
}
$dbres = M()->table("({$dbres})a")
->where("company_id = '0' or company_name is not null")
->where($secwhere);
if(isset($params['export'])){
$dbres = $dbres->where($where)->group("company_id,m.relation_game_id")->select();
$dbres = $dbres->select();
}else{
$dbres = $dbres->where($where)->page($page, $row)->group("company_id,m.relation_game_id")->select();
$dbres = $dbres->page($page, $row)->select();
}
// dump($dbres);die();
foreach($dbres as $k=>&$v){
$begin_time = explode('|',$v['begin_time']);
$end_time = explode('|',$v['end_time']);
$turnover_type = explode('|',$v['turnover_type']);
if (!$v['company_name']) {
$v['company_name'] = '无';
}
foreach ($begin_time as $tk => $tv) {
$begintime = date("Y-m-d",$tv);
@ -126,6 +152,10 @@ class CompanyGameRatioController extends AdminController
$v["turnover_types"][$tk] = "月流水";
} elseif($turnover_type[$tk] == 2) {
$v["turnover_types"][$tk] = "历史流水";
} elseif($turnover_type[$tk] == 3) {
$v["turnover_types"][$tk] = "cp月流水";
} elseif($turnover_type[$tk] == 4) {
$v["turnover_types"][$tk] = "cp历史流水";
}
}
@ -136,6 +166,8 @@ class CompanyGameRatioController extends AdminController
// $v["valid"] = "{$v['begin_time']} ~ {$v['end_time']}";
$v['company_belong'] ="下游".getCompanyBlong($v['company_belong']);
// $v['company_belong'] ="下游".$this->setCompanyBelong($v['company_belong']);
if (isset($params['export'])) {
$symbol = "\n";
} else {
@ -161,13 +193,20 @@ class CompanyGameRatioController extends AdminController
exit();
}
$count = M("company_game_ratio","tab_")->alias('m')->field("m.id")
$count = M("company_game_ratio","tab_")->alias('m')->field("m.company_id,p.company_name,m.id,p.company_belong,m.relation_game_id")
->join("JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")
->join("JOIN tab_promote_company p ON ( m.company_id = p.id".$pwhere.")")
->join("left JOIN tab_promote_company p ON ( m.company_id = p.id".$pwhere.")")
->where($where)
->group("company_id,m.relation_game_id")
->group("company_id,m.relation_game_id,m.company_belong")
->select(false);
$count = M()->table("({$count})a")
->where("company_id = '0' or company_name is not null")
->where($secwhere)
->group("company_id,relation_game_id,company_belong")
->select(false);
// dump($count);die();
$count = M()->table("({$count})a")->count();
$page = set_pagination($count, $row,$params);
@ -200,10 +239,10 @@ class CompanyGameRatioController extends AdminController
$where['m.status'] = $params['status'];
}
$pwhere = false;
if(isset($params['company_belong'])){
$pwhere = " and p.company_belong = {$params['company_belong']}";
}
// $pwhere = false;
// if(isset($params['company_belong'])){
// $pwhere = " and p.company_belong = {$params['company_belong']}";
// }
if(isset($params['company_id'])){
$where['m.company_id'] = $params['company_id'];
@ -229,7 +268,7 @@ class CompanyGameRatioController extends AdminController
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$time_start = strtotime($_REQUEST['time_start']);
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
$where["_string"] = "(begin_time BETWEEN {$time_start} AND {$time_end}) OR (end_time BETWEEN {$time_start} AND {$time_end}) OR (begin_time <= {$time_end} AND end_time >= {$time_end}) OR (begin_time >0 AND end_time = 0)";
$where["_string"] = "(begin_time BETWEEN {$time_start} AND {$time_end}) OR (end_time BETWEEN {$time_start} AND {$time_end}) OR (begin_time <= {$time_end} AND end_time >= {$time_end}) OR (begin_time <{$time_start} AND (end_time >{$time_end} or end_time = 0))";
} elseif (isset($_REQUEST['time_start'])) {
$time_start = strtotime($_REQUEST['time_start']);
$where["_string"] = "end_time >= {$time_start} OR end_time = 0";
@ -243,12 +282,22 @@ class CompanyGameRatioController extends AdminController
$gameres = M("game","tab_")->field("tab_game.relation_game_id,tab_game.relation_game_name,IF(tab_game.original_package_name='','未配置',tab_game.original_package_name) original_package_name,tab_game_type.type_name game_type_name")->where($gamewhere)->join("tab_game_type on tab_game.game_type_id = tab_game_type.id")->group("tab_game.relation_game_id")->select(false);
$dbres = M("company_game_ratio_log","tab_")
->alias('m')
->field("m.*,g.*,p.company_name,p.company_belong,IFNULL(r.settlement_type,0) settlement_type")
->field("m.id,m.status,g.game_type_name,g.original_package_name,g.relation_game_name,m.company_id,p.company_name,m.turnover_type,begin_time,end_time,m.turnover_ratio,last_ratio,last_turnover_ratio,m.ratio,verify_log,(CASE WHEN p.company_belong is not null THEN p.company_belong ELSE m.company_belong END) company_belong,IFNULL(r.settlement_type,0) settlement_type")
->join("JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")
->join("JOIN tab_promote_company p ON ( m.company_id = p.id".$pwhere.")")
->join("left JOIN tab_promote_company p ON ( m.company_id = p.id)")
->join("left JOIN tab_company_relation r ON (r.first_company_type =2 AND r.first_company_id = m.company_id) OR (r.second_company_type =2 AND r.second_company_id = m.company_id)")
->where($where)
->order("FIELD(m.status,0,1,-1,-2,2),id desc");
->order("FIELD(m.status,0,1,-1,-2,2),m.id desc")
->select(false);
if(isset($params['company_belong'])){
$secwhere['company_belong'] = $params['company_belong'];
}
$dbres = M()->table("({$dbres})a")
->where("company_id = '0' or company_name is not null")
->where($secwhere);
if(isset($params['export'])){
$dbres = $dbres->select();
}else{
@ -260,6 +309,10 @@ class CompanyGameRatioController extends AdminController
$v['begin_time'] = date("Y-m-d",$v['begin_time']);
$v['end_time'] = $v['end_time'] ? date('Y-m-d', $v['end_time']) : '永久';
if (!$v['company_name']) {
$v['company_name'] = '无';
}
$v["valid"] = "{$v['begin_time']} ~ {$v['end_time']}";
if($v["turnover_type"] == 0) {
@ -268,10 +321,15 @@ class CompanyGameRatioController extends AdminController
$v["turnover_types"] = "月流水";
} elseif($v["turnover_type"] == 2) {
$v["turnover_types"] = "历史流水";
} elseif($v["turnover_type"] == 3) {
$v["turnover_types"] = "cp月流水";
} elseif($v["turnover_type"] == 4) {
$v["turnover_types"] = "cp历史流水";
}
$v['company_belong'] ="下游".getCompanyBlong($v['company_belong']);
// $v['company_belong'] ="下游".$this->setCompanyBelong($v['company_belong']);
$v['verify_log'] = json_decode($v['verify_log'], true);
if (isset($params['export'])) {
$symbol = "\n";
@ -348,10 +406,32 @@ class CompanyGameRatioController extends AdminController
));
}
$count =M("company_game_ratio_log","tab_")->alias('m')->field("count(m.id) count")
->join("JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")
->join("JOIN tab_promote_company p ON ( m.company_id = p.id".$pwhere.")")
->where($where)->find()['count'];
// $count =M("company_game_ratio_log","tab_")->alias('m')->field("m.id,p.company_belong,m.company_id,p.company_name")
// ->join("JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")
// ->join("left JOIN tab_promote_company p ON ( m.company_id = p.id)")
// ->where($where)
// ->select(false);
$count = M("company_game_ratio_log","tab_")
->alias('m')
->field("m.id,m.company_id,p.company_name,m.turnover_type,(CASE WHEN p.company_belong is not null THEN p.company_belong ELSE m.company_belong END) company_belong")
->join("JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")
->join("left JOIN tab_promote_company p ON ( m.company_id = p.id)")
->join("left JOIN tab_company_relation r ON (r.first_company_type =2 AND r.first_company_id = m.company_id) OR (r.second_company_type =2 AND r.second_company_id = m.company_id)")
->where($where)
->order("FIELD(m.status,0,1,-1,-2,2),m.id desc")
->select(false);
if(isset($params['company_belong'])){
$secwhere['company_belong'] = $params['company_belong'];
}
// die($count);
$count = M()->table("({$count})a")
->field("count(id) count")
->where("company_id = '0' or company_name is not null")
->where($secwhere)
->find()['count'];
$this->assign('data', $dbres);
$page = set_pagination($count, $row,$params);
if($page) {
@ -447,6 +527,7 @@ class CompanyGameRatioController extends AdminController
//保存到其他表
//查找是否存在
$ratiov = [
'company_belong'=>$v['company_belong'],
"company_id"=>$v['company_id'],
"relation_game_id"=>$v['relation_game_id'],
"ratio"=>$v['ratio'],
@ -456,7 +537,7 @@ class CompanyGameRatioController extends AdminController
"turnover_type"=>$v['turnover_type'],
];
$this->companyRatioTimeChange($v['company_id'],$v['relation_game_id'],$v['begin_time'],$v['end_time'],$ratiov);
$this->companyRatioTimeChange($v['company_belong'],$v['company_id'],$v['relation_game_id'],$v['begin_time'],$v['end_time'],$ratiov);
// $has = $company_game_ratio->where("company_id='{$v['company_id']}' and relation_game_id='{$v['relation_game_id']}' and begin_time={$v['begin_time']} and end_time={$v['end_time']}")->find();
// if(isset($has['id'])){
@ -474,9 +555,9 @@ class CompanyGameRatioController extends AdminController
));
}
public function companyRatioTimeChange($company_id = 0, $relation_game_id = 0, $begin_time = 0, $end_time = 0,$ratiov=[]) {
public function companyRatioTimeChange($company_belong = 0,$company_id = 0, $relation_game_id = 0, $begin_time = 0, $end_time = 0,$ratiov=[]) {
if (!$company_id || !$relation_game_id) {
if (!$relation_game_id) {
$this->error("公司与游戏的参数错误.");
}
// dump($end_time);dump($begin_time);die();
@ -590,6 +671,11 @@ class CompanyGameRatioController extends AdminController
if (!isset($params['ratio']) || $params['ratio'] === '') {
$this->error('默认分成比例不能为空');
}
if(!$params['company_id']) {
$save['company_belong'] = $params['company_belong'] ?? 0;
}
$save['turnover_ratio'] = $this->setTurnoverRatio($params);
$save['ratio'] = $params['ratio'] ?? 0;
$save['relation_game_id'] = $params['relation_game_id'] ?? 0;
@ -615,6 +701,7 @@ class CompanyGameRatioController extends AdminController
//判断已有未审核
$where = [
"company_belong"=>$save['company_belong'],
"relation_game_id"=>$save['relation_game_id'],
"company_id"=>$save['company_id'],
"status"=>["LT",2],//管理员未确认
@ -657,7 +744,7 @@ class CompanyGameRatioController extends AdminController
$this->error('默认分成比例不能为空');
}
//查询
$y = M("company_game_ratio_log","tab_")->where("id='{$params['id']}'")->find();
$y = M("company_game_ratio","tab_")->where("id='{$params['id']}'")->find();
$save['turnover_ratio'] = $this->setTurnoverRatio($params);
$save['ratio'] = $params['ratio'] ?? 0;
$save['last_turnover_ratio'] = $params['last_turnover_ratio'];
@ -670,6 +757,7 @@ class CompanyGameRatioController extends AdminController
$save['turnover_type'] = $params['turnover_type'] ?? 1;
$save['status'] = 0;
$save['verify_log']=json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]);
$save['company_belong'] = $y['company_belong'] ?? 0;
if($y['ratio'] != $save['ratio'] || $y['turnover_ratio'] != $save['turnover_ratio'] || $y['begin_time'] != $save['begin_time'] || $y['end_time'] != $save['end_time']){
$save['status'] = 0;
@ -687,11 +775,13 @@ class CompanyGameRatioController extends AdminController
$gameres = M("game","tab_")->field("tab_game.relation_game_id,tab_game.relation_game_name,IF(tab_game.original_package_name='','未配置',tab_game.original_package_name) original_package_name,tab_game_type.type_name game_type_name")->join("tab_game_type on tab_game.game_type_id = tab_game_type.id")->group("tab_game.relation_game_id")->select(false);
$dbres = M("company_game_ratio","tab_")
->alias('m')
->field("m.*,g.*,p.company_name,p.company_belong")
->field("m.*,g.*,p.company_name,m.company_belong")
->join("left JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")
->join("left JOIN tab_promote_company p ON m.company_id = p.id")
->where($map)
->find();
$dbres['company_belong'] ="下游".$this->setCompanyBelong($dbres['company_belong']);
$dbres['turnover_ratio'] = $dbres['turnover_ratio'] ? json_decode($dbres['turnover_ratio'], true) : $dbres['turnover_ratio'];
$dbres['begin_time'] = date("Y-m-d",$dbres['begin_time']);
$dbres['end_time'] = empty($dbres['end_time']) ? '' :date("Y-m-d",$dbres['end_time']);
@ -727,6 +817,7 @@ class CompanyGameRatioController extends AdminController
$save['end_time'] = $params['end_time'] ? strtotime($params['end_time'])+86399 : 0;
$save['remark'] = $params['remark'] ?? '';
$save['turnover_type'] = $params['turnover_type'] ?? 1;
$save['company_belong'] = $y['company_belong'] ?? 0;
if($y['ratio'] != $save['ratio'] || $y['turnover_ratio'] != $save['turnover_ratio'] || $y['begin_time'] != $save['begin_time'] || $y['end_time'] != $save['end_time'] || $y['turnover_type'] != $save['turnover_type']){
$save['status'] = 0;
$save['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]);
@ -754,11 +845,12 @@ class CompanyGameRatioController extends AdminController
$gameres = M("game","tab_")->field("tab_game.relation_game_id,tab_game.relation_game_name,IF(tab_game.original_package_name='','未配置',tab_game.original_package_name) original_package_name,tab_game_type.type_name game_type_name")->join("tab_game_type on tab_game.game_type_id = tab_game_type.id")->group("tab_game.relation_game_id")->select(false);
$dbres = M("company_game_ratio_log","tab_")
->alias('m')
->field("m.*,g.*,p.company_name,p.company_belong")
->field("m.*,g.*,p.company_name,m.company_belong")
->join("left JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")
->join("left JOIN tab_promote_company p ON m.company_id = p.id")
->where($map)
->find();
$dbres['company_belong'] ="下游".$this->setCompanyBelong($dbres['company_belong']);
$dbres['turnover_ratio'] = $dbres['turnover_ratio'] ? json_decode($dbres['turnover_ratio'], true) : $dbres['turnover_ratio'];
$dbres['begin_time'] = date("Y-m-d",$dbres['begin_time']);
$dbres['end_time'] = empty($dbres['end_time']) ? '' :date("Y-m-d",$dbres['end_time']);

@ -109,8 +109,9 @@ class CompanyStatementOfflineController extends ThinkController
}
public function doPayment()
{
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
if(!isset($_REQUEST['ids']) || !isset($_REQUEST['payment_time'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$payment_time = $_REQUEST['payment_time'];
//获取所有的母单id
$companyStatementInfo = M("company_statement_info","tab_");
$statementPool = $companyStatementInfo->where("id in ($ids) and pay_status <> 1")->field("pool_id,count(id) count")->group("pool_id")->select();
@ -128,7 +129,7 @@ class CompanyStatementOfflineController extends ThinkController
$saveData = [
"pay_type"=>3,
"pay_status"=>1,
"pay_info"=>json_encode(["payment_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"payment_time"=>date("Y-m-d H:i:s")])
"pay_info"=>json_encode(["payment_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"payment_time"=>$payment_time])
];
$ires = $companyStatementInfo->where("id in ($ids)")->save($saveData);

@ -25,13 +25,15 @@ class CompanyStatementPoolController extends ThinkController
];
public $VerifyStatus=[
"-2"=>"拒绝打款",
"-1"=>"审拒绝",
"0"=>"未审",
"1"=>"审批通过",
"2"=>"待打款",
"-1"=>"审拒绝",
"0"=>"未审",
"1"=>"打款信息确认",
"2"=>"审核通过",
"3"=>"打款中",
"4"=>"打款成功",
"5"=>"无需打款"
"5"=>"无需打款",
"6"=>"初审通过",
"-3"=>"初审拒绝",
];
public $InfoVerifyStatus=[
"-1"=>"配置信息不全",
@ -110,7 +112,7 @@ class CompanyStatementPoolController extends ThinkController
$data = $this->DBModel
->field("*")
->where($map)
->order("FIELD(verify_status,0,1,-1,-2,2,3,4,5),id desc")
->order("id desc")
->page($page,$row)->select();
foreach($data as $k => &$v) {
@ -137,6 +139,19 @@ class CompanyStatementPoolController extends ThinkController
$symbol = "<br>";
}
$v["create"]= "{$v['verify_log']['create_user']} {$symbol} {$v['verify_log']['create_time']}";
if(isset($v['verify_log']['firstverify_user'])){
if($v['verify_status'] == -3){
$ts = "初审拒绝";
}else{
$ts = "初审通过";
}
$v["firstverify"]= "{$ts}({$v['verify_log']['firstverify_user']}) {$symbol} {$v['verify_log']['firstverify_time']}";
$ts = '';
}else{
$v["firstverify"] = '--';
}
if(isset($v['verify_log']['verify_user'])){
if($v['verify_status'] == -1){
$ts = "审核拒绝";
@ -152,6 +167,8 @@ class CompanyStatementPoolController extends ThinkController
if(isset($v['verify_log']['payment_user'])){
if($v['verify_status'] == -2){
$ts = "拒绝打款";
}elseif($v['verify_status'] == 1){
$ts = "打款信息确认";
}elseif($v['verify_status'] == 2){
$ts = "待打款";
}elseif($v['verify_status'] == 3){
@ -247,8 +264,12 @@ class CompanyStatementPoolController extends ThinkController
$this->assign("title",$statement_num);
$this->assign("pool_status",$pool_info['verify_status']);
$this->assign("is_payment",$pool_info['is_payment']);
if ($_REQUEST['type']) {
$this->editSpecialPuPool($infolist,$is_export);
} else {
$this->editPuPool($infolist,$is_export);
}
$this->editPuPool($infolist,$is_export);
}
public function editPuPool(&$infolist,$is_export) {
@ -338,12 +359,107 @@ class CompanyStatementPoolController extends ThinkController
$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 editSpecialPuPool(&$infolist,$is_export) {
$line = 1;
$count = [];
$week_line = 2;
//获取对接人
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;
if($is_export){
$v['statement_money'] = "=ROUND(";
}
$row = 0;
foreach($v['statement_info'] as $ke=>&$va){
$va['row'] = count($va['game_list']);
$row += count($va['game_list']);
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;
}
if (!$val['ratio']) {
$val['ratio'] = 0;
}
if (!$val['refund']) {
$val['refund'] = 0;
}
// if(isset($val['ratio'])){
// $val['increment_ratio'] = 0;
// }else{
// $val['ratio'] = 0;
// }
}
if($is_export){
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}*(M{$line}),2)";
}
$v['statement_money'] .= "N{$line}+";
}else{
$count['platform_amount'] += $val['pay_amount'];
$count['sum_money'] += $val['sum_money'];
}
}
}
$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) {
$v['statement_money'] .="O{$cline}-P{$cline},2)";
} else {
$v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1).",2)";
}
}
}
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/editSpecialPuPool");
}
//个人汇总结算查看
public function viewPuPool(&$infolist,$is_export){
$line = 1;
@ -401,7 +517,7 @@ class CompanyStatementPoolController extends ThinkController
} else {
$val['sum_money'] = "=ROUND(K{$line}*(N{$line}),2)";
}
$v['statement_money'] .= "O{$line}+";
$v['statement_money'] .= "S{$line}+";
}else{
$count['platform_amount'] += $val['pay_amount'];
$count['week_money'] += $val['sum_money'];
@ -420,7 +536,8 @@ class CompanyStatementPoolController extends ThinkController
if($is_export){
if($v['withdraw_type'] != 3) {
$v['statement_money'] .="P{$cline}-Q{$cline},2)";
// $v['statement_money'] .="P{$cline}-Q{$cline},2)";
$v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1) . ",2)";
} else {
$v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1).",2)";
}
@ -430,8 +547,8 @@ class CompanyStatementPoolController extends ThinkController
if($is_export){
$count["platform_amount"] = "=ROUND(SUM(K2:K".$line."),2)";
$count["week_money"] = "=ROUND(SUM(R2:R".$line."),2)";
$count["sum_money"] = "=ROUND(SUM(S2:S".$line."),2)";
$count["week_money"] = "=ROUND(SUM(S2:S".$line."),2)";
$count["sum_money"] = "=ROUND(SUM(T2:T".$line."),2)";
}
// die();
$this->assign("data",$infolist);
@ -444,7 +561,7 @@ class CompanyStatementPoolController extends ThinkController
$game_list = [];
$old_line = $week_line;
// dump($statement_info);
//使用时间与会长账号作为键值分离数据
foreach($statement_info as $sk=>$sv){
@ -456,7 +573,6 @@ class CompanyStatementPoolController extends ThinkController
}
}
// dump($game_list);
$game_data = [];
$handle_data = [];
@ -483,12 +599,14 @@ class CompanyStatementPoolController extends ThinkController
for ($i=0;;$i++) {
if ($sv[$i]['sum_money']) {
$game_data['week_amount'] += $sv[$i]['sum_money'];
$game_data['withhold_amount'] += $sv[$i]['withhold'];
$game_data['fine'] += $sv[$i]['fine'];
$game_data['reward'] += $sv[$i]['reward'];
} else {
break;
}
}
// $game_data['week_amount'] += $sv[0]['sum_money'];
$game_data['game_list'] = $sv;
array_push($handle_data,$game_data);
@ -497,12 +615,11 @@ class CompanyStatementPoolController extends ThinkController
}
}
// dump($handle_data);
$substract = 1;
// dump($game_list);
// dump($handle_data);
//添加周结算金额,合并相同的结算时间
// dump($handle_data);
foreach($handle_data as $hk => $hv) {
if($hk > 0) {
@ -516,17 +633,13 @@ class CompanyStatementPoolController extends ThinkController
}
}
// if (
//// $hv['account'] == 'zj9587' ||
// $hv['account'] == 'ruiyou' || $hv['account'] == 'weicheng') {
// dump($handle_data);
// }
// dump($hv);
if ($hv['time'] == $handle_data[$hk-$substract]['time']) {
$handle_data[$hk-$substract]['time_row'] += $handle_data[$hk]['time_row'];
$handle_data[$hk-$substract]['week_amount'] += $handle_data[$hk]['week_amount'];
$handle_data[$hk-$substract]['withhold_amount'] += $handle_data[$hk]['withhold_amount'];
unset($handle_data[$hk]['time']);
unset($handle_data[$hk]['time_row']);
@ -536,15 +649,11 @@ class CompanyStatementPoolController extends ThinkController
}
}
// $substract = 0;
foreach($handle_data as $hk => $hv) {
$substract = 1;
if ($is_export) {
// if (
//// $hv['account'] == 'zj9587' ||
// $hv['account'] == 'ruiyou' || $hv['account'] == 'weicheng') {
// dump($handle_data);
// }
for (;;) {
if (!$handle_data[$hk+$substract]['time']&&$handle_data[$hk+$substract]['account']) {
@ -560,28 +669,19 @@ class CompanyStatementPoolController extends ThinkController
break;
}
}
if (count($hv['game_list'])>1) {
$week_line += count($hv['game_list'])-1;
}
// if (
//// $hv['account'] == 'zj9587' ||
// $hv['account'] == 'ruiyou' || $hv['account'] == 'weicheng') {
// dump($handle_data);
// }
$handle_data[$hk]['week_amount'] = "=ROUND(SUM(O{$old_line}:O{$week_line}),2)";
$handle_data[$hk]['week_amount'] = "=ROUND(SUM(O{$old_line}:O{$week_line})+SUM(P{$old_line}:P{$week_line})-SUM(Q{$old_line}:Q{$week_line})-SUM(R{$old_line}:R{$week_line}),2)";
if (count($hv['game_list'])>1) {
$old_line += count($hv['game_list']);
// if (
//// $hv['account'] == 'zj9587' ||
// $hv['account'] == 'DCX1012' || $hv['account'] == 'chuangshi168') {
// dump($old_line);
// }
} else {
$old_line++;
}
@ -592,17 +692,11 @@ class CompanyStatementPoolController extends ThinkController
} else {
$week_line = $old_line;
}
// if (
//// $hv['account'] == 'zj9587' ||
// $hv['account'] == 'DCX1012' || $hv['account'] == 'chuangshi168') {
// dump($week_line);
// }
}
}
// dump($handle_data);
return $handle_data?$handle_data:[];
}
@ -901,10 +995,19 @@ class CompanyStatementPoolController extends ThinkController
//审批通过
public function verifyAgree(){
$this->setVerifyStatus(0,1,"verify");
$this->setVerifyStatus(6,1,"payment",false);
$this->setVerifyStatus(1,2,"verify");
}
public function verifyRefuse(){
$this->setVerifyStatus(0,-1,"verify");
$this->setVerifyStatus([1,6],-1,"verify");
}
//审批通过
public function firstverifyAgree(){
$this->setVerifyStatus(0,6,"firstverify");
}
public function firstverifyRefuse(){
$this->setVerifyStatus(0,-3,"firstverify");
}
//审批撤回
public function verifyReturn() {
@ -913,14 +1016,16 @@ class CompanyStatementPoolController extends ThinkController
$dbres = $this->DBModel->field("id,verify_status,verify_log")->where("id in ({$ids})")->select();
foreach($dbres as $k=>&$v){
if($v['verify_status'] != -1&&$v['verify_status'] != 1) continue;
$VerifyStatus = $v['verify_status'];
if(!in_array($VerifyStatus,[-1,1,2])) continue;
$v['verify_log'] = json_decode($v['verify_log'],true);
unset($v['verify_log']['verify_user']);
unset($v['verify_log']['verify_time']);
if(isset($v['verify_log']['payment_user'])) unset($v['verify_log']['payment_user']);
if(isset($v['verify_log']['payment_time'])) unset($v['verify_log']['payment_time']);
$v['verify_log'] = json_encode($v['verify_log']);
$v['verify_status']=0;
$v['verify_status']=6;
$this->DBModel->save($v);
addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"审批撤回",'url'=>U('lists')]);
}
@ -948,13 +1053,18 @@ class CompanyStatementPoolController extends ThinkController
}
protected function setVerifyStatus($old_status,$change_status,$op_pre)
protected function setVerifyStatus($old_status,$change_status,$op_pre,$ajaxreturn=true)
{
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$dbres = $this->DBModel->field("id,verify_status,verify_log")->where("id in ({$ids})")->select();
foreach($dbres as $k=>&$v){
if($v['verify_status'] != $old_status) continue;
if(is_array($old_status)){
if(!in_array($v['verify_status'],$old_status)) continue;
}else{
if($v['verify_status'] != $old_status) continue;
}
$v['verify_log'] = json_decode($v['verify_log'],true);
$v['verify_log'][$op_pre.'_user']=$this->admininfo["username"];
$v['verify_log'][$op_pre.'_time']=date("Y.m.d H:i:s");
@ -964,10 +1074,13 @@ class CompanyStatementPoolController extends ThinkController
$opname = $this->VerifyStatus[$change_status];
addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>$opname,'url'=>U('lists')]);
}
$this->ajaxReturn(array(
'status' => 1,
"info"=>$opname."成功"
));
if($ajaxreturn){
$this->ajaxReturn(array(
'status' => 1,
"info"=>$opname."成功"
));
}
}
protected function setOneVerifyStatus($change_status,$op_pre,$id,$mgs = "操作")
@ -1016,6 +1129,7 @@ class CompanyStatementPoolController extends ThinkController
public function editPayment(){
if(!isset($_REQUEST['info'])) $this->error("参数错误");
$info = $_REQUEST['info'];
$pool_id = $_REQUEST['pool_id'];
$CompanyInfo = M("company_statement_info","tab_");
//循环保存
foreach($info as $k=>$v){
@ -1043,8 +1157,15 @@ class CompanyStatementPoolController extends ThinkController
}
$CompanyInfo->save($savedata);
}
//修改状态
$this->setOneVerifyStatus(2,"payment",$_REQUEST['pool_id'],$mgs = "打款信息确认");
$verify_status = $this->DBModel->field("verify_status")->where("id = {$pool_id}")->find()['verify_status'];
if( $verify_status == 6){
$this->setOneVerifyStatus(1,"payment",$_REQUEST['pool_id'],$mgs = "打款信息确认");
}else{
$this->ajaxReturn(array(
'status' => 1,
"info"=>"打款信息编辑成功"
));
}
}
//查看打款信息
public function viewPayment(){
@ -1421,6 +1542,7 @@ class CompanyStatementPoolController extends ThinkController
"viewPool"=>"<a class='confirm viewPool' data-id='{$id}'>查看</a>",
"editPool"=>"<a class='confirm editPool' data-id='{$id}'>编辑</a>",
"editSpecialPuPool"=>"<a class='confirm editSpecialPuPool' data-id='{$id}'>编辑</a>",
"addRemark"=>"<a class='confirm addRemark' data-id='{$id}'>新增备注</a>",
"editRemark"=>"<a class='confirm editRemark' data-remark='{$remark}' data-id='{$id}'>修改备注</a>",
@ -1449,13 +1571,13 @@ class CompanyStatementPoolController extends ThinkController
$optist = ["viewPool","reCount","cancelPool"];
break;
case '1':
$optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher","setPayment","setUlPayment"];
$optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher","editPayment","setUlPayment"];
break;
case '2':
$optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher","editPayment"];
$optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher"];
break;
case '3':
$optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher","editPayment","viewPayment"];
$optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher","viewPayment"];
break;
case '4':
$optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher","viewPayment"];
@ -1463,6 +1585,9 @@ class CompanyStatementPoolController extends ThinkController
case '5':
$optist = ["viewPool","addRemark","viewRemark","editRemark","reCount","cancelPool"];
break;
case '6':
$optist = ["viewPool","addRemark","viewRemark","editRemark","reCount","cancelPool","setPayment"];
break;
default:
break;
}
@ -1487,10 +1612,13 @@ class CompanyStatementPoolController extends ThinkController
}
if ($info['withdraw_type'] == "特殊补点") {
$optist = ['viewPool','cancelPool'];
$optist = array_diff($optist, ["reCount"]);
if ($info['company_type'] == 2 && $info['verify_status'] == '0') {
array_push($optist,'editSpecialPuPool');
}
}
if($info['company_type'] == 2 && $info['verify_status'] == '0'&&$info['withdraw_type'] != "特殊补点") {
if($info['company_type'] == 2 && ($info['verify_status'] == '6' || $info['verify_status'] == '0') &&$info['withdraw_type'] != "特殊补点") {
array_push($optist,"editPool");
}
@ -1530,9 +1658,11 @@ class CompanyStatementPoolController extends ThinkController
public function menuAuth()
{
$mentBtn = [
"verifyAgree"=>"<a class='butn' id='verifyAgree'>审批通过</a>",
"firstverifyAgree"=>"<a class='butn' id='firstverifyAgree'>初审通过</a>",
"firstverifyRefuse"=>"<a class='butn' id='firstverifyRefuse' style='background-color: red;'>初审拒绝</a>",
"verifyAgree"=>"<a class='butn' id='verifyAgree'>审核通过</a>",
"verifyRefuse"=>"<a class='butn' id='verifyRefuse' style='background-color: red;'>审核拒绝</a>",
"verifyReturn"=>"<a class='butn' id='verifyReturn'>审批撤回</a>",
"verifyReturn"=>"<a class='butn' id='verifyReturn'>撤回</a>",
"export"=>"<a class='butn' id='export'>导出</a>"
];
$resarr = [];
@ -1558,6 +1688,7 @@ class CompanyStatementPoolController extends ThinkController
$ratio = $data['ratio'];
$refund = $data['refund'];
$withhold = $data['withhold'];
$increment_ratio = $data['increment_ratio'];
$sum_money = $data['sum_money'];
$st = $data['st'];
@ -1568,45 +1699,60 @@ class CompanyStatementPoolController extends ThinkController
$statement_amount = 0;
$statement_lack_amount = 0;
foreach ($ratio as $key => $value) {
// dump($increment_ratio);
foreach ($increment_ratio as $key => $value) {
if ($st[$key] == 1) {
$model = M("company_statement_info","tab_");
} else {
$model = M("company_lack_statement_info","tab_");
}
$statement_data = $model->where(['id'=>$key])->find();
$statement_info = array();
foreach($value as $akey => $aval) {
if ($st[$key][$akey] == 1) {
$model = M("company_statement_info","tab_");
} else {
$model = M("company_lack_statement_info","tab_");
}
$statement_info = json_decode($statement_data['statement_info'],true);
$statement_data = $model->where(['id'=>$key])->find();
foreach ($statement_info as $k => $v) {
$statement_info = json_decode($statement_data['statement_info'],true);
$game_list = $v['game_list'];
foreach ($statement_info as $k => $v) {
foreach ($game_list as $gk => $gv) {
$game_list = $v['game_list'];
$statement_info[$k]['game_list'][$gk]['ratio'] = $ratio[$key][$v['account']][$gk];
$statement_info[$k]['game_list'][$gk]['refund'] = $refund[$key][$v['account']][$gk];
$statement_info[$k]['game_list'][$gk]['increment_ratio'] = $increment_ratio[$key][$v['account']][$gk];
$statement_info[$k]['game_list'][$gk]['sum_money'] = $sum_money[$key][$v['account']][$gk];
foreach ($game_list as $gk => $gv) {
$amount += $sum_money[$key][$v['account']][$gk];
if ($ratio[$key][$v['account']][$gk]) {
$statement_info[$k]['game_list'][$gk]['ratio'] = (int)$ratio[$key][$v['account']][$gk];
}
$statement_info[$k]['game_list'][$gk]['refund'] = $refund[$key][$v['account']][$gk];
$statement_info[$k]['game_list'][$gk]['withhold'] = $withhold[$key][$v['account']][$gv['statement_begin_time']];
$withhold[$key][$v['account']][$gv['statement_begin_time']] = 0;
$statement_info[$k]['game_list'][$gk]['increment_ratio'] = $increment_ratio[$key][$v['account']][$gk];
$statement_info[$k]['game_list'][$gk]['sum_money'] = $sum_money[$key][$v['account']][$gk];
$amount += $sum_money[$key][$v['account']][$gk];
if ($st[$key][$akey] == 1) {
$statement_amount += $sum_money[$key][$v['account']][$gk];
} else {
$statement_lack_amount += $sum_money[$key][$v['account']][$gk];
}
if ($st[$key] == 1) {
$statement_amount += $sum_money[$key][$v['account']][$gk];
} else {
$statement_lack_amount += $sum_money[$key][$v['account']][$gk];
}
// dump($v['account']);
// dump($sum_money[$key][$v['account']][$gk]);
}
$statement_info_data = json_encode($statement_info);
$model->where(['id'=>$key])->save(['statement_info'=>$statement_info_data,'statement_money'=>$amount,'pay_amount'=>$amount,'remark'=>$remark[$key]]);
$amount = 0;
}
$statement_info = json_encode($statement_info);
$model->where(['id'=>$key])->save(['statement_info'=>$statement_info,'statement_money'=>$amount,'pay_amount'=>$amount,'remark'=>$remark[$key]]);
$amount = 0;
}
M("company_statement_pool","tab_")->where(['id'=>$id])->save(['pay_amount'=>$statement_amount,'statement_money'=>$statement_amount,'lack_statement_money'=>$statement_lack_amount]);

@ -616,6 +616,7 @@ class CompanyStatementSetController extends Controller {
$tmpp = M("PromoteCompany","tab_")->field("id,uid,company_name partner,settlement_contact link_man,address,contact_phone link_phone,bank_name opening_bank,bank_address payee_name,bank_card bank_account,fax_ratio,taxation_rate,company_belong,company_type,ali_user,ali_account,has_server_fee,server_fee,has_ratio,turnover_ratio")
->where($pc_map)
->select();
// dump($tmpp);
if(empty($tmpp)){
return true;
}
@ -723,7 +724,10 @@ class CompanyStatementSetController extends Controller {
if(count($t_game_ratio) == 1){
$tmp_game_ratio = $t_game_ratio[0];
$game['pay_amount'] = $v['game_list'][$t_game_id]['pay_amount'];
$game['pay_amount'] =$this->getRelationGameIdSpend($add_data['company_id'],$t_game_id,$tmp_game_ratio['begintime'],$tmp_game_ratio['endtime']);
// $game['pay_amount'] = $v['game_list'][$t_game_id]['pay_amount'];
$game['pay_amount'] -=0;
$game['statement_begin_time']=$statement_begin_time;
@ -733,11 +737,18 @@ class CompanyStatementSetController extends Controller {
if($type == 1){
$tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio += $company_ratio;
// if ($add_data['company_id'] == 5) {
// dump($game_all_payment);
// dump($this->getTurnoverType($t_game_id,$k,$begintime,$endtime));
// dump($tmp_game_ratio);
// }
}elseif($type == 0){
// $tratio = $tmp_game_ratio['ratio'];
$turnover_type = $this->getTurnoverType($t_game_id,$k,$begintime,$endtime);
if ($turnover_type == 2) {
if ($turnover_type == 2 || $turnover_type == 4) {
$tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
} else {
$tratio = $tmp_game_ratio['ratio'];
@ -745,7 +756,7 @@ class CompanyStatementSetController extends Controller {
}else{
//补点
$turnover_type = $this->getTurnoverType($t_game_id,$k,$begintime,$endtime);
if ($turnover_type == 2) {
if ($turnover_type == 2 || $turnover_type == 4) {
continue;
}
$tratio1 =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
@ -761,7 +772,9 @@ class CompanyStatementSetController extends Controller {
$game['sum_money']=round($game['pay_amount']*$tratio*(100-$fax_ratio)/(100*100),2);//结算金额=平台总额*(分成比例+补点比例)*(1-税费费率)
$add_data['statement_money'] += $game['sum_money'];
$add_data['statement_info'][] = $game;
if ($game['pay_amount'] != '0') {
$add_data['statement_info'][] = $game;
}
}else{
// dd($t_game_ratio);
for ($i=0; $i < count($t_game_ratio); $i++) {
@ -775,20 +788,27 @@ class CompanyStatementSetController extends Controller {
$add_data['pay_amount'] += $temp_game['pay_amount'];
if($type == 1){
// if ($add_data['company_id'] == 5) {
// dump($game_all_payment);
// dump($this->getTurnoverType($t_game_id,$k,$begintime,$endtime));
// dump($tmp_game_ratio);
// }
$tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio += $company_ratio;
}elseif($type == 0){
// $tratio = $t_game_ratio['ratio'];
$turnover_type = $this->getTurnoverType($t_game_id,$k,$begintime,$endtime);
if ($turnover_type == 2) {
if ($turnover_type == 2 || $turnover_type == 4) {
$tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
} else {
$tratio = $tmp_game_ratio['ratio'];
}
}else{
$turnover_type = $this->getTurnoverType($t_game_id,$k,$begintime,$endtime);
if ($turnover_type == 2) {
if ($turnover_type == 2 || $turnover_type == 4) {
continue;
}
//补点
@ -804,7 +824,9 @@ class CompanyStatementSetController extends Controller {
}
$temp_game['sum_money']=round($temp_game['pay_amount']*$tratio*(100-$fax_ratio)/(100*100),2);//结算金额=平台总额*(分成比例+补点比例)*(1-税费费率)
$add_data['statement_money'] += $temp_game['sum_money'];
$add_data['statement_info'][] = $temp_game;
if ($temp_game['pay_amount'] != '0') {
$add_data['statement_info'][] = $temp_game;
}
}
}
}
@ -865,6 +887,19 @@ class CompanyStatementSetController extends Controller {
$add_data['pay_amount'] -= $server_count;;
}
}
$is_continue = false;
$statement_data = $add_data['statement_info'];
foreach ($statement_data as $skey => $sval) {
if ($sval) {
$is_continue = true;
}
}
if (!$is_continue) {
continue;
}
$add_data['statement_info'] = json_encode($add_data['statement_info'],JSON_UNESCAPED_UNICODE);
if($type == 2 && $add_data['statement_money'] == 0){
@ -908,6 +943,8 @@ class CompanyStatementSetController extends Controller {
public function getPromoteCompanySpend(&$pcList,$idarr,$begintime,$endtime){
$res = [];
$all_res = [];
$cp_res = [];
$cp_all_res = [];
//获取推广员
if(count($idarr) == 0){return $res;}
$Promote = M("Promote","tab_");
@ -916,6 +953,14 @@ class CompanyStatementSetController extends Controller {
"s.pay_status"=>1,
"s.payed_time"=>['between', [$begintime,$endtime]],
];
// dump($spenMap);
$cpMap = $spenMap;
$cpMap["s.payed_time"] = ['between', [strtotime(date("Y-m-1",$begintime)),$endtime]];
$cpAllMap = $spenMap;
$cpAllMap["s.payed_time"] = ['elt',$endtime];
for ($i=0; $i <count($idarr); $i++) {
$company_id = $idarr[$i];
@ -949,6 +994,7 @@ class CompanyStatementSetController extends Controller {
}
}
if(empty($list)){continue;}
foreach($list as $k=>$v){
@ -989,9 +1035,67 @@ class CompanyStatementSetController extends Controller {
// ];
// $turnover_type = D("CompanyGameRatio")->field("turnover_type")->where($turnover_where)->find()['turnover_type'];
$turnover_type = $this->getTurnoverType($v[$j],$company_id,$begintime,$endtime);
if ($turnover_type == 2) {
$res[$company_id][$v[$j]]['ratio_pay_amount'] = $all_res[$company_id][$v[$j]]['pay_amount'];
$temp += $all_res[$company_id][$v[$j]]['pay_amount'];
} elseif($turnover_type == 3){
if (empty($cp_res[$company_id])) {
$cpSpendList = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($cpMap)->group('game_id')
->join("left join tab_game g on s.game_id = g.id")
->select();
// if ($company_id == 5) {
// dump($cpMap);
// }
foreach($cpSpendList as $ck=>$cv){
try {
$cp_res[$company_id]["pay_amount"] += $cv['pay_amount'];
} catch (\Throwable $th) {
$cp_res[$company_id]["pay_amount"] = $cv['pay_amount'];
}
if(isset($cp_res[$company_id][$cv['relation_game_id']])){
//
$cp_res[$company_id][$cv['relation_game_id']]['pay_amount'] += $cv['pay_amount'];
}else{
unset($cv['game_id']);
$cp_res[$company_id][$cv['relation_game_id']]= $cv;
}
}
}
$res[$company_id][$v[$j]]['ratio_pay_amount'] = $cp_res[$company_id][$v[$j]]['pay_amount'];
$temp += $cp_res[$company_id][$v[$j]]['pay_amount'];
} elseif($turnover_type == 4){
if (empty($cp_all_res[$company_id])) {
$cpAllSpendList = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($cpAllMap)->group('game_id')
->join("left join tab_game g on s.game_id = g.id")
->select();
foreach ($cpAllSpendList as $ck => $cv) {
try {
$cp_all_res[$company_id]["pay_amount"] += $cv['pay_amount'];
} catch (\Throwable $th) {
$cp_all_res[$company_id]["pay_amount"] = $cv['pay_amount'];
}
if (isset($cp_all_res[$company_id][$cv['relation_game_id']])) {
//
$cp_all_res[$company_id][$cv['relation_game_id']]['pay_amount'] += $cv['pay_amount'];
} else {
unset($cv['game_id']);
$cp_all_res[$company_id][$cv['relation_game_id']] = $cv;
}
}
}
$res[$company_id][$v[$j]]['ratio_pay_amount'] = $cp_all_res[$company_id][$v[$j]]['pay_amount'];
$temp += $cp_all_res[$company_id][$v[$j]]['pay_amount'];
} else {
// $res[$company_id][$v[$j]]['ratio_pay_amount'] = $res[$company_id][$v[$j]]['pay_amount'];
$temp += $res[$company_id][$v[$j]]['pay_amount'];
@ -1016,8 +1120,62 @@ class CompanyStatementSetController extends Controller {
if ($k!='pay_amount') {
$turnover_type = $this->getTurnoverType($k,$key,$begintime,$endtime);
if ($turnover_type == 2) {
$res[$key][$k]['ratio_pay_amount'] = $all_res[$key][$k]['pay_amount'];
} elseif($turnover_type == 3){
if (empty($cp_res[$key])) {
// if ($key == 5) {
// dump(2);
// dump($cpMap);
// dump($cp_res);
// }
$cpSpendList = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($cpMap)->group('game_id')
->join("left join tab_game g on s.game_id = g.id")
->select();
foreach($cpSpendList as $ck=>$cv){
try {
$cp_res[$key]["pay_amount"] += $cv['pay_amount'];
} catch (\Throwable $th) {
$cp_res[$key]["pay_amount"] = $cv['pay_amount'];
}
if(isset($cp_res[$key][$cv['relation_game_id']])){
//
$cp_res[$key][$cv['relation_game_id']]['pay_amount'] += $cv['pay_amount'];
}else{
unset($cv['game_id']);
$cp_res[$key][$cv['relation_game_id']]= $cv;
}
}
}
$res[$key][$k]['ratio_pay_amount'] = $cp_res[$key][$k]['pay_amount'];
} elseif($turnover_type == 4){
if (empty($cp_all_res[$key])) {
$cpAllSpendList = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($cpAllMap)->group('game_id')
->join("left join tab_game g on s.game_id = g.id")
->select();
foreach ($cpAllSpendList as $ck => $cv) {
try {
$cp_all_res[$key]["pay_amount"] += $cv['pay_amount'];
} catch (\Throwable $th) {
$cp_all_res[$key]["pay_amount"] = $cv['pay_amount'];
}
if (isset($cp_all_res[$key][$cv['relation_game_id']])) {
//
$cp_all_res[$key][$cv['relation_game_id']]['pay_amount'] += $cv['pay_amount'];
} else {
unset($cv['game_id']);
$cp_all_res[$key][$cv['relation_game_id']] = $cv;
}
}
}
$res[$key][$k]['ratio_pay_amount'] = $cp_all_res[$key][$k]['pay_amount'];
}
}
@ -1037,6 +1195,11 @@ class CompanyStatementSetController extends Controller {
* 返回结算流水类型
*/
public function getTurnoverType($relation_game_id = 0, $company_id = 0, $begin_time = 0, $end_time = 0){
$company_belong = M("promote_company","tab_")->field("company_belong")->where(['id'=>$company_id])->find();
if (!$company_belong) {
return 0;
}
$turnover_where = [
"relation_game_id"=>$relation_game_id,
@ -1044,10 +1207,20 @@ class CompanyStatementSetController extends Controller {
"_string"=>"begin_time <={$end_time} AND ( end_time = 0 OR end_time >= {$begin_time})"
];
$turnover_type = D("CompanyGameRatio")->field("turnover_type")->where($turnover_where)->find();
if (!$turnover_type) {
$turnover_where = [
"company_belong"=>$company_belong['company_belong'],
"relation_game_id"=>$relation_game_id,
"company_id"=>0,
"_string"=>"begin_time <={$end_time} AND ( end_time = 0 OR end_time >= {$begin_time})"
];
$turnover_type = D("CompanyGameRatio")->field("turnover_type")->where($turnover_where)->find();
}
//判断特殊比例是否存在,存在直接返回结算流水类型
if (!$turnover_type) {
$company_belong = M("promote_company","tab_")->field("company_belong")->where(['id'=>$company_id])->find();
//判断公司内外团类型是否存在不存在直接返回0
if (!$company_belong) {
return 0;
@ -1084,6 +1257,16 @@ class CompanyStatementSetController extends Controller {
"s.pay_status"=>1,
"s.payed_time"=>['between', [$begintime,$endtime]],
];
$cpallgame = [];
$cpgame = [];
$cpMap = $spenMap;
$cpMap["s.payed_time"] = ['between', [strtotime(date("Y-m-1",$begintime)),$endtime]];
$cpAllMap = $spenMap;
$cpAllMap["s.payed_time"] = ['elt',$endtime];
// unset($cpAllMap["s.payed_time"]);
for ($i=0; $i <count($idarr); $i++) {
$company_id = $idarr[$i];
@ -1152,6 +1335,42 @@ class CompanyStatementSetController extends Controller {
$turnover_type = $this->getTurnoverType($v[$j],$company_id,$begintime,$endtime);
if ($turnover_type == 2) {
$temp += $allgame[$v[$j]]['pay_amount'];
} elseif($turnover_type == 3) {
if (empty($cpgame)) {
$cpSpendList = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($cpMap)->group('game_id')
->join("left join tab_game g on s.game_id = g.id")
->select();
// if ($company_id == 43) {
// dump($cpMap);
// }
foreach($cpSpendList as $ck=>$cv){
if(isset($cpgame[$cv['relation_game_id']])){
$cpgame[$cv['relation_game_id']]['pay_amount'] += $cv['pay_amount'];
}else{
$cpgame[$cv['relation_game_id']]['pay_amount'] = $cv['pay_amount'];
}
}
}
$temp += $cpgame[$v[$j]]['pay_amount'];
} elseif($turnover_type == 4) {
if (empty($cpallgame)) {
$cpAllSpendList = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($cpAllMap)->group('game_id')
->join("left join tab_game g on s.game_id = g.id")
->select();
foreach($cpAllSpendList as $ck=>$cv){
if(isset($cpallgame[$cv['relation_game_id']])){
$cpallgame[$cv['relation_game_id']]['pay_amount'] += $cv['pay_amount'];
}else{
$cpallgame[$cv['relation_game_id']]['pay_amount'] = $cv['pay_amount'];
}
}
}
$temp += $cpallgame[$v[$j]]['pay_amount'];
} else {
// $res[$company_id][$v[$j]]['ratio_pay_amount'] = $res[$company_id][$v[$j]]['pay_amount'];
$temp += $game[$v[$j]]['pay_amount'];
@ -1186,6 +1405,43 @@ class CompanyStatementSetController extends Controller {
if ($turnover_type == 2) {
// $temp += $allgame[$v[$j]]['pay_amount'];
$res[$company_id][$p_account][$v['relation_game_id']]['all_pay_amount']= $allgame[$v['relation_game_id']]['pay_amount'];
} elseif($turnover_type == 3) {
if (empty($cpgame)) {
$cpSpendList = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($cpMap)->group('game_id')
->join("left join tab_game g on s.game_id = g.id")
->select();
// if ($company_id == 43) {
// dump($cpMap);
// }
foreach($cpSpendList as $ck=>$cv){
if(isset($cpgame[$cv['relation_game_id']])){
$cpgame[$cv['relation_game_id']]['pay_amount'] += $cv['pay_amount'];
}else{
$cpgame[$cv['relation_game_id']]['pay_amount'] = $cv['pay_amount'];
}
}
}
$res[$company_id][$p_account][$v['relation_game_id']]['all_pay_amount']= $cpgame[$v['relation_game_id']]['pay_amount'];
} elseif($turnover_type == 4) {
if (empty($cpallgame)) {
$cpAllSpendList = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($cpAllMap)->group('game_id')
->join("left join tab_game g on s.game_id = g.id")
->select();
foreach($cpAllSpendList as $ck=>$cv){
if(isset($cpallgame[$cv['relation_game_id']])){
$cpallgame[$cv['relation_game_id']]['pay_amount'] += $cv['pay_amount'];
}else{
$cpallgame[$cv['relation_game_id']]['pay_amount'] = $cv['pay_amount'];
}
}
}
$res[$company_id][$p_account][$v['relation_game_id']]['all_pay_amount']= $cpallgame[$v['relation_game_id']]['pay_amount'];
} else {
// $res[$company_id][$v[$j]]['ratio_pay_amount'] = $res[$company_id][$v[$j]]['pay_amount'];
$res[$company_id][$p_account][$v['relation_game_id']]['all_pay_amount']= $game[$v['relation_game_id']]['pay_amount'];
@ -1376,6 +1632,9 @@ class CompanyStatementSetController extends Controller {
}
}
$promoteCompanyGameRatio = D("CompanyGameRatio")->getPromoteCompanyGameRatio($v['id'],$v['game_ids'],$begintime,$endtime,$company_belong);
$handleed_data = [];
foreach($v['list'] as $ke=>$va){
$templist = $va['game_list'];
$va['game_list'] = [];
@ -1394,14 +1653,20 @@ class CompanyStatementSetController extends Controller {
// $tratio = $tmp_game_ratio['ratio'];
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime);
if ($turnover_type == 2) {
// if ($v['id'] == 5) {
// dump($p_info['all_pay_amount']);
// dump($turnover_type);
// dump($tmp_game_ratio);
// }
if ($turnover_type == 2||$turnover_type == 4) {
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
} else {
$tratio = $tmp_game_ratio['ratio'];
}
}else{
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime);
if ($turnover_type == 2) {
if ($turnover_type == 2||$turnover_type == 4) {
continue;
}
//补点
@ -1417,6 +1682,8 @@ class CompanyStatementSetController extends Controller {
$p_info['ratio']=$tratio;
}
$p_info['pay_amount'] = $this->getRelationGameIdPromoteSpend($p_info["p_id"],$p_info['relation_game_id'],$tmp_game_ratio['begintime'],$tmp_game_ratio['endtime']);
$v['platform_amount'] += $p_info['pay_amount'];
$p_info['sum_money']=round($p_info['pay_amount']*$tratio/100,2); //个人等于 结算金额*比例
$v['pay_amount'] += $p_info['sum_money'];
@ -1424,8 +1691,34 @@ class CompanyStatementSetController extends Controller {
$p_info['fax_ratio']=$fax_ratio;
$p_info['statement_begin_time']=$statement_begin_time;
$p_info['statement_end_time']=$statement_end_time;
$RewardRecordRes = $this->getPromoteUserGameRewardRecord($v['id'],$statement_begin_time,$statement_end_time);
if (
($handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['fine'] || $handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['fine'] == '0')
|| ($handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['reward'] || $handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['reward'] == '0')
) {
$p_info['fine'] = 0;
$p_info['reward'] = 0;
} else {
$p_info['fine'] = $RewardRecordRes['fine']?$RewardRecordRes['fine']:0;
$p_info['reward'] = $RewardRecordRes['reward']?$RewardRecordRes['reward']:0;
$handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['fine'] = (string)$RewardRecordRes['fine'];
$handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['reward'] = (string)$RewardRecordRes['reward'];
}
// if ($p_info['relation_game_id'] == 191 && $v['id'] == 334) {
// dump($RewardRecordRes);
// }
$p_info['statement_type']=0;
$va['game_list'][] = $p_info;
if ($p_info['pay_amount'] !='0') {
$va['game_list'][] = $p_info;
}
}else{
for ($i=0; $i < $ratioCount; $i++) {
$temp_game = [];
@ -1436,8 +1729,12 @@ class CompanyStatementSetController extends Controller {
}elseif($type == 0){
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime);
if ($turnover_type == 2) {
// if ($v['id'] == 5) {
// dump($p_info['all_pay_amount']);
// dump($turnover_type);
// dump($tmp_game_ratio);
// }
if ($turnover_type == 2 || $turnover_type == 4) {
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
} else {
$tratio = $tmp_game_ratio['ratio'];
@ -1446,7 +1743,7 @@ class CompanyStatementSetController extends Controller {
}else{
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime);
if ($turnover_type == 2) {
if ($turnover_type == 2 || $turnover_type == 4) {
continue;
}
//补点
@ -1474,12 +1771,35 @@ class CompanyStatementSetController extends Controller {
$temp_game['statement_end_time']=date("Y.m.d",$tmp_game_ratio['endtime']);
$temp_game['statement_type']=0;
$RewardRecordRes = $this->getPromoteUserGameRewardRecord($v['id'],$temp_game['statement_begin_time'],$temp_game['statement_end_time']);
if (
($handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['fine'] || $handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['fine'] == '0')
|| ($handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['reward'] || $handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['reward'] == '0')
) {
$temp_game['fine'] = 0;
$temp_game['reward'] = 0;
} else {
$temp_game['fine'] = $RewardRecordRes['fine']?$RewardRecordRes['fine']:0;
$temp_game['reward'] = $RewardRecordRes['reward']?$RewardRecordRes['reward']:0;
$handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['fine'] = (string)$RewardRecordRes['fine'];
$handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['reward'] = (string)$RewardRecordRes['reward'];
}
// if ($p_info['relation_game_id'] == 191 && $v['id'] == 334) {
// dump($RewardRecordRes);
// }
$temp_game['statement_type']=0;
$temp_game['relation_game_id']=$p_info["relation_game_id"];
$temp_game['game_name']=$p_info["game_name"];
$temp_game['game_type_name']=$p_info["game_type_name"];
$temp_game['all_pay_amount']=$p_info["all_pay_amount"];
$va['game_list'][] = $temp_game;
if ($temp_game['pay_amount'] != '0') {
$va['game_list'][] = $temp_game;
}
}
}
}
@ -1517,6 +1837,19 @@ class CompanyStatementSetController extends Controller {
"statement_info"=>json_encode($v['statement_info'],JSON_UNESCAPED_UNICODE)
];
}
$is_continue = false;
$statement_data = $v['statement_info'];
foreach ($statement_data as $skey => $sval) {
if ($sval['game_list']) {
$is_continue = true;
}
// dump($sval);
}
if (!$is_continue) {
continue;
}
//无需补点不统计其他金额
if($type == 2 && $v['statement_money'] == 0){
continue ;
@ -1555,6 +1888,7 @@ class CompanyStatementSetController extends Controller {
if($v['platform_amount'] == 0 && $v['statement_money'] == 0){
continue ;
}
if($v['platform_amount'] < 300){
//存未满
// if($lackcompany['pay_amount'] != 0){
@ -1679,6 +2013,55 @@ class CompanyStatementSetController extends Controller {
}
return $ratio;
}
/**
* 获取游戏奖罚
*/
protected function getPromoteUserGameRewardRecord($cpmpamy_id,$begintime,$endtime)
{
$begintime = strtotime(str_replace('.','-',$begintime));
$endtime = strtotime(str_replace('.','-',$endtime))+86499;
//获取所有公司的奖罚
$rrmap = array(
"d.confirm_time" => ['between', [$begintime,$endtime]],
"d.company_type"=>2,
"d.company_id"=>$cpmpamy_id,
"d.settlement_type"=>2,
// "relation_game_id"=>$relation_game_id,
);
$rfres = M("RewardDetail","tab_")
->alias("d")
->field("
IFNULL(SUM(CASE WHEN type = 1 THEN amount ELSE 0 END),0) as reward,
IFNULL(SUM(CASE WHEN type = 2 THEN amount ELSE 0 END),0) as fine")
->join('tab_reward_record as r on d.record_id = r.id', 'LEFT')
->where($rrmap)
->group("company_id")
->find();
// $rfres = M('reward_record', 'tab_')
// ->alias('r')
// ->field("
// IFNULL(SUM(CASE WHEN type = 1 THEN amount ELSE 0 END),0) as reward,
// IFNULL(SUM(CASE WHEN type = 2 THEN amount ELSE 0 END),0) as fine")
// ->where($rrmap)
// ->join('tab_reward_detail as d on d.record_id = r.id', 'LEFT')
// ->group("company_id")
// ->find();
// if ($relation_game_id == 191 && $cpmpamy_id == 334) {
// dump($rfres);
// }
if(empty($rfres)){
return false;
}else{
return $rfres;
}
}
/**
* 获取公司奖罚
*/
@ -1793,12 +2176,28 @@ class CompanyStatementSetController extends Controller {
* return string "148,157"
*/
protected function getModuleRatioGame($company_id,$relation_game_ids,$begintime,$endtime){
$where = [
"relation_game_id"=>["in",$relation_game_ids],
"company_id"=>$company_id,
"_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"
];
$dbres = D("CompanyGameRatio")->field("relation_game_id")->where($where)->select();
if (!$dbres) {
$company_belong = M("promote_company","tab_")->field("company_belong")->where(['id'=>$company_id])->find();
$where = [
"company_id"=>0,
"company_belong"=>$company_belong['company_belong'],
"relation_game_id"=>["in",$relation_game_ids],
"_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"
];
$dbres = D("CompanyGameRatio")->field("relation_game_id")->where($where)->select();
}
if(is_string($relation_game_ids)) $relation_game_ids = explode(",",$relation_game_ids);
if(empty($dbres)){

@ -66,6 +66,10 @@ class GameRatioMouldController extends AdminController
$v["turnover_types"][$tk] = "月流水";
} elseif($turnover_type[$tk] == 2) {
$v["turnover_types"][$tk] = "历史流水";
} elseif($turnover_type[$tk] == 3) {
$v["turnover_types"][$tk] = "cp月流水";
} elseif($turnover_type[$tk] == 4) {
$v["turnover_types"][$tk] = "cp历史流水";
}

@ -29,6 +29,11 @@ class PromoteCompanyController extends ThinkController
//列表
public function lists()
{
//设定默认时间
if(!array_key_exists("begintime",$_REQUEST) && I('type') != 2){
$this->redirect(ACTION_NAME, array('begintime' => date('Y-m-d',strtotime('-30 day')),"endtime"=>date('Y-m-d')));
}
$model = M($this->modelName, 'tab_');
$is_export= false;
if (isset($_REQUEST['export']) && $_REQUEST['export']==1){
@ -95,6 +100,18 @@ class PromoteCompanyController extends ThinkController
}
}
// if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
// $time_start = strtotime($_REQUEST['time_start']);
// $time_end = strtotime($_REQUEST['time_end'])+ 86399;
// $where["_string"] = "(begin_time BETWEEN {$time_start} AND {$time_end}) OR (end_time BETWEEN {$time_start} AND {$time_end}) OR (begin_time <= {$time_end} AND end_time >= {$time_end}) OR (begin_time >0 AND end_time = 0)";
// } elseif (isset($_REQUEST['time_start'])) {
// $time_start = strtotime($_REQUEST['time_start']);
// $where["_string"] = "end_time >= {$time_start} OR end_time = 0";
// } elseif (isset($_REQUEST['time_end'])) {
// $time_end = strtotime($_REQUEST['time_end'])+ 86399;
// $where["_string"] = "begin_time <= {$time_end}";
// }
// dd($map);
@ -179,11 +196,20 @@ class PromoteCompanyController extends ThinkController
$v["game_ids"] = $g_id;
}
$senddata = $this->getGamePromoteCompanyRadio($v["id"],$v["game_ids"],$is_export);
foreach($senddata as $key => $value) {
$senddata[$key]['ratio_data'] = array_values($senddata[$key]['ratio_data']);
}
// dump($senddata);
}
$game = $this->getPromoteGameRadio($v["id"],$senddata,$promotemap);
$v += $game;
// dump($game);
}
}
// die();
//公司及会长数量统计
$companycount = $model->field("id")->where($map)->select();
@ -196,6 +222,9 @@ class PromoteCompanyController extends ThinkController
$this->assign('listData', $companyres);
$this->assign('count', $count);
$this->assign('promotecount', $promotecount);
// dump($companyres);die();
if($is_export){
$getData = $_GET;
@ -1342,6 +1371,7 @@ class PromoteCompanyController extends ThinkController
*/
protected function getGamePromoteCompanyRadio($company_id,$game_ids,$is_export = false){
$is_inside = M("PromoteCompany","tab_")->field("is_inside")->where("id='{$company_id}'")->find()['is_inside'];
//判断是否有生效
$senddata = [];
$game = $this->getGameInfo($game_ids);
@ -1350,19 +1380,42 @@ class PromoteCompanyController extends ThinkController
$CpRadio = $this->getPromoteCompanyCpRadio($game_ids);
}
// dd($CpRadio);
$endtime = time();
$rwhere = "(end_time = 0 OR end_time >= '{$endtime}') and company_id='{$company_id}' and relation_game_id in ({$game_ids})";
if (isset($_REQUEST['begintime']) && isset($_REQUEST['endtime'])) {
$time_start = strtotime($_REQUEST['begintime']);
$time_end = strtotime($_REQUEST['endtime'])+ 86399;
$rwhere["_string"] = "(begin_time BETWEEN {$time_start} AND {$time_end}) OR (end_time BETWEEN {$time_start} AND {$time_end}) OR (begin_time <= {$time_end} AND end_time >= {$time_end}) OR (begin_time <{$time_start} AND (end_time >{$time_end} or end_time = 0))";
$mwhere['_string'] = "(begin_time BETWEEN {$time_start} AND {$time_end}) OR (end_time BETWEEN {$time_start} AND {$time_end}) OR (begin_time <= {$time_end} AND end_time >= {$time_end}) OR (begin_time <{$time_start} AND (end_time >{$time_end} or end_time = 0))";
} elseif (isset($_REQUEST['begintime'])) {
$time_start = strtotime($_REQUEST['begintime']);
$rwhere["_string"] = "end_time >= {$time_start} OR end_time = 0";
$mwhere["_string"] = "end_time >= {$time_start} OR end_time = 0";
} elseif (isset($_REQUEST['time_end'])) {
$time_end = strtotime($_REQUEST['endtime'])+ 86399;
$rwhere["_string"] = "begin_time <= {$time_end}";
$mwhere["_string"] = "begin_time <= {$time_end}";
}
$company_belong = M("PromoteCompany","tab_")->field("company_belong")->where("id='{$company_id}'")->find()['company_belong'];
$rwhere['company_id'] = $company_id;
$rwhere['relation_game_id'] = ['in',$game_ids];
// $rwhere['company_belong'] = $company_belong;
// dump($rwhere);
// $endtime = time();
// $rwhere = "(end_time = 0 OR end_time >= '{$endtime}') and company_id='{$company_id}' and relation_game_id in ({$game_ids})";
$cgr_res = M("CompanyGameRatio","tab_")->where($rwhere)->select();
//判断哪些游戏为空
$game_arr = array_flip(explode(",",$game_ids));
if(!empty($cgr_res)){
foreach ($cgr_res as $k => $v) {
$t_gid = $v['relation_game_id'];
unset($game_arr[$t_gid]);
$senddata[$t_gid] = ["turnover_ratio"=>$v['turnover_ratio'],"ratio"=>!$is_inside?$v['ratio']:0,"relation_game_id"=>$v['relation_game_id']];
$senddata[$t_gid]['ratio_data'][$v['begin_time']] = ["turnover_ratio"=>$v['turnover_ratio'],"ratio"=>!$is_inside?$v['ratio']:0,"relation_game_id"=>$v['relation_game_id'],'time'=>(($v['begin_time']<strtotime($_REQUEST['begintime'])) ? date("Y.m.d",strtotime($_REQUEST['begintime'])) : date("Y.m.d",$v['begin_time']))."-".(($v['end_time']&&$v['end_time']>strtotime($_REQUEST['endtime']))?date("Y.m.d",$v['end_time']):date("Y.m.d",strtotime($_REQUEST['endtime'])))];
$senddata[$t_gid] += $game[$t_gid];
$this->setPromoteRadio($senddata[$t_gid],$is_inside);
$this->setPromoteRadio($senddata[$t_gid]['ratio_data'][$v['begin_time']],$is_inside);
$senddata[$t_gid]['row'] += $senddata[$t_gid]['ratio_data'][$v['begin_time']]['row'];
if($is_export){
if(isset($CpRadio[$t_gid])){
@ -1370,7 +1423,8 @@ class PromoteCompanyController extends ThinkController
if( count($CpRadio[$t_gid]) >= $senddata[$t_gid]['row'] ){
$c = count($CpRadio[$t_gid]) - $senddata[$t_gid]['row'];
for ($x=0; $x<$c; $x++) {
$senddata[$t_gid]['turnover_ratio'][]=["name"=>"--","ratio"=>"--"];
$senddata[$t_gid]['ratio_data'][$v['begin_time']]['turnover_ratio'][]=["name"=>"--","ratio"=>"--"];
$senddata[$t_gid]['ratio_data'][$v['begin_time']]['row'] += 1;
}
$senddata[$t_gid]['row'] = count($CpRadio[$t_gid]);
}else{
@ -1388,25 +1442,39 @@ class PromoteCompanyController extends ThinkController
}
$diff_ids = implode(",",array_keys($game_arr));
$company_belong = M("PromoteCompany","tab_")->field("company_belong")->where("id='{$company_id}'")->find()['company_belong'];
$mwhere = "company_belong='{$company_belong}' and relation_game_id in ({$diff_ids})";
// $mwhere = "(end_time = 0 OR end_time >= '{$endtime}') and company_belong='{$company_belong}' and relation_game_id in ({$diff_ids})";
$mwhere['company_belong'] = $company_belong;
$mwhere['relation_game_id'] = ['in',$diff_ids];
$m_res = M("GameRatioMould","tab_")->where($mwhere)->select();
// dump($m_res);die();
if(!empty($m_res)){
foreach ($m_res as $k => $v) {
$t_gid = $v['relation_game_id'];
unset($game_arr[$t_gid]);
$senddata[$t_gid] = ["turnover_ratio"=>$v['turnover_ratio'],"ratio"=>!$is_inside?$v['ratio']:0,"relation_game_id"=>$v['relation_game_id']];
$senddata[$t_gid]['ratio_data'][$v['begin_time']] = ["turnover_ratio"=>$v['turnover_ratio'],"ratio"=>!$is_inside?$v['ratio']:0,"relation_game_id"=>$v['relation_game_id'],'time'=>(($v['begin_time']<strtotime($_REQUEST['begintime'])) ? date("Y.m.d",strtotime($_REQUEST['begintime'])) : date("Y.m.d",$v['begin_time']))."-".(($v['end_time']&&$v['end_time']>strtotime($_REQUEST['endtime']))?date("Y.m.d",$v['end_time']):date("Y.m.d",strtotime($_REQUEST['endtime'])))];
$senddata[$t_gid] += $game[$t_gid];
$this->setPromoteRadio($senddata[$t_gid],$is_inside);
$this->setPromoteRadio($senddata[$t_gid]['ratio_data'][$v['begin_time']],$is_inside);
$senddata[$t_gid]['row'] += $senddata[$t_gid]['ratio_data'][$v['begin_time']]['row'];
if($is_export){
if(isset($CpRadio[$t_gid])){
$senddata[$t_gid]["cp_ratio"] = $CpRadio[$t_gid];
if( count($CpRadio[$t_gid]) >= $senddata[$t_gid]['row'] ){
$c = count($CpRadio[$t_gid]) - $senddata[$t_gid]['row'];
for ($x=0; $x<$c; $x++) {
$senddata[$t_gid]['turnover_ratio'][]=["name"=>"--","ratio"=>"--"];
$senddata[$t_gid]['ratio_data'][$v['begin_time']]['turnover_ratio'][]=["name"=>"--","ratio"=>"--"];
$senddata[$t_gid]['ratio_data'][$v['begin_time']]['row'] += 1;
}
$senddata[$t_gid]['row'] = count($CpRadio[$t_gid]);
}else{
@ -1425,7 +1493,9 @@ class PromoteCompanyController extends ThinkController
}
foreach($game_arr as $k=>$v){
if(empty($game[$k])) continue;
$senddata[$k]= ["turnover_ratio"=>[["name"=>"--","ratio"=>"--"]],"ratio"=>0,"relation_game_id"=>$k,"cp_ratio"=>[["name"=>"--","ratio"=>"--"]],"row"=>1];
$senddata[$k]['ratio_data']['1567267200']= ["turnover_ratio"=>[["name"=>"--","ratio"=>"--"]],"ratio"=>0,"relation_game_id"=>$k,"cp_ratio"=>[["name"=>"--","ratio"=>"--"]],'time'=>date("Y.m.d",strtotime($_REQUEST['begintime']))."-".date("Y.m.d",strtotime($_REQUEST['endtime']))];
$senddata[$k]["row"] = 1;
$senddata[$k] += $game[$k];
}
return $senddata;
@ -1452,7 +1522,7 @@ class PromoteCompanyController extends ThinkController
//无会长
return ["list"=>["account" => "--","list" => ["turnover_ratio"=>[["name"=>"--","ratio"=>"--"]],"ratio"=>0,"relation_game_id"=>$k,"cp_ratio"=>[["name"=>"--","ratio"=>"--"]],"row"=>1,"original_package_name"=>"--","relation_game_name"=>"--","game_type_name"=>"--"]],"row"=>1];
}
foreach ($promoteres as $k => &$v) {
$admin = isset($adminList[$v['id']]) && $adminList[$v['id']]['admin'] ? $adminList[$v['id']]['admin'] : null;
$v['market_admin_username'] = $admin ? ($admin['real_name'] ? $admin['real_name'] : $admin['username']) : '无';

@ -771,7 +771,29 @@ class TimingController extends AdminController {
$return = [];
foreach ($data as $key => $value) {
$statement_info = json_decode($value['statement_info'],true);
$info = [];
$pool_data = M("company_statement_pool","tab_")
->field("id")
->where("(statement_begin_time <={$end_time} AND ( statement_end_time = 0 OR statement_end_time >= {$start_time})) and withdraw_type=3 and statement_ids like '%{$value['id']}%'")
->select();
foreach ($pool_data as $pk => $pv) {
$info = M("company_statement_info","tab_")
->field("statement_info")
->where("(statement_begin_time <={$end_time} AND ( statement_end_time = 0 OR statement_end_time >= {$start_time})) and withdraw_type=3 and pool_id = {$pv['id']} and company_id = {$value['company_id']}")
->find()['statement_info'];
if ($info) {
break;
}
}
if ($info) {
$statement_info = json_decode($info,true);
} else {
$statement_info = json_decode($value['statement_info'],true);
}
$is_inside = M("PromoteCompany","tab_")->field("is_inside")->where("id='{$value['company_id']}'")->find()['is_inside'];
if ($value['company_type'] == 2) {
@ -787,7 +809,7 @@ class TimingController extends AdminController {
continue;
}
//
if (isset($return[$statement_info['promote_id'].$v['relation_game_id']])) {
if (isset($return[$value['company_id']."-".$sval['promote_id']."-".$v['relation_game_id']])) {
$return[$value['company_id']."-".$sval['promote_id']."-".$v['relation_game_id']] = !$is_inside?$v['sum_money']:0;
} else {
$return[$value['company_id']."-".$sval['promote_id']."-".$v['relation_game_id']] += !$is_inside?$v['sum_money']:0;
@ -834,15 +856,15 @@ class TimingController extends AdminController {
}
}
// dump($return);
return $return;
}
public function test() {
// $this->getSpecialComplement(strtotime(date("Y-m-1",strtotime("2020-07"))),strtotime(date("Y-m-t",strtotime("2020-07")))+86399,2259);
// dump(D("CompanyGameRatio")->getPromoteCompanyGameRatio(64,(string)211,1596211200,1598889599,1));
$this->createMarketBonus("all");
$this->getSpecialComplement(strtotime(date("Y-m-1",strtotime("2020-08"))),strtotime(date("Y-m-t",strtotime("2020-08")))+86399,2259);
// dump(D("CompanyGameRatio")->getPromoteCompanyGameRatio(18,(string)207,1600099200,1603728000,1));
// $this->createMarketBonus("all");
}

@ -18,6 +18,7 @@ class CompanyGameRatioModel extends Model
$is_inside = M("PromoteCompany","tab_")->field("is_inside")->where("id='{$company_id}'")->find()['is_inside'];
//设置默认
$game_ratio = [];
$tmp_g = explode(",",$game_ids);
@ -31,7 +32,80 @@ class CompanyGameRatioModel extends Model
"turnover_ratio"=>''
]];
}else{
$game_ratio[$game_id] = $this->getGameRadio($company_id,$game_id,$company_belong,$begintime,$endtime);
$company_belong_game = M("company_belong_game","tab_")
->field("game_ids,begin_time,end_time")
->where("((begin_time<={$begintime} and (end_time >={$begintime} or end_time=0)) or (begin_time<={$endtime} and end_time >={$endtime}) or (end_time>={$begintime} and end_time <={$endtime})) AND game_ids like '%,{$game_id},%'")
->order("begin_time ASC")
->select();
if ($company_belong == 1 && !empty($company_belong_game)) {
$company_begin_time = $begintime;
$company_end_time = $endtime;
$game_ratio[$game_id] = [];
foreach($company_belong_game as $key => $value) {
if ($value['begin_time'] > $company_begin_time) {
$game_ratio[$game_id] = array_merge($game_ratio[$game_id],$this->getGameRadio($company_id,$game_id,$company_belong,$company_begin_time,$value['begin_time']));
if ($value['end_time'] >= $company_end_time) {
// $game_ratio[$game_id] = array_merge($game_ratio[$game_id],[[
// "begintime" => $value['begin_time'],
// "endtime"=>$company_end_time,
// "ratio"=>0,
// "turnover_ratio"=>''
// ]]);
} else {
// $game_ratio[$game_id] = array_merge($game_ratio[$game_id],[[
// "begintime" => $value['begin_time'],
// "endtime"=>$value['end_time']+86399,
// "ratio"=>0,
// "turnover_ratio"=>''
// ]]);
if (!$company_belong_game[$key+1]['begin_time']) {
// $game_ratio[$game_id] = array_merge($game_ratio[$game_id],[[
// "begintime" => $value['end_time']+86400,
// "endtime"=>$company_end_time,
// "ratio"=>0,
// "turnover_ratio"=>''
// ]]);
$game_ratio[$game_id] = array_merge($game_ratio[$game_id],$this->getGameRadio($company_id,$game_id,$company_belong,$value['end_time']+86400,$company_end_time));
} else {
$company_begin_time = $value['end_time'];
}
}
} else {
if ($value['end_time'] >= $company_end_time) {
// $game_ratio[$game_id] = array_merge($game_ratio[$game_id],[[
// "begintime" => $company_begin_time,
// "endtime"=>$company_end_time,
// "ratio"=>0,
// "turnover_ratio"=>''
// ]]);
} else {
// $game_ratio[$game_id] = array_merge($game_ratio[$game_id],[[
// "begintime" => $company_begin_time,
// "endtime"=>$value['end_time']+86399,
// "ratio"=>0,
// "turnover_ratio"=>''
// ]]);
if (!$company_belong_game[$key+1]['begin_time']) {
$game_ratio[$game_id] = array_merge($game_ratio[$game_id],$this->getGameRadio($company_id,$game_id,$company_belong,$value['end_time']+86400,$company_end_time));
} else {
$company_begin_time = $value['end_time'];
}
}
}
}
} else {
// if ($company_id == 12&&$game_id == 191) {
// dump(2);
// }
$game_ratio[$game_id] = $this->getGameRadio($company_id,$game_id,$company_belong,$begintime,$endtime);
}
}
}
return $game_ratio;
@ -43,9 +117,22 @@ class CompanyGameRatioModel extends Model
$map = [
"company_id"=>$company_id,
"relation_game_id"=>$game_id,
"_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"
"_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})",
];
$res = $this->where($map)->order("begin_time asc")->select();
if (empty($res)) {
$map = [
"company_id"=>0,
"relation_game_id"=>$game_id,
"_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})",
"company_belong"=>$company_belong,
];
$res = $this->where($map)->order("begin_time asc")->select();
}
$data = [];
if(empty($res)){
$this->getGameMouldRadio($data,$game_id,$company_belong,$begintime,$endtime);

@ -100,8 +100,20 @@
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">推广公司类型:</td>
<td class="r">
<select id="company_belong" name="company_belong" class="select_gallery">
<option value="0">内团</option>
<option value="1">外团</option>
<option value="2">外团-分发</option>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>推广公司:</td>
<td class="l">推广公司:</td>
<td class="r">
<select name="company_id" id="company_id" class="select_gallery">
<option value="">请选择公司</option>
@ -142,6 +154,8 @@
<select id="turnover_type" name="turnover_type" class="select_gallery">
<option value="1">月流水</option>
<option value="2">历史流水</option>
<option value="3">cp月流水</option>
<option value="4">cp历史流水</option>
</select>
</td>
</tr>
@ -279,7 +293,7 @@ $(function(){
//查看是否报错
var flag = true;
var obj = {
"company_id":["required","推广公司不能为空","select"],
// "company_id":["required","推广公司不能为空","select"],
"relation_game_id":["required","游戏不能为空","select"],
"ratio":["number","默认比例必须是大于0的数字"],
"begin_time":["date","开始时间不能为空"],
@ -314,13 +328,6 @@ $(function(){
});
var momday = getMonday();
//判断日期是否小于当周周一
// if (momday > cres.begin_time) {
// layer.msg("配置的开始日期不能小于当周周一", {icon: 2});
// return false;
// }
if(!flag){
return false;
}

@ -100,6 +100,13 @@
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">推广公司类型:</td>
<td class="r table_radio">
<span class="form_radio table_btn">{$data.company_belong}</span>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l">推广公司:</td>
<td class="r table_radio">
@ -131,6 +138,8 @@
<select id="turnover_type" name="turnover_type" class="select_gallery">
<option value="1" <if condition="$data['turnover_type'] eq 1">selected</if>>月流水</option>
<option value="2" <if condition="$data['turnover_type'] eq 2">selected</if>>历史流水</option>
<option value="3" <if condition="$data['turnover_type'] eq 3">selected</if>>cp月流水</option>
<option value="4" <if condition="$data['turnover_type'] eq 4">selected</if>>cp历史流水</option>
</select>
</td>
</tr>

@ -100,6 +100,13 @@
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">推广公司类型:</td>
<td class="r table_radio">
<span class="form_radio table_btn">{$data.company_belong}</span>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l">推广公司:</td>
<td class="r table_radio">
@ -127,6 +134,8 @@
<select id="turnover_type" name="turnover_type" class="select_gallery">
<option value="1" <if condition="$data['turnover_type'] eq 1">selected</if>>月流水</option>
<option value="2" <if condition="$data['turnover_type'] eq 2">selected</if>>历史流水</option>
<option value="3" <if condition="$data['turnover_type'] eq 3">selected</if>>cp月流水</option>
<option value="4" <if condition="$data['turnover_type'] eq 4">selected</if>>cp历史流水</option>
</select>
</td>
</tr>

@ -291,17 +291,31 @@
}
text = text.join(",");
var date = false;
if(confirm){
layer.confirm('【警告】确认打款后将不可回退,如需继续请点击确认', {
btn: ['确认','取消'],
title:false
}, function(){
layer.open({
title : '打款时间确认',
content : `<input type="text" readonly id="deposit_recept_time" value="" placeholder="打款时间"/>`,
success : function() {
$('#deposit_recept_time').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$("#deposit_recept_time").datetimepicker("setDate", new Date());
},
yes : function(index, layero) {
date = $('#deposit_recept_time').val();
if (!date) {
layer.msg('请选择打款时间');
return true;
}
_doAgreeApply();
});
}else{
_doAgreeApply();
}
return true;
}
});
function _doAgreeApply(){
//执行
@ -310,7 +324,7 @@
url: "{:U('doPayment')}",
dataType: 'json',
async: false,
data: {ids:text},
data: {ids:text,payment_time:date},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");

@ -121,6 +121,7 @@
<th>分成结算金额</th>
<th>奖励</th>
<th>罚款</th>
<th>其他扣款</th>
<th>周结算金额</th>
<th>结算金额</th>
@ -170,9 +171,10 @@
<td><input class="increment_ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="increment_ratio[{$com['id']}][{$com['statement_info'][0]['account']}][]" value="{$com['statement_info'][0]['game_list'][0]['increment_ratio']}" style="width: 25px;">%</td>
<td><span class="sum_money_span">{$com['statement_info'][0]['game_list'][0]['sum_money']}</span>
<input class="sum_money" name="sum_money[{$com['id']}][{$com['statement_info'][0]['account']}][]" value="{$com['statement_info'][0]['game_list'][0]['sum_money']}" style="width: 20px;display: none">
<input class="st" name="st[{$com['id']}]" value="{$com['st']}" style="width: 20px;display: none"></td>
<input class="st" name="st[{$com['id']}][{$com['statement_info'][0]['account']}]" value="{$com['st']}" style="width: 20px;display: none"></td>
<td rowspan="{$com.row}">{$com['reward']}</td>
<td rowspan="{$com.row}">{$com['fine']}</td>
<td rowspan="{$com['statement_info'][0]['time_row']}"><input class="withhold" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$com['statement_info'][0]['withhold_amount']|default=0}" style="width: 40px;" name="withhold[{$com['id']}][{$com['statement_info'][0]['account']}][{$com['statement_info'][0]['game_list'][0]['statement_begin_time']}]"></td>
<td rowspan="{$com['statement_info'][0]['time_row']}" class="week_amount">{$com['statement_info'][0]['week_amount']}</td>
<td rowspan="{$com.row}" data-st="{$com['st']}" class="statement_money">{$com['statement_money']}</td>
@ -228,6 +230,7 @@
<td><input class="ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="ratio[{$com['id']}][{$com['statement_info'][0]['account']}][]" value="{$game['ratio']}" style="width: 25px;">%</td>
<td><input class="increment_ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="increment_ratio[{$com['id']}][{$com['statement_info'][0]['account']}][]" value="{$game['increment_ratio']}" style="width: 25px;">%</td>
<td><span class="sum_money_span">{$game['sum_money']}</span><input class="sum_money" name="sum_money[{$com['id']}][{$com['statement_info'][0]['account']}][]" value="{$game['sum_money']}" style="width: 20px;display: none"></td>
<!-- <td><input class="withhold" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$game['withhold']|default=0}" style="width: 40px;" name="withhold[{$com['id']}][{$com['statement_info'][0]['account']}][]"></td>-->
</tr>
</if>
@ -258,6 +261,7 @@
<td><input class="increment_ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="increment_ratio[{$com['id']}][{$account['account']}][]" value="{$account['game_list'][0]['increment_ratio']}" style="width: 25px;">%</td>
<td><span class="sum_money_span">{$account['game_list'][0]['sum_money']}</span><input class="sum_money" name="sum_money[{$com['id']}][{$account['account']}][]" value="{$account['game_list'][0]['sum_money']}" style="width: 20px;display: none"></td>
<notempty name="account['time']">
<td rowspan="{$account['time_row']}"><input class="withhold" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$account['withhold_amount']|default=0}" style="width: 40px;" name="withhold[{$com['id']}][{$account['account']}][{$account['game_list'][0]['statement_begin_time']}]"></td>
<td rowspan="{$account['time_row']}" class="week_amount">{$account['week_amount']}</td>
</notempty>
<else />
@ -270,6 +274,7 @@
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</notempty>
</tr>
@ -287,6 +292,7 @@
<td><input class="ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="ratio[{$com['id']}][{$account['account']}][]" value="{$game['ratio']}" style="width: 25px;">%</td>
<td><input class="increment_ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="increment_ratio[{$com['id']}][{$account['account']}][]" value="{$game['increment_ratio']}" style="width: 25px;">%</td>
<td><span class="sum_money_span">{$game['sum_money']}</span><input class="sum_money" name="sum_money[{$com['id']}][{$account['account']}][]" value="{$game['sum_money']}" style="width: 20px;display: none"></td>
<!-- <td><input class="withhold" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$game['withhold']|default=0}" style="width: 40px;" name="withhold[{$com['id']}][{$account['account']}][]"></td>-->
</tr>
</if>
@ -307,6 +313,7 @@
<td></td>
<td></td>
<td></td>
<td></td>
<td class="count_sum_money">{$count.sum_money}</td>
<td class="count_sum_money">{$count.sum_money}</td>
<td></td>
@ -404,6 +411,12 @@
changeSumAmount();
});
$(".withhold").on("blur",function () {
caculate_sum_money(this);
changeStatementAmount(this);
changeSumAmount();
});
$(".ratio").on("blur",function () {
caculate_sum_money(this);
changeStatementAmount(this);
@ -438,6 +451,17 @@
refund = pay_money;
$(_this).parent().parent().find(".refund").val(refund);
}
//退款
var withhold = $(_this).parent().parent().find(".withhold").val();
if (!withhold || withhold < 0) {
withhold = 0;
$(_this).parent().parent().find(".withhold").val(withhold);
} else if(parseFloat(withhold) > parseFloat(pay_money)) {
withhold = pay_money;
$(_this).parent().parent().find(".withhold").val(withhold);
}
//补点
var increment_ratio = $(_this).parent().parent().find(".increment_ratio").val();
if (!increment_ratio || increment_ratio < 0) {
@ -453,7 +477,7 @@
//扣款
pay_money = parseFloat(pay_money) - parseFloat(refund);
var value = parseFloat(pay_money)*(parseFloat(ratio)/100) + parseFloat(pay_money)*(parseFloat(increment_ratio)/100);
var value = (parseFloat(pay_money)*(parseFloat(ratio)/100) + parseFloat(pay_money)*(parseFloat(increment_ratio)/100));
$(_this).parent().parent().find(".sum_money_span").text(value.toFixed(2));
$(_this).parent().parent().find(".sum_money").val(value.toFixed(2));
@ -464,14 +488,14 @@
for (;;) {
week_amount = week_amount_find.find(".week_amount").text();
if (week_amount_find) {
if (week_amount) {
break;
} else {
week_amount_find = week_amount_find.prev();
}
}
var D_value = parseFloat(old_amount)-parseFloat(this_amount);
var D_value = parseFloat(old_amount)-parseFloat(this_amount) - parseFloat(withhold);
week_amount_find.find(".week_amount").text((parseFloat(week_amount)-D_value).toFixed(2));

@ -0,0 +1,563 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__STATIC__/jquery.form.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
<script src="__STATIC__/table2excel.js"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px 10px 150px 10px;
/* width: 960px; */
margin: auto;
}
/* .tabcon1711 table{
width: 480px;
} */
table{
margin: auto;
}
tr{
border-bottom: dotted 1px #c7c7c7;
}
.hidebox{
display: none;
}
.r{
width: 300px;
}
.l{
width: 180px;
}
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;
height: 35px;
height: 28px;
border-radius: 3px;
font-size: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 35px;
line-height: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height: 26px;
line-height: 26px;
font-size: 12px;
}
.select2-results__option[aria-selected] {
font-size: 12px;
}
.input-list, .i_list {
float: left;
margin: 0;
}
#statementShow td{
line-height: 1.5;
padding: 8px 0;
}
</style>
<body>
<!-- <div style="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
海南万盟天下科技有限公司
</div> -->
<div class="data_list box_mt" style="margin-top: 10px;">
<div class="">
<form id="form" method="post" class="form-horizontal" action="{:U('editCompanyStatementPool')}" enctype="multipart/form-data" target="rfFrame">
<table id="exporttable">
<!-- 表头 -->
<thead>
<tr>
<th>序号</th>
<th>下游名称</th>
<!-- <th>结算时间</th>-->
<th>会长账号</th>
<th>内外团</th>
<th>开发类型</th>
<th>市场专员</th>
<th>下游性质</th>
<th>产品</th>
<th>产品类型</th>
<th>结算时间</th>
<th>推广流水</th>
<th>退款</th>
<th>分成比例</th>
<th>补点</th>
<th>分成结算金额</th>
<th>奖励</th>
<th>罚款</th>
<th>其他扣款</th>
<th>周结算金额</th>
<th>结算金额</th>
<th>户名</th>
<th>帐号</th>
<th>开户行</th>
<th>是否支付宝打款</th>
<th>是否结算</th>
<th>备注</th>
<if condition="!$is_export">
<th>操作</th>
</if>
</tr>
</thead>
<tbody id="statementShow">
<foreach name="data" item="com">
<tr>
<td rowspan="{$com.row}">{$key-0+1}</td>
<td rowspan="{$com.row}">{$com.company_name}</td>
<!-- <td rowspan="{$com.statement_count}">{$com.company_info.account}</td> -->
<notempty name="com['statement_info']">
<!-- <td rowspan="{$com['statement_info'][0]['time_row']}">{$com['statement_info'][0]['time']}</td>-->
<td rowspan="{$com['statement_info'][0]['row']}" >{$com['statement_info'][0]['account']}</td>
<else />
<td>-</td>
</notempty>
<td rowspan="{$com.row}">{$com.company_info.company_belong_str}</td>
<td rowspan="{$com.row}">{$com.company_info.company_relation_str}</td>
<td rowspan="{$com.row}">{$com.company_info.nickname}</td>
<td rowspan="{$com.row}">{$com.company_info.company_type_str}</td>
<notempty name="com['statement_info'][0]['game_list']">
<td>{$com['statement_info'][0]['game_list'][0]['game_name']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['game_type_name']}</td>
<td rowspan="{$com['statement_info'][0]['time_row']}">{$com['statement_info'][0]['time']}</td>
<!-- <td>{$com['statement_info'][0]['game_list'][0]['statement_begin_time']}-{$com['statement_info'][0]['game_list'][0]['statement_end_time']}</td>-->
<td><span class="pay_amount">{$com['statement_info'][0]['game_list'][0]['pay_amount']}</span></td>
<td>
{$com['statement_info'][0]['game_list'][0]['refund']|default=0}
<!-- <input class="refund" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$com['statement_info'][0]['game_list'][0]['refund']|default=0}" style="width: 40px;" name="refund[{$com['id']}][{$com['statement_info'][0]['account']}][]">-->
</td>
<td>{$com['statement_info'][0]['game_list'][0]['ratio']}%</td>
<td><input class="increment_ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="increment_ratio[{$com['id']}][{$com['statement_info'][0]['account']}][]" value="{$com['statement_info'][0]['game_list'][0]['increment_ratio']}" style="width: 25px;">%</td>
<td><span class="sum_money_span">{$com['statement_info'][0]['game_list'][0]['sum_money']}</span>
<input class="sum_money" name="sum_money[{$com['id']}][{$com['statement_info'][0]['account']}][]" value="{$com['statement_info'][0]['game_list'][0]['sum_money']}" style="width: 20px;display: none">
<input class="st" name="st[{$com['id']}][{$com['statement_info'][0]['account']}]" value="{$com['st']}" style="width: 20px;display: none"></td>
<td rowspan="{$com.row}">{$com['reward']}</td>
<td rowspan="{$com.row}">{$com['fine']}</td>
<td rowspan="{$com['statement_info'][0]['time_row']}">
{$com['statement_info'][0]['game_list'][0]['withhold']|default=0}
<!-- <input class="withhold" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$com['statement_info'][0]['game_list'][0]['withhold']|default=0}" style="width: 40px;" name="withhold[{$com['id']}][{$com['statement_info'][0]['account']}][]">-->
</td>
<td rowspan="{$com['statement_info'][0]['time_row']}" class="week_amount">{$com['statement_info'][0]['week_amount']}</td>
<td rowspan="{$com.row}" data-st="{$com['st']}" class="statement_money">{$com['statement_money']}</td>
<else />
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td rowspan="{$com.row}">-</td>
<td rowspan="{$com.row}">-</td>
<td rowspan="{$com.row}">-</td>
</notempty>
<if condition="$com['is_payment'] eq 2">
<td rowspan="{$com.row}">{$com.company_info.payee_name}</td>
<td rowspan="{$com.row}">&nbsp;{$com.company_info.bank_account}</td>
<td rowspan="{$com.row}">{$com.company_info.opening_bank}</td>
</if>
<if condition="$com['is_payment'] eq 1">
<td rowspan="{$com.row}">{$com.company_info.ali_user}</td>
<td rowspan="{$com.row}">{$com.company_info.ali_account}</td>
<td rowspan="{$com.row}"></td>
</if>
<td rowspan="{$com.row}"><if condition="$com['is_payment'] eq 1"><else /></if></td>
<td rowspan="{$com.row}"><if condition="$com['st'] eq 0"><else /></if></td>
<td rowspan="{$com.row}"><textarea name="remark[{$com['id']}]">{$com.remark}</textarea></td>
<if condition="!$is_export">
<td rowspan="{$com.row}">
<if condition="($com['st'] eq 1 ) AND ($pool_status lt 1)">
<a data-id="{$com['id']}" class='butn no_statement' style="cursor:pointer">不结算</a>
</if>
</td>
</if>
</tr>
<if condition="$com['statement_info'][0]['row'] gt 1">
<foreach name="com['statement_info'][0]['game_list']" item="game" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game['game_name']}</td>
<td>{$game['game_type_name']}</td>
<!-- <td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>-->
<td><span class="pay_amount">{$game['pay_amount']}</span></td>
<td><input class="refund" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$game['refund']|default=0}" style="width: 40px;" name="refund[{$com['id']}][{$com['statement_info'][0]['account']}][]"></td>
<td>{$game['ratio']}%</td>
<td><input class="increment_ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="increment_ratio[{$com['id']}][{$com['statement_info'][0]['account']}][]" value="{$game['increment_ratio']}" style="width: 25px;">%</td>
<td><span class="sum_money_span">{$game['sum_money']}</span><input class="sum_money" name="sum_money[{$com['id']}][{$com['statement_info'][0]['account']}][]" value="{$game['sum_money']}" style="width: 20px;display: none"></td>
<!-- <td><input class="withhold" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$game['withhold']|default=0}" style="width: 40px;" name="withhold[{$com['id']}][{$com['statement_info'][0]['account']}][]"></td>-->
</tr>
</if>
</foreach>
</if>
<notempty name="com['statement_info'][1]">
<foreach name="com['statement_info']" item="account" key="akey">
<if condition="$akey gt 0">
<tr>
<td rowspan="{$account['row']}" class="accounts">{$account['account']}</td>
<notempty name="account['game_list']">
<td>{$account['game_list'][0]['game_name']}</td>
<td>{$account['game_list'][0]['game_type_name']}</td>
<notempty name="account['time']">
<td rowspan="{$account['time_row']}">{$account['time']}</td>
</notempty>
<!-- <td>{$account['game_list'][0]['statement_begin_time']}-{$account['game_list'][0]['statement_end_time']}</td>-->
<td><span class="pay_amount">{$account['game_list'][0]['pay_amount']}</span></td>
<!-- <td>{$account['game_list'][0]['ratio']|showNumPercent}</td>-->
<!-- <td>{$account['game_list'][0]['increment_ratio']|showNumPercent}</td>-->
<td><input class="refund" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$account['game_list'][0]['refund']|default=0}" style="width: 40px;" name="refund[{$com['id']}][{$account['account']}][]"></td>
<td>{$account['game_list'][0]['ratio']}%</td>
<td><input class="increment_ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="increment_ratio[{$com['id']}][{$account['account']}][]" value="{$account['game_list'][0]['increment_ratio']}" style="width: 25px;">%</td>
<td><span class="sum_money_span">{$account['game_list'][0]['sum_money']}</span><input class="sum_money" name="sum_money[{$com['id']}][{$account['account']}][]" value="{$account['game_list'][0]['sum_money']}" style="width: 20px;display: none"></td>
<notempty name="account['time']">
<td rowspan="{$account['time_row']}"><input class="withhold" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$account['withhold_amount']|default=0}" style="width: 40px;" name="withhold[{$com['id']}][{$account['account']}][{$account['game_list'][0]['statement_begin_time']}]"></td>
<td rowspan="{$account['time_row']}" class="week_amount">{$account['week_amount']}</td>
</notempty>
<else />
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</notempty>
</tr>
<if condition="$account['row'] gt 1">
<foreach name="account['game_list']" item="game" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game['game_name']}</td>
<td>{$game['game_type_name']}</td>
<!-- <td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>-->
<td><span class="pay_amount">{$game['pay_amount']}</span></td>
<!-- <td>{$game['ratio']|showNumPercent}</td>-->
<!-- <td>{$game['increment_ratio']|showNumPercent}</td>-->
<td><input class="refund" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$game['refund']|default=0}" style="width: 40px;" name="refund[{$com['id']}][{$account['account']}][]"></td>
<td>{$game['ratio']}%</td>
<td><input class="increment_ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="increment_ratio[{$com['id']}][{$account['account']}][]" value="{$game['increment_ratio']}" style="width: 25px;">%</td>
<td><span class="sum_money_span">{$game['sum_money']}</span><input class="sum_money" name="sum_money[{$com['id']}][{$account['account']}][]" value="{$game['sum_money']}" style="width: 20px;display: none"></td>
<!-- <td><input class="withhold" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$game['withhold']|default=0}" style="width: 40px;" name="withhold[{$com['id']}][{$account['account']}][]"></td>-->
</tr>
</if>
</foreach>
</if>
</if>
</foreach>
</notempty>
</foreach>
<tr>
<td colspan=10 >合计:</td>
<td >{$count.platform_amount}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="count_sum_money">{$count.sum_money}</td>
<td class="count_sum_money">{$count.sum_money}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<if condition="!$is_export">
<td></td>
</if>
</tr>
</tbody>
</table>
<input type="hidden" name="id" value="{$_GET['id']}">
</form>
<div class="form-item cf" style="float: right;margin-top: 30px;margin-right: 30px;">
<button class="submit_btn" id="submit" style="margin-left:210px;">
保存
</button>
</div>
<iframe id="rfFrame" name="rfFrame" src="about:blank" style="display:none;"></iframe>
</div>
</div>
</body>
<script>
<if condition="$is_export">
$(function(){
$("#exporttable").table2excel({
filename: "{$title}.xls", // do include extension
preserveColors: false // set to true if you want background colors and font colors preserved
});
});
</if>
$(".no_statement").on("click",function(){
var id = $(this).data('id');
$.ajax({
type: "POST",
url: "{:U('cancelStatement')}",
dataType: 'json',
async: false,
data: {id:id},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
});
var return_data = "";
$("#submit").click(function(){
var options = {
url:"{:U('editCompanyStatementPool')}", //同action
type:'post',
beforeSend:function(xhr){
},
success:function(data)
{
return_data = data;
},
complete:function(data){
if(return_data.status==1){
layer.msg("<font style='color:white'>" + return_data.info + "</font>");
setTimeout(function(){
parent.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + return_data.info + "</font>");
return false;
}
},
error: function(xhr,status,msg){
//alert("状态码"+status+"; "+msg)
layer.msg('玩命加载中..');
}
};
$("#form").ajaxSubmit(options);
});
$(".refund").on("blur",function () {
caculate_sum_money(this);
changeStatementAmount(this);
changeSumAmount();
});
$(".withhold").on("blur",function () {
caculate_sum_money(this);
changeStatementAmount(this);
changeSumAmount();
});
$(".ratio").on("blur",function () {
caculate_sum_money(this);
changeStatementAmount(this);
changeSumAmount();
});
$(".increment_ratio").on("blur",function () {
caculate_sum_money(this);
changeStatementAmount(this);
changeSumAmount();
});
// 分成结算金额重算
function caculate_sum_money(_this) {
var pay_money = $(_this).parent().parent().find(".pay_amount").text();
var ratio = $(_this).parent().parent().find(".ratio").val();
//比例金额
if (!ratio || ratio < 0) {
ratio = 0;
$(_this).parent().parent().find(".ratio").val(ratio);
} else if (ratio > 100) {
ratio = 100;
$(_this).parent().parent().find(".ratio").val(ratio);
}
//退款
var refund = $(_this).parent().parent().find(".refund").val();
if (!refund || refund < 0) {
refund = 0;
$(_this).parent().parent().find(".refund").val(refund);
} else if(parseFloat(refund) > parseFloat(pay_money)) {
refund = pay_money;
$(_this).parent().parent().find(".refund").val(refund);
}
//退款
var withhold = $(_this).parent().parent().find(".withhold").val();
if (!withhold || withhold < 0) {
withhold = 0;
$(_this).parent().parent().find(".withhold").val(withhold);
} else if(parseFloat(withhold) > parseFloat(pay_money)) {
withhold = pay_money;
$(_this).parent().parent().find(".withhold").val(withhold);
}
//补点
var increment_ratio = $(_this).parent().parent().find(".increment_ratio").val();
if (!increment_ratio || increment_ratio < 0) {
increment_ratio = 0;
$(_this).parent().parent().find(".increment_ratio").val(increment_ratio);
} else if(increment_ratio > 100) {
increment_ratio = 100;
$(_this).parent().parent().find(".increment_ratio").val(increment_ratio);
}
var week_amount_find = $(_this).parent().parent();
var old_amount = week_amount_find.find(".sum_money_span").text();
//扣款
pay_money = parseFloat(pay_money) - parseFloat(refund);
var value = (parseFloat(pay_money)*(parseFloat(ratio)/100) + parseFloat(pay_money)*(parseFloat(increment_ratio)/100));
$(_this).parent().parent().find(".sum_money_span").text(value.toFixed(2));
$(_this).parent().parent().find(".sum_money").val(value.toFixed(2));
var this_amount = week_amount_find.find(".sum_money_span").text();
var week_amount = 0;
for (;;) {
week_amount = week_amount_find.find(".week_amount").text();
if (week_amount) {
break;
} else {
week_amount_find = week_amount_find.prev();
}
}
var D_value = parseFloat(old_amount)-parseFloat(this_amount) - parseFloat(withhold);
week_amount_find.find(".week_amount").text((parseFloat(week_amount)-D_value).toFixed(2));
}
//结算金额重算
function changeStatementAmount(_this) {
var _parent = $(_this).parent().parent();
var statement_amount = '';
for (;;) {
statement_amount = _parent.find(".statement_money").text();
if (!statement_amount ) {
_parent = _parent.prev();
} else {
break;
}
}
var row = _parent.find(".statement_money").attr("rowspan");
var get_item = _parent;
var sum_amount = 0;
for (var i =0;i<parseInt(row);i++) {
var amount = get_item.find(".sum_money_span").text();
sum_amount = parseFloat(sum_amount) + parseFloat(amount);
get_item = get_item.next();
}
// week_amount_find.find(".week_amount").text();
_parent.find(".statement_money").text(sum_amount.toFixed(2));
}
//结算金额合计重算
function changeSumAmount() {
var sum_amount = 0;
var st = 0;
$("#statementShow").find(".statement_money").each(function (key,val) {
st = $(val).data('st')
sum_amount = parseFloat(sum_amount) + parseFloat($(val).text());
});
$(".count_sum_money").text(sum_amount.toFixed(2));
}
</script>
</html>

@ -160,6 +160,7 @@
<!-- <th>结算流水</th> -->
<th>不结算金额</th>
<th>创建记录</th>
<th>初审状态</th>
<th>审批状态</th>
<th>打款状态</th>
<th>凭证</th>
@ -187,6 +188,17 @@
<!-- <td>{$data.platform_amount}</td> -->
<td>{$data.lack_statement_money}</td>
<td>{$data.create}</td>
<td>
<if condition="$data.verify_status eq -3 ">
<div style="line-height: 2;color: red;">
{$data.firstverify}
</div>
<else />
<div style="line-height: 2;">
{$data.firstverify}
</div>
</if>
</td>
<td>
<if condition="$data.verify_status eq -1 ">
<div style="line-height: 2;color: red;">
@ -307,19 +319,42 @@
});
});
$(".editSpecialPuPool").click(function () {
var id = $(this).data("id");
var url = "{:U('editPool')}"+"&id="+id+"&type=1"
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
});
$("#verifyAgree,#verifyRefuse").on("click",function(){
$("#verifyAgree,#verifyRefuse,#firstverifyAgree,#firstverifyRefuse").on("click",function(){
var id = $(this).attr("id");
if(id == "verifyAgree"){
var opname = "审批通过";
var opurl = "{:U('verifyAgree')}";
var opst ="[未进行审批]";
var status = [0];
var opst ="[初审通过]";
var status = [6,1];
}else if(id=="verifyRefuse"){
var opname = "审批拒绝";
var opurl = "{:U('verifyRefuse')}";
var opst ="[初审通过]";
var status = [6];
}else if(id=="firstverifyAgree"){
var opname = "初审通过";
var opurl = "{:U('firstverifyAgree')}";
var opst ="[未进行审批]";
var status = [0];
}else if(id=="firstverifyRefuse"){
var opname = "初审拒绝";
var opurl = "{:U('firstverifyRefuse')}";
var opst ="[未进行审批]";
var status = [0,1];
}
var confirm = confirm ? confirm :false;
@ -392,7 +427,7 @@
var status = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
console.log($(elem).data("status"))
if($(elem).data("status") == 1 || $(elem).data("status") == -1){
if($(elem).data("status") == 1 || $(elem).data("status") == -1 || $(elem).data("status") == 2){
return $(elem).val();
} else {
status = true;

@ -119,6 +119,7 @@
<th>分成结算金额</th>
<th>奖励</th>
<th>罚款</th>
<th>其他扣款</th>
<th>周结算金额</th>
<th>结算金额</th>
@ -142,13 +143,12 @@
<td rowspan="{$com.row}">{$key-0+1}</td>
<td rowspan="{$com.row}">{$com.company_name}</td>
<!-- <td rowspan="{$com.statement_count}">{$com.company_info.account}</td> -->
<notempty name="com['statement_info']">
<!-- <td rowspan="{$com['statement_info'][0]['time_row']}">{$com['statement_info'][0]['time']}</td>-->
<td rowspan="{$com['statement_info'][0]['row']}">{$com['statement_info'][0]['account']}</td>
<else />
<!-- <td>-</td>-->
<td>-</td>
</notempty>
@ -162,14 +162,16 @@
<td>{$com['statement_info'][0]['game_list'][0]['game_name']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['game_type_name']}</td>
<td rowspan="{$com['statement_info'][0]['time_row']}">{$com['statement_info'][0]['time']}</td>
<!-- <td>{$com['statement_info'][0]['game_list'][0]['statement_begin_time']}-{$com['statement_info'][0]['game_list'][0]['statement_end_time']}</td>-->
<td><span class="pay_amount">{$com['statement_info'][0]['game_list'][0]['pay_amount']}</span></td>
<td>{$com['statement_info'][0]['game_list'][0]['refund']|default=0}</td>
<td>{$com['statement_info'][0]['game_list'][0]['ratio']}%</td>
<td>{$com['statement_info'][0]['game_list'][0]['increment_ratio']}%</td>
<td><span class="sum_money_span">{$com['statement_info'][0]['game_list'][0]['sum_money']}</span></td>
<td rowspan="{$com.row}">{$com['reward']}</td>
<td rowspan="{$com.row}">{$com['fine']}</td>
<td rowspan="{$com['statement_info'][0]['time_row']}">{$com['statement_info'][0]['reward']||default="0"}</td>
<td rowspan="{$com['statement_info'][0]['time_row']}">{$com['statement_info'][0]['fine']||default="0"}</td>
<td rowspan="{$com['statement_info'][0]['time_row']}">{$com['statement_info'][0]['game_list'][0]['withhold']|default=0}</td>
<td rowspan="{$com['statement_info'][0]['time_row']}">{$com['statement_info'][0]['week_amount']||default="0"}</td>
<td rowspan="{$com.row}">{$com['statement_money']}</td>
@ -219,13 +221,14 @@
<tr>
<td>{$game['game_name']}</td>
<td>{$game['game_type_name']}</td>
<!-- <td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>-->
<td><span class="pay_amount">{$game['pay_amount']}</span></td>
<td>{$game['refund']|default=0}</td>
<td>{$game['ratio']}%</td>
<td>{$game['increment_ratio']}%</td>
<td><span class="sum_money_span">{$game['sum_money']}</span></td>
</tr>
</if>
</foreach>
@ -245,17 +248,22 @@
<td>{$account['game_list'][0]['game_name']}</td>
<td>{$account['game_list'][0]['game_type_name']}</td>
<notempty name="account['time']">
<td rowspan="{$account['time_row']}">{$account['time']|default="-----"}</td>
<td rowspan="{$account['time_row']}">{$account['time']|default="-----"}</td>
</notempty>
<!-- <td>{$account['game_list'][0]['statement_begin_time']}-{$account['game_list'][0]['statement_end_time']}</td>-->
<td><span class="pay_amount">{$account['game_list'][0]['pay_amount']}</span></td>
<!-- <td>{$account['game_list'][0]['ratio']|showNumPercent}</td>-->
<!-- <td>{$account['game_list'][0]['increment_ratio']|showNumPercent}</td>-->
<td>{$account['game_list'][0]['refund']|default=0}</td>
<td>{$account['game_list'][0]['ratio']}%</td>
<td>{$account['game_list'][0]['increment_ratio']}%</td>
<td><span class="sum_money_span">{$account['game_list'][0]['sum_money']}</span></td>
<notempty name="account['time']">
<td rowspan="{$account['time_row']}">{$account['reward']|default=0}</td>
<td rowspan="{$account['time_row']}">{$account['fine']|default=0}</td>
</notempty>
<notempty name="account['time']">
<td rowspan="{$account['time_row']}">{$account['withhold_amount']|default=0}</td>
<td rowspan="{$account['time_row']}">{$account['week_amount']}</td>
</notempty>
@ -268,6 +276,10 @@
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</notempty>
</tr>
@ -277,15 +289,15 @@
<tr>
<td>{$game['game_name']}</td>
<td>{$game['game_type_name']}</td>
<!-- <td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>-->
<td><span class="pay_amount">{$game['pay_amount']}</span></td>
<!-- <td>{$game['ratio']|showNumPercent}</td>-->
<!-- <td>{$game['increment_ratio']|showNumPercent}</td>-->
<td>{$game['refund']|default=0}</td>
<td>{$game['ratio']}%</td>
<td>{$game['increment_ratio']}%</td>
<td><span class="sum_money_span">{$game['sum_money']}</span></td>
</tr>
</if>
</foreach>
@ -305,6 +317,7 @@
<td></td>
<td></td>
<td></td>
<td></td>
<td>{$count.week_money}</td>
<td>{$count.sum_money}</td>
<td></td>

@ -150,6 +150,8 @@
<select id="turnover_type" name="turnover_type" class="select_gallery">
<option value="1">月流水</option>
<option value="2">历史流水</option>
<option value="3">cp月流水</option>
<option value="4">cp历史流水</option>
</select>
</td>
</tr>

@ -134,6 +134,8 @@
<select id="turnover_type" name="turnover_type" class="select_gallery">
<option value="1" <if condition="$data['turnover_type'] eq 1">selected</if>>月流水</option>
<option value="2" <if condition="$data['turnover_type'] eq 2">selected</if>>历史流水</option>
<option value="3" <if condition="$data['turnover_type'] eq 3">selected</if>>cp月流水</option>
<option value="4" <if condition="$data['turnover_type'] eq 4">selected</if>>cp历史流水</option>
</select>
</td>
</tr>

@ -51,6 +51,7 @@
<th>现包名</th>
<th>聚合包名</th>
<th>产品类型</th>
<th>结算时间</th>
<th colspan="2">推广分成比例</th>
<th colspan="2">CP分成比例</th>
@ -116,18 +117,29 @@
<td rowspan="{$data['list'][0]['list'][0]['row']}">
{$data['list'][0]['list'][0]['game_type_name']|default="--"}</td>
<notempty name="data['list'][0]['list'][0]['turnover_ratio']">
<td>{$data['list'][0]['list'][0]['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$data['list'][0]['list'][0]['turnover_ratio'][0]['ratio']|showPercent}</td>
<notempty name="data['list'][0]['list'][0]['ratio_data']">
<td rowspan="{$data['list'][0]['list'][0]['ratio_data'][0]['row']}">{$data['list'][0]['list'][0]['ratio_data'][0]['time']|default="--"}</td>
<else />
<td>--</td>
</notempty>
<notempty name="data['list'][0]['list'][0]['ratio_data'][0]['turnover_ratio']">
<td>{$data['list'][0]['list'][0]['ratio_data'][0]['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$data['list'][0]['list'][0]['ratio_data'][0]['turnover_ratio'][0]['ratio']|showPercent}</td>
<td>{$data['list'][0]['list'][0]['cp_ratio'][0]['name']|default="--"}</td>
<td>{$data['list'][0]['list'][0]['cp_ratio'][0]['ratio']|showPercent}</td>
<else />
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
</notempty>
<notempty name="data['list'][0]['list'][0]['cp_ratio']">
<td>{$data['list'][0]['list'][0]['cp_ratio'][0]['name']|default="--"}</td>
<td>{$data['list'][0]['list'][0]['cp_ratio'][0]['ratio']|showPercent}</td>
<else/>
<td>--</td>
<td>--</td>
</notempty>
<else />
<td>--</td>
<td>--</td>
@ -137,6 +149,7 @@
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
</notempty>
<else />
<td>--</td>
@ -149,6 +162,7 @@
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
</notempty>
<td rowspan="{$data.row}">{$data.bank_address|default="--"}</td>
@ -176,24 +190,6 @@
<if condition="$data['list'][0]['list'][0]['row'] gt 1">
<foreach name="data['list'][0]['list'][0]['turnover_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
<td>{$data['list'][0]['list'][0]['cp_ratio'][$gamekey]['name']|default="--"}</td>
<td>{$data['list'][0]['list'][0]['cp_ratio'][$gamekey]['ratio']|showPercent}</td>
</tr>
</if>
</foreach>
</if>
<!-- 游戏循环 -->
<if condition="$data['list'][0]['row'] gt 1">
<foreach name="data['list'][0]['list']" item="p_ratio" key="pkey">
@ -204,34 +200,55 @@
<td rowspan="{$p_ratio['row']}">{$p_ratio['aggregate_gamename']|default="--"}</td>
<td rowspan="{$p_ratio['row']}">{$p_ratio['game_type_name']|default="--"}</td>
<notempty name="p_ratio['turnover_ratio']">
<notempty name="p_ratio['ratio_data']">
<td rowspan="{$p_ratio['ratio_data'][0]['row']}">{$p_ratio['ratio_data'][0]['time']|default="--"}</td>
<else />
<td>--</td>
</notempty>
<notempty name="p_ratio['ratio_data'][0]['turnover_ratio']">
<td>{$p_ratio['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$p_ratio['turnover_ratio'][0]['ratio']|showPercent}</td>
<td>{$p_ratio['ratio_data'][0]['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$p_ratio['ratio_data'][0]['turnover_ratio'][0]['ratio']|showPercent}</td>
<td>{$p_ratio['cp_ratio'][0]['name']|default="--"}</td>
<td>{$p_ratio['cp_ratio'][0]['ratio']|showPercent}</td>
<else />
<td >-</td>
<td>-</td>
</notempty>
<notempty name="p_ratio['cp_ratio']">
<td>{$p_ratio['cp_ratio'][0]['name']|default="--"}</td>
<td>{$p_ratio['cp_ratio'][0]['ratio']|showPercent}</td>
<else />
<td >-</td>
<td>-</td>
</notempty>
</notempty>
</tr>
</if>
<if condition="$p_ratio['row'] gt 1">
<foreach name="p_ratio['turnover_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
<td>{$p_ratio['cp_ratio'][$gamekey]['name']|default="--"}</td>
<td>{$p_ratio['cp_ratio'][$gamekey]['ratio']|showPercent}</td>
</tr>
</if>
<php>$count = 1;</php>
<foreach name="p_ratio['ratio_data']" item="ratio" key="rkey">
<foreach name="ratio['turnover_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0 or $rkey gt 0">
<tr>
<if condition="$rkey gt 0">
<td rowspan="{$ratio['row']}">{$ratio['time']|default="--"}</td>
</if>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
<td>{$p_ratio['cp_ratio'][$count]['name']|default="--"}</td>
<td>{$p_ratio['cp_ratio'][$count]['ratio']|showPercent}</td>
<php>$count++;</php>
</tr>
</if>
</foreach>
</foreach>
</if>
</if>
</foreach>
</if>
<!-- 会长循环 -->
@ -250,20 +267,33 @@
<td rowspan="{$promote['list'][0]['row']}">{$promote['list'][0]['relation_game_name']|default="--"}</td>
<td rowspan="{$promote['list'][0]['row']}">{$promote['list'][0]['aggregate_gamename']|default="--"}</td>
<td rowspan="{$promote['list'][0]['row']}">{$promote['list'][0]['game_type_name']|default="--"}</td>
<notempty name="promote['list'][0]['ratio_data']">
<td rowspan="{$promote['list'][0]['row']}">{$promote['list'][0]['ratio_data'][0]['time']|default="--"}</td>
<else />
<td>--</td>
</notempty>
<notempty name="promote['list'][0]['turnover_ratio']">
<td>{$promote['list'][0]['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$promote['list'][0]['turnover_ratio'][0]['ratio']|showPercent}</td>
<td>{$promote['list'][0]['cp_ratio'][0]['name']|default="--"}</td>
<td>{$promote['list'][0]['cp_ratio'][0]['ratio']|showPercent}</td>
<notempty name="promote['list'][0]['ratio_data'][0]['turnover_ratio']">
<td>{$promote['list'][0]['ratio_data'][0]['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$promote['list'][0]['ratio_data'][0]['turnover_ratio'][0]['ratio']|showPercent}</td>
<else />
<td >--</td>
<td>--</td>
</notempty>
<notempty name="promote['list'][0]['cp_ratio']">
<td>{$promote['list'][0]['cp_ratio'][0]['name']|default="--"}</td>
<td>{$promote['list'][0]['cp_ratio'][0]['ratio']|showPercent}</td>
<else />
<td >--</td>
<td>--</td>
</notempty>
<else />
</notempty>
<else />
<td >--</td>
<td>--</td>
<td>--</td>
@ -271,24 +301,10 @@
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
</notempty>
</tr>
<if condition="$promote['list'][0]['row'] gt 1">
<foreach name="promote['list'][0]['turnover_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
<td>{$promote['list'][0]['cp_ratio'][$gamekey]['name']|default="--"}</td>
<td>{$promote['list'][0]['cp_ratio'][$gamekey]['ratio']|showPercent}</td>
</tr>
</if>
</foreach>
</if>
<foreach name="promote['list']" item="game" key="gkey">
<if condition="$gkey gt 0">
@ -297,37 +313,56 @@
<td rowspan="{$game['row']}">{$game['relation_game_name']|default="--"}</td>
<td rowspan="{$game['row']}">{$game['aggregate_gamename']|default="--"}</td>
<td rowspan="{$game['row']}">{$game['game_type_name']|default="--"}</td>
<notempty name="game['turnover_ratio']">
<notempty name="game['ratio_data']">
<td rowspan="{$game['ratio_data'][0]['row']}">{$game['ratio_data'][0]['time']|default="--"}</td>
<else />
<td>--</td>
</notempty>
<notempty name="game['ratio_data'][0]['turnover_ratio']">
<td>{$game['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$game['turnover_ratio'][0]['ratio']|showPercent}</td>
<td>{$game['ratio_data'][0]['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$game['ratio_data'][0]['turnover_ratio'][0]['ratio']|showPercent}</td>
<td>{$game['cp_ratio'][0]['name']|default="--"}</td>
<td>{$game['cp_ratio'][0]['ratio']|showPercent}</td>
<else />
<td >-</td>
<td>-</td>
<td>-</td>
</notempty>
<notempty name="game['cp_ratio']">
<td>{$game['cp_ratio'][0]['name']|default="--"}</td>
<td>{$game['cp_ratio'][0]['ratio']|showPercent}</td>
<else />
<td >-</td>
<td>-</td>
</notempty>
</notempty>
</tr>
</if>
<if condition="$game['row'] gt 1">
<foreach name="game['turnover_ratio']" item="game_ratio2" key="gamekey2">
<if condition="$gamekey2 gt 0">
<tr>
<td>{$game_ratio2['name']|default="--"}</td>
<td>{$game_ratio2['ratio']|showPercent}</td>
<td>{$game['cp_ratio'][$gamekey2]['name']|default="--"}</td>
<td>{$game['cp_ratio'][$gamekey2]['ratio']|showPercent}</td>
</tr>
</if>
<php>$count = 1;</php>
<foreach name="game['ratio_data']" item="ratio" key="rkey">
<foreach name="ratio['turnover_ratio']" item="game_ratio2" key="gamekey2">
<if condition="$gamekey2 gt 0 or $rkey gt 0">
<tr>
<if condition="$rkey gt 0">
<td rowspan="{$ratio['row']}">{$ratio['time']|default="--"}</td>
</if>
<td>{$game_ratio2['name']|default="--"}</td>
<td>{$game_ratio2['ratio']|showPercent}</td>
<td>{$game['cp_ratio'][$count]['name']|default="--"}</td>
<td>{$game['cp_ratio'][$count]['ratio']|showPercent}</td>
<php>$count++;</php>
</tr>
</if>
</foreach>
</foreach>
</if>
</if>
</foreach>
</if>
@ -336,17 +371,9 @@
</volist>
<tr class="data_summary">
<td style="text-align: center;" colspan="3">汇总:</td>
<td colspan="33">
<td colspan="34">
累计推广公司数量:{$count}&#12288;&#12288;会长数量:{$promotecount}
</td>
</tr>

@ -116,6 +116,17 @@
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<input type="text" id="time-start" name="begintime" class="" value="{$_GET['begintime']}"
placeholder="结算开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" id="time-end" name="endtime" class="" value="{$_GET['endtime']}"
placeholder="结算结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('PromoteCompany/lists','model='.$model['name'].'&row='.I('row'),false)}">搜索</a>
@ -162,6 +173,7 @@
<th>原包名</th>
<th>现包名</th>
<th>产品类型</th>
<th>结算时间</th>
<th colspan="2">游戏分成比例</th>
<th style="width:10%;min-width:150px;">操作</th>
</tr>
@ -197,14 +209,21 @@
<td rowspan="{$data['list'][0]['list'][0]['row']}">{$data['list'][0]['list'][0]['relation_game_name']|default="--"}</td>
<td rowspan="{$data['list'][0]['list'][0]['row']}">{$data['list'][0]['list'][0]['game_type_name']|default="--"}</td>
<notempty name="data['list'][0]['list'][0]['turnover_ratio']">
<td>{$data['list'][0]['list'][0]['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$data['list'][0]['list'][0]['turnover_ratio'][0]['ratio']|default="--"}</td>
<notempty name="data['list'][0]['list'][0]['ratio_data']">
<td rowspan="{$data['list'][0]['list'][0]['ratio_data'][0]['row']}">{$data['list'][0]['list'][0]['ratio_data'][0]['time']|default="--"}</td>
<else />
<td>--</td>
</notempty>
<notempty name="data['list'][0]['list'][0]['ratio_data'][0]['turnover_ratio']">
<td>{$data['list'][0]['list'][0]['ratio_data'][0]['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$data['list'][0]['list'][0]['ratio_data'][0]['turnover_ratio'][0]['ratio']|default="--"}</td>
<else />
<td>--</td>
<td>--</td>
</notempty>
<else />
<td >--</td>
<td >--</td>
<td>--</td>
<td>--</td>
@ -213,6 +232,7 @@
</notempty>
<else />
<td>--</td>
<td >--</td>
<td>--</td>
<td>--</td>
<td>--</td>
@ -230,49 +250,55 @@
</td>
</tr>
<if condition="$data['list'][0]['list'][0]['row'] gt 1">
<foreach name="data['list'][0]['list'][0]['turnover_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
</tr>
</if>
</foreach>
</if>
<!-- 游戏循环 -->
<if condition="$data['list'][0]['row'] gt 1">
<foreach name="data['list'][0]['list']" item="p_ratio" key="pkey">
<if condition="$pkey gt 0">
<tr>
<td rowspan="{$p_ratio['row']}">{$p_ratio['original_package_name']|default="--"}</td>
<td rowspan="{$p_ratio['row']}">{$p_ratio['relation_game_name']|default="--"}</td>
<td rowspan="{$p_ratio['row']}">{$p_ratio['game_type_name']|default="--"}</td>
<notempty name="p_ratio['turnover_ratio']">
<td>{$p_ratio['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$p_ratio['turnover_ratio'][0]['ratio']|default="--"}</td>
<else />
<notempty name="p_ratio['ratio_data']">
<td rowspan="{$p_ratio['ratio_data'][0]['row']}">{$p_ratio['ratio_data'][0]['time']|default="--"}</td>
<else />
<td>--</td>
</notempty>
<notempty name="p_ratio['ratio_data'][0]['turnover_ratio']">
<td>{$p_ratio['ratio_data'][0]['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$p_ratio['ratio_data'][0]['turnover_ratio'][0]['ratio']|default="--"}</td>
<else />
<td >-</td>
<td>-</td>
</notempty>
</notempty>
</tr>
</if>
<if condition="$p_ratio['row'] gt 1">
<foreach name="p_ratio['turnover_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
</tr>
</if>
<foreach name="p_ratio['ratio_data']" item="ratio" key="rkey">
<foreach name="ratio['turnover_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0 or $rkey gt 0">
<tr>
<if condition="$rkey gt 0 and $gamekey eq 0">
<td rowspan="{$ratio['row']}">{$ratio['time']|default="--"}</td>
</if>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
</tr>
</if>
</foreach>
</foreach>
</if>
</if>
</foreach>
</if>
<!-- 会长循环 -->
@ -288,10 +314,16 @@
<td rowspan="{$promote['list'][0]['row']}">{$promote['list'][0]['original_package_name']|default="--"}</td>
<td rowspan="{$promote['list'][0]['row']}">{$promote['list'][0]['relation_game_name']|default="--"}</td>
<td rowspan="{$promote['list'][0]['row']}">{$promote['list'][0]['game_type_name']|default="--"}</td>
<notempty name="promote['list'][0]['ratio_data']">
<td rowspan="{$promote['list'][0]['row']}">{$promote['list'][0]['ratio_data'][0]['time']|default="--"}</td>
<else />
<td>--</td>
</notempty>
<notempty name="promote['list'][0]['turnover_ratio']">
<td>{$promote['list'][0]['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$promote['list'][0]['turnover_ratio'][0]['ratio']|default="--"}</td>
<notempty name="promote['list'][0]['ratio_data'][0]['turnover_ratio'][0]['name']">
<td>{$promote['list'][0]['ratio_data'][0]['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$promote['list'][0]['ratio_data'][0]['turnover_ratio'][0]['ratio']|default="--"}</td>
<else />
<td >--</td>
<td>--</td>
@ -302,50 +334,54 @@
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
</notempty>
</tr>
<if condition="$promote['list'][0]['row'] gt 1">
<foreach name="promote['list'][0]['turnover_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
</tr>
</if>
</foreach>
</if>
<!-- {$promote['list'][0]['ratio_data'][0]['turnover_ratio'][1]['name']}-->
<!-- dsfsa -->
<foreach name="promote['list']" item="game" key="gkey">
<if condition="$gkey gt 0">
<tr>
<td rowspan="{$game['row']}">{$game['original_package_name']|default="--"}</td>
<td rowspan="{$game['row']}">{$game['relation_game_name']|default="--"}</td>
<td rowspan="{$game['row']}">{$game['game_type_name']|default="--"}</td>
<notempty name="game['ratio_data']">
<td rowspan="{$game['ratio_data'][0]['row']}">{$game['ratio_data'][0]['time']|default="--"}</td>
<else />
<td>--</td>
</notempty>
<notempty name="game['turnover_ratio']">
<notempty name="game['ratio_data'][0]['turnover_ratio']">
<td>{$game['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$game['turnover_ratio'][0]['ratio']|default="--"}</td>
<td>{$game['ratio_data'][0]['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$game['ratio_data'][0]['turnover_ratio'][0]['ratio']|default="--"}</td>
<else />
<td >-</td>
<td>-</td>
</notempty>
</notempty>
</tr>
</if>
<if condition="$game['row'] gt 1">
<foreach name="game['turnover_ratio']" item="game_ratio2" key="gamekey2">
<if condition="$gamekey2 gt 0">
<tr>
<td>{$game_ratio2['name']|default="--"}</td>
<td>{$game_ratio2['ratio']|showPercent}</td>
</tr>
</if>
<foreach name="game['ratio_data']" item="ratio" key="rkey">
<foreach name="ratio['turnover_ratio']" item="game_ratio2" key="gamekey2">
<if condition="$gamekey2 gt 0 or $rkey gt 0">
<tr>
<if condition="$rkey gt 0 and $gamekey2 eq 0">
<td rowspan="{$ratio['row']}">{$ratio['time']|default="--"}</td>
</if>
<td>{$game_ratio2['name']|default="--"}</td>
<td>{$game_ratio2['ratio']|showPercent}</td>
</tr>
</if>
</foreach>
</foreach>
</if>
</if>
</foreach>
</if>
@ -355,7 +391,7 @@
</volist>
<tr class="data_summary">
<td style="text-align: center;" colspan="3">汇总:</td>
<td colspan="16">
<td colspan="17">
累计推广公司数量:{$count}&#12288;&#12288;会长数量:{$promotecount}
</td>
</tr>
@ -437,6 +473,11 @@
<block name="script">
<script src="__STATIC__/layer/layer.js"></script>
<script src="__STATIC__/layer/extend/layer.ext.js"></script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<style>
.layui-layer-demo .layui-layer-title {background:#F0F5F7;font-weight:bold;}
.layui-layer-demo .layui-layer-content {}
@ -458,6 +499,41 @@
//导航高亮
highlight_subnav("{:U('lists')}");
$(function(){
$('#time-start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
showMeridian:true,
pickDate:true,
minView: 2,
autoclose: true,
pickTime:true,
todayBtn:true,
}).on('change',function(ev){
var val = new Date($.trim($(this).val())).getTime();
var end = new Date($.trim($('#time-end').val())).getTime();
if (val>end) {
layer.msg('开始时间大于结束时间!');$(this).val('');
}
return false;
});
$("#time-end").datetimepicker({
format:"yyyy-mm-dd",
language: "zh-CN",
showMeridian:true,
minView:2,
autoclose:true,
todayBtn:true,
}).on('change',function(ev){
var val = new Date($.trim($(this).val())).getTime();
var start = new Date($.trim($('#time-start').val())).getTime();
if (val<start) {
layer.msg('开始时间大于结束时间!');$(this).val('');
}
return false;
});
//搜索功能
$("#search").click(function(){
var url = $(this).attr('url');
@ -486,7 +562,7 @@
area: ['40%', '30%'],
content: url,
success:function(){
layer.closeAll();
layer.closeAll();
}
});

@ -2691,6 +2691,7 @@ CREATE TABLE `tab_company_belong_game` (
UPDATE `tab_game_ratio_mould` SET `begin_time` = 1567267200 WHERE `begin_time` = 0
CREATE TABLE `tab_testing_game_setting` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`base_game_id` int(11) NOT NULL COMMENT '游戏ID',
@ -2702,7 +2703,6 @@ CREATE TABLE `tab_testing_game_setting` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='测试资源游戏设置';
ALTER TABLE `tab_promote_grade_setting`
ADD COLUMN `base_game_id` int(11) not NULL DEFAULT 0 COMMENT '游戏ID' AFTER `name`,
ADD COLUMN `month_begin` int(11) not NULL DEFAULT 0 COMMENT '规则截止月份' AFTER `base_game_id`,
@ -2715,6 +2715,10 @@ ADD COLUMN `verify_time` int(11) NOT NULL DEFAULT 0 COMMENT '审核时间' AFTER
ALTER TABLE `tab_testing_resource_batch`
ADD COLUMN `auto_verify` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否需要审核' AFTER `verify_status`;
ALTER TABLE `tab_company_game_ratio_log`
ADD COLUMN `company_belong` varchar(60) NOT NULL DEFAULT 0 COMMENT '工会归属0-内团 1-外团 2-分发联盟 3-无 4-下游聚合' AFTER `verify_log`;
ALTER TABLE `tab_promote_company`
ADD COLUMN `is_site_custom` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否定制推广后台' AFTER `is_inside`;
ALTER TABLE `tab_promote_company`

Loading…
Cancel
Save