新增结算类型

master
chenzhi 4 years ago
parent 31b1c771a1
commit 0aac0cfad7

@ -655,6 +655,62 @@ class CompanyStatementPoolController extends ThinkController
'info' => "删除成功"
));
}
//不结算
public function cancelStatement()
{
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
//获取结算信息
$v = M("company_statement_info","tab_")->where("id = '{$id}'")->find();
if(empty($v)){
$this->error("请勿重复操作");
}
$pool = M("company_statement_pool","tab_")->where("id = {$v['pool_id']}")->find();
// dump($pool);
//保存未结算
$lackcompany =[
"company_id"=>$v['company_id'],
"company_type"=>$v['company_type'],
"company_name"=>$v['company_name'],
"company_info"=>$v['company_info'],
"statement_money"=>$v['statement_money'],
"pay_amount"=>$v['pay_amount'],
"platform_amount"=>$v['platform_amount'],
"fine"=>$v['fine'],
"reward"=>$v['reward'],
"statement_begin_time"=>$v['statement_begin_time'],
"statement_end_time"=>$v['statement_end_time'],
"is_payment"=>$pool['is_payment'],
"statement_pool_num"=>$pool['statement_num'],
"statement_info"=>$v['statement_info'],
];
$l_id = M("company_lack_statement_info","tab_")->add($lackcompany);
//汇总表
$pool_data = [
"id"=>$pool['id'],
'statement_money'=>$pool['statement_money']-$v['statement_money'],
'pay_amount'=>$pool['pay_amount']-$v['pay_amount'],
'fine'=>$pool['fine']-$v['fine'],
'reward'=>$pool['reward']-$v['reward'],
'lack_statement_money'=>$pool['lack_statement_money']+$v['statement_money'],
'lack_platform_amount'=>$pool['lack_platform_amount']-0+$v['platform_amount']
];
//
if(empty($pool_data['create_lack_ids'])){
$pool_data['create_lack_ids'] = $l_id;
}else{
$pool_data['create_lack_ids'] = $pool_data['create_lack_ids'].",".$l_id;
}
$info_ids = explode(",",$pool['info_ids']);
$pool_data['info_ids'] =implode(",",array_diff($info_ids,[$id]));
M("company_statement_pool","tab_")->save($pool_data);
M("company_statement_info","tab_")->where("id='{$id}'")->delete();
$this->ajaxReturn(array(
'status' => 1,
"info"=>"不结算成功"
));
}
//撤销汇总
public function cancelPool(){

@ -1047,7 +1047,7 @@ class CompanyStatementSetController extends Controller {
* 保存信息汇总信息
*/
public function savePromotateUserPool($data){
if($data['withdraw_type'] == 2 && empty($data['create_lack_ids']) && empty($data['del_lack_ids']) && empty($data['info_ids'])){ //补点为空不重算
if(empty($data['create_lack_ids']) && empty($data['del_lack_ids']) && empty($data['info_ids'])){ //补点为空不重算
return ;
}
if($data['statement_money'] == 0){

@ -118,8 +118,10 @@
<th>备注</th>
<if condition="$is_export">
<th>是否结算</th>
</if>
<else />
<th>操作</th>
</if>
</tr>
</thead>
<tbody id="statementShow">
@ -156,14 +158,16 @@
<td rowspan="{$com.statement_count}">{$com.remark}</td>
<if condition="$is_export">
<td rowspan="{$com.statement_count}"><if condition="$com['st'] eq 0"><else /></if></td>
</if>
<else />
<td rowspan="{$com.statement_count}">
<if condition="$com['st'] eq 1">
<a class='butn no_statement' style="cursor:pointer">不结算</a>
<a data-id="{$com['id']}" class='butn no_statement' style="cursor:pointer">不结算</a>
</if>
</td>
</if>
</tr>
<foreach name="com.statement_info" item="it" key="k">
@ -220,5 +224,26 @@
});
});
</if>
$(".no_statement").on("click",function(){
var id = $(this).data('id');
$.ajax({
type: "POST",
url: "{:U('cancelStatement')}",
dataType: 'json',
async: false,
data: {id:id},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
})
</script>
</html>

Loading…
Cancel
Save