优化编辑和重算

master
chenzhi 4 years ago
parent 34b30c70f6
commit 7caaf75647

@ -141,6 +141,9 @@ class GameMarginController extends AdminController
$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_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; $item["jh_margin_ratio"] = round($item["jh_margin_amount"]/$item['jh_pay_amount'],4)*100;
} }
$item['margin_amount'] = round( ($item['pay_amount']-$item['cp_statement_amount']-$item['cp_rebate_amount']-$item['cp_other_amount']-$item['pc_statement_amount']-$item['pu_statement_amount']+$item['jh_statement_amount']),2);
$item['margin_ratio'] = round($item['margin_amount']/$item['pay_amount'],4)*100;
$margin_amount = 0; $margin_amount = 0;
//总计 //总计
foreach ($marginInfo as &$v) { foreach ($marginInfo as &$v) {
@ -156,7 +159,23 @@ class GameMarginController extends AdminController
$this->DBModel->where("id='{$params['id']}'")->save($save); $this->DBModel->where("id='{$params['id']}'")->save($save);
$this->ajaxReturn(['status'=>1,'msg'=>"修改成功,刷新。。。"]); $this->ajaxReturn(['status'=>1,'msg'=>"修改成功,刷新。。。"]);
} }
public function recount()
{
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$data = $this->DBModel->field("count_year,count_month")->where("id='{$id}'")->find();
$time = $data['count_year']."-".$data['count_month'];
$this->DBModel->where("id='{$id}'")->delete();
$params = "php ".SUBSITE_INDEX." GameMarginSet/setFreeMonth/recount/1/count_date/{$time}";
$r = D("CmdTasks")->addTask("GameMargin",$params,true);
if($r){
$this->ajaxReturn(["status"=>"1",'msg'=>"任务添加成功大约需等待5分钟后生成"]);
}else{
$this->ajaxReturn(["error"=>"error","msg"=>'任务添加失败']);
}
}
} }

@ -117,7 +117,7 @@
<td> <td>
<a class="confirm margin_view" data-id="{$data.id}">查看/编辑</a> <a class="confirm margin_view" data-id="{$data.id}">查看/编辑</a>
<a class="confirm margin_recount" data-id="{$data.id}">重算</a> <a class="confirm margin_recount" data-id="{$data.id}">重算</a>
</td> </td>
</tr> </tr>
</volist> </volist>
@ -173,6 +173,21 @@
content: url content: url
}); });
}); });
$(".margin_recount").click(function () {
var id = $(this).data("id");
var url = "{:U('recount')}"+"&id="+id
$.get(url,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(){ $("#search").click(function(){

@ -216,7 +216,7 @@
<td>{$count["jh_margin_amount"]}</td> <td>{$count["jh_margin_amount"]}</td>
<td>{$count["jh_margin_ratio"]}%</td> <td>{$count["jh_margin_ratio"]}%</td>
<td>{$count["margin_ratio"]}%</td> <td>{$count["margin_ratio"]}%</td>
<td>{$count["margin_amount"]}%</td> <td>{$count["margin_amount"]}</td>
<td></td> <td></td>
</tr> </tr>
</tbody> </tbody>

Loading…
Cancel
Save