Explorar o código

修改备货导出

lvhao hai 1 día
pai
achega
f28511ad83
Modificáronse 1 ficheiros con 95 adicións e 0 borrados
  1. 95 0
      core/CoreApp/controllers/Whlabel_bh.php

+ 95 - 0
core/CoreApp/controllers/Whlabel_bh.php

@@ -125,6 +125,9 @@ class Whlabel_bh extends Start_Controller {
 		else if($arg == 'cj_transfer_log_count'){
 			$this->_cj_transfer_log_count();
 		}
+		else if($arg == 'excelwchz'){
+			$this->_excelwchz();
+		}
 		else
 		{
 			 $this->_index();
@@ -2417,4 +2420,96 @@ class Whlabel_bh extends Start_Controller {
 		$this->data['final_list'] = $final_list;
 		$this->_Template('whlabel_bh_cj_transfer_detail',$this->data);
 	}
+
+	public function _excelwchz(){
+		$classid = $this->classid->sku();
+		$pm = $classid;
+		$typeclass = array();
+		$tc = $this->typeclass->find_all();
+		foreach ($tc as $v)
+		{
+			$typeclass[$v['id']] = $v;
+		}
+		$prc = array();
+		$purchase = $this->purchase->find_all();
+		foreach($purchase as $k=>$v)
+		{
+			$prc[$v['id']] = $v['title'];
+		}
+		if(isset($_GET['excel']))  
+		{
+			$number = $this->input->post('number',true);
+			$pm = $this->input->post('pm',true);
+			$color = $this->input->post('color',true);
+			$transfer = $this->input->get('transfer',true);
+			$ktime = $this->input->get('ktime',true);
+			$jtime = $this->input->get('jtime',true);
+			$ktime = strtotime($ktime);
+			$jtime = strtotime($jtime);
+			$where = " time >= ".$ktime." and time <= ".$jtime." ";$gj = "";$ck = "";
+
+			$where .=" rk like '%|".$transfer."| ";
+			if($number)
+            {
+                $where  .= " and number like '%$number%'";
+            }
+			
+			if($pm)
+            {
+                $where  .= " and pm like '%$pm%'";
+            }
+			
+			if($color)
+            {
+                $where  .= " and features like '%-$color-%'";
+            }
+			
+			
+          
+				$list = array();
+				$rows = $this->whlabel_bh_transfer->find_all($where,'id,wbid,orderinfo,jm,pm,time');
+				
+            	
+
+				$filename = date("Y-m-d")."工厂备货完成汇总.xls";
+				$str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
+				<head>
+				<!--[if gte mso 9]><xml>
+				<x:ExcelWorkbook>
+				<x:ExcelWorksheets>
+				<x:ExcelWorksheet>
+				<x:Name>EXCEL</x:Name>
+				<x:WorksheetOptions>
+				<x:Print>
+				<x:ValidPrinterInfo />
+				</x:Print>
+				</x:WorksheetOptions>
+				</x:ExcelWorksheet>
+				</x:ExcelWorksheets>
+				</x:ExcelWorkbook>
+				</xml>
+				<![endif]-->
+				</head><body>";
+				$str .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'>"; 
+				$str .= "<tr><td>ID</td><td>编号</td><td>简码</td><td>品名</td><td>时间</td></tr>";
+				foreach ($list as $key=>$value) 
+				{ 
+					$str .= "<tr>";
+					$str .= "<td>". $value['id']. "</td>";
+					$str .= "<td>". $value['orderinfo']. "</td>";	
+					$str .= "<td>". $value['jm']. "</td>";	
+					$str .= "<td>". $value['pm']. "</td>";	
+					$str .= "<td>". date('Y-m-d H:i:s',$value['time']). "</td>";
+					$str .= "</tr>";
+				}
+				$str .= "</table></body></html>"; 
+				header( "Content-Type: application/vnd.ms-excel; name='excel'" ); 
+				header( "Content-type: application/octet-stream" ); 
+				header( "Content-Disposition: attachment; filename=".$filename ); 
+				header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); 
+				header( "Pragma: no-cache" ); 
+				header( "Expires: 0" ); 
+				exit($str); 
+			}
+	}
 }