From e8e2a55a89e1aad4443e9752a3e6b4600e1cf746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=90=8C?= <494089941@qq.com> Date: Fri, 17 Feb 2023 13:32:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=80=E5=94=AE=E6=BC=8F=E6=96=97=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=20=E8=BE=93=E5=8D=95=E5=8E=9F=E5=9B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/crm/controller/Business.php | 2 ++ application/crm/model/Business.php | 6 +++++- application/oa/logic/ExamineLogic.php | 25 ++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/application/crm/controller/Business.php b/application/crm/controller/Business.php index 0e93081..fd44a5e 100644 --- a/application/crm/controller/Business.php +++ b/application/crm/controller/Business.php @@ -384,6 +384,7 @@ class Business extends ApiCommon $userInfo = $this->userInfo; $userModel = new \app\admin\model\User(); $is_end = $param['is_end'] ?: 0; //1赢单2输单3无效 + $remark = $param['statusRemark']; if (!$param['business_id']) { return resultArray(['error' => '参数错误']); } @@ -408,6 +409,7 @@ class Business extends ApiCommon $data = []; $data['update_time'] = time(); $data['is_end'] = $is_end; + $data['remark'] = $remark; // if ($is_end) { // $status_id = $is_end; // } diff --git a/application/crm/model/Business.php b/application/crm/model/Business.php index 692e5b6..f6bf670 100644 --- a/application/crm/model/Business.php +++ b/application/crm/model/Business.php @@ -716,6 +716,8 @@ class Business extends Common $sql_a = CrmBusinessModel::field([ 'SUM(CASE WHEN is_end = 1 THEN money ELSE 0 END) AS sum_ying', 'SUM(CASE WHEN is_end = 2 THEN money ELSE 0 END) AS sum_shu', + 'count(if (is_end = 1,true,null)) as count_ying', + 'count(if (is_end = 2,true,null)) as count_shu', 'type_id' ]) ->where($map) @@ -729,7 +731,7 @@ class Business extends Common 'type_id' ]) ->where($where) - ->whereNotIn('is_end', '1,2,3') + ->whereNotIn('is_end', '3') ->group('status_id') ->fetchSql() ->select(); @@ -754,6 +756,8 @@ class Business extends Common $data['list'] = $statusList; $data['sum_ying'] = $res_a[0]['sum_ying'] ?: 0; $data['sum_shu'] = $res_a[0]['sum_shu'] ?: 0; + $data['count_ying']=$res_a[0]['count_ying']?:0; + $data['count_shu']=$res_a[0]['count_shu']?:0; $data['sum_money'] = $sum_money ?: 0; $data['total'] = ['name' => '合计', 'money_count' => $moneyCount, 'count' => $count]; diff --git a/application/oa/logic/ExamineLogic.php b/application/oa/logic/ExamineLogic.php index dff9efd..cd66a3e 100644 --- a/application/oa/logic/ExamineLogic.php +++ b/application/oa/logic/ExamineLogic.php @@ -422,7 +422,7 @@ class ExamineLogic extends Common } break; - case '3': + case '3'://发票 $list = db('crm_invoice') ->alias('a') ->join('__ADMIN_USER__ user', 'user.id = a.create_user_id', 'LEFT') @@ -446,6 +446,29 @@ class ExamineLogic extends Common ->where($whereOr) ->count(); break; + case 4:// 商机 + $list = db('crm_bussiness') + ->alias('a') + ->join('__ADMIN_USER__ user', 'user.id = a.create_user_id', 'LEFT') + ->join('__ADMIN_EXAMINE_FLOW__ examine_flow', 'examine_flow.flow_id = a.flow_id', 'LEFT') + ->where($where) + ->where($whereOr) + ->field( + 'a.invoice_id as catagory_id ,a.invoice_apple_number as name,a.create_time,a.check_status,a.create_user_id,a.check_user_id,a.flow_user_id,user.realname,examine_flow.name as examine_name' + ) + ->page($param['page'], $param['limit']) + ->order('a.create_time desc') + ->select(); + foreach ($list as $k => $v) { + $list[$k]['create_user_info'] = $userModel->getUserById($v['create_user_id']); + + } + $dataCount = db('crm_invoice') + ->alias('a') + ->join('__ADMIN_USER__ user', 'user.id = a.create_user_id', 'LEFT') + ->where($where) + ->where($whereOr) + ->count(); }