From 92dcf56e22693057e2db9238210c2d4e73f0e837 Mon Sep 17 00:00:00 2001 From: lin fan Date: Tue, 26 Nov 2024 15:41:11 +0800 Subject: [PATCH] s --- admin/controllers/receiver/Report.php | 81 ++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 3 deletions(-) diff --git a/admin/controllers/receiver/Report.php b/admin/controllers/receiver/Report.php index 171bd1fd..49b2ade2 100644 --- a/admin/controllers/receiver/Report.php +++ b/admin/controllers/receiver/Report.php @@ -13,6 +13,8 @@ class Report extends HD_Controller $this->load->model('receiver/receiver_score_day_model'); $this->load->model('app/licheb/app_licheb_users_model'); $this->load->model('receiver/receiver_customers_model'); + $this->load->model('receiver/order/receiver_orders_model'); + $this->load->model('receiver/order/receiver_order_datas_model'); } //首页信息 @@ -107,8 +109,68 @@ class Report extends HD_Controller $cust_month = $this->receiver_customers_model->count(array('biz_id' => $v['id'], 'MONTH(p_time)' => $month)); //今日新增跟进数 - $cust_visit = $works = $this->receiver_score_log_model->count(array('day' => $day, 'biz_id' => $v['id'], 'type' => 1, 'sub_type' => 2, 'target_id <>' => 0)); + $cust_visit = $this->receiver_score_log_model->count(array('day' => $day, 'biz_id' => $v['id'], 'type' => 1, 'sub_type' => 2, 'target_id >' => 0)); + //本月跟进客户数 + $cust_visit_month = $this->receiver_score_log_model->count(array('MONTH(day)' => $month, 'biz_id' => $v['id'], 'type' => 1, 'sub_type' => 2, 'target_id >' => 0), 'target_id'); + + //今日订单新增数 + $order_new = $this->receiver_orders_model->select(array('DATE(order_time)' => $day, 'biz_id' => $v['id'], 'status >' => 0), '', 0, 0, 'id'); + + //本月订单总数 + $order_month = $this->receiver_orders_model->count(array('MONTH(order_time)' => $month, 'biz_id' => $v['id'], 'status >' => 0)); + + //本月订单信息完整数 + if($order_new){ + $oids = implode(',', array_unique(array_column($order_new, 'id'))); + + $where = array( + "o_id in ({$oids})" => null, + "(cardida != '' AND cardidb != '') OR (business_licence != '')" => null, + "pay_img <>" => '', + "contract_img <>" => '', + "bill_img <>" => '', + "car_img <>" => '', + "insurance_img <>" => '', + "business_img <>" => '', + ); + $order_finish = $this->receiver_order_datas_model->count($where); + }else{ + $order_finish = 0; + } + + //今日线索逾期数 + $cust_delay = $this->receiver_score_log_model->count(array('day' => $day, 'biz_id' => $v['id'], 'type' => 3, 'sub_type' => 3, 'target_id >' => 0)); + + //本月线索逾期数 + $cust_delay_month = $this->receiver_score_log_model->count(array('MONTH(day)' => $month, 'biz_id' => $v['id'], 'type' => 3, 'sub_type' => 3, 'target_id >' => 0)); + + //今日订单未达T+1 + $order_wrong = $this->receiver_score_log_model->count(array('day' => $day, 'biz_id' => $v['id'], 'type' => 3, 'sub_type' => 2, 'target_id >' => 0), 'target_id'); + + //本月订单未达T+1 + $order_wrong_month = $this->receiver_score_log_model->count(array('MONTH(day)' => $month, 'biz_id' => $v['id'], 'type' => 3, 'sub_type' => 2, 'target_id >' => 0), 'target_id'); + + //今日开票早与订单时间数 + $order_early = $this->receiver_score_log_model->count(array('day' => $day, 'biz_id' => $v['id'], 'type' => 3, 'sub_type' => 1, 'target_id >' => 0), 'target_id'); + + //今日未及时分配数 + $cust_push = $this->receiver_score_log_model->count(array('day' => $day, 'biz_id' => $v['id'], 'type' => 3, 'sub_type' => 4, 'target_id >' => 0), 'target_id'); + + //本月未及时分配数 + $cust_push_month = $this->receiver_score_log_model->count(array('MONTH(day)' => $month, 'biz_id' => $v['id'], 'type' => 3, 'sub_type' => 4, 'target_id >' => 0), 'target_id'); + + //今日战败申请未处理数 + $cust_defeat = $this->receiver_score_log_model->count(array('day' => $day, 'biz_id' => $v['id'], 'type' => 3, 'sub_type' => 5, 'target_id >' => 0), 'target_id'); + + //本月战败申请未处理数 + $cust_defeat_moth = $this->receiver_score_log_model->count(array('MONTH(day)' => $month, 'biz_id' => $v['id'], 'type' => 3, 'sub_type' => 5, 'target_id >' => 0), 'target_id'); + + //今日运营分 + $score = $this->receiver_score_day_model->get(array('day' => $day, 'biz_id' => $v['id'], 'type' => 1)); + + //本月运营分 + $score_month = $this->receiver_score_day_model->get(array('MONTH(day)' => $month, 'biz_id' => $v['id'], 'type' => 1), 'sum(score) as scores'); $data[] = array( 'biz_name' => $v['biz_name'], @@ -117,12 +179,25 @@ class Report extends HD_Controller 'cust_new' => $cust_new, 'cust_month' => $cust_month, 'cust_visit' => $cust_visit, + 'cust_visit_month' => $cust_visit_month, + 'order_new' => count($order_new), + 'order_month' => $order_month, + 'order_finish' => $order_finish, + 'cust_delay' => $cust_delay, + 'cust_delay_month' => $cust_delay_month, + 'order_wrong' => $order_wrong, + 'order_wrong_month' => $order_wrong_month, + 'order_early' => $order_early, + 'cust_push' => $cust_push, + 'cust_push_month' => $cust_push_month, + 'cust_defeat' => $cust_defeat, + 'cust_defeat_month' => $cust_defeat_moth, + 'score' => round($score['score']), + 'score_month' => round($score_month['scores']/date('d')), ); } } -print_r($data); - exit; $fileName = '车卖场日报'; array_unshift($data, $indexs);