| 
					
				 | 
			
			
				@@ -345,13 +345,18 @@ class My extends Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return $this->data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    # 销售对账单管理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    # 采购对账单管理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public function stat_month() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $type = Dever::input('type', 'shop'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $table = 'cash/' . $shop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $this->data['config'] = Dever::db('main/manage_config')->find(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $where['shop_id'] = $this->shop_id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $shop = Dever::db('shop/info')->find($this->shop_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $stat_type = Dever::db('cash/shop')->config['config_type']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $stat_type = Dever::db($table)->config['config_type']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $status = Dever::db($table)->config['config_status']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $month = Dever::input('month'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if ($month) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Dever::setInput('day', $month); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -360,12 +365,9 @@ class My extends Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 list($where['start'], $where['end']) = Dever::week(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $this->data['data'] = Dever::db('cash/shop')->getAll($where); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $status = Dever::db('cash/shop')->config['config_status']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $this->data['data'] = Dever::db($table)->getAll($where); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if ($this->data['data']) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             foreach ($this->data['data'] as $k => $v) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -390,15 +392,17 @@ class My extends Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public function set_stat_month() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $id = Dever::input('id'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $type = Dever::input('type', 'shop'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $table = 'cash/' . $shop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $where['id'] = $id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $where['shop_id'] = $this->shop_id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $info = Dever::db('cash/shop')->find($where); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $info = Dever::db($table)->find($where); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!$info) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Dever::alert('账单不存在'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if ($info) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Dever::db('cash/shop')->update(array('where_id' => $id, 'shop_status' => 2)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Dever::db($table)->update(array('where_id' => $id, 'shop_status' => 2)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return $this->stat_month(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -408,11 +412,14 @@ class My extends Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public function stat_month_view() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $id = Dever::input('id'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $type = Dever::input('type', 'shop'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $table = 'cash/' . $shop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $where['id'] = $id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $where['shop_id'] = $this->shop_id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $this->data['config'] = Dever::db('main/manage_config')->find(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $this->data['info'] = Dever::db('cash/shop')->find($where); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $stat_type = Dever::db('cash/shop')->config['config_type']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $this->data['info'] = Dever::db($table)->find($where); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $stat_type = Dever::db($table)->config['config_type']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!$this->data['info']) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Dever::alert('账单不存在'); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -439,6 +446,11 @@ class My extends Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $where['start'] = Dever::maketime($this->data['info']['start']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $where['end'] = Dever::maketime($this->data['info']['end']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $where['status'] = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($type == 'shop_sell') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $where['pay_type'] = '2,3'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $where['pay_type'] = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $this->data['data'] = Dever::db('cash/order')->getAll($where); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if ($this->data['data']) { 
			 |