sunhao 5 years ago
parent
commit
e731429d41

+ 40 - 0
app/Http/Controllers/Admin/CustReportController.php

@@ -362,6 +362,10 @@ class custReportController extends Controller
362 362
         $adminList = DB::table('admin')->select('id', 'realname', 'username')->where('id','>', 1)->get();
363 363
         $adminList = json_decode(json_encode($adminList), true);
364 364
 
365
+        //未上报数据销售
366
+        $noReportSaler = $this->noReportSaler();
367
+        $no_height = '100';
368
+        if($no_num = count($noReportSaler)) $no_height += round($no_num * 36);
365 369
         return view('custreport/detaillist', ['result' =>$result,
366 370
             'page'              =>$page,
367 371
             'count'             =>$count,
@@ -371,6 +375,8 @@ class custReportController extends Controller
371 375
             'admin_id'          =>$admin_id,
372 376
             'search_admin'      =>$search_admin,
373 377
             'adminlist'         =>$adminList,
378
+            'noReportSaler'         =>$noReportSaler,
379
+            'no_height'         =>$no_height,
374 380
             ]);
375 381
     }
376 382
 
@@ -734,5 +740,39 @@ class custReportController extends Controller
734 740
         return redirect('admin/custreport/disCostList')->with('info','导入成功');       
735 741
 
736 742
     }
743
+
744
+    /**
745
+     * 未上报数据销售
746
+     */
747
+    public function noReportSaler(){
748
+        $today = date('Y-m-d');
749
+        //销售列表
750
+        $ids = DB::table('admin_role')->where('role_name', '销售')->lists('user_id');
751
+        //销售名字
752
+        $salers = DB::table('admin')->whereIn('id', $ids)->lists('realname', 'id');
753
+ 
754
+        //查每日上报数据销售
755
+        $result = DB::table('cust_day_detail')->select('admin_id', 'dtime')->where('dtime','<',$today)->where('is_del', 0)->orderBy('dtime', 'desc')->get();
756
+        $result = json_decode(json_encode($result), true);
757
+
758
+        $data = array();
759
+        foreach($result as $k=>$v){
760
+            $data[$v['dtime']][] = $v['admin_id'];
761
+        }
762
+
763
+        $ret = array();
764
+        foreach($data as $k=>$v){
765
+            $diff = array_diff($ids, $v);
766
+            if(!empty($diff)){
767
+                //名字带入
768
+                foreach($diff as &$nid){
769
+                    $nid = $salers[$nid];
770
+                }
771
+                $ret[$k] = implode(',', $diff);
772
+            }
773
+        } 
774
+
775
+        return $ret;  
776
+    }
737 777
 }
738 778
 

+ 43 - 0
resources/views/custreport/detaillist.blade.php

@@ -21,6 +21,7 @@
21 21
                
22 22
                 
23 23
                     <a style="margin-left: 5px" class="btn btn-primary radius" onclick="user_search()" href="javascript:;">搜索</a>
24
+                    <a style="margin-left: 5px" class="btn btn-primary radius" onclick="look_noreport()" href="javascript:;">查看未上报数据销售</a>
24 25
                     <!--a class="btn btn-primary radius" onclick="custreport_export()" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 导出订单</a-->
25 26
                 
26 27
             </div>
@@ -59,6 +60,43 @@
59 60
                 </tbody>
60 61
             </table>
61 62
         </div>
63
+        <!--弹出层 推入分组-->
64
+        <div id="modal-demo1" class="modal fade" tabnonautomatic_index="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
65
+            <div class="modal-dialog" style="width:980px">
66
+                <div class="modal-content radius" style="width:980px">
67
+                    <div class="modal-body" style="height:{{$no_height}}px">
68
+                        <div id="fa2">                       
69
+                            <div class="mt-20">
70
+                                <table class="table table-border table-bordered table-bg table-hover table-sort">
71
+                                    <thead>
72
+                                    <tr class="text-c">
73
+                                        <th>日期</th>
74
+                                        <th>未上报销售</th>
75
+                                            
76
+                                    </tr>
77
+                                    </thead>
78
+                                    <tbody>
79
+                                    @if($noReportSaler)
80
+                                        @foreach($noReportSaler as $date=>$saler)
81
+                                            <tr class="text-c" style=" text-align:center;">                           
82
+                                                <td>{{$date}}</td>                            
83
+                                                <td>{{$saler}}</td>                                                                             
84
+                                            </tr>
85
+                                        @endforeach
86
+                                    @endif
87
+                                    </tbody>
88
+                                </table>
89
+                            </div>
90
+                           
91
+                        </div>
92
+         
93
+                        <div style="float:right">                           
94
+                            <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">关闭</button>
95
+                        </div>
96
+                    </div>
97
+                </div>
98
+            </div>
99
+        </div>
62 100
         <div id="page" class="page_div"></div>
63 101
     </div>
64 102
     
@@ -112,6 +150,11 @@
112 150
             var etime = $('#etime').val();
113 151
             location.href = '/admin/custreport/detail_export?admin_id='+admin_id+'&stime='+stime+'&etime='+etime;
114 152
         }
153
+
154
+        /*弹出层-填写原因*/
155
+        function look_noreport() {
156
+            $("#modal-demo1").modal("show");
157
+        }
115 158
        
116 159
         /*分页*/
117 160