From 34b30c70f641c46e4fcac39b3e5ba0067f497c8e Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 21 May 2021 16:42:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 20 ++ .../Controller/GameMarginController.class.php | 162 +++++++++ Application/Admin/View/GameMargin/lists.html | 203 +++++++++++ .../Admin/View/GameMargin/marginView.html | 338 ++++++++++++++++++ 4 files changed, 723 insertions(+) create mode 100644 Application/Admin/Controller/GameMarginController.class.php create mode 100644 Application/Admin/View/GameMargin/lists.html create mode 100644 Application/Admin/View/GameMargin/marginView.html diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 88fa10232..121f5b719 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -1511,6 +1511,26 @@ function getMonth() { return $range; } +//开业至今月份 +function getOpenCompanyMonthsList() +{ + $start_month = "2019-09"; + + $temp = strtotime(date('Y-m-01 00:00:00',strtotime('-1 month'))); + $end_month = date('Y',$temp)."-".date('m',$temp); + + $time_arr = []; + $begin = new \DateTime($start_month); + $end = new \DateTime($end_month); + $end = $end->modify('+1 month'); + $interval = new \DateInterval('P1M'); + $daterange = new \DatePeriod($begin, $interval ,$end); + foreach($daterange as $date){ + $time_arr[] = $date->format("Y-m"); + } + rsort($time_arr); + return $time_arr; +} function showMonthRange($start, $end) { diff --git a/Application/Admin/Controller/GameMarginController.class.php b/Application/Admin/Controller/GameMarginController.class.php new file mode 100644 index 000000000..143c3c850 --- /dev/null +++ b/Application/Admin/Controller/GameMarginController.class.php @@ -0,0 +1,162 @@ +DBModel = M("game_margin","tab_"); + parent::_initialize(); + } + + public function lists() + { + $params = I('get.'); + $page = $params['p'] ? intval($params['p']) : 1; + $row = $params['row'] ? intval($params['row']) : 10; + $where = [ + "_string"=>"1=1" + ]; + if(array_key_exists('count_date',$params)){ + $m = explode("-",$params['count_date']); + $where['count_year']=$m[0]; + $where['count_month']=$m[1]; + } + $data = $this->DBModel->where($where)->field("margin_info",true)->page($page,$row)->select(); + // dd($data); + $count = $this->DBModel->where($where)->count(); + $page = set_pagination($count,$row); + if($page) {$this->assign('_page', $page);} + + $this->assign("data",$data); + $this->display(); + } + + //查看毛利表 + public function marginView(){ + if(!isset($_REQUEST['id'])){ + $this->error('参数错误'); + } + $id = $_REQUEST['id']; + $info = $this->DBModel->where("id = '{$id}'")->find(); + $this->marginCount($info); + $this->assign("year", $info['count_year']); + $this->assign("month", $info['count_month']); + $this->assign("id", $id); + $this->display(); + } + private function marginCount($info) + { + $marginInfo = json_decode($info['margin_info'],true); + $count = [ + "pay_amount"=>$info['pay_amount'], + "margin_ratio"=>$info['margin_ratio'], + "margin_amount"=>$info['margin_amount'], + "cp_statement_amount"=>0, + "cp_ratio"=>0, + "cp_rebate_amount"=>0, + "cp_other_amount"=>0, + "pu_pay_amount"=>0, + "pu_statement_amount"=>0, + "pu_ratio"=>0, + "pu_margin_amount"=>0, + "pu_margin_ratio"=>0, + "pc_pay_amount"=>0, + "pc_statement_amount"=>0, + "pc_ratio"=>0, + "pc_margin_amount"=>0, + "pc_margin_ratio"=>0, + "platform_margin_ratio"=>0, + "jh_pay_amount"=>0, + "jh_statement_amount"=>0, + "jh_ratio"=>0, + "jh_margin_amount"=>0, + "jh_margin_ratio"=>0, + + ]; + foreach ($marginInfo as $v) { + $count['cp_statement_amount'] += $v['cp_statement_amount']; + $count['cp_rebate_amount'] += $v['cp_rebate_amount']; + $count['cp_other_amount'] += $v['cp_other_amount']; + + $count['pu_pay_amount'] += $v['pu_pay_amount']; + $count['pu_statement_amount'] += $v['pu_statement_amount']; + $count['pu_margin_amount'] += $v['pu_margin_amount']; + + $count['pc_pay_amount'] += $v['pc_pay_amount']; + $count['pc_statement_amount'] += $v['pc_statement_amount']; + $count['pc_margin_amount'] += $v['pc_margin_amount']; + + $count['jh_pay_amount'] += $v['jh_pay_amount']; + $count['jh_statement_amount'] += $v['jh_statement_amount']; + $count['jh_margin_amount'] += $v['jh_margin_amount']; + + } + $count['cp_ratio'] = round( $count['cp_statement_amount']/$count['pay_amount'] ,4)*100; + + $count['pu_ratio'] = round( $count['pu_statement_amount']/$count['pu_pay_amount'] ,4)*100; + $count['pu_margin_ratio'] = round( $count['pu_margin_amount']/$count['pu_pay_amount'] ,4)*100; + + $count['pc_ratio'] = round( $count['pc_statement_amount']/$count['pc_pay_amount'] ,4)*100; + $count['pc_margin_ratio'] = round( $count['pc_margin_amount']/$count['pc_pay_amount'] ,4)*100; + + $count['platform_margin_ratio'] = round(($count['pay_amount']-$count['jh_pay_amount']-$count['cp_statement_amount']-$count['cp_rebate_amount']-$count['cp_other_amount']-$count['pc_statement_amount']-$count['pu_statement_amount'])/($count['pay_amount']-$count['jh_pay_amount']),4)*100; + + $count['jh_ratio'] = round( $count['jh_statement_amount']/$count['jh_pay_amount'] ,4)*100; + $count['jh_margin_ratio'] = round( $count['jh_margin_amount']/$count['jh_pay_amount'] ,4)*100; + // dd($count); + $this->assign("data",$marginInfo); + $this->assign("count",$count); + } + /** + * 编辑 + */ + public function marginEdit(){ + ini_set('serialize_precision',14); + if(!isset($_REQUEST['id'])){ + $this->error('参数错误'); + } + $params = I("post."); + + $data = $this->DBModel->where("id='{$params['id']}'")->find(); + $marginInfo = json_decode($data['margin_info'],true); + $item = &$marginInfo[$params['key']]; + $item['cp_rebate_ratio'] = $params['cp_rebate_ratio']; + $item['cp_rebate_amount'] = $params['cp_rebate_amount']; + $item['cp_other_amount'] = $params['cp_other_amount']; + if($item["pc_pay_amount"] > 0){ + $item["pc_margin_amount"] = round($item["pc_pay_amount"]*(1-$item['cp_promote_ratio']/100)*(100-$item["cp_ratio"]-$item['cp_rebate_ratio']-$item["pc_ratio"])/100,2); + $item["pc_margin_ratio"] = round($item["pc_margin_amount"]/$item['pc_pay_amount'],4)*100; + } + if ($item["pu_pay_amount"] > 0) { + $item["pu_margin_amount"] = round($item["pu_pay_amount"]-$item["pu_pay_amount"]*(1-$item['cp_promote_ratio']/100)*($item["cp_ratio"]+$item['cp_rebate_ratio'])/100-$item["pu_statement_amount"],2); + $item["pu_margin_ratio"] = round($item["pu_margin_amount"]/$item['pu_pay_amount'],4)*100; + } + + $item['platform_margin_ratio'] = round(($item['pay_amount']-$item['jh_pay_amount']-$item['cp_statement_amount']-$item['cp_rebate_amount']-$item['cp_other_amount']-$item['pc_statement_amount']-$item['pu_statement_amount'])/($item['pay_amount']-$item['jh_pay_amount']),4)*100; + + if($item['jh_pay_amount'] > 0){ + $item["jh_margin_amount"] = round( $item["jh_statement_amount"]-$item["jh_pay_amount"]*(1-$item['cp_promote_ratio']/100)*($item["cp_ratio"]+$item['cp_rebate_ratio'])/100 ,2); + $item["jh_margin_ratio"] = round($item["jh_margin_amount"]/$item['jh_pay_amount'],4)*100; + } + $margin_amount = 0; + //总计 + foreach ($marginInfo as &$v) { + $margin_amount += $v['margin_amount']; + } + $margin_ratio = round( $margin_amount/$data['pay_amount'] ,4)*100; + + $save = [ + "margin_ratio"=>$margin_ratio, + "margin_amount"=>$margin_amount, + "margin_info"=>json_encode($marginInfo,JSON_UNESCAPED_UNICODE) + ]; + $this->DBModel->where("id='{$params['id']}'")->save($save); + $this->ajaxReturn(['status'=>1,'msg'=>"修改成功,刷新。。。"]); + } + + + +} \ No newline at end of file diff --git a/Application/Admin/View/GameMargin/lists.html b/Application/Admin/View/GameMargin/lists.html new file mode 100644 index 000000000..5218b864d --- /dev/null +++ b/Application/Admin/View/GameMargin/lists.html @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+ 搜索 +
+ +
+
+ +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
月份流水毛利额毛利率操作
aOh! 暂时还没有内容!
{$data.count_year}-{$data.count_month}{$data.pay_amount}{$data.margin_amount}{$data.margin_ratio}% + 查看/编辑 + 重算 +
+
+ +
+
+ {$_page|default=''} +
+
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + + + diff --git a/Application/Admin/View/GameMargin/marginView.html b/Application/Admin/View/GameMargin/marginView.html new file mode 100644 index 000000000..01709dfd1 --- /dev/null +++ b/Application/Admin/View/GameMargin/marginView.html @@ -0,0 +1,338 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
年份月份游戏名流水成本——上游CP上游返点其他费用成本——下游内团成本——下游外团(含分发)联运产品毛利率成本——下游聚合毛利操作
渠道费率分成比例结算金额返点比例返点金额推广流水分成比例结算金额内团毛利额内团毛利率推广流水分成比例结算金额外团毛利额外团毛利率推广流水分成比例结算收入聚合毛利额聚合毛利率毛利率毛利额
aOh! 暂时还没有内容!
{$year}{$month}{$margin["relation_game_name"]}{$margin["pay_amount"]}{$margin["cp_promote_ratio"]}%{$margin["cp_ratio"]}%{$margin["cp_statement_amount"]}{$margin["cp_rebate_ratio"]}%{$margin["cp_rebate_amount"]}{$margin["cp_other_amount"]}{$margin["pc_pay_amount"]}{$margin["pc_ratio"]}%{$margin["pc_statement_amount"]}{$margin["pc_margin_amount"]}{$margin["pc_margin_ratio"]}%{$margin["pu_pay_amount"]}{$margin["pu_ratio"]}%{$margin["pu_statement_amount"]}{$margin["pu_margin_amount"]}{$margin["pu_margin_ratio"]}%{$margin["platform_margin_ratio"]}%{$margin["jh_pay_amount"]}{$margin["jh_ratio"]}%{$margin["jh_statement_amount"]}{$margin["jh_margin_amount"]}{$margin["jh_margin_ratio"]}%{$margin["margin_ratio"]}%{$margin["margin_amount"]} + 编辑 +
{$year}{$month}小计{$count["pay_amount"]}{$count["cp_ratio"]}%{$count["cp_statement_amount"]}{$count["cp_rebate_amount"]}{$count["cp_other_amount"]}{$count["pc_pay_amount"]}{$count["pc_ratio"]}%{$count["pc_statement_amount"]}{$count["pc_margin_amount"]}{$count["pc_margin_ratio"]}%{$count["pu_pay_amount"]}{$count["pu_ratio"]}%{$count["pu_statement_amount"]}{$count["pu_margin_amount"]}{$count["pu_margin_ratio"]}%{$count["platform_margin_ratio"]}%{$count["jh_pay_amount"]}{$count["jh_ratio"]}%{$count["jh_statement_amount"]}{$count["jh_margin_amount"]}{$count["jh_margin_ratio"]}%{$count["margin_ratio"]}%{$count["margin_amount"]}%
+
+
+ + + +