奖惩限制逻辑修改

master
zhengyongxing 4 years ago
parent 603f56550e
commit 963e806218

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