diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index 3d5f54ea1..b34b5a9e7 100644 --- a/Application/Admin/Controller/MarketPercentageController.class.php +++ b/Application/Admin/Controller/MarketPercentageController.class.php @@ -122,9 +122,10 @@ class MarketPercentageController extends ThinkController // var_dump($map);die(); $data = SM("settleup_marketorder", "tab_") - ->field("pay_time,promote_account,company_name,company_belong,real_name,develop_type,game_name, + ->field("id,pay_time,promote_account,company_name,company_belong,real_name,develop_type,game_name, sum(pay_amount) pay_amount,sum(cp_amount) cp_amount,sum(promote_amount) promote_amount, - sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit"); + sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit, + other_amount,refund_amount"); if ($_REQUEST['export']) { $data = $data->where($map) @@ -142,7 +143,8 @@ class MarketPercentageController extends ThinkController $sum = SM("settleup_marketorder", "tab_") ->field("pay_time,promote_account,company_belong,real_name,develop_type,game_name, sum(pay_amount) pay_amount,sum(cp_amount) cp_amount,sum(promote_amount) promote_amount, - sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit") + sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit, + sum(other_amount) other_amount,sum(refund_amount) refund_amount") ->where($map) ->find(); @@ -181,9 +183,11 @@ class MarketPercentageController extends ThinkController 'develop_type' => '类型', 'game_name' => '游戏名称', 'pay_amount' => '总流水', - 'cp_amount' => '上游结算流水', - 'promote_amount' => '下游结算流水', + 'cp_amount' => '上游结算额', + 'promote_amount' => '下游结算额', 'channel_amount' => '支付渠道费用', + 'refund_amount'=>'退款金额', + 'other_amount'=>'返点及其他', 'company_tax' => '公司税费', 'company_profit' => '税后毛利额']; @@ -221,6 +225,22 @@ class MarketPercentageController extends ThinkController $this->display(); } + public function otherAmountEdit() + { + if(!array_key_exists('id',$_REQUEST) || !array_key_exists('other_amount',$_REQUEST)){ + $this->ajaxReturn(['status'=>0,'msg'=>'参数错误']); + } + $id = I("id"); + $other_amount = I("other_amount"); + $dbres = M("settleup_marketorder","tab_")->where("id = {$id}")->find(); + $save = [ + 'id'=>$id, + 'company_profit'=>$dbres['company_profit']-($other_amount-$dbres['other_amount']), + 'other_amount'=>$other_amount + ]; + M("settleup_marketorder","tab_")->save($save); + $this->ajaxReturn(['status'=>1,'msg'=>'其他扣款添加成功']); + } public function indexuncaculate($row = 10, $p = 1) { @@ -1266,19 +1286,23 @@ class MarketPercentageController extends ThinkController public function reCaculateBonus() { - - $pay_time = $_REQUEST['pay_time']; - - if (!$pay_time) { - $pay_time = "all"; -// $pay_time = date("Y-m",strtotime('-1 month')); + $type = $_REQUEST['type']; + if(empty($type)){ + die('参数错误'); + } + if($type == 1){ + $action = "caculateMarketStream/time"; + }else{ + $action = "createMarketBonus/pay_time"; + } + $pay_time = date( 'Y-m', strtotime( 'last day of -1 months' ) ); + $params = "php ".SUBSITE_INDEX." Timing/{$action}/{$pay_time}"; + $r = D("CmdTasks")->addTask("MarketPerformanceSet",$params); + if($r){ + $this->ajaxReturn(["status"=>"1",'msg'=>"任务添加成功,大约需等待5分钟后生成"]); + }else{ + $this->ajaxReturn(["status"=>"0","msg"=>'任务添加失败']); } - -// var_dump("cd ".ROOTTT.";php admin.php timing/caculateMarketStream/time/{$pay_time} > /dev/null &");die(); - - exec("source /etc/profile;cd " . ROOTTT . ";php " . SUBSITE_INDEX . " timing/caculateMarketStream/time/{$pay_time} > /dev/null &"); - - $this->ajaxReturn(['status' => 1]); } public function showBonusList($row = 10, $p = 1) diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 6d40c92a0..d08526f0d 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -844,6 +844,7 @@ class TimingController extends AdminController { $count_date = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')); } A("MarketPerformanceSet")->setFreeMonth($count_date); + $this->createMarketBonus($_REQUEST['time']); die(); echo date("Y-m-d H:i:s")."----------------------市场结算管理计算----------------------\n"; @@ -1357,6 +1358,7 @@ class TimingController extends AdminController { ->field("id,admin_id,pay_time,promote_account,company_belong,tab_settleup_marketorder.real_name,develop_type,game_name, sum(pay_amount) pay_amount,sum(company_profit) company_profit, sum(if((develop_type = 1 or develop_type = 2), pay_amount, 0)) performance_revenue,sum(if(develop_type = 3, pay_amount, 0)) appraisal_bonuses, + sum(if((develop_type = 1 or develop_type = 2), refund_amount, 0)) performance_refund_amount,sum(if(develop_type = 3, refund_amount, 0)) appraisal_refund_amount, sum(company_tax) company_tax, sum(cp_amount) cp_amount,sum(promote_amount) promote_amount") ->where($map) ->where(["admin_id"=>['in',array_keys($accessData)]]) @@ -1368,6 +1370,8 @@ class TimingController extends AdminController { if(isset($accessData[$admin_id])){ $value = array_merge($value,$accessData[$admin_id]); } + $value['performance_revenue'] -= $value['performance_refund_amount']; + $value['appraisal_bonuses'] -= $value['appraisal_refund_amount']; $sum_amount = $value['performance_revenue'] + $value['appraisal_bonuses']; diff --git a/Application/Admin/View/MarketPercentage/index.html b/Application/Admin/View/MarketPercentage/index.html index 02c2d0628..8dae70017 100644 --- a/Application/Admin/View/MarketPercentage/index.html +++ b/Application/Admin/View/MarketPercentage/index.html @@ -43,7 +43,7 @@
- 重算 + 重算
@@ -125,11 +125,14 @@ 类型 游戏名称 总流水 - 上游结算流水 - 下游结算流水 + 上游结算额 + 下游结算额 支付渠道费用 + 退款金额 + 返点及其他 公司税费 税后毛利额 + 操作 @@ -154,8 +157,11 @@ {$data['cp_amount']} {$data['promote_amount']} {$data['channel_amount']} + {$data['refund_amount']} + {$data['other_amount']} {$data['company_tax']} {$data['company_profit']} + 编辑 @@ -170,8 +176,11 @@ {$sum['cp_amount']} {$sum['promote_amount']} {$sum['channel_amount']} + {$sum['refund_amount']} + {$sum['other_amount']} {$sum['company_tax']} {$sum['company_profit']} + @@ -187,6 +196,24 @@ {$_page|default=''} + @@ -206,6 +233,63 @@ //导航高亮 highlight_subnav('{:U('MarketPercentage/index')}'); $(function(){ + $(".edit_oter_amout").on("click",function(){ + var data = $(this).data(); + layer.open({ + type: 1, + title: '编辑', + maxWidth:720, + closeBtn: 1, + shadeClose: false, + content: $("#changeTpl").html(), + success:function(){ + env(data); + } + }); + + }); + function env(data) { + $("#other_amount").val(data.amount); + $("#changeMargin").off("click"); + $("#changeMargin").on("click",function(){ + let other_amount = $("#other_amount").val(); + var reg = /^(\-|\+)?\d+(\.\d*)?$/; + if( !reg.test(other_amount)){ + layer.msg("返点扣款金额格式错误"); + return ; + } + if(other_amount == data.amount){ + layer.msg("无修改请直接关闭窗口"); + return ; + } + //成功 + let send = { + id:data.id, + other_amount:other_amount, + } + $.ajax({ + type: "POST", + url: "{:U('otherAmountEdit')}", + dataType: 'json', + data: send, + success: function (data) { + if (data.status == 1) { + layer.msg(data.msg); + setTimeout(function () { + window.location.reload(); + }, 1500); + } else { + layer.msg(data.msg); + return false; + } + } + }); + }); + + } + + + //搜索功能 $("#search").click(function(){ var url = $(this).attr('url'); @@ -230,54 +314,12 @@ window.location.href = url; }); - $(".paixu").click(function(){ - var that=$(this); - $data_order=that.attr('data-order'); - $order_type='{$userarpu_order}'; - if($order_type==''||$order_type=='4'){ - $(".sortBy").attr('name','data_order'); - val='3,'+$data_order; - $(".sortBy").attr('value',val); - $("#search").click(); - }else if($order_type=='3'){ - $(".sortBy").attr('name','data_order'); - val='4,'+$data_order; - $(".sortBy").attr('value',val); - $("#search").click(); - } - }); //回车自动提交 $('.jssearch').find('input').keyup(function(event){ if(event.keyCode===13){ $("#search").click(); } }); - $("#admin").on('click',function(event) { - var navlist = $(this).find('.i_list_li'); - if (navlist.hasClass('hidden')) { - navlist.removeClass('hidden'); - $(this).find('#i_list_id').focus().val(''); - } else { - navlist.addClass('hidden'); - } - $(document).one("click", function(){ - navlist.addClass('hidden'); - }); - event.stopPropagation(); - }); - - $('#admin #i_list_id').on('keyup',function(event) { - var val = $.trim($(this).val()).toLowerCase(); - $(this).closest('.drop-down').find('#i_list_idh').val(val); - }); - - $("#admin #i_list_li").find("a").each(function(){ - $(this).click(function(){ - var text = $.trim($(this).text()).toLowerCase(); - $(this).closest('.drop-down').find("#i_list_id").val(text); - $(this).closest('.drop-down').find('#i_list_idh').val(text); - }) - }); $('#time_start').datetimepicker({ format: 'yyyy-mm', @@ -321,35 +363,6 @@ }); event.stopPropagation(); }); - /* 状态搜索子菜单 */ - /*渠道删除*/ - $('.delete').click(function(){ - var id = $(this).attr('data-id'); - layer.confirm('渠道删除后,下级渠道同时被删除,所属数据归属于自然渠道!', { - title:'确定要删除该渠道?', - icon:0, - btn: ['删除','取消'] //按钮 - }, function(){ - $.ajax({ - type: "POST", - url: "{:U('del_promote')}", - dataType: 'json', - async: false, - data: {id:id}, - success:function(data){ - if(data.status==1){ - layer.msg(data.msg); - setTimeout(function(){ - window.location.reload(); - },1500); - } - } - }); - }, function(){ - layer.close(); - }); - - }) $('.recaculate').click(function(){ var url = $(this).attr('url'); @@ -361,16 +374,17 @@ $.ajax({ type: "POST", url: url, + data:{type:1}, dataType: 'json', async: false, success:function(data){ if(data.status == 1) { - layer.msg("重新计算需要时间,请等待10分钟后再查看"); + layer.msg(data.msg); setTimeout(function(){ window.location.reload(); },1500); } else { - layer.msg(data.info); + layer.msg(data.msg); } }, }); @@ -384,124 +398,4 @@ - diff --git a/Application/Admin/View/MarketPercentage/marketstaffsettle.html b/Application/Admin/View/MarketPercentage/marketstaffsettle.html index 2c575d913..0b197a5b3 100644 --- a/Application/Admin/View/MarketPercentage/marketstaffsettle.html +++ b/Application/Admin/View/MarketPercentage/marketstaffsettle.html @@ -113,7 +113,7 @@
- 重算 + 重算
@@ -196,8 +196,8 @@ 市场专员 离职时间 级别 -
开发总流水当月自主开发下渠道游戏内充值总和
-
维护总流水当月只维护下渠道游戏内充值总和
+
开发总流水当月自主开发下渠道游戏内充值总和(已减去退款)
+
维护总流水当月只维护下渠道游戏内充值总和(已减去退款)
业绩提成
绩效考核奖金当月开发税后毛利奖金与维护税后毛利奖金之和
绩效系数 @@ -584,16 +584,17 @@ $.ajax({ type: "POST", url: url, + data:{type:2}, dataType: 'json', async: false, success:function(data){ if(data.status == 1) { - layer.msg("重新计算需要时间,请等待10分钟后再查看"); + layer.msg(data.msg); setTimeout(function(){ window.location.reload(); },1500); } else { - layer.msg(data.info); + layer.msg(data.msg); } },