lvhao 1 týždeň pred
rodič
commit
92fa9eec7a

+ 129 - 0
core/CoreApp/controllers/Systembound.php

@@ -47,6 +47,9 @@ class Systembound extends Start_Controller {
         }else if($arg == 'zxdpdexcel'){
 			$this->_zxdpdexcel();
 		}
+		else if($arg == 'dcall'){
+			$this->_dcall();
+		}
 		else
 		{
 			 $this->_index();
@@ -1172,4 +1175,130 @@ class Systembound extends Start_Controller {
 			
 		}
 	}
+
+
+	public function _dcall(){
+		if(isset($_GET['fexcel']))  
+		{
+			$timetk = $this->input->get('timetk',true);
+			$timetj = $this->input->get('timetj',true);
+			$library = $this->input->get('library',true);
+			$type = $this->input->get('type',true);
+			$number = $this->input->get('number',true);
+			$waybill = $this->input->get('waybill',true);
+			$timetk = strtotime($timetk);
+			$timetj = strtotime($timetj);
+			
+			$typename = "订单计数";
+			// $cx_arr = [78,79];
+
+			// $ex_list = $this->express->find_all("id in (".implode(',',$cx_arr).")","id,servicename");
+			
+			// $where = "type != 0 and express in (".implode(',',$cx_arr).")";
+			$where = " type != 0 ";
+			
+			if($timetk && $timetj)
+            {
+                $where  .= " and time > '$timetk' and time < '$timetj'";
+            }
+			if(isset($_SESSION['api']))
+            {
+				if($type)
+            	{
+                	$where  .= " and type = '$type'";
+           		}
+				else
+				{
+					$uw = '';
+				    $u = $this->user->get_api($_SESSION['api']);
+				    $u['warehouse'] =  explode('|',trim($u['warehouse'],'|'));
+				    foreach ($u['warehouse'] as $v) 
+		            {
+					    $uw  .= " type = '$v' or";
+                    }
+				    $uw = rtrim($uw,'or');
+					$uw = " and (".ltrim($uw,' ').")";
+					$where  .= $uw;
+				}
+            }
+			else
+			{
+				echo json_encode(array('msg'=>'导出失败,请重新登陆!','success'=>false));exit;
+			}
+			if($number)
+            {
+                $where  .= " and number = '$number'";
+            }
+			if($waybill)
+            {
+                $where  .= " and waybill = '$waybill'";
+            }
+			
+			$data = array();
+			$datafy = array();
+			$j = 0;
+			$info_list = $this->outbound->find_all($where,'number,waybill,express','time asc');
+			
+			$express_ids = array_unique(array_column($info_list,'express'));
+			$express_ids = array_values($express_ids);
+		
+			
+			$ex_list = $this->express->find_all("id in (".implode(',',$express_ids).")","id,servicename",'id asc');
+			
+			$final_list= [
+
+			];
+			foreach($ex_list as $v){
+				$final_list[$v['id']] = [];
+			}
+			
+			foreach ($info_list as $key=>$value)
+		    {
+				if(isset($final_list[$value['express']])){
+					$orderinfo = $this->logic_order->getInfo('number = "'.$value['number'].'"');
+					$weight = 0;
+					if(!empty($orderinfo)){
+						$weight = $orderinfo['weight'];
+					}
+					$weight = str_replace('kgkg','kg',$weight);
+					$final_list[$value['express']][] = [
+						$value['number'],
+						$value['waybill'],
+						$weight
+					];
+				}
+				
+			}
+			$data[] = $datafy;
+			 //格式化数据
+			$i = 0;$cpexcel = array();
+
+            $title = date('Ymd',time()).$typename."发货统计信息"; $td = '';
+			$td = "";
+			$count = 0;
+			foreach($ex_list as $v){
+			    $num = count($final_list[$v['id']]);
+			    if($num > $count){
+			        $count = $num;
+			    }
+				$td .= "<td>".$v['servicename']."</td><td>总数(".$num.")</td><td>重量</td>";
+			}
+			foreach($final_list as $k=>$v){
+			    for($i=0;$i < $count ;$i++){
+			        if(!isset($final_list[$k][$i])){
+			            $final_list[$k][$i] = [
+			                    " "," ",""
+			                ];
+			        }
+			    }
+			}
+            $titlename = "<table border=1>
+            <tr>
+            ".$td."
+            </tr>
+            </table>"; 
+            $filename = $title.".xls";
+            $this->excel->get_fz7($final_list,$titlename,$filename);
+	    }
+	}
 }

+ 29 - 2
template/erp/systembound.html

@@ -57,7 +57,10 @@
 </li>
 <li>
     <font class="cona dczxdpd" style="background-color: #F80 !important;"  data-type="zxdpd">导出正鑫DPD计数</font>
- </li>
+</li>
+<li>
+    <font class="cona dcall" style="background-color: #F80 !important;"  data-type="dcall">导出全部</font>
+</li>
 </ul>
 <ul class="exdata"></ul>
 <table class="datatitle data" border="0" style="border-collapse:collapse;">
@@ -166,7 +169,31 @@ $(".dczxdpd").click(function() {
     window.location.href = dataurl+"zxdpdexcel?fexcel=1&" + f;
     $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
 });
-
+$(".dcall").click(function(){
+    let type = $(this).data("type");
+    var f = "select_express=" + type+"&";
+    $(".select").each(function() {
+        f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
+    });
+    $("input:text").each(function() {
+        f = f + $(this).attr("name") + "=" + $(this).val() + "&";
+    });
+    $("input:hidden").each(function() {
+        f = f + $(this).attr("name") + "=" + $(this).val() + "&";
+    });
+	if($("input[name=systembox]").length > 0)
+	{
+		if($("select[name='warehouse']").children("option:selected").val() == '')
+		{
+			 $(".ts p").text("请选择仓库!");
+        $(".ts").show();
+        setTimeout('$(".ts").fadeOut()', 800);
+		return false;
+		}
+	}
+    window.location.href = dataurl+"dcall?fexcel=1&" + f;
+    $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
+})
 
 </script>
 <script type="text/javascript" src="{$theme}js/laydate.js"></script>