From d5e7546c514a873d32e2f8d2a16219ae695f8c22 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Wed, 12 Aug 2020 15:05:57 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=B8=82=E5=9C=BA=E4=B8=9A=E7=BB=A9=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarketPercentageController.class.php | 26 +++++++++++++------ .../Controller/TimingController.class.php | 13 +++++++--- Data/update.sql | 5 ++++ 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index e314200ff..850186825 100644 --- a/Application/Admin/Controller/MarketPercentageController.class.php +++ b/Application/Admin/Controller/MarketPercentageController.class.php @@ -486,7 +486,8 @@ class MarketPercentageController extends ThinkController 'maintain_commission_ratio'=>'维护业绩提成比例(%)', 'appraisal_bonuses_ratio'=>'开发考核奖金比例(%)', 'maintain_appraisal_bonuses_ratio'=>'维护奖金考核比例(%)', - 'company_profit'=>'税后毛利', + 'achievement_profit'=>'开发税后毛利', + 'performance_profit'=>'维护税后毛利', 'performance_commission' => '业绩提成', 'achievement_bonus' => '绩效考核奖金', 'commission' => '当月合计', @@ -500,29 +501,38 @@ class MarketPercentageController extends ThinkController $data[$key]['performance_commission'] = "=ROUND("; $data[$key]['achievement_bonus'] = "=ROUND("; - if ($value['performance_revenue'] != "0.00") { + if ($value['performance_profit'] != "0.00") { $data[$key]['performance_commission'] .= "J{$line}*(F{$line}/100)"; $data[$key]['achievement_bonus'] .= "J{$line}*(H{$line}/100)"; } - if ($value['appraisal_bonuses'] != "0.00") { + if ($value['achievement_profit'] != "0.00") { if ($data[$key]['performance_commission'] == "=ROUND(") { - $data[$key]['performance_commission'] .= "J{$line}*(G{$line}/100),2)"; + $data[$key]['performance_commission'] .= "K{$line}*(G{$line}/100),2)"; } else { - $data[$key]['performance_commission'] .= "+J{$line}*(G{$line}/100),2)"; + $data[$key]['performance_commission'] .= "+K{$line}*(G{$line}/100),2)"; } if ($data[$key]['achievement_bonus'] == "=ROUND(") { - $data[$key]['achievement_bonus'] .= "J{$line}*(I{$line}/100),2)"; + $data[$key]['achievement_bonus'] .= "K{$line}*(I{$line}/100),2)"; } else { - $data[$key]['achievement_bonus'] .= "+J{$line}*(I{$line}/100),2)"; + $data[$key]['achievement_bonus'] .= "+K{$line}*(I{$line}/100),2)"; } } else { $data[$key]['performance_commission'] .= ",2)"; $data[$key]['achievement_bonus'] .= ",2)"; } + + if ($data[$key]['performance_commission'] == '=ROUND(,2)') { + $data[$key]['performance_commission'] = "0.00"; + } + + if ($data[$key]['achievement_bonus'] == '=ROUND(,2)') { + $data[$key]['achievement_bonus'] = "0.00"; + } + // $data[$key]['performance_commission'] = "=ROUND(J{$line}*(F{$line}/100)+J{$line}*(G{$line}/100),2)"; // $data[$key]['achievement_bonus'] = "=ROUND(J{$line}*(H{$line}/100)+J{$line}*(I{$line}/100),2)"; - $data[$key]['commission'] = "=ROUND(K{$line}+L{$line},2)"; + $data[$key]['commission'] = "=ROUND(L{$line}+M{$line},2)"; } $data = array_merge($data,[$sum]); diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index d2e378244..42875bfdc 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -1051,10 +1051,13 @@ class TimingController extends AdminController { if($v['develop_type'] == 1 || $v['develop_type'] == 2) { $all_data[$key]['performance_commission'] += $v['company_profit']*($market_percentage['develop_commission_ratio']/100); + $all_data[$key]['achievement_profit'] += $v['company_profit']; + } if ($v['develop_type'] == 3) { $all_data[$key]['performance_commission'] += $v['company_profit']*($market_percentage['maintain_commission_ratio']/100); + $all_data[$key]['performance_profit'] += $v['company_profit']; } //绩效考核奖金 @@ -1071,10 +1074,10 @@ class TimingController extends AdminController { $all_data[$key]['achievement_bonus'] = number_format($all_data[$key]['achievement_bonus'], 2, '.', ''); $sum_amount <$market_percentage['performance_revenue'] ? ($all_data[$key]['performance_commission'] = 0):""; -// $all_data[$key]['achievement_bonus'] = -// number_format($value['company_profit']*($market_percentage['appraisal_bonuses_ratio']/100) + -// $value['company_profit']*($market_percentage['maintain_appraisal_bonuses_ratio']/100), 2, '.', ''); + $sum_amount <$market_percentage['performance_revenue'] ? ($all_data[$key]['achievement_profit'] = 0):""; + $sum_amount <$market_percentage['appraisal_bonuses'] ? ($all_data[$key]['achievement_bonus'] = 0):""; + $sum_amount <$market_percentage['appraisal_bonuses'] ? ($all_data[$key]['performance_profit'] = 0):""; //总提成 $all_data[$key]['commission'] = number_format($all_data[$key]['performance_commission']+$all_data[$key]['achievement_bonus'], 2, '.', ''); //应发金额 @@ -1113,6 +1116,10 @@ class TimingController extends AdminController { $insert['wait_performance_commission'] = number_format($all_data[$key]['performance_commission'] * (1-($market_percentage['performance_monthly_ratio']/100)), 2, '.', ''); //待发绩效奖金 $insert['wait_achievement_commission'] = number_format($all_data[$key]['achievement_bonus'] * (1-($market_percentage['month_bonus_ratio']/100)), 2, '.', ''); + + $insert['achievement_profit'] = number_format($all_data[$key]['achievement_profit'], 2, '.', ''); + $insert['performance_profit'] = number_format($all_data[$key]['performance_profit'], 2, '.', ''); + // $insert['wait_commission'] = ($insert['wait_performance_commission']+$insert['wait_achievement_commission']); $is_hav = M("market_altogether","tab_") ->where(['admin_id'=>$value['admin_id'],'pay_time'=>$value['pay_time']]) diff --git a/Data/update.sql b/Data/update.sql index 764f5718e..0d227f99c 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -2401,3 +2401,8 @@ INSERT INTO `sys_kv`(`id`, `key`, `value`, `type`, `remark`) VALUES (4, 'cp_comp ALTER TABLE `sj_game_channel`.`sj_cptogether_company` ADD COLUMN `is_qualifity` tinyint(2) NULL COMMENT '是否具有游戏资质 0 否 1 是' AFTER `is_received`; + + +ALTER TABLE `tab_market_altogether` +ADD COLUMN `achievement_profit` decimal(13, 2) NULL DEFAULT 0.00 COMMENT '开发毛利' AFTER `wait_achievement_commission`, +ADD COLUMN `performance_profit` decimal(13, 2) NULL DEFAULT 0.00 COMMENT '维护毛利' AFTER `achievement_profit`; \ No newline at end of file From 8cc9bdb0c69ed67de121178ed1db5ff0d47fbabd Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Wed, 12 Aug 2020 16:54:06 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=B8=82=E5=9C=BA=E4=B8=9A=E7=BB=A9=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarketPercentageController.class.php | 59 ++++++++++++++----- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index 850186825..f836e01e3 100644 --- a/Application/Admin/Controller/MarketPercentageController.class.php +++ b/Application/Admin/Controller/MarketPercentageController.class.php @@ -501,34 +501,61 @@ class MarketPercentageController extends ThinkController $data[$key]['performance_commission'] = "=ROUND("; $data[$key]['achievement_bonus'] = "=ROUND("; - if ($value['performance_profit'] != "0.00") { + + if ($value['achievement_profit'] != "0.00") { $data[$key]['performance_commission'] .= "J{$line}*(F{$line}/100)"; $data[$key]['achievement_bonus'] .= "J{$line}*(H{$line}/100)"; } - if ($value['achievement_profit'] != "0.00") { - if ($data[$key]['performance_commission'] == "=ROUND(") { - $data[$key]['performance_commission'] .= "K{$line}*(G{$line}/100),2)"; - } else { + + if ($value['performance_profit'] != "0.00") { + + if ($data[$key]['performance_commission'] != '=ROUND(') { $data[$key]['performance_commission'] .= "+K{$line}*(G{$line}/100),2)"; + } else { + $data[$key]['performance_commission'] .= "K{$line}*(G{$line}/100),2)"; } - if ($data[$key]['achievement_bonus'] == "=ROUND(") { - $data[$key]['achievement_bonus'] .= "K{$line}*(I{$line}/100),2)"; - } else { + if ($data[$key]['achievement_bonus'] != '=ROUND(') { $data[$key]['achievement_bonus'] .= "+K{$line}*(I{$line}/100),2)"; + } else { + $data[$key]['achievement_bonus'] .= "K{$line}*(I{$line}/100),2)"; } + + + +// $data[$key]['achievement_bonus'] .= "J{$line}*(H{$line}/100)"; } else { - $data[$key]['performance_commission'] .= ",2)"; - $data[$key]['achievement_bonus'] .= ",2)"; + $data[$key]['performance_commission'] .= ',2)'; + $data[$key]['achievement_bonus'] .= ',2)'; } - if ($data[$key]['performance_commission'] == '=ROUND(,2)') { - $data[$key]['performance_commission'] = "0.00"; - } - if ($data[$key]['achievement_bonus'] == '=ROUND(,2)') { - $data[$key]['achievement_bonus'] = "0.00"; - } + + +// if ($value['achievement_profit'] != "0.00") { +// if ($data[$key]['performance_commission'] == "=ROUND(") { +// $data[$key]['performance_commission'] .= "K{$line}*(G{$line}/100),2)"; +// } else { +// $data[$key]['performance_commission'] .= "+K{$line}*(G{$line}/100),2)"; +// } +// +// if ($data[$key]['achievement_bonus'] == "=ROUND(") { +// $data[$key]['achievement_bonus'] .= "K{$line}*(I{$line}/100),2)"; +// } else { +// $data[$key]['achievement_bonus'] .= "+K{$line}*(I{$line}/100),2)"; +// } +// } else { +// $data[$key]['performance_commission'] .= ",2)"; +// $data[$key]['achievement_bonus'] .= ",2)"; +// } +// +// if ($data[$key]['performance_commission'] == '=ROUND(,2)') { +// $data[$key]['performance_commission'] = "0.00"; +// } +// +// if ($data[$key]['achievement_bonus'] == '=ROUND(,2)') { +// $data[$key]['achievement_bonus'] = "0.00"; +// } // $data[$key]['performance_commission'] = "=ROUND(J{$line}*(F{$line}/100)+J{$line}*(G{$line}/100),2)"; // $data[$key]['achievement_bonus'] = "=ROUND(J{$line}*(H{$line}/100)+J{$line}*(I{$line}/100),2)"; From 250d2ac2c05b435a43351ce97e6a67c75ee361fc Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Wed, 19 Aug 2020 11:17:11 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E4=B8=9A=E7=BB=A9?= =?UTF-8?q?=E6=AF=9B=E5=88=A9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarketPercentageController.class.php | 17 +++++++++++++++-- .../Admin/Controller/UserController.class.php | 3 +++ Application/Admin/View/User/add.html | 14 ++++++++++++++ Application/Admin/View/User/edit.html | 14 ++++++++++++++ Data/update.sql | 5 ++++- 5 files changed, 50 insertions(+), 3 deletions(-) diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index f836e01e3..e0ad51bce 100644 --- a/Application/Admin/Controller/MarketPercentageController.class.php +++ b/Application/Admin/Controller/MarketPercentageController.class.php @@ -202,17 +202,30 @@ class MarketPercentageController extends ThinkController if(is_administrator()||session('user_group_id') == 15||session('user_group_id') == 14||session('user_group_id') == 19||session('user_group_id') == 23) { unset($map['admin_id']); + $markerData = M("ucenter_member")->field("id")->where(['work_status'=>1])->select(); + + if ($markerData) { + $admin_map['sys_member.uid'] = ['not in',array_column($markerData,'id')]; + } + $admin_data = M("member") ->field("access.uid admin_id") ->join("left join sys_auth_group_access access on sys_member.uid = access.uid") ->join("left join sys_auth_group auth on access.group_id=auth.id") ->where(['group_id'=>['in','11,12,21']]) + ->where($admin_map) ->select(); if ($admin_data) { $map['admin_id'] = ['in',array_column($admin_data,'admin_id')]; } + if (!in_array($_REQUEST['admin_id'],array_column($markerData,'id'))) { + $_REQUEST['admin_id']?($map['admin_id'] = $_REQUEST['admin_id']):''; + } else { + $this->display("marketstaffsettle"); + die(); + } + - $_REQUEST['admin_id']?($map['admin_id'] = $_REQUEST['admin_id']):''; } @@ -991,7 +1004,7 @@ class MarketPercentageController extends ThinkController $map['pay_time'] = $_REQUEST['pay_time']; } } -// var_dump($map);die(); + $data = M("market_altogether","tab_") ->field("max(pay_time) pay_time,real_name,admin_id,nickname,level,sum(pay_amount) pay_amount,sum(extend_commission) extend_commission, sum(performance_commission) performance_commission,sum(achievement_bonus) achievement_bonus, diff --git a/Application/Admin/Controller/UserController.class.php b/Application/Admin/Controller/UserController.class.php index 5d1420f60..48c7c8bfd 100644 --- a/Application/Admin/Controller/UserController.class.php +++ b/Application/Admin/Controller/UserController.class.php @@ -420,6 +420,9 @@ class UserController extends AdminController $info['second_pwd'] = (empty($spwd) || $spwd == $oldspwd) ? $oldspwd : $spwd; $info['email'] = $_POST['email']; $info['mobile'] = isset($_POST['mobile']) ? $_POST['mobile'] : ''; + if($_POST['work_status']) { + $info['work_status'] = $_POST['work_status']; + } $ss['group_id'] = $_POST['auth']; $ss['houtai'] = $_POST['houtai']; $smember = $Member->where($map)->save($info); diff --git a/Application/Admin/View/User/add.html b/Application/Admin/View/User/add.html index 6de26319d..cb254779e 100644 --- a/Application/Admin/View/User/add.html +++ b/Application/Admin/View/User/add.html @@ -73,6 +73,20 @@ 管理员手机号码,用于找回密码等安全操作 + + 离职状态 + + + + + 离职状态,市场专员离职发放后自动标志未离职 + + + diff --git a/Application/Admin/View/User/edit.html b/Application/Admin/View/User/edit.html index db208188c..84f1118de 100644 --- a/Application/Admin/View/User/edit.html +++ b/Application/Admin/View/User/edit.html @@ -68,6 +68,20 @@ + + 离职状态 + + + + + 离职状态,市场专员离职发放后自动标志未离职 + + + 手机: diff --git a/Data/update.sql b/Data/update.sql index 0d227f99c..6035dfc39 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -2405,4 +2405,7 @@ ADD COLUMN `is_qualifity` tinyint(2) NULL COMMENT '是否具有游戏资质 0 ALTER TABLE `tab_market_altogether` ADD COLUMN `achievement_profit` decimal(13, 2) NULL DEFAULT 0.00 COMMENT '开发毛利' AFTER `wait_achievement_commission`, -ADD COLUMN `performance_profit` decimal(13, 2) NULL DEFAULT 0.00 COMMENT '维护毛利' AFTER `achievement_profit`; \ No newline at end of file +ADD COLUMN `performance_profit` decimal(13, 2) NULL DEFAULT 0.00 COMMENT '维护毛利' AFTER `achievement_profit`; + +ALTER TABLE `sys_ucenter_member` +ADD COLUMN `work_status` tinyint(2) NOT NULL DEFAULT 0 COMMENT '离职状态' AFTER `openid_sign`; \ No newline at end of file From e6bc6853aa42d5ebe7cfdbaee868803788fe9a64 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Sat, 22 Aug 2020 17:51:43 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E7=89=B9=E6=AE=8A=E8=A1=A5=E7=82=B9?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E5=8A=9F=E8=83=BD=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/AjaxController.class.php | 44 ++ .../CompanyGameRatioController.class.php | 304 ++++++++-- .../CompanyStatementController.class.php | 324 +++++++++- .../Admin/View/CompanyGameRatio/edit.html | 441 ++++++++++++++ .../Admin/View/CompanyGameRatio/index.html | 79 ++- .../Admin/View/CompanyStatement/lists.html | 14 + .../viewSpecialComplement.html | 561 ++++++++++++++++++ 7 files changed, 1708 insertions(+), 59 deletions(-) create mode 100644 Application/Admin/View/CompanyGameRatio/edit.html create mode 100644 Application/Admin/View/CompanyStatement/viewSpecialComplement.html diff --git a/Application/Admin/Controller/AjaxController.class.php b/Application/Admin/Controller/AjaxController.class.php index 02e6eed5a..ea80320e6 100644 --- a/Application/Admin/Controller/AjaxController.class.php +++ b/Application/Admin/Controller/AjaxController.class.php @@ -540,6 +540,50 @@ class AjaxController extends ThinkController{ $this->ajaxReturn($data); } + + /** + *获取下游公司 + */ + public function getPromoteCompany() + { + $company_belong = I('company_belong'); + if ($company_belong == 1) { + $map['company_belong'] = ['in','1,2']; + } else { + $map['company_belong'] = $company_belong; + } + + $data = M('promote_company','tab_') + ->field('id, company_name as name,game_ids') + ->where(['status' => 1]) + ->where($map) + ->select(); + + $this->ajaxReturn($data); + } + + /** + * 获取下游公司游戏列表 + */ + public function getPromoteGameList() { + + $game_ids = I('game_ids'); + + if ($game_ids) { + $map['relation_game_id'] = ['in',$game_ids]; + } else { + $this->ajaxReturn([]); + } + + $data = M("game","tab_") + ->field("relation_game_id,relation_game_name") + ->where($map) + ->group("relation_game_id") + ->select(); + $this->ajaxReturn($data); + + } + /** * 操作日志 * option: diff --git a/Application/Admin/Controller/CompanyGameRatioController.class.php b/Application/Admin/Controller/CompanyGameRatioController.class.php index 6c53c0b4a..a33b551ad 100644 --- a/Application/Admin/Controller/CompanyGameRatioController.class.php +++ b/Application/Admin/Controller/CompanyGameRatioController.class.php @@ -98,20 +98,33 @@ 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") + ->field("m.*,g.*,p.company_name,p.company_belong,IFNULL(r.settlement_type,-1) settlement_type,group_concat(ratio SEPARATOR '|') ratio,group_concat(begin_time SEPARATOR '|') begin_time,group_concat(end_time SEPARATOR '|') end_time,group_concat(m.turnover_ratio SEPARATOR '|') turnover_ratio,group_concat(m.id 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)"); if(isset($params['export'])){ - $dbres = $dbres->where($where)->select(); + $dbres = $dbres->where($where)->group("company_id,m.relation_game_id")->select(); }else{ - $dbres = $dbres->where($where)->page($page, $row)->select(); + $dbres = $dbres->where($where)->page($page, $row)->group("company_id,m.relation_game_id")->select(); } + foreach($dbres as $k=>&$v){ - $v['begin_time'] = date("Y-m-d",$v['begin_time']); - $v['end_time'] = $v['end_time'] ? date('Y-m-d', $v['end_time']) : '永久'; - $v["valid"] = "{$v['begin_time']} ~ {$v['end_time']}"; + $begin_time = explode('|',$v['begin_time']); + $end_time = explode('|',$v['end_time']); + + foreach ($begin_time as $tk => $tv) { + + $begintime = date("Y-m-d",$tv); + $endtime = $end_time[$tk] ? date('Y-m-d', $end_time[$tk]) : '永久'; + $v["valid"][$tk] = "{$begintime} ~ {$endtime}"; + + } + +// $v['begin_time'] = date("Y-m-d",$v['begin_time']); +// $v['end_time'] = $v['end_time'] ? date('Y-m-d', $v['end_time']) : '永久'; +// +// $v["valid"] = "{$v['begin_time']} ~ {$v['end_time']}"; $v['company_belong'] ="下游".getCompanyBlong($v['company_belong']); if (isset($params['export'])) { @@ -119,11 +132,17 @@ class CompanyGameRatioController extends AdminController } else { $symbol = "
"; } - $v['settlement_type'] = $this->SettlementType[$v['settlement_type']]; $this->readTurnoverRatio($v); - $v['oplist'] = $this->OpAuth($v); + + $getId = explode('|',$v['operate_id']); + + foreach ($getId as $key => $value) { + $v['oplist'][] = $this->OpAuth(['id'=>$value]); + } + } + $this->assign('data', $dbres); if(isset($_REQUEST['export'])){ $GetData = $_GET; @@ -133,10 +152,14 @@ class CompanyGameRatioController extends AdminController exit(); } - $count = M("company_game_ratio","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","tab_")->alias('m')->field("m.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.")") + ->where($where) + ->group("company_id,m.relation_game_id") + ->select(false); + + $count = M()->table("({$count})a")->count(); $page = set_pagination($count, $row,$params); if($page) { @@ -413,13 +436,15 @@ class CompanyGameRatioController extends AdminController "end_time"=>$v['end_time'], ]; - $has = $company_game_ratio->where("company_id='{$v['company_id']}' and relation_game_id='{$v['relation_game_id']}'")->find(); - if(isset($has['id'])){ - $ratiov['id'] = $has['id']; - $company_game_ratio->save($ratiov); - }else{ - $company_game_ratio->add($ratiov); - } + $this->companyRatioTimeChange($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'])){ +// $ratiov['id'] = $has['id']; +// $company_game_ratio->save($ratiov); +// }else{ +// $company_game_ratio->add($ratiov); +// } // addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"管理员审核",'url'=>U('lists')]); } @@ -429,6 +454,106 @@ class CompanyGameRatioController extends AdminController )); } + public function companyRatioTimeChange($company_id = 0, $relation_game_id = 0, $begin_time = 0, $end_time = 0,$ratiov=[]) { + + if (!$company_id || !$relation_game_id) { + $this->error("公司与游戏的参数错误."); + } + + $check_data = M("company_game_ratio","tab_") + ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$begin_time,'end_time'=>$end_time]) + ->find(); + if ($check_data) { + M("company_game_ratio","tab_") + ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$begin_time,'end_time'=>$end_time]) + ->save($ratiov); + return; + } + + M("company_game_ratio","tab_") +// ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>['egt',$begin_time],'end_time'=>['elt',$end_time]]) + ->where("company_id={$company_id} and relation_game_id={$relation_game_id} and begin_time>={$begin_time} and end_time <= {$end_time} and end_time!=0") + ->delete(); + + $data = M("company_game_ratio","tab_") + ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id]) + ->select(); + + + + foreach($data as $key => $value) { + + if ($value['begin_time'] > $begin_time) { + + if ($value['begin_time'] >= $end_time && $value['end_time']!=0) { + continue; + } + + if ($end_time > $value['begin_time'] && ($end_time < $value['end_time']||$value['end_time']==0)) { +// $value['begin_time'] = $end_time; +// M("company_game_ratio","tab_")->save($value); + M("company_game_ratio","tab_") + ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) + ->save(['begin_time'=>$end_time+1]); + } else if ($end_time > $value['begin_time'] && ($end_time >= $value['end_time']&&$value['end_time']!=0)) { +// $value['begin_time'] = $begin_time; +// $value['end_time'] = $end_time; +// M("company_game_ratio","tab_")->save($value); + M("company_game_ratio","tab_") + ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) + ->save(['begin_time'=>$begin_time,'end_time'=>$end_time]); + } + + } else if ($value['begin_time'] <= $begin_time) { + + if ($begin_time >= $value['end_time']&& $value['end_time']!=0) { + continue; + } + if ($begin_time > $value['begin_time'] && ($end_time >= $value['end_time'] && $value['end_time']!=0)) { +// $value['end_time'] = $begin_time; +// M("company_game_ratio","tab_")->save($value); + M("company_game_ratio","tab_") + ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) + ->save(['end_time'=>$begin_time-1]); + } else if ($begin_time > $value['begin_time'] && ($end_time < $value['end_time']||$value['end_time']==0)) { +// $value['end_time'] = $begin_time; +// M("company_game_ratio","tab_")->save($value); +// dump(2);die(); + M("company_game_ratio","tab_") + ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) + ->save(['end_time'=>$begin_time-1]); + $dataValue = $value; + $dataValue['begin_time'] = $end_time+1; + unset($dataValue['id']); + M("company_game_ratio","tab_")->add($dataValue); + + } else if ($begin_time == $value['begin_time'] && ($end_time < $value['end_time']||$value['end_time']==0)) { + M("company_game_ratio","tab_") + ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) + ->save(['begin_time'=>$end_time+1]); + } else if ($end_time == $value['end_time']&&$begin_time>$value['begin_time']) { + M("company_game_ratio","tab_") + ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) + ->save(['end_time'=>$begin_time-1]); + } else if ($end_time == $value['end_time']&&$begin_time == $value['begin_time']) { + +// $value['begin_time'] = $begin_time; +// $value['end_time'] = $end_time; + M("company_game_ratio","tab_") + ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']]) + ->save(['begin_time'=>$begin_time,'end_time'=>$end_time]); + + } + + } + + } + + M("company_game_ratio","tab_")->add($ratiov); + + + } + public function addRatio() { if ($_POST) { @@ -457,9 +582,11 @@ class CompanyGameRatioController extends AdminController $this->getOldRatio($save); //判断已有未审核 $where = [ - "relation_game_id"=>$save['company_id'], + "relation_game_id"=>$save['relation_game_id'], "company_id"=>$save['company_id'], - "status"=>["LT",2]//管理员未确认 + "status"=>["LT",2],//管理员未确认 + "begin_time"=>$save['begin_time'], + "end_time"=>$save['end_time'] ]; $hasdb = M("company_game_ratio_log","tab_")->field("count(id) count")->where($where)->find()['count']; if($hasdb > 0){ @@ -478,6 +605,66 @@ class CompanyGameRatioController extends AdminController } } + public function edit() + { + if ($_POST) { + $params = I('post.'); + if(!isset($params['id'])){ + $this->error('参数错误'); + } + if (empty($params['begin_time'])) { + $this->error('请选择开始时间'); + } + if (!empty($params['end_time'])) { + if (strtotime($params['end_time']) < strtotime($params['begin_time'])) { + $this->error('结束时间不得小于开始时间'); + } + } + if (!isset($params['ratio']) || $params['ratio'] === '') { + $this->error('默认分成比例不能为空'); + } + //查询 + $y = M("company_game_ratio_log","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']; + $save['last_ratio'] = $params['last_ratio']; + $save['relation_game_id'] = $params['relation_game_id'] ?? 0; + $save['company_id'] = $params['company_id'] ?? 0; + $save['begin_time'] = strtotime($params['begin_time']); + $save['end_time'] = $params['end_time'] ? strtotime($params['end_time'])+86399 : 0; + $save['remark'] = $params['remark'] ?? ''; + $save['status'] = 0; + $save['verify_log']=json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]); + + 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; + $save['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]); + } + M("company_game_ratio_log","tab_")->add($save); + addOperationLog(['op_type'=>1,'key'=>$params['id'],'op_name'=>'修改','url'=>U('index')]); + $this->ajaxReturn(["msg"=>"修改申请提交成功","code"=>1,"url"=>U("index")]); + } else { + $params = I('get.'); + $id = $params['id'] ?? 0; + $id = intval($id); + $map['m.id'] = $id; + + $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") + ->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['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']); + $this->assign('data', $dbres); + $this->display(); + } + } public function editRatio() { if ($_POST) { @@ -595,7 +782,7 @@ class CompanyGameRatioController extends AdminController ]; //操作对应菜单 if(!isset($info['status'])){ - $optist = ["delGameRatio"]; + $optist = ["editRatio","delGameRatio"]; }else{ if($info['status'] == 2){ $optist = []; @@ -742,28 +929,65 @@ class CompanyGameRatioController extends AdminController $company_id = implode(",",$company_id); return $company_id; } - //设置比例阶梯 - protected function readTurnoverRatio(&$v){ - $turnover_ratio = json_decode($v['turnover_ratio'],true); - $v['turnover_ratio'] = array( - array("ratio"=>$v['ratio']."%","name"=>"默认比例") - ); - - foreach($turnover_ratio as $ke=>$va){ - $t=array("ratio"=>$va["ratio"]."%"); - if(array_key_exists("instanceof",$va)){ - //存在 - if($va['instanceof']=='1'){ - $t['name']="月流水≥".$va['turnover']; +// //设置比例阶梯 +// protected function readTurnoverRatio(&$v){ +// $turnover_ratio = json_decode($v['turnover_ratio'],true); +// $v['turnover_ratio'] = array( +// array("ratio"=>$v['ratio']."%","name"=>"默认比例") +// ); +// +// foreach($turnover_ratio as $ke=>$va){ +// $t=array("ratio"=>$va["ratio"]."%"); +// if(array_key_exists("instanceof",$va)){ +// //存在 +// if($va['instanceof']=='1'){ +// $t['name']="月流水≥".$va['turnover']; +// }else{ +// $t['name']="月流水>".$va['turnover']; +// } +// }else{ +// $t['name']="月流水≥".$va['turnover']; +// } +// $v['turnover_ratio'][]=$t; +// } +// $v['row'] = count($v['turnover_ratio']); +// } + + //设置比例阶梯 + protected function readTurnoverRatio(&$v){ + + $radio = explode('|',$v['ratio']); + $turnover_ratio = explode('|',$v['turnover_ratio']); + + $sec_row = 1; + + foreach ($radio as $key => $value) { + + $turnoverratio = json_decode($turnover_ratio[$key],true); + $v['turnover_ratios'][$key] = array( + array("ratio"=>$value."%","name"=>"默认比例") + ); + + foreach($turnoverratio as $ke=>$va){ + $t=array("ratio"=>$va["ratio"]."%"); + if(array_key_exists("instanceof",$va)){ + //存在 + if($va['instanceof']=='1'){ + $t['name']="月流水≥".$va['turnover']; + }else{ + $t['name']="月流水>".$va['turnover']; + } }else{ - $t['name']="月流水>".$va['turnover']; + $t['name']="月流水≥".$va['turnover']; } - }else{ - $t['name']="月流水≥".$va['turnover']; + $sec_row++; + $v['turnover_ratios'][$key][]=$t; } - $v['turnover_ratio'][]=$t; + $v['sec_row'][$key] = $sec_row; + $sec_row = 1; } - $v['row'] = count($v['turnover_ratio']); + $v['row'] = array_sum($v['sec_row']); + } diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index e727fe19d..18ad9a9fe 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -866,8 +866,329 @@ class CompanyStatementController extends ThinkController $this->ajaxReturn(array("success"=>"ok","data"=>[])); } - + public function viewSpecialComplement() { + + $this->display(); + + } + + public function addSpecialComplement() { + + $map = []; + $radioMap = []; + $relation_game_id = implode(',',$_REQUEST['relation_game_id']); + $relation_game_data = $_REQUEST['relation_game_id']; + + if ($_REQUEST['relation_game_id']) { + + $relation_game_id = implode(',',$_REQUEST['relation_game_id']); + + $map['relation_game_id'] = ['in',$relation_game_id]; + $radioMap['tab_company_game_ratio.relation_game_id'] = ['in',$relation_game_id]; + + } + if ($_REQUEST['company_id']) { + $promote_id = M("promote","tab_") + ->field("id") + ->where(['company_id'=>$_REQUEST['company_id']]) + ->select(); + if ($promote_id) { + $map['promote_id'] = ['in',array_column($promote_id,'id')]; + } else { + $map['promote_id'] = '-1'; + } + + $radioMap['company_id'] = $_REQUEST['company_id']; + } + + $start_time = strtotime($_REQUEST['time_start']); + $end_time = strtotime($_REQUEST['time_end']) + 86399; + if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { + $map['payed_time'] = ['between', [$start_time, $end_time]]; + + $radioMap['_string'] = "(begin_time>{$start_time} and begin_time<{$end_time}) + or (end_time>{$start_time} and (end_time<{$end_time} and end_time!=0)) or (begin_time<{$start_time} and end_time>{$end_time})"; + } elseif (isset($_REQUEST['time_start'])) { + $map['payed_time'] = ['GT', $start_time]; + + $radioMap['_string'] = "end_time > {$start_time}"; + } elseif (isset($_REQUEST['time_end'])) { + $map['payed_time'] = ['LT', $end_time]; + + $radioMap['_string'] = "start_time < {$end_time}"; + } + $map['tab_spend.pay_status'] = 1; + $map['pay_way'] = ['egt',1]; + + $data = M("spend","tab_") + ->field("pay_amount,relation_game_id,relation_game_name,payed_time") + ->join("left join tab_game game on tab_spend.game_id=game.id") + ->where($map) + ->select(false); + + //默认游戏模板比例 + $gameRatioMould = M("game_ratio_mould","tab_") + ->field("ratio,turnover_ratio,relation_game_id") + ->where(['relation_game_id'=>['in',$relation_game_id],'company_belong'=>$_REQUEST['company_type']]) + ->select(); + //各个游戏的模板比例 + $handleRadioMould = []; + foreach($gameRatioMould as $key => $value) { + $handleRadioMould[$value['relation_game_id']]['ratio'] = $value['ratio']; + $handleRadioMould[$value['relation_game_id']]['turnover_ratio'] = $value['turnover_ratio']; + } + + $game_data = M("game","tab_")->field("relation_game_id,relation_game_name")->group("relation_game_id")->select(false); + + $radioData = M("company_game_ratio","tab_") + ->field("tab_company_game_ratio.*,game.relation_game_name") + ->join("left join ({$game_data}) game on tab_company_game_ratio.relation_game_id=game.relation_game_id") + ->where($radioMap) + ->order("begin_time ASC") + ->select(); + + $handleRadioData = []; + foreach($radioData as $key => $value) { + $handleRadioData[$value['relation_game_id']] = $value['relation_game_name']; + } + + + $companyData = M("promote_company","tab_") + ->field("company_name") + ->where(['id'=>$_REQUEST['company_id']]) + ->find(); + + $num = 0; + $handleData = []; + + foreach ($relation_game_data as $rkey => $rvalue) { + if (!$handleRadioData[$rvalue]) { + $game_name = M("game","tab_") + ->field("relation_game_id,relation_game_name") + ->where(['relation_game_id'=>['in',$rvalue]]) + ->find(); + $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id']; + $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name']; + $handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start')); + $handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end')) + 86399; + $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $rvalue; + $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $game_name['relation_game_name']; + $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$handleRadioMould[$value['relation_game_id']]['ratio']:0; + $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio']; + } + } + + foreach ($radioData as $key => $value) { + + if (strtotime(I('time_start')) <= $value['begin_time']) { + $handleData[$_REQUEST['company_id']]['begin_time'][] = $value['begin_time']; + } else { + $handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start')); + } + if (strtotime(I('time_end')) > $value['end_time'] && $value['end_time']!=0) { + $handleData[$_REQUEST['company_id']]['end_time'][] = $value['end_time']; + } else { + $handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end')) + 86399; + } + $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id']; + $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name']; + $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id']; + $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name']; + $handleData[$_REQUEST['company_id']]['ratio'][] = $value['ratio']; + $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $value['turnover_ratio']; + $num++; + + //如果结算时间小于比例开始时间 + if ($key == 0) { + if (strtotime(I('time_start')) < $value['begin_time']) { + $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id']; + $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name']; + $handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start')); + $handleData[$_REQUEST['company_id']]['end_time'][] = $value['begin_time']-1; + $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id']; + $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name']; + $handleData[$_REQUEST['company_id']]['ratio'][] = $gameRatioMould['ratio']?$gameRatioMould['ratio']:0; + $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $gameRatioMould['turnover_ratio']; + + } + } + + if(!$radioData[$key+1]) { + + if (strtotime(I('time_end')) > $value['end_time'] && $value['end_time']!=0) { + $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id']; + $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name']; + $handleData[$_REQUEST['company_id']]['begin_time'][] = $value['end_time'] + 1; + $handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end'))-86399; + $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id']; + $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name']; + $handleData[$_REQUEST['company_id']]['ratio'][] = $gameRatioMould['ratio']?$gameRatioMould['ratio']:0; + $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $gameRatioMould['turnover_ratio']; + } + } + + //如果结算时间中有时间段间隔 + if ($radioData[$key+1]) { + if ($radioData[$key+1]['begin_time'] != ($value['end_time']+1)) { + $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id']; + $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name']; + $handleData[$_REQUEST['company_id']]['begin_time'][] = $value['end_time'] + 1; + $handleData[$_REQUEST['company_id']]['end_time'][] = $radioData[$key+1]['begin_time'] - 1; + $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id']; + $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name']; + $handleData[$_REQUEST['company_id']]['ratio'][] = $gameRatioMould['ratio']?$gameRatioMould['ratio']:0; + $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $gameRatioMould['turnover_ratio']; + } + } + } +// dump($handleData);die(); + foreach ($handleData as $key => $value) { + $handleData[$key]['row'] = 0; + $timeArr = $value['begin_time']; + foreach ($timeArr as $k => $v) { + $handleData[$key]['row']++; + $turnover_ratio = json_decode($value['turnover_ratio'][$k],true); + + $amount_time['_string'] = "payed_time between {$value['begin_time'][$k]} and {$value['end_time'][$k]} and relation_game_id={$value['relation_game_id'][$k]}"; + $pay_amount = M()->table("({$data})a") + ->field("sum(pay_amount) pay_amount") + ->where($amount_time) + ->find(); + + $handleData[$key]['pay_amount'][$k] = $pay_amount['pay_amount']?$pay_amount['pay_amount']:0; + + $handleData[$key]['withdraw_amount'][$k] = number_format($pay_amount['pay_amount'] * (((int)$value['ratio'][$k])/100),2,'.',''); + + foreach($turnover_ratio as $ke=>$va){ + + if(array_key_exists("instanceof",$va)){ + //存在 + + if($va['instanceof']=='1'&&$pay_amount['pay_amount']>=$va['turnover']){ + $handleData[$key]['ratio'] = $va["ratio"]; + $handleData[$key]['withdraw_amount'][$k] = number_format($pay_amount['pay_amount'] * ($va["ratio"]/100),2,'.',''); + }elseif($pay_amount['pay_amount']>$va['turnover']){ + $handleData[$key]['ratio'] = $va["ratio"]; + $handleData[$key]['withdraw_amount'][$k] = number_format($pay_amount['pay_amount'] * ($va["ratio"]/100),2,'.',''); + } + }else{ + if ($pay_amount['pay_amount']>=$va['turnover']) { + $handleData[$key]['ratio'] = $va["ratio"]; + $handleData[$key]['withdraw_amount'][$k] = number_format($pay_amount['pay_amount'] * ($va["ratio"]/100),2,'.',''); + } + } + + } + + $handleData[$key]['begin_time'][$k] = date("Y.m.d",$value['begin_time'][$k]); + $handleData[$key]['end_time'][$k] = date("Y.m.d",$value['end_time'][$k]); + + } + + } + + + $this->ajaxReturn(['status'=>1,'data'=>$handleData]); + + } + + public function addSpecialComplementPost( ) { + + $data = json_decode($_REQUEST['data'],true); + + $withdraw_type = 3; + + foreach ($data as $key => $value) { + + $company_data = M("promote_company","tab_")->where(['id'=>$value['company_id']])->find(); + + $company_type = M("company_relation","tab_")->where("first_company_id={$value['company_id']} or second_company_id={$value['company_id']}")->find(); + + $insert['is_payment'] = $company_type['is_payment']; + $insert['statement_begin_time'] = $value['statement_begin_time']; + $insert['statement_end_time'] = $value['statement_end_time']; + $insert['withdraw_type'] = $withdraw_type; + $insert['company_belong'] = $company_data['company_belong']; + $insert['company_name'] = $company_data['company_name']; + $insert['company_id'] = $value['company_id']; + $insert['company_type'] = $value['company_type']; + + $proCompany_info['id'] = $company_data['id']; + $proCompany_info['partner'] =$company_data['company_name']; + $proCompany_info['link_man'] = $company_data['settlement_contact']; + $proCompany_info['link_phone'] =$company_data['contact_phone']; + $proCompany_info['address'] = $company_data['address']; + $proCompany_info['payee_name'] =$company_data['company_name']; + + $proCompany_info['bank_account'] = $company_data['bank_card']; + $proCompany_info['opening_bank'] =$company_data['bank_name']; + $proCompany_info['fax_ratio'] = $company_data['fax_ratio']; + $proCompany_info['taxation_rate'] = $company_data['taxation_rate']; + + $proCompany_info['company_belong'] = $company_data['company_belong']; + $proCompany_info['company_type'] =$company_data['company_type']; + $proCompany_info['ali_user'] = $company_data['ali_user']; + $proCompany_info['ali_account'] =$company_data['ali_account']; + $proCompany_info['has_server_fee'] = $company_data['has_server_fee']; + $proCompany_info['server_fee'] =$company_data['server_fee']; + + $proCompany_info['has_ratio'] = $company_data['has_ratio']; + $proCompany_info['turnover_ratio'] =$company_data['turnover_ratio']; + $proCompany_info['invoice_type'] = $company_type['invoice_type']; + $proCompany_info['invoice_content'] = $company_type['invoice_content']; + + if ($company_type['first_company_id'] == $value['company_id']) { + $weCompany = M("company_info","tab_")->where(['id'=>$company_type['second_company_id']])->find(); + } elseif ($company_type['second_company_id'] == $value['company_id']) { + $weCompany = M("company_info","tab_")->where(['id'=>$company_type['first_company_id']])->find(); + } + + $secord_info['id'] = $weCompany['id']; + $secord_info['partner'] =$weCompany['company_name']; + $secord_info['link_man'] = $weCompany['link_man']; + $secord_info['link_phone'] =$weCompany['link_phone']; + $secord_info['address'] = $weCompany['address']; + $secord_info['company_tax_no'] = $weCompany['company_tax_no']; + $secord_info['payee_name'] =$weCompany['payee_name']; + + $secord_info['bank_account'] = $weCompany['bank_account']; + $secord_info['opening_bank'] =$weCompany['opening_bank']; + $secord_info['invoice_type'] = $company_type['invoice_type']; + $secord_info['invoice_content'] = $company_type['invoice_content']; + + $statement_info =$value['statement_info']; + $pay_amount = 0; + $statement_money = 0; + foreach($statement_info as $k => $v) { + + $pay_amount += $v['pay_amount']; + $statement_money += $v['sum_money']; + + } + $insert['pay_amount'] = $pay_amount; + $insert['platform_amount'] = $pay_amount; + $insert['statement_money'] = $statement_money; + + + if ($company_type['first_company_id'] == $value['company_id']) { + + + + + + } elseif ($company_type['second_company_id'] == $value['company_id']) { + + + + } + + + } + + dump($data); + + } public function OpAuth($info) { @@ -929,6 +1250,7 @@ class CompanyStatementController extends ThinkController "export"=>"批量导出", "updateNewStatement"=>"新增结算", "launch"=>"对外发起", + "specialComplement"=>"特殊补点", ]; $resarr = []; foreach ($mentBtn as $k => $v) { diff --git a/Application/Admin/View/CompanyGameRatio/edit.html b/Application/Admin/View/CompanyGameRatio/edit.html new file mode 100644 index 000000000..ab000fa7b --- /dev/null +++ b/Application/Admin/View/CompanyGameRatio/edit.html @@ -0,0 +1,441 @@ + + + + + + + + + + + + + + + +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
推广公司: + + + + + {$data.company_name} + +
现包名: + {$data.relation_game_name} + +
原包名: + {$data.original_package_name} + +
*分成比例设定: + + + % + 当前需要修改成的分成比例 +
+
+
+ + + +
+ +
+ + +
+ + +
+ +
+ + % + +
+
+
+
+ +
*生效期限: +
+ {$data.begin_time} + + - + + {$data.end_time} +
+ 结束时间不填则默认永久。 +
备注: + + +
+
+ + +
+ + + 返回 + +
+
+
+
+ + + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + + diff --git a/Application/Admin/View/CompanyGameRatio/index.html b/Application/Admin/View/CompanyGameRatio/index.html index 1bf8f598b..0ec433b8c 100644 --- a/Application/Admin/View/CompanyGameRatio/index.html +++ b/Application/Admin/View/CompanyGameRatio/index.html @@ -172,31 +172,70 @@ {$data.game_type_name} {$data.original_package_name} {$data.relation_game_name} - {$data.valid} - - {$data['turnover_ratio'][0]['name']|default="--"} - {$data['turnover_ratio'][0]['ratio']|showPercent} + + {$data['valid'][0]} + + -- + + + {$data['turnover_ratios'][0][0]['name']|default="--"} + {$data['turnover_ratios'][0][0]['ratio']|showPercent} -- -- - + - - + + {$vo} - - - - - {$game_ratio['name']|default="--"} - {$game_ratio['ratio']|showPercent} - - - - + + + + + {$valid|default="--"} + {$data['turnover_ratios'][$keys][0]['name']|default="--"} + {$data['turnover_ratios'][$keys][0]['ratio']|showPercent} + + + {$vo} + + + + + + + {$game_ratio['name']|default="--"} + {$game_ratio['ratio']|showPercent} + + + + + + + + {$game_ratio['name']|default="--"} + {$game_ratio['ratio']|showPercent} + + + + + + + + + + + + + + + + + +
@@ -283,7 +322,11 @@ $(function(){ }); }) - + $(".editRatio").on("click",function(){ + var id = $(this).data("id"); + var url = "{:U('edit')}"+"&id="+id; + window.location.href = url; + }) $(".delGameRatio").on("click",function(){ var id = $(this).data("id"); var url = "{:U('delGameRatio')}"+"&id="+id; diff --git a/Application/Admin/View/CompanyStatement/lists.html b/Application/Admin/View/CompanyStatement/lists.html index 0875ca76d..dc31d3924 100644 --- a/Application/Admin/View/CompanyStatement/lists.html +++ b/Application/Admin/View/CompanyStatement/lists.html @@ -441,6 +441,20 @@ content: url }); }); + + $("#specialComplement").click(function () { + var id = $(this).data("id"); + var url = "{:U('viewSpecialComplement')}"+"&id="+id + layer.open({ + type: 2, + title: "海南万盟天下科技有限公司", + shadeClose: true, + shade: 0.8, + area: ['70%', '80%'], + content: url + }); + }); + $(".editStatement").click(function () { var id = $(this).data("id"); var url = "{:U('editStatement')}"+"&id="+id diff --git a/Application/Admin/View/CompanyStatement/viewSpecialComplement.html b/Application/Admin/View/CompanyStatement/viewSpecialComplement.html new file mode 100644 index 000000000..01a63a19c --- /dev/null +++ b/Application/Admin/View/CompanyStatement/viewSpecialComplement.html @@ -0,0 +1,561 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +  -  +
+ + +
+
+
+ +
+
+ +
+ +
+ 添加 +
+
+ +
+
+
+ + {$vo} + +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + +
公司结算时间产品平台总额分成比例特殊补点结算金额操作
+ +
+
+ + +
+ From 89801c1467b3f372e5af030b131471bab8c9829a Mon Sep 17 00:00:00 2001 From: zyx Date: Sun, 23 Aug 2020 13:58:11 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E7=89=B9=E6=AE=8A=E8=A1=A5=E7=82=B9?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementController.class.php | 44 ++++++++++++++----- .../viewSpecialComplement.html | 8 +++- 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index 18ad9a9fe..317ef6618 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -1096,9 +1096,9 @@ class CompanyStatementController extends ThinkController public function addSpecialComplementPost( ) { $data = json_decode($_REQUEST['data'],true); - +// dump($data);die(); $withdraw_type = 3; - + M()->startTrans(); foreach ($data as $key => $value) { $company_data = M("promote_company","tab_")->where(['id'=>$value['company_id']])->find(); @@ -1106,13 +1106,15 @@ class CompanyStatementController extends ThinkController $company_type = M("company_relation","tab_")->where("first_company_id={$value['company_id']} or second_company_id={$value['company_id']}")->find(); $insert['is_payment'] = $company_type['is_payment']; - $insert['statement_begin_time'] = $value['statement_begin_time']; - $insert['statement_end_time'] = $value['statement_end_time']; + $insert['statement_begin_time'] = strtotime($value['statement_begin_time']); + $insert['statement_end_time'] = strtotime($value['statement_end_time']); $insert['withdraw_type'] = $withdraw_type; $insert['company_belong'] = $company_data['company_belong']; $insert['company_name'] = $company_data['company_name']; $insert['company_id'] = $value['company_id']; - $insert['company_type'] = $value['company_type']; + $insert['company_type'] = $company_data['company_type']; + $insert['pay_type'] = $company_type['collection']; + $insert['verify_log'] = ''; $proCompany_info['id'] = $company_data['id']; $proCompany_info['partner'] =$company_data['company_name']; @@ -1145,7 +1147,7 @@ class CompanyStatementController extends ThinkController } $secord_info['id'] = $weCompany['id']; - $secord_info['partner'] =$weCompany['company_name']; + $secord_info['partner'] =$weCompany['partner']; $secord_info['link_man'] = $weCompany['link_man']; $secord_info['link_phone'] =$weCompany['link_phone']; $secord_info['address'] = $weCompany['address']; @@ -1166,27 +1168,49 @@ class CompanyStatementController extends ThinkController $statement_money += $v['sum_money']; } + $insert['pay_amount'] = $pay_amount; $insert['platform_amount'] = $pay_amount; $insert['statement_money'] = $statement_money; - + $insert['op_time'] = time(); if ($company_type['first_company_id'] == $value['company_id']) { + $insert['first_party_info'] = json_encode($proCompany_info); + $insert['second_party_info'] = json_encode($secord_info); + } elseif ($company_type['second_company_id'] == $value['company_id']) { + $insert['second_party_info'] = json_encode($proCompany_info); + $insert['first_party_info'] = json_encode($secord_info); + } + foreach($statement_info as $k => $v) { + $statement_info[$k]['statement_type'] = 0; + $statement_info[$k]['fax_ratio'] = $company_data['fax_ratio']; + } - } elseif ($company_type['second_company_id'] == $value['company_id']) { + if ($company_data['company_type'] == 2) { + $statement_data['account'] = ''; + $statement_data['game_list'] = $statement_info; + $insert['statement_info'] = json_encode($statement_data); + } else { + $insert['statement_info'] = json_encode($statement_info); } + $is_save = M('company_statement','tab_')->add($insert); - } + if (!$is_save) { + M()->rollback(); + $this->ajaxReturn(['status'=>1001]); + } - dump($data); + } + M()->commit(); + $this->ajaxReturn(['status'=>1]); } diff --git a/Application/Admin/View/CompanyStatement/viewSpecialComplement.html b/Application/Admin/View/CompanyStatement/viewSpecialComplement.html index 01a63a19c..dc83c0ae4 100644 --- a/Application/Admin/View/CompanyStatement/viewSpecialComplement.html +++ b/Application/Admin/View/CompanyStatement/viewSpecialComplement.html @@ -308,8 +308,12 @@ dataType: 'json', data: {data:JSON.stringify(send)}, success: function(result) { - - + if (result.status == 1) { + layer.msg("插入成功"); + parent.location.reload() + } elseif (result.status==1001) { + layer.msg("数据插入失败"); + } }}); } else { From 90005336442ec7b2193b27d60d2accd61fb5754f Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Mon, 24 Aug 2020 20:54:21 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E4=B8=8B=E6=B8=B8=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementController.class.php | 182 ++++- .../editPcComplementStatement.html | 664 +++++++++++++++++ .../editPuComplementStatement.html | 666 ++++++++++++++++++ .../viewPuComplementStatement.html | 225 ++++++ .../viewSpecialComplement.html | 124 +++- 5 files changed, 1803 insertions(+), 58 deletions(-) create mode 100644 Application/Admin/View/CompanyStatement/editPcComplementStatement.html create mode 100644 Application/Admin/View/CompanyStatement/editPuComplementStatement.html create mode 100644 Application/Admin/View/CompanyStatement/viewPuComplementStatement.html diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index 1e0c5546a..7c1b37dc2 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -138,7 +138,7 @@ class CompanyStatementController extends ThinkController $v["valid"] = "{$v['statement_begin_time']}-{$v['statement_end_time']}"; - $v['withdraw_type_1'] = ($v['withdraw_type'] == 1 ? "月结" :"周结"); + $v['withdraw_type_1'] = ($v['withdraw_type'] == 1 ? "月结" : ($v['withdraw_type'] == 3 ?"特殊补点" : "周结")); $v['withdraw_type_2'] = ($v['withdraw_type'] == 2 ? "补点" :"正常结算"); $v['verify_log'] = json_decode($v['verify_log'], true); @@ -245,10 +245,35 @@ class CompanyStatementController extends ThinkController //上游 $this->display("viewCpStatement"); }else{ - if($dbres["company_type"] == 1){ - $this->display("viewPcStatement"); - }else{ - $this->display("viewPuStatement"); + if ($dbres["withdraw_type"] == 3) { + if($dbres["company_type"] == 1){ + $this->display("viewPcStatement"); + }else{ + + if($dbres['company_type'] == 1) { + $dbres['company_type_str'] = '公司'; + } elseif($dbres['company_type'] == 2){ + $dbres['company_type_str'] = '个人'; + } + + if($dbres['company_belong'] == '0') { + $dbres['company_belong_str'] = '内团'; + } elseif($dbres['company_belong'] == '1') { + $dbres['company_belong_str'] = '外团'; + }elseif($dbres['company_belong'] == '2') { + $dbres['company_belong_str'] = '分发联盟'; + }elseif($dbres['company_belong'] == '3') { + $dbres['company_belong_str'] = '无'; + } + $this->assign('dbres',$dbres); + $this->display("viewPuComplementStatement"); + } + } else { + if($dbres["company_type"] == 1){ + $this->display("viewPcStatement"); + }else{ + $this->display("viewPuStatement"); + } } } @@ -288,21 +313,35 @@ class CompanyStatementController extends ThinkController //上游 $this->display("editCpStatement"); } else { - if($dbres["company_type"] == 1){ - $this->display("editPcStatement"); - }else{ - if($dbres['pay_type'] == 2){ - $payinfo = $dbres['second_party_info']; - $payinfo['type'] = "second_party_info"; + if ($dbres["withdraw_type"] == 3) { + if($dbres["company_type"] == 1){ + $this->display("editPcComplementStatement"); + }else{ + if($dbres['pay_type'] == 2){ + $payinfo = $dbres['second_party_info']; + $payinfo['type'] = "second_party_info"; + }else{ + $payinfo = $dbres['first_party_info']; + $payinfo['type'] = "first_party_info"; + } + $this->assign("payinfo", $payinfo); + $this->display("editPuComplementStatement"); + } + } else { + if($dbres["company_type"] == 1){ + $this->display("editPcStatement"); }else{ - $payinfo = $dbres['first_party_info']; - $payinfo['type'] = "first_party_info"; + if($dbres['pay_type'] == 2){ + $payinfo = $dbres['second_party_info']; + $payinfo['type'] = "second_party_info"; + }else{ + $payinfo = $dbres['first_party_info']; + $payinfo['type'] = "first_party_info"; + } + $this->assign("payinfo", $payinfo); + $this->display("editPuStatement"); } - $this->assign("payinfo", $payinfo); - $this->display("editPuStatement"); } - - } } } @@ -937,14 +976,15 @@ class CompanyStatementController extends ThinkController ->field("relation_game_id,relation_game_name") ->where(['relation_game_id'=>['in',$rvalue]]) ->find(); + $handleData[$_REQUEST['company_id']]['company_id'] = $_REQUEST['company_id']; $handleData[$_REQUEST['company_id']]['company_name'] = $companyData['company_name']; $handleData[$_REQUEST['company_id']]['begin_time'][] = strtotime(I('time_start')); $handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end')) + 86399; $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $rvalue; $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $game_name['relation_game_name']; - $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$handleRadioMould[$value['relation_game_id']]['ratio']:0; - $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio']; + $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$rvalue]['ratio']?$handleRadioMould[$rvalue]['ratio']:0; + $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$rvalue]['turnover_ratio']; } } @@ -977,8 +1017,8 @@ class CompanyStatementController extends ThinkController $handleData[$_REQUEST['company_id']]['end_time'][] = $value['begin_time']-1; $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id']; $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name']; - $handleData[$_REQUEST['company_id']]['ratio'][] = $gameRatioMould['ratio']?$gameRatioMould['ratio']:0; - $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $gameRatioMould['turnover_ratio']; + $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$handleRadioMould[$value['relation_game_id']]['ratio']:0; + $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio']; } } @@ -992,8 +1032,8 @@ class CompanyStatementController extends ThinkController $handleData[$_REQUEST['company_id']]['end_time'][] = strtotime(I('time_end'))-86399; $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id']; $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name']; - $handleData[$_REQUEST['company_id']]['ratio'][] = $gameRatioMould['ratio']?$gameRatioMould['ratio']:0; - $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $gameRatioMould['turnover_ratio']; + $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$handleRadioMould[$value['relation_game_id']]['ratio']:0; + $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio']; } } @@ -1006,8 +1046,8 @@ class CompanyStatementController extends ThinkController $handleData[$_REQUEST['company_id']]['end_time'][] = $radioData[$key+1]['begin_time'] - 1; $handleData[$_REQUEST['company_id']]['relation_game_id'][] = $value['relation_game_id']; $handleData[$_REQUEST['company_id']]['relation_game_name'][] = $value['relation_game_name']; - $handleData[$_REQUEST['company_id']]['ratio'][] = $gameRatioMould['ratio']?$gameRatioMould['ratio']:0; - $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $gameRatioMould['turnover_ratio']; + $handleData[$_REQUEST['company_id']]['ratio'][] = $handleRadioMould[$value['relation_game_id']]['ratio']?$gameRatioMould['ratio']:0; + $handleData[$_REQUEST['company_id']]['turnover_ratio'][] = $handleRadioMould[$value['relation_game_id']]['turnover_ratio']; } } } @@ -1050,8 +1090,8 @@ class CompanyStatementController extends ThinkController } - $handleData[$key]['begin_time'][$k] = date("Y.m.d",$value['begin_time'][$k]); - $handleData[$key]['end_time'][$k] = date("Y.m.d",$value['end_time'][$k]); + $handleData[$key]['begin_time'][$k] = date("Y-m-d",$value['begin_time'][$k]); + $handleData[$key]['end_time'][$k] = date("Y-m-d",$value['end_time'][$k]); } @@ -1065,8 +1105,9 @@ class CompanyStatementController extends ThinkController public function addSpecialComplementPost( ) { $data = json_decode($_REQUEST['data'],true); -// dump($data);die(); + $withdraw_type = 3; + $statement_data = []; M()->startTrans(); foreach ($data as $key => $value) { @@ -1083,7 +1124,7 @@ class CompanyStatementController extends ThinkController $insert['company_id'] = $value['company_id']; $insert['company_type'] = $company_data['company_type']; $insert['pay_type'] = $company_type['collection']; - $insert['verify_log'] = ''; + $insert['verify_log'] = json_encode(["create_user"=>session('user_auth')['username'],"create_time"=>date("Y-m-d H:i:s")]);; $proCompany_info['id'] = $company_data['id']; $proCompany_info['partner'] =$company_data['company_name']; @@ -1156,28 +1197,93 @@ class CompanyStatementController extends ThinkController $statement_info[$k]['statement_type'] = 0; $statement_info[$k]['fax_ratio'] = $company_data['fax_ratio']; - } + if ($company_data['company_type'] == 2) { - $statement_data['account'] = ''; - $statement_data['game_list'] = $statement_info; + $statement_insert = []; + + $promote_id = M("promote","tab_") + ->field("id") + ->where(['company_id'=>$value['company_id']]) + ->select(); + if ($promote_id) { + $amount_time['promote_id'] = ['in',array_column($promote_id,'id')]; + } else { + $amount_time['promote_id'] = '-1'; + } + $amount_time['tab_spend.pay_status'] = 1; + $amount_time['pay_way'] = ['egt',1]; + + foreach ($statement_info as $k => $v) { + $statement_begin_time = strtotime($v['statement_begin_time']); + $statement_end_time = strtotime($v['statement_end_time']); + $amount_time['_string'] = "payed_time between {$statement_begin_time} and {$statement_end_time} and relation_game_id={$v['relation_game_id']}"; + + $dataAmount = M("spend","tab_") + ->field("pay_amount,relation_game_id,relation_game_name,payed_time,game_type_name,substring_index(substring_index(promote.`chain`,'/',2),'/',-1) promote_id,chain,admin_id") + ->join("left join tab_promote promote on tab_spend.promote_id=promote.id") + ->join("left join tab_game game on tab_spend.game_id=game.id") + ->where($amount_time) + ->select(false); + + $dataAmount = M()->table("({$dataAmount})a") + ->field("a.*,sum(pay_amount) pay_amount,promote.account,member.real_name") + ->join("left join tab_promote promote on promote_id=promote.id") + ->join("left join sys_member member on promote.admin_id=member.uid ") + ->group("promote_id") + ->select(); + + foreach ($dataAmount as $akey => $aval) { + + $game_list['pay_amount'] = $aval['pay_amount']; + $game_list['relation_game_id'] = $aval['relation_game_id']; + $game_list['game_name'] = $aval['relation_game_name']; + $game_list['game_type_name'] = $aval['relation_game_id']; + + $game_list['ratio'] = $v['ratio']; + $game_list['fax_ratio'] = $company_data['fax_ratio']; + $game_list['sum_money'] = number_format(($aval['pay_amount']*($v['ratio']+$v['increment_ratio']))/100,2,'.',''); + $game_list['increment_ratio'] = $v['increment_ratio']; + $game_list['statement_begin_time'] = $v['statement_begin_time']; + $game_list['statement_end_time'] = $v['statement_end_time']; + $game_list['statement_type'] = '0'; + + $statement_data[$aval['account']."-".$aval['real_name']][] = $game_list; +// $statement_insert[] = $statement_data; + } + + } + + foreach ($statement_data as $k => $v) { + + $strKey = explode('-',$k); + + $statement['account'] = $strKey[0]; + $statement['real_name'] = $strKey[1]; + $statement['game_list'] = $v; + + $statement['row'] = count($v); + + $statement_insert[] = $statement; + + } - $insert['statement_info'] = json_encode($statement_data); + $insert['statement_info'] = json_encode($statement_insert); } else { $insert['statement_info'] = json_encode($statement_info); } $is_save = M('company_statement','tab_')->add($insert); - if (!$is_save) { M()->rollback(); $this->ajaxReturn(['status'=>1001]); } } + M()->commit(); $this->ajaxReturn(['status'=>1]); @@ -1186,12 +1292,13 @@ class CompanyStatementController extends ThinkController public function OpAuth($info) { $id = $info['id']; + $withdraw_type = $info['withdraw_type']; $img = $info['ext_field']; $remark = $info['remark']; //原始列表 $opBtn = [ "viewStatement"=>"查看", - "editStatement"=>"编辑", + "editStatement"=>"编辑", "addRemark"=>"新增备注", "editRemark"=>"修改备注", "viewRemark"=>"查看备注", @@ -1211,12 +1318,17 @@ class CompanyStatementController extends ThinkController default: break; } + if(empty($info['remark'])){ //未上传备注 $optist = array_diff($optist, ["editRemark", "viewRemark"]); }else{ $optist = array_diff($optist, ["addRemark"]); } + + if ($withdraw_type == 3) { + $optist = array_diff($optist, ["editStatement"]); + } // $resarr = []; foreach ($optist as $k => $v) { diff --git a/Application/Admin/View/CompanyStatement/editPcComplementStatement.html b/Application/Admin/View/CompanyStatement/editPcComplementStatement.html new file mode 100644 index 000000000..aa7f2bda9 --- /dev/null +++ b/Application/Admin/View/CompanyStatement/editPcComplementStatement.html @@ -0,0 +1,664 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
甲方: +
+ +
+
联系人: + +
联系电话: + +
邮寄地址: + +
公司税号: + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
乙方: +
+ +
+
联系人: + +
联系电话: + +
邮寄地址: + +
公司税号: + +
+
+
+
+
+

支付给:{$data.company_name} + +

+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
结算时间产品平台总额(元)补点比例分成比例特殊补点比例结算金额(元)
+ 请先选择生成条件后点击生成对账数据 +
+
+
+
+
+
+ + + + + + + + + + + + + + + +
收款方名称: + +
银行账号: + +
开户行: + +
+
+
+ + + + + + + + + + + +
开票项目: + +
发票类型: +
+ +
+
+
+
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/Application/Admin/View/CompanyStatement/editPuComplementStatement.html b/Application/Admin/View/CompanyStatement/editPuComplementStatement.html new file mode 100644 index 000000000..d2439f7c0 --- /dev/null +++ b/Application/Admin/View/CompanyStatement/editPuComplementStatement.html @@ -0,0 +1,666 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
甲方: +
+ +
+
联系人: + +
联系电话: + +
邮寄地址: + +
公司税号: + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
乙方: +
+ +
+
联系人: + +
联系电话: + +
邮寄地址: + +
公司税号: + +
+
+
+
+
+

支付给:{$data.company_name} + +

+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
会长账号结算时间产品平台总额(元)补点比例分成比例特殊补点比例结算金额(元)
+ 请先选择生成条件后点击生成对账数据 +
+
+
+
+
+
+ + + + + + + + + + + + + + + +
收款方名称: + +
银行账号: + +
开户行: + +
+
+
+ + + + + + + + + + + +
开票项目: + +
发票类型: +
+ +
+
+
+
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/Application/Admin/View/CompanyStatement/viewPuComplementStatement.html b/Application/Admin/View/CompanyStatement/viewPuComplementStatement.html new file mode 100644 index 000000000..157e27e5d --- /dev/null +++ b/Application/Admin/View/CompanyStatement/viewPuComplementStatement.html @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
公司名称: + +
+
+
+ + + + + + + + + + + +
下游类型: + +
下游性质: + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
市场员会长账号产品产品类型结算时间推广流水(元)补点比例分成比例结算金额(元)
{$it['real_name']}{$it['account']}{$it['game_list'][0]['game_name']}{$it['game_list'][0]['game_type_name']}{$it['game_list'][0]['statement_begin_time']}~{$it['game_list'][0]['statement_end_time']}{$it['game_list'][0]['pay_amount']}{$it['game_list'][0]['increment_ratio']}%{$it['game_list'][0]['ratio']}%{$it['game_list'][0]['sum_money']}
{$game_list['game_name']}{$game_list['game_type_name']}{$game_list['statement_begin_time']}~{$game_list['statement_end_time']}{$game_list['pay_amount']}{$game_list['increment_ratio']}%{$game_list['ratio']}%{$game_list['sum_money']}
合计{$data.statement_count.pay_amount}{$data.statement_count.statement_money}
本月分成总金额(人民币大写):{$data.statement_count.big_ratio_money}
+
+
+
+
+ + + + + + + + + + + + +
开户名: + +
开户支行: + +
+
+
+ + + + + + + +
银行卡号: + +
+
+
+ + diff --git a/Application/Admin/View/CompanyStatement/viewSpecialComplement.html b/Application/Admin/View/CompanyStatement/viewSpecialComplement.html index dc83c0ae4..7f3bc7514 100644 --- a/Application/Admin/View/CompanyStatement/viewSpecialComplement.html +++ b/Application/Admin/View/CompanyStatement/viewSpecialComplement.html @@ -215,7 +215,11 @@ - + 合计 + + + +