|  | @@ -219,26 +219,7 @@ class Set
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          $html .= '</tbody></table></div></div>';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        $id = $info[$type . '_id'];
 | 
	
		
			
				|  |  | -        if ($type == 'shop') {
 | 
	
		
			
				|  |  | -            $where['type'] = 1;
 | 
	
		
			
				|  |  | -            $where['type_id'] = $id;
 | 
	
		
			
				|  |  | -            $m = 'getAll';
 | 
	
		
			
				|  |  | -        } elseif ($type == 'factory') {
 | 
	
		
			
				|  |  | -            $where['source_type'] = 3;
 | 
	
		
			
				|  |  | -            $where['source_id'] = $id;
 | 
	
		
			
				|  |  | -            $m = 'getAll';
 | 
	
		
			
				|  |  | -        } else {
 | 
	
		
			
				|  |  | -            $where['type'] = 2;
 | 
	
		
			
				|  |  | -            $where['type_id'] = $id;
 | 
	
		
			
				|  |  | -            $where['source_type'] = 2;
 | 
	
		
			
				|  |  | -            $where['source_id'] = $id;
 | 
	
		
			
				|  |  | -            $m = 'getAllByStore';
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        $where['status'] = 2;
 | 
	
		
			
				|  |  | -        $where['start'] = $info['start'];
 | 
	
		
			
				|  |  | -        $where['end'] = $info['end'];
 | 
	
		
			
				|  |  | -        $data = Dever::db('cash/order')->$m($where);
 | 
	
		
			
				|  |  | +        $data = $this->getOrderData($type, $info, '');
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if ($data) {
 | 
	
		
			
				|  |  |              
 | 
	
	
		
			
				|  | @@ -353,26 +334,8 @@ class Set
 | 
	
		
			
				|  |  |          $config = Dever::db($table)->config;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          $info = Dever::db($table)->one($id);
 | 
	
		
			
				|  |  | -        $id = $info[$type . '_id'];
 | 
	
		
			
				|  |  | -        if ($type == 'shop') {
 | 
	
		
			
				|  |  | -            $where['type'] = 1;
 | 
	
		
			
				|  |  | -            $where['type_id'] = $id;
 | 
	
		
			
				|  |  | -            $m = 'getAllNoPage';
 | 
	
		
			
				|  |  | -        } elseif ($type == 'factory') {
 | 
	
		
			
				|  |  | -            $where['source_type'] = 3;
 | 
	
		
			
				|  |  | -            $where['source_id'] = $id;
 | 
	
		
			
				|  |  | -            $m = 'getAllNoPage';
 | 
	
		
			
				|  |  | -        } else {
 | 
	
		
			
				|  |  | -            $where['type'] = 2;
 | 
	
		
			
				|  |  | -            $where['type_id'] = $id;
 | 
	
		
			
				|  |  | -            $where['source_type'] = 2;
 | 
	
		
			
				|  |  | -            $where['source_id'] = $id;
 | 
	
		
			
				|  |  | -            $m = 'getAllByStoreNoPage';
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        $where['status'] = 2;
 | 
	
		
			
				|  |  | -        $where['start'] = $info['start'];
 | 
	
		
			
				|  |  | -        $where['end'] = $info['end'];
 | 
	
		
			
				|  |  | -        $data = Dever::db('cash/order')->$m($where);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        $data = $this->getOrderData($type, $info);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          $stat_type = Dever::db('cash/shop')->config['config_type'];
 | 
	
		
			
				|  |  |          $other = Dever::db($type . '/info')->find($id);
 | 
	
	
		
			
				|  | @@ -478,18 +441,7 @@ class Set
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          $pdf->hr();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        if ($type == 'store') {
 | 
	
		
			
				|  |  | -            $where['type'] = 2;
 | 
	
		
			
				|  |  | -            $where['type_id'] = $info[$type . '_id'];
 | 
	
		
			
				|  |  | -        } else {
 | 
	
		
			
				|  |  | -            $where['source_type'] = 3;
 | 
	
		
			
				|  |  | -            $where['source_id'] = $info[$type . '_id'];
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        
 | 
	
		
			
				|  |  | -        $where['status'] = 2;
 | 
	
		
			
				|  |  | -        $where['start'] = $info['start'];
 | 
	
		
			
				|  |  | -        $where['end'] = $info['end'];
 | 
	
		
			
				|  |  | -        $data = Dever::db('cash/order')->getAll($where);
 | 
	
		
			
				|  |  | +        $data = $this->getOrderData($type, $info);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          $body = array();
 | 
	
		
			
				|  |  |          $body_total = array();
 | 
	
	
		
			
				|  | @@ -576,4 +528,32 @@ class Set
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          $pdf->out('对账单');
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    # 获取对账单数据
 | 
	
		
			
				|  |  | +    public function getOrderData($type, $info, $page = 'NoPage')
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        $id = $info[$type . '_id'];;
 | 
	
		
			
				|  |  | +        if ($type == 'shop') {
 | 
	
		
			
				|  |  | +            $where['type'] = 1;
 | 
	
		
			
				|  |  | +            $where['type_id'] = $id;
 | 
	
		
			
				|  |  | +            $m = 'getAllNoPage';
 | 
	
		
			
				|  |  | +        } elseif ($type == 'factory') {
 | 
	
		
			
				|  |  | +            $where['source_type'] = 3;
 | 
	
		
			
				|  |  | +            $where['source_id'] = $id;
 | 
	
		
			
				|  |  | +            $m = 'getAllNoPage';
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            $where['type'] = 2;
 | 
	
		
			
				|  |  | +            $where['type_id'] = $id;
 | 
	
		
			
				|  |  | +            $where['source_type'] = 2;
 | 
	
		
			
				|  |  | +            $where['source_id'] = $id;
 | 
	
		
			
				|  |  | +            $m = 'getAllByStoreNoPage';
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        $m .= $page;
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        $where['status'] = 2;
 | 
	
		
			
				|  |  | +        $where['start'] = $info['start'];
 | 
	
		
			
				|  |  | +        $where['end'] = $info['end'];
 | 
	
		
			
				|  |  | +        return Dever::db('cash/order')->$m($where);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |