Browse Source

提交数据

lvhao 2 months ago
parent
commit
6bcab3f226
2 changed files with 155 additions and 1 deletions
  1. 154 0
      core/CoreApp/controllers/Whlabelfz.php
  2. 1 1
      template/erp/whlabel_printrk.html

+ 154 - 0
core/CoreApp/controllers/Whlabelfz.php

@@ -22,6 +22,11 @@ class Whlabelfz extends Start_Controller
             //获取标签出库的按条件导出的excel
 			$this->_bqck_excel();
 		} 
+        if ($arg == 'bqrkexcel') //
+		{
+            //获取标签出库的按条件导出的excel
+			$this->_bqrk_excel();
+		} 
 	    else {
 			$this->_index();
 		}
@@ -168,4 +173,153 @@ class Whlabelfz extends Start_Controller
 
         }
     }
+
+    public function _bqrk_excel(){
+        if (isset($_GET['excel'])) {
+			$sku = $this->input->get('sku', true);
+			$bs = $this->input->get('bs', true);
+			$number = $this->input->get('number', true);
+			$warehouse = $this->input->get('warehouse', true);
+			$purchase = $this->input->get('purchase', true);
+			$orderinfo = $this->input->get('orderinfo', true);
+			$waybill = $this->input->get('waybill', true);
+			$category = $this->input->get('category', true);
+			$size = $this->input->get('size', true);
+			$grade = $this->input->get('grade', true);
+			$color = $this->input->get('color', true);
+			$lowe = $this->input->get('lowe', true);
+			$state = $this->input->get('state', true);
+			$label = $this->input->get('label', true);
+			$timetk = $this->input->get('ktime', true);
+			$timetj = $this->input->get('jtime', true);
+			$timetk = strtotime($timetk);
+			$timetj = strtotime($timetj);
+			$where = "1=1 ";
+			if ($timetk && $timetj) {
+				$where .= " and enter > '$timetk' and enter < '$timetj'";
+			}
+			if ($sku) {
+				$where  .= " and sku = '$sku'";
+			}
+			if ($bs != '') {
+				$where  .= " and bs = '$bs'";
+			}
+			if ($number) {
+				$where  .= " and number = '$number'";
+			}
+			if ($warehouse) {
+				$where  .= " and warehouse = '$warehouse'";
+			}
+			if ($purchase) {
+				$where  .= " and purchase = '$purchase'";
+			}
+			if ($orderinfo) {
+				$where  .= " and orderinfo = '$orderinfo'";
+			}
+			if ($waybill) {
+				$where  .= " and waybill = '$waybill'";
+			}
+			if ($category) {
+				$where  .= " and features like '%-$category-%'";
+			}
+			if ($size) {
+				$where  .= " and features like '%-$size-%'";
+			}
+			if ($grade) {
+				$where  .= " and features like '%-$grade-%'";
+			}
+			if ($color) {
+				$where  .= " and features like '%-$color-%'";
+			}
+			if ($lowe) {
+				$where  .= " and features like '%-$lowe-%'";
+			}
+			if ($label) {
+				$where  .= " and label = '$label'";
+			}
+			if ($state || $state == 0) {
+				$where  .= " and state = '$state'";
+			}
+			$ck = ($warehouse == '12') ? 'specialstock' : 'whlabel';
+			//数据排序
+			$order_str = "enter desc";
+			
+			//取得信息列表
+			$info_list = $this->$ck->find_all($where, 'id,warehouse,purchase,sku,title,features,state,enter,details', $order_str);
+			foreach ($info_list as $key => $value) {
+				$warehouse = $this->warehouse->read($value['warehouse']);
+				$info_list[$key]['warehouse'] = ($ck == 'specialstock') ? '特殊仓' : $warehouse['title'];
+				$info_list[$key]['purchase'] = (isset($prc[$value['purchase']])) ? $prc[$value['purchase']] : '未知';
+				if ($value['state'] == 0) {
+					$info_list[$key]['state'] = "在库";
+				} else if ($value['state'] == 1) {
+					$info_list[$key]['state'] = "出库";
+				} else if ($value['state'] == 2) {
+					$info_list[$key]['state'] = "退库";
+				} else if ($value['state'] == 3) {
+					$info_list[$key]['state'] = "调拨中";
+				} else if ($value['state'] == 4) {
+					$info_list[$key]['state'] = "再加工";
+				} else if ($value['state'] == 5) {
+					$info_list[$key]['state'] = "维修中";
+				} else if ($value['state'] == 6) {
+					$info_list[$key]['state'] = "盘亏";
+				} else if ($value['state'] == 7) {
+					$info_list[$key]['state'] = "更换标签";
+				} else if ($value['state'] == 8) {
+					$info_list[$key]['state'] = "其它";
+				} else if ($value['state'] == 9) {
+					$info_list[$key]['state'] = "预设";
+				} else if ($value['state'] == 10) {
+					$info_list[$key]['state'] = "美店零售";
+				}
+				$info_list[$key]['enter'] = date('Y-m-d H:i:s', $value['enter']);
+			}
+			//生成excel
+            $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>仓库</td><td>供应商</td><td>SKU</td><td>名称</td><td>料号</td><td>状态</td><td>出库时间</td><td>所在位置</td></tr>";
+            foreach ($info_list as $key=>$value) 
+            { 
+                
+                $str .= "<tr>";
+                $str .= "<td>". $value['warehouse']. "</td>";
+                $str .= "<td>". $value['purchase']. "</td>";	
+                $str .= "<td>". $value['sku']. "</td>";	
+                $str .= "<td>". $value['title']. "</td>";
+                $str .= "<td>". $value['features']. "</td>";
+                $str .= "<td>". $value['state']. "</td>";
+                $str .= "<td>". $value['enter']. "</td>";
+                $str .= "<td>". $value['details']. "</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); 
+			
+		}
+    }
 }

+ 1 - 1
template/erp/whlabel_printrk.html

@@ -197,7 +197,7 @@ $(".whlabelprintexcel").click(function() {
 	$("input:hidden").each(function() {
         f = f + $(this).attr("name") + "=" + $(this).val() + "&";
     });
-	window.location.href = "/specialstock/hwwz?excel="+$(this).data("id")+"&"+f;
+	window.location.href = "/whlabelfz/bqrkexcel?excel="+$(this).data("id")+"&"+f;
 });
 
 $(".tcnrwk .tcnrrj").click(function() {