Ver código fonte

美仓下载

lvhao 5 dias atrás
pai
commit
801ec7201e
2 arquivos alterados com 214 adições e 7 exclusões
  1. 193 7
      core/CoreApp/controllers/Returns.php
  2. 21 0
      template/erp/returns.html

+ 193 - 7
core/CoreApp/controllers/Returns.php

@@ -42,7 +42,9 @@ class Returns extends Start_Controller {
 		else if($arg == 'excel')
         {
              $this->_excel();
-        }
+        }else if($arg == 'mcexcel'){
+			$this->_mcexcel();
+		}
 		else if($arg == 'qr')
         {
              $this->_qr();
@@ -676,20 +678,26 @@ class Returns extends Start_Controller {
 					    {
 						    if($nr[0] == 1)
 						    {
-							    $info_list[$key]['a'.$k] = '可 用';
+							    $info_list[$key]['a'.$k] = '(人发)可用';
 						    }
 						    else if($nr[0] == 2)
 						    {
-						    	$info_list[$key]['a'.$k] = '精打理';
+						    	$info_list[$key]['a'.$k] = '(人发)精打理';
 						    }
 						    else if($nr[0] == 3)
 						    {
-							    $info_list[$key]['a'.$k] = '不可用';
+							    $info_list[$key]['a'.$k] = '(人发)不可用';
 						    }
 							else if($nr[0] == 4)
 						    {
-							    $info_list[$key]['a'.$k] = '其 它';
-						    }
+							    $info_list[$key]['a'.$k] = '非假发/非我司头发';
+						    }else if($nr[0] == 5){
+								$info_list[$key]['a'.$k] = '(化纤)不可用';
+							}else if($nr[0] == 6){
+								$info_list[$key]['a'.$k] = '(化纤)可用';
+							}else if($nr[0] == 7){
+								$info_list[$key]['a'.$k] = '(化纤)待确认';
+							}
 					    }
 					    if(isset($nr[1]))
 					    {
@@ -722,13 +730,191 @@ class Returns extends Start_Controller {
 <td>完好程度-2</td>   
 <td>完好程度补充-2</td>   
 <td>完好程度-3</td>   
-<td>完好程度补充-3</td>          
+<td>完好程度补充-3</td>   
+<td>完好程度-4</td>   
+<td>完好程度补充-4</td>  
+<td>完好程度-5</td>   
+<td>完好程度补充-5</td>        
   </tr>
             </table>"; 
             $filename = $title.".xls"; 
 			$tail = "\n";
             $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
 	}
+
+	public function _mcexcel()
+    {
+		$user = $this->user->get_api($_SESSION['api']);
+		if($user)
+		{
+		    $fgshop = "";$sid = "";
+		    $user = explode('|',trim($user['shop'],'|'));
+			foreach ($user as $value) 
+		    {
+				$fgshop .= " shop = ".$value." or";
+				$sid .= " id = ".$value." or";
+			}
+		}
+		$post = $this->input->get(NULL, TRUE);
+		if(isset($post['timetk']))  
+		{
+		    $page = $this->input->get('page',true);
+		    $perpage = $this->input->get('perpage',true);
+			$timetk = $this->input->get('timetk',true);
+			$timetj = $this->input->get('timetj',true);
+			$shop = $this->input->get('shop',true);
+			$fh = $this->input->get('fh',true);
+			$name = $this->input->get('name',true);
+			$express = $this->input->get('express',true);
+			$orderinfo = $this->input->get('orderinfo',true);
+			$number = $this->input->get('number',true);
+			$torderinfo = $this->input->get('torderinfo',true);
+			$region = $this->input->get('region',true);
+			$xztime = $this->input->get('xztime',true);
+			$timetk = strtotime($timetk);
+			$timetj = strtotime($timetj);
+			$dowid = $this->input->get('a');
+			$ret_regist_no = $this->input->get('ret_regist_no',true);
+			$wid = "";
+			if($dowid != "")
+			{
+				$id_arr =  explode(',',rtrim($dowid,','));
+				$wid  .= " id = 0 or";
+				foreach ($id_arr as $v) 
+		        {
+                    $wid  .= " id = '$v' or";
+                }
+				$wid = " and".rtrim($wid,'or');
+			}
+			$where = "1=1 and (".$fgshop." shop = '0')";
+			if($timetk && $timetj)
+            {
+                $where  .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj' ";
+            }
+			if($shop)
+            {
+                $where  .= " and shop = '$shop'";
+            }
+
+			if($region == 0){
+				$where  .= " and region = '$region' ";
+			}
+			if($region == 1){
+				$where  .= " and region = '$region' ";
+			}
+
+			if($fh)
+            {
+				if($fh == 1)
+				{
+					$where  .= " and stime > '0'";
+				}
+				else
+				{
+					$where  .= " and stime = '0'";
+				}
+            }
+			if($name)
+            {
+				$where  .= " and name = '$name'";
+            }
+			if($express)
+            {
+                $where  .= " and express = '$express'";
+            }
+			if($orderinfo)
+            {
+                $where  .= " and orderinfo = '$orderinfo'";
+            }
+			if($number)
+            {
+                $where  .= " and number = '$number'";
+            }
+			if($torderinfo)
+            {
+                $where  .= " and torderinfo = '$torderinfo'";
+            }
+			if($ret_regist_no){
+				$where .= " and  ret_regist_no like '%$ret_regist_no%' ";
+			}
+			 $info_list = $this->returns->find_all($where.$wid,'edittime,ret_regist_no,torderinfo,xh,received,degreetext','time desc');
+			 //格式化数据
+            foreach ($info_list as $key=>$value) 
+		    {
+				$info_list[$key]['edittime'] = ($value['edittime'] > 0)?date('Y-m-d H:i:s',$value['edittime']):'';
+				if($value['degreetext'] == '' || $value['degreetext'] == 'undefined-|')
+				{
+					$info_list[$key]['degreetext'] = 0;
+				}
+				else
+				{
+				    $degreetext = explode('|',rtrim($value['degreetext'],'|'));
+				    $info_list[$key]['degreetext'] = count($degreetext);
+				    foreach ($degreetext as $k=>$val) 
+		    	    {
+					    $nr = explode('~',rtrim($val,'~'));
+					    if(isset($nr[0]) && is_numeric($nr[0]))
+					    {
+						    if($nr[0] == 1)
+						    {
+							    $info_list[$key]['a'.$k] = '(人发)可用';
+						    }
+						    else if($nr[0] == 2)
+						    {
+						    	$info_list[$key]['a'.$k] = '(人发)精打理';
+						    }
+						    else if($nr[0] == 3)
+						    {
+							    $info_list[$key]['a'.$k] = '(人发)不可用';
+						    }
+							else if($nr[0] == 4)
+						    {
+							    $info_list[$key]['a'.$k] = '非假发/非我司头发';
+						    }else if($nr[0] == 5){
+								$info_list[$key]['a'.$k] = '(化纤)不可用';
+							}else if($nr[0] == 6){
+								$info_list[$key]['a'.$k] = '(化纤)可用';
+							}else if($nr[0] == 7){
+								$info_list[$key]['a'.$k] = '(化纤)待确认';
+							}
+					    }
+					    if(isset($nr[1]))
+					    {
+						    $info_list[$key]['b'.$k] = $nr[1];
+					    }
+					}
+				}
+            }
+		}
+		
+		
+			$title = '退货登记'.date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj); 
+            $titlename = "<table border=1>
+            <tr>
+			<td>登记日期</td>
+            <td>退货登记编号</td>
+<td>退货运单号</td>
+<td>装箱箱号</td>
+<td>货物明细</td>
+<td>数量</td>  
+<td>完好程度-1</td>   
+<td>完好程度补充-1</td>   
+<td>完好程度-2</td>   
+<td>完好程度补充-2</td>   
+<td>完好程度-3</td>   
+<td>完好程度补充-3</td>
+<td>完好程度-4</td>   
+<td>完好程度补充-4</td>  
+<td>完好程度-5</td>   
+<td>完好程度补充-5</td>            
+  </tr>
+            </table>"; 
+            $filename = $title.".xls"; 
+			$tail = "\n";
+            $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
+	}
+
+
 	
 	public function _qr()
 	{

+ 21 - 0
template/erp/returns.html

@@ -82,6 +82,7 @@
 <a href="/data/lymob/thdjb.xlsx" >下载导入模板</a>
 
 <a href="javascript:void(0);" class="window" data-h="/returns/scan_waybill/" data-t="扫运单录入">扫运单录入</a>
+<a href="javascript:void(0);"  class="mcreturnsexcel">美仓下载专用</a>
 </div>
 <table class="datatitle data" border="0" style="border-collapse:collapse;">
 <tr>
@@ -287,6 +288,26 @@ $(".returnsexcel").click(function() {
 	f = f + "excel=1&a="+a;
 	window.location.href = "/returns/excel?excel=1&"+f;
 });
+$(".mcreturnsexcel").click(function() { 
+    var f = "";
+	var a = "";
+    $(".datatext input[name='check']:checked").each(function() {
+        a = a + $(this).val()+",";
+    });
+	f = f + "a=" + a + "&";
+    $(".select").each(function() {
+        f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
+    });
+    $("input:text").each(function() {
+        f = f + $(this).attr("name") + "=" + $(this).val() + "&";
+    });
+	var a = "";
+    $(".datatext input[name='check']:checked").each(function() {
+        a = a + $(this).val()+",";
+    });
+	f = f + "excel=1&a="+a;
+	window.location.href = "/returns/mcexcel?excel=1&"+f;
+});
 $(".datatext").on('click',".thqr",function() {
 	var thid = $(this).data("id");
     $.ajax({