| 
					
				 | xqd
			
			
				@@ -9,6 +9,7 @@ use App\Models\Notification; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use App\Models\Option; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use App\Models\Order; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use App\Models\OrderDevice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use App\Models\OrderOverviewModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use App\Models\Project; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use App\Models\ProjectRole; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use App\Models\ProjectUser; 
			 | 
		
	
	
		
			
				| 
					
				 | xqd
			
			
				@@ -147,6 +148,58 @@ class OrderController extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return $this->success(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function getOrderview(Request $request) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($request->input('year')) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $year = $request->input('year'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $year = 2021; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($request->input('status')) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $status = $request->input('status'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $status = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($request->input('project_id')) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $project_id = $request->input('project_id'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $project_id =  38; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取当前项目的当前年的所有月份的数据总览 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($status == 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $items = OrderOverviewModel::whereYear('date',$year)->where('project_id',$project_id)->get()->toArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            foreach ($items as &$item) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $item['date'] = date('Y年m月',strtotime($item['date'])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $item['total_price'] = $item['total_price']/100; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $item['status'] = $item['status'] ? '已确认':'未确认'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $item['confirmation_user_id'] = User::where('id',$item['confirmation_user_id'])->value('name'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $item['project_id'] = Project::where('id',$item['project_id'])->value('name'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $item['confirmation_time'] = $item['confirmation_time'] ?$item['confirmation_time']: '暂无'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $items = OrderOverviewModel::whereYear('date',$year)->where('project_id',$project_id)->where('status',$status)->get()->toArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            foreach ($items as &$item) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $item['date'] = date('Y年m月',strtotime($item['date'])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $item['total_price'] = $item['total_price']/100; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $item['status'] = $item['status'] ? '已确认':'未确认'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $item['confirmation_user_id'] = User::where('id',$item['confirmation_user_id'])->value('name'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $item['project_id'] = Project::where('id',$item['project_id'])->value('name'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $item['confirmation_time'] = $item['confirmation_time'] ?$item['confirmation_time']: '暂无'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return $this->success(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public function update(Request $request) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $order = $this->model->find($request->input('id')); 
			 |