lvhao 1 dzień temu
rodzic
commit
6cb60e1b6d
1 zmienionych plików z 50 dodań i 1 usunięć
  1. 50 1
      core/CoreApp/controllers/Beihuogl.php

+ 50 - 1
core/CoreApp/controllers/Beihuogl.php

@@ -91,6 +91,8 @@ class Beihuogl extends Start_Controller {
             $this->_dyapplyyjsh();
         }elseif($arg == 'ccwlbhdownload'){
             $this->_ccwlbhdownload();
+        }elseif($arg == 'ckexcel'){
+           $this->_ckexcel();
         }
 		else
 		{
@@ -1218,7 +1220,7 @@ class Beihuogl extends Start_Controller {
                 if($v['ck_status'] == 0){
                     $str .=  "<div style='text-align:center;'>";
                     $str .= "<a href='javascript:void(0)'class='window' data-h='/beihuogl/ckbhedit/".$v['id']."' data-t='修改' style='margin-right:4px;color: #fff;background-color:#228B22;padding:4px 10px;border-radius:5px;font-size:15px'>审核</a>";
-                    // $str .= "<a href='javascript:void(0)' style='margin-right:4px;color: #fff;background-color:#4169E1;padding:4px 10px;border-radius:5px;font-size:15px' data-id='".$v['id']."' data-type='1' onclick='update_status(this)'>审核</a>";
+                    $str .= "<a href='/beihuogl/ckexcel/".$v['id']."' style='margin-right:4px;color: #fff;background-color:#5F9EA0;padding:4px 10px;border-radius:5px;font-size:15px'>下载</a>";
                     $str .=  "</div>";
 
                 }
@@ -1895,4 +1897,51 @@ class Beihuogl extends Start_Controller {
             echo json_encode(['success'=>false,'msg'=>'请求方式错误']);exit;
         }
     }
+
+    private function _ckexcel(){
+        $id = $arg_array[0];
+        $info = $this->bhccwl->read($id);
+        $list = $this->bhsq->find_all("bh_no = '".$info['bh_no']."' ");
+      
+        	//生成excel
+		$filename = $info['bh_no']."备货生产单.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>备货单号</td><td>中文品名</td><td>u9料号</td><td>生产数量</td></tr>";
+		foreach ($list as $key=>$value) 
+		{ 
+			
+			$str .= "<tr>";
+			$str .= "<td>". $value['bh_no']. "</td>";	
+			$str .= "<td>". $value['title']. "</td>";	
+			$str .= "<td>". $value['jm']. "</td>";
+			$str .= "<td>". $value['ck_num']. "</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); 
+    }
 }