奖惩限制逻辑修改

master
zhengyongxing 4 years ago
parent 603f56550e
commit 963e806218

@ -524,10 +524,10 @@ class StatementMangementController extends ThinkController
if ($id) {
// $checkReward = $this->checkRewardDetail($settlmentSet);
// if ($checkReward) {
// return $this->error("奖惩确认时间需在结算时间以后,请重新选择");
// }
$checkReward = $this->checkRewardDetail($settlmentSet);
if ($checkReward) {
return $this->error("奖惩确认时间需在结算时间以后,请重新选择");
}
$upt = M('reward_record', 'tab_')->where(['id'=>$id])->save($data);
if ($upt === false) {
@ -543,10 +543,10 @@ class StatementMangementController extends ThinkController
}
} else {
// $checkReward = $this->checkRewardDetail($settlmentSet);
// if ($checkReward) {
// return $this->error("奖惩确认时间需在结算时间以后,请重新选择");
// }
$checkReward = $this->checkRewardDetail($settlmentSet);
if ($checkReward) {
return $this->error("奖惩确认时间需在结算时间以后,请重新选择");
}
$data['create_time'] = time();
$data['creater_id'] = is_login();
@ -623,26 +623,49 @@ class StatementMangementController extends ThinkController
public function checkRewardDetail($settlmentSet = []) {
$pool_data = M("company_statement_pool","tab_")->field('id,statement_num,create_lack_ids,verify_status,is_payment,withdraw_type,statement_begin_time,statement_end_time')
->where([
'verify_status'=>['egt',2]
])
->select();
foreach ($settlmentSet as $key => $value) {
if ($value['company_id']) {
$sql = "(select statement_begin_time,statement_end_time,company_id,company_name from tab_company_statement
union all select statement_begin_time,statement_end_time,company_id,company_name from tab_company_statement_info
union all select statement_begin_time,statement_end_time,company_id,company_name from tab_company_lack_statement_info where is_pool=0)statement_info";
$data = M()->table("$sql")
->where(
[
'statement_begin_time'=>['elt',$value['confirm_time']],
'statement_end_time'=>['egt',$value['confirm_time']],
'company_id'=>$value['company_id']
]
)
->select();
if ($data) {
return true;
foreach ($pool_data as $pkey => $pvalue) {
$infolist = [];
if ($pvalue['verify_status'] != 6) {
//获取基本信息
$infolist = M("company_statement_info", "tab_")->field("*,'1' as st")
// ->where("pool_id = '{$pvalue['id']}'")
->where([
'statement_begin_time' => ['elt', $value['confirm_time']],
'statement_end_time' => ['egt', $value['confirm_time']],
'company_id' => $value['company_id'],
'pool_id'=>$pvalue['id'],
])
->select();
//获取母单
if (!empty($pvalue['create_lack_ids'])) {
$l_ids = explode(',',$pvalue['create_lack_ids']);
$lack_info = M("company_lack_statement_info", "tab_")
->field("*,'0' as st")
// ->where("id in ({$l_ids})")
->where([
'id'=>['in',$l_ids],
'statement_begin_time' => ['elt', $value['confirm_time']],
'statement_end_time' => ['egt', $value['confirm_time']],
'company_id' => $value['company_id'],
])
->select();
$infolist = array_merge($infolist, $lack_info);
}
if ($infolist) {
return true;
}
}
}

Loading…
Cancel
Save