lvhao vor 1 Woche
Ursprung
Commit
d6b36c5ec4
2 geänderte Dateien mit 170 neuen und 0 gelöschten Zeilen
  1. 134 0
      core/CoreApp/controllers/Whlabel_bh.php
  2. 36 0
      template/erp/whlabel_bh_operate.html

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

@@ -137,6 +137,9 @@ class Whlabel_bh extends Start_Controller {
 		else if($arg == "cj_transfer_scanout_xzlog"){
 			$this->_cj_transfer_scanout_xzlog();
 		}
+		else if($arg == 'excelbhdc'){
+			$this->_excelbhdc();
+		}
 		else if($arg == 'excelwchz'){
 			$this->_excelwchz();
 		}
@@ -3157,4 +3160,135 @@ class Whlabel_bh extends Start_Controller {
 		header( "Expires: 0" ); 
 		exit($str); 
 	}
+
+	public function _excelbhdc(){
+		$orderinfo = $this->input->get('number',true);
+		$color = $this->input->get('color',true);
+		$pm = $this->input->get('pm',true);
+		$purchase = $this->input->get('purchase',true);
+		$transfer = $this->input->get('transfer',true);
+		$lx = $this->input->get('lx',true);
+		$crk_select = $this->input->get('crk',true);
+		$timetk = $this->input->get('timetk',true);
+		$timetj = $this->input->get('timetj',true);
+		$timetk = strtotime($timetk);
+		$timetj = strtotime($timetj);
+		$where = "1=1";
+		if($transfer)
+		{
+			$ctime = 'ctime'.$transfer;
+			$where  .= " and $ctime > '$timetk' and $ctime < '$timetj'";
+		}
+		else
+		{
+			$where  .= " and time > '$timetk' and time < '$timetj'";
+		}
+		if($orderinfo)
+		{
+			$where  .= " and orderinfo like '%$orderinfo%'";
+		}
+		if($transfer)
+		{
+			$where  .= " and rk like '%|".$transfer."|%'";
+		}
+		if($purchase)
+		{
+			$where  .= " and purchase = '$purchase'";
+		}
+		if($pm)
+		{
+			$where  .= " and pm like '%$pm%'";
+		}
+		if($color)
+		{
+			$where  .= " and features like '%-".$color."-%'";
+		}
+		if(!empty($crk_select)){
+			$where_arr = [];
+			$where_arr['time >='] =$timetk;
+			$where_arr['time <='] = $timetj;
+			if($transfer > 0){
+				$where_arr['lx'] =$transfer;
+			}
+		
+			$cr_model = $this->db->from('whlabel_bh_transfer_cr')->select('id,fid,is_over,lx,time,type');
+			if($crk_select == 1){
+				$where_arr['type'] =1;
+				$cr_tmp_list = $cr_model->where($where_arr)->get()->result_array();
+			}else{
+				$where_arr['type'] = 2;
+				$cr_tmp_list = $cr_model->where($where_arr)->get()->result_array();
+			}
+			$fids = array_column($cr_tmp_list,'fid');
+			$ids = array_unique($fids);
+			if(empty($ids)){
+				$where  .= " and id = 0 ";
+			}else{
+				$where  .= " and id in (".implode(",",$ids).")";
+			}
+		}
+		//取得信息列表
+		$info_list = $this->whlabel_bh_transfer->find_all($where,'id,orderinfo,pm,shipremarks,ts,printtime');
+		$transfer = $this->transfer->find_all();
+		$t = array();$ot = array();
+		foreach ($transfer as $v)
+		{
+			$t[$v['id']] = $v['title'];
+			$ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
+		}
+			//格式化数据
+		foreach ($info_list as $key=>$value)
+		{
+			$info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
+			//$log_list= $this->whlabel_bh_transfer_cr->find_all("fid = ".$value['id']);
+			// $tmp_operate_str = "";
+			// foreach($log_list as $k=>$v){
+			// 	$tmp_operate_str.= $t[$v['lx']]."".($v['type']==1?'入库':'出库').":".date('Y-m-d H:i:s',$v['time'])."<br>";
+			// }
+
+			// $info_list[$key]['time'] = trim($tmp_operate_str,'<br>');
+		}
+
+		$filename = date("Ymd",$ktime)."~".date("Ymd",$jtime).$transfer_info['title']."备货流转.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>备注</td><td>数量</td><td>打印时间</td></tr>";
+		foreach ($final_list as $key=>$value) 
+		{ 
+			$str .= "<tr>";
+			$str .= "<td>". $value['orderinfo']. "</td>";
+			$str .= "<td>". $value['pm']. "</td>";
+			$str .= "<td>". $value['shipremarks']. "</td>";
+			$str .= "<td>". $value['ts']. "</td>";	
+			$str .= "<td>". $value['printtime']. "</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); 
+		
+	}
 }

+ 36 - 0
template/erp/whlabel_bh_operate.html

@@ -55,6 +55,9 @@
 <li>
 <font class="cona wcxz">完成汇总下载excel</font>
 </li>
+<li>
+    <font class="cona tjsx_xz">按条件筛选</font>
+</li>
 <li style="padding-left:25px">
 <select name="printer" class="select">
 <option value="">选择打印机</option>
@@ -318,6 +321,39 @@ $(".systemwindow").on('click', "#bdbbprintks", function() {
         }
     });
 	  });
+
+$(".tjsx_xz").click(function() {
+   let f = "excel=1";
+   let t = $("select[name='transfer']").children("option:selected").val();
+   if(t){
+      f += "&transfer="+t;
+   }
+   let c = $("select[name='color']").children("option:selected").val();
+   if(c){
+      f += "&color="+c;
+   }
+   let crk = $("select[name='crk']").children("option:selected").val();
+   if(crk){
+      f += "&crk="+crk;
+   }
+   let number = $("input[name='number']").val();
+   if(number){
+      f += "&number="+number;
+   }
+   let pm = $("input[name='pm']").val();
+   if(pm){
+      f += "&pm="+pm;
+   }
+   let timetk = $("input[name='timetk']").val();
+   if(timetk){
+      f += "&timetk="+timetk;
+   }
+   let timetj = $("input[name='timetj']").val();
+   if(timetj){
+      f += "&timetj="+timetj;
+   }
+   window.location.href = "/whlabel_bh/excelbhdc?"+f;
+});
 </script>
 <script type="text/javascript" src="{$theme}js/laydate.js"></script>
 {Template footer}