From 963e8062183444c01f52c07b05c9f81354cf8e8f Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Mon, 18 Jan 2021 14:30:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A5=96=E6=83=A9=E9=99=90=E5=88=B6?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StatementMangementController.class.php | 73 ++++++++++++------- 1 file changed, 48 insertions(+), 25 deletions(-) diff --git a/Application/Admin/Controller/StatementMangementController.class.php b/Application/Admin/Controller/StatementMangementController.class.php index 10741d25b..d97f8a4bf 100644 --- a/Application/Admin/Controller/StatementMangementController.class.php +++ b/Application/Admin/Controller/StatementMangementController.class.php @@ -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; + } + + } } From 508f4abef1a7bc75bd2b711a51908d91f366d70e Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Mon, 18 Jan 2021 14:32:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A5=96=E6=83=A9=E9=99=90=E5=88=B6?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/StatementMangementController.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Application/Admin/Controller/StatementMangementController.class.php b/Application/Admin/Controller/StatementMangementController.class.php index d97f8a4bf..ed8c47fb4 100644 --- a/Application/Admin/Controller/StatementMangementController.class.php +++ b/Application/Admin/Controller/StatementMangementController.class.php @@ -625,7 +625,8 @@ class StatementMangementController extends ThinkController $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] + 'verify_status'=>['egt',2], + 'withdraw_type'=>['neq',3] ]) ->select(); foreach ($settlmentSet as $key => $value) {