| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159 | 
							- <?php defined('BASEPATH') OR exit('No direct script access allowed');
 
- class Systemwigsout extends Start_Controller {
 
- 	public function __construct(){
 
- 		parent::__construct();
 
- 		$this->load->library('session');
 
- 		$this->load->_model('Model_systemwigsout','systemwigsout');
 
- 		$this->load->_model('Model_excel','excel');
 
- 		$this->load->_model('Model_shop','shop');
 
- 		$this->load->_model('Model_warehouse','warehouse');
 
- 		$this->load->_model('Model_fullorder','fullorder');
 
- 		$this->load->_model('Model_fullordertt','fullordertt');
 
- 		$this->load->_model('Model_fullordersmt','fullordersmt');
 
- 		$this->load->_model('Model_typeclass','typeclass');
 
- 		$this->load->_model('Model_transfer','transfer');
 
- 		$this->load->_model('Model_apiyy','apiyy');
 
- 		$this->load->_model('Model_classid','classid');
 
- 	}
 
- 	//定义方法的调用规则 获取URI第二段值
 
-     public function _remap($arg,$arg_array)
 
-     {
 
- 		if($arg == 'data')
 
-         {
 
-              $this->_data();
 
-         }
 
- 		else if($arg == 'out')
 
-         {
 
-              $this->_out();
 
-         }
 
- 		else if($arg == 'del')
 
-         {
 
-              $this->_del();
 
-         }
 
- 		else if($arg == 'add')
 
-         {
 
-              $this->_add();
 
-         }
 
- 		else if($arg == 'excel')
 
-         {
 
-              $this->_excel();
 
-         }
 
- 		else if($arg == 'barcode')
 
-         {
 
-              $this->_barcode($arg_array);
 
-         }
 
- 		else if($arg == 'hb')
 
-         {
 
-              $this->_hb();
 
-         }
 
- 		else if($arg == 'xz')
 
-         {
 
-              $this->_xz();
 
-         }
 
- 		else
 
- 		{
 
- 			 $this->_index();
 
- 		}
 
-     }
 
- 	
 
- 	public function _index()
 
- 	{
 
- 		$power = 0;
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$kx = '';$xz = '';
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $fgshop = "";$sid = "";$wid="";$wtype="";
 
- 		    $usersp = explode('|',trim($user['shop'],'|'));
 
- 			$userwh = explode('|',trim($user['warehouse'],'|'));
 
- 			$transferdata = explode('|',trim($user['transfer'],'|'));
 
- 			foreach ($usersp as $value) 
 
- 		    {
 
- 				$fgshop .= " shop = ".$value." or";
 
- 				$sid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($userwh as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 				$wtype .= " type = ".$value." or";
 
- 			}
 
- 			foreach ($transferdata as $v) 
 
- 		    {
 
- 				$tf = $this->transfer->read($v);
 
- 				if($v == 11)
 
- 				{
 
- 					$xz = '<option value="">查看全部</option>';
 
- 				}
 
- 				$kx .= '<option value="'.$v.'">'.$tf['title'].'</option>';
 
- 			}
 
- 			$kx .= $xz;
 
- 			if(stripos($user['userid'],'hr') !== false)//老厂小单
 
- 			    {
 
- 				    $power = 37;
 
- 			    }
 
- 		}
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
 
- 			$warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
 
- 		    $this->data['wlshop'] = $wlshop;
 
- 		    $this->data['warehouse'] = $warehouse;
 
- 			$this->data['vip'] = $user['vip'];
 
- 			$this->data['kx'] = $kx;
 
- 		}
 
- 		if(stripos($user['userid'],'baozhuang') !== false)
 
- 		{
 
- 			$this->data['xz'] = 1;
 
- 		}
 
- 		else
 
- 		{
 
- 			$this->data['xz'] = 0;
 
- 		}
 
- 		$this->data['userid'] = $user['userid'];
 
- 		$this->data['czwarehouse'] = $power;
 
- 		$this->_Template('systemwigsout',$this->data);
 
- 	}
 
- 	
 
- 	public function _data()
 
- 	{
 
- 		$wh = array();
 
- 			$w = $this->warehouse->find_all('1=1','id,title');
 
- 			foreach ($w as $v) 
 
- 			{
 
- 				$wh[$v['id']] = $v['title'];
 
- 			}
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 	    if(isset($post['page']))  
 
- 		{
 
- 			$api = $this->input->post('api',true);
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			$number = $this->input->post('number',true);
 
- 			$type = $this->input->post('type',true);
 
- 			$color = $this->input->post('color',true);
 
- 			$cz = $this->input->post('cz',true);
 
- 			$zjtab = $this->input->post('zjtab',true);
 
- 			$czwarehouse = $this->input->post('czwarehouse',true);
 
- 			$timetk = $this->input->post('timetk',true);
 
- 			$timetj = $this->input->post('timetj',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			$where = "type != 0";
 
- 			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;
 
- 				}
 
- 			}
 
- 			if(!$cz)
 
- 			{
 
- 				$cxctime = "time";
 
- 			}
 
- 			else
 
- 			{
 
- 			    $cxctime = "ctime".$cz;
 
- 			}
 
- 			if($timetk)
 
-             {
 
-                 $where  .= " and $cxctime > '$timetk' and $cxctime < '$timetj'";
 
-             }
 
- 			if($number)
 
-             {
 
-                 $where  .= " and number = '$number'";
 
-             }
 
- 			if($cz)
 
-             {
 
-                 $where  .= " and cz like '%|".$cz."|%'";
 
-             }
 
- 			if($zjtab)
 
-             {
 
-                 $where  .= " and cz like '%~".$zjtab."-%'";
 
-             }
 
- 			if($color)
 
-             {
 
-                 $where  .= " and fpdata like '%-".$color."-%'";
 
-             }
 
- 			if($czwarehouse != '')
 
-             {
 
- 				$where  .= " and czwarehouse = '$czwarehouse'";
 
-             }
 
-             //数据排序
 
-             $order_str = "time desc";
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
- 			$transfer = array();
 
- 			$t = $this->transfer->find_all("1=1");
 
- 			foreach ($t as $v)
 
- 		    {
 
- 				$transfer[$v['id']] = $v['title'];
 
- 			}
 
-             //取得信息列表
 
-             $info_list = $this->systemwigsout->find_all($where,'id,type,number,shipremarks,printtime,time,quantity',$order_str,$start,$perpage);
 
- 			 //格式化数据
 
-             foreach ($info_list as $key=>$value)
 
- 		    {
 
- 				$info_list[$key]['type'] = $wh[$value['type']];
 
- 				$dd = $this->systemwigsout->read($value['id']);
 
- 				$info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
 
- 				$cz = explode('|',trim($dd['cz'],'|'));
 
- 				$cztime = explode('|',trim($dd['cztime'],'|'));
 
- 				$zw = $transfer;
 
- 				if($dd['cz'] != '' && count($cz) > 0)
 
- 				{
 
- 					$info_list[$key]['time'] = '';
 
- 					for($i=0;$i<count($cz);$i++)
 
- 		            {
 
- 						if(isset($cztime[$i]))
 
- 						{
 
- 						    $info_list[$key]['time'] .= $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).'<br>';
 
- 						}
 
- 						else
 
- 						{
 
- 							$info_list[$key]['time'] .= $zw[$cz[$i]].' :'.'未获取到时间<br>';
 
- 						}
 
- 					}
 
- 				}
 
- 				$info_list[$key]['time'] = trim($info_list[$key]['time'],'<br>');
 
-             }
 
- 		    $total = $this->systemwigsout->find_count($where);
 
- 		    $pagenum = ceil($total/$perpage);
 
- 		    $over = $total-($start+$perpage);
 
- 			$exdata = 0;
 
- 			$count = $this->systemwigsout->find_all($where);
 
- 			foreach ($count as $v) 
 
- 			{
 
- 				$exdata += $v['quantity']; 
 
- 			}
 
- 		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list),'datacount'=>$exdata,'exdata'=>$exdata);
 
- 		    echo json_encode($rows);exit;
 
- 		}
 
- 	}
 
- 	
 
- 	public function _out()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['number']))
 
- 		{
 
- 			$time = time();
 
- 			$number = $this->input->post('number',true);
 
- 			$type = $this->input->post('type',true);
 
- 			$ps = $this->input->post('ps',true);
 
- 			$cz = $this->input->post('cz',true);
 
- 			$lx = $this->input->post('lx',true);
 
- 			$ly = $this->input->post('ly',true);
 
- 			$czwarehouse = $this->input->post('czwarehouse',true);
 
- 			$timetk = $this->input->post('timetk',true);
 
- 			$timetj = $this->input->post('timetj',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			if(!$number)
 
- 			{
 
- 				echo json_encode(array('msg'=>'未扫入数据!','success'=>false));exit;
 
- 			}
 
- 			if(!$cz)
 
- 			{
 
- 				echo json_encode(array('msg'=>'请选择需对应的部门!','success'=>false));exit;
 
- 			}
 
- 			if(!$lx)
 
- 			{
 
- 				echo json_encode(array('msg'=>'请选择需要操作的类型!','success'=>false));exit;
 
- 			}
 
- 			if(!$ly)
 
- 			{
 
- 				$ly = 0;
 
- 			}
 
- 			$fullorder = 'fullorder';
 
- 			$nu = $this->fullorder->get_number($number);
 
- 			if(!$nu)
 
- 			{
 
- 				$fullorder = 'fullordersmt';
 
- 				$nu = $this->fullordersmt->get_number($number);
 
- 			}
 
- 			if(!$nu)
 
- 			{
 
- 				$fullorder = 'fullordertt';
 
- 				$nu = $this->fullordertt->get_number($number);
 
- 			}
 
- 			if(!$nu)
 
- 			{
 
- 				echo json_encode(array('msg'=>'错误!未找到此编号的订单','success'=>false));exit;
 
- 			}
 
- 			if($nu['state'] == '214' || $nu['state'] == '217')
 
- 			{
 
- 				echo json_encode(array('msg'=>'错误,此单已取消!请联系店员核实','success'=>false));exit;
 
- 			}
 
- 			$systemwigsout = $this->systemwigsout->get_czwarehouse($number,$czwarehouse);
 
- 			//$systemwigsout = $this->systemwigsout->get_number($number);
 
- 			if(!$systemwigsout)
 
- 			{
 
- 				if($this->systemwigsout->insert(array('type'=>$nu['type'],'cz'=>'|'.$cz.'|','cztime'=>'|'.$time.'|','number'=>$number,'shipremarks'=>$nu['shipremarks'],'printtime'=>$nu['printtime'],'quantity'=>1,'gtime'=>date('YmdH',$time),'time'=>$time,'fpdata'=>$nu['fpdata'],'ctime'.$cz=>$time,'czwarehouse'=>$czwarehouse)))
 
- 				 {
 
- 				    echo json_encode(array('music'=>'1','success'=>true));exit;
 
- 				 }
 
- 				 else
 
- 				 {
 
- 				    echo json_encode(array('msg'=>'数据写入失败,请重试!','success'=>false));exit;
 
- 				 }
 
- 			}
 
- 			$czarray = explode('|',trim($systemwigsout['cz'],'|'));
 
- 			$cztimearray = explode('|',trim($systemwigsout['cztime'],'|'));
 
- 			$czarray = array_flip($czarray);
 
- 			if(stripos($systemwigsout['cz'],'|'.$cz.'|') !== false && $cztimearray[$czarray[$cz]] > $time-1200 && $cz != 11)
 
- 			{
 
- 				echo json_encode(array('msg'=>'错误,系统20分钟内已录入过!','success'=>false));exit;
 
- 			}
 
- 			$fg = 0;
 
- 			if($systemwigsout['ctime11'] != 0)
 
- 			{
 
- 				$fg = 1;
 
- 			}
 
- 			if($this->systemwigsout->save(array('cz'=>$systemwigsout['cz'].$cz.'|','cztime'=>$systemwigsout['cztime'].$time.'|','ctime'.$cz=>$time,'fg'=>$fg,'time'=>$time),$systemwigsout['id']))
 
- 			{
 
- 				if($nu['state'] == '216')
 
- 				{
 
- 				    echo json_encode(array('msg'=>'数据已录入成功!此订单已出库,请终止生产。','success'=>false));exit;
 
- 				}
 
- 				else if($nu['type'] == '5')
 
- 				{
 
- 				    echo json_encode(array('msg'=>'数据已录入成功!该单已改成美国仓发货,请终止生产。','success'=>false));exit;
 
- 				}
 
- 				else
 
- 				{
 
- 					if($nu['scapi'] == 99 && $nu['scid'] != '' && $nu['scid'] != '|' && $nu['dbapi'] != '99' && $cz == 11)
 
- 				    {
 
- 				        @$rk = $this->apiyy->_rk($nu,$fullorder);
 
- 					    if($rk['c'] == 1)
 
- 					    {
 
- 						    $this->apiyy->insert(array('number'=>$rk['number'],'lx'=>$rk['lc'],'type'=>2,'error'=>$rk['error']));
 
- 						    $this->$fullorder->save(array('dbapi'=>$rk['lc']),$nu['id']);
 
- 							echo json_encode(array('music'=>'1','cs'=>$rk,'success'=>true));exit;
 
- 					    }
 
- 					    else
 
- 					    {
 
- 							echo json_encode(array('music'=>'1','cs'=>'0','success'=>true));exit;
 
- 						    $this->$fullorder->save(array('dbapi'=>99),$nu['id']);
 
- 					    }	
 
- 				    }
 
- 					else
 
- 					{
 
- 				        echo json_encode(array('music'=>'1','cs'=>'2','success'=>true));exit;
 
- 					}
 
- 				}
 
- 			}
 
- 			else
 
- 			{
 
- 				echo json_encode(array('msg'=>'数据写入失败,请重试!','success'=>false));exit;
 
- 			}
 
- 			
 
- 		}
 
- 	}
 
- 	
 
- 	public function _barcode($arg_array)
 
- 	{
 
- 		$dir = 'data/img/'.date('Ymd',time()).'/';
 
-         if(!is_dir('./'.$dir))mkdir('./'.$dir,0777);
 
-         $imgUrl = $dir.$arg_array.'.png';
 
- 		// 引用class文件夹对应的类
 
- 		require_once('./data/barcodegen/class/BCGFontFile.php');
 
- 		require_once('./data/barcodegen/class/BCGColor.php');
 
- 		require_once('./data/barcodegen/class/BCGDrawing.php');
 
-  
 
- 		// 条形码的编码格式
 
- 		require_once('./data/barcodegen/class/BCGcode128.barcode.php');
 
-  
 
- 		// 加载字体大小
 
- 		$font = new \BCGFontFile('./data/barcodegen/Arial.ttf', 18);
 
- 		//设置条形码颜色
 
- 		$color_black = new \BCGColor(0, 0, 0);
 
- 		$color_white = new \BCGColor(255, 255, 255);
 
-  
 
- 		$drawException = null;
 
- 		try 
 
- 		{
 
-    		    $code = new \BCGcode128();
 
-     		$code->setScale(2);
 
-     		$code->setThickness(30); // 条形码的厚度
 
-     		$code->setForegroundColor($color_black); // 条形码颜色
 
-     		$code->setBackgroundColor($color_white); // 条形码间隙颜色
 
-     		$code->setFont($font); //设置引用字体 条形码下方的文字
 
-     		$code->parse($arg_array); // 条形码需要的数据内容
 
- 		} 
 
- 		catch(\Exception $exception)
 
- 		{
 
-             $drawException = $exception;
 
-         }
 
- 		$drawing = new \BCGDrawing($imgUrl, $color_white);
 
- 		if($drawException) 
 
- 		{
 
-             $drawing->drawException($drawException);
 
-         }
 
- 		else 
 
- 		{
 
- 			$drawing->setBarcode($code);
 
-     		$drawing->draw();
 
- 		}
 
- 		// Header that says it is an image (remove it if you save the barcode to a file)
 
-         //header('Content-Type: image/png');
 
-         //header('Content-Disposition: inline; filename="barcode.png"');
 
-         // Draw (or save) the image into PNG format.
 
-         $drawing->finish(\BCGDrawing::IMG_FORMAT_PNG);
 
- 		
 
- 		return 'http://'.$_SERVER['HTTP_HOST'].'/data/img/'.date('Ymd',time()).'/'.$arg_array.'.png';
 
-         //return "<img src='".$data."' />";
 
- 	}
 
- 	public function _excel()
 
- 	{
 
- 		if(isset($_GET['fexcel']))  
 
- 		{
 
- 			$timetk = $this->input->get('timetk',true);
 
- 			$timetj = $this->input->get('timetj',true);
 
- 			$type = $this->input->get('type',true);
 
- 			$cz = $this->input->get('cz',true);
 
- 			$number = $this->input->get('number',true);
 
- 			$timetk = strtotime($timetk.':0:0');
 
- 			$timetj = strtotime($timetj);
 
- 			$gctime = "gctime".$cz;
 
- 			$where = "type != 0 and $gctime like '%-".date('YmdH',$timetk)."'";
 
- 			if(isset($_SESSION['api']))
 
-             {
 
- 				if($type)
 
-             	{
 
-                 	$where  .= " and type = '$type'";
 
- 					$warehouse = $this->warehouse->read($type);
 
- 					$titletype = "---".$warehouse['title'];
 
-            		}
 
- 				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;
 
- 					$titletype = "";
 
- 				}
 
-             }
 
- 			else
 
- 			{
 
- 				echo json_encode(array('msg'=>'导出失败,请重新登陆!','success'=>false));exit;
 
- 			}
 
- 			if($number)
 
-             {
 
-                 $where  .= " and number = '$number'";
 
-             }
 
- 			if($cz)
 
-             {
 
-                 $where  .= " and cz like '%~".$cz."-%'";
 
-             }
 
- 			$data = array();
 
- 			$datafy = array();
 
- 			$j = 0;
 
- 			$info_list = $this->systemwigsout->find_all($where,'number,shipremarks,printtime,quantity');
 
- 			foreach ($info_list as $key=>$value)
 
- 		    {
 
- 				$img = $this->_barcode($value['number']);
 
- 				$info_list[$key]['number'] = ".<img width='260' src='".$img."' />";
 
- 				$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('<','>'),$value['shipremarks']);
 
- 				$info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
 
-             }
 
-             $title = date('Y-m-d H-i',time()).'扫码统计表'.$titletype;
 
-             $titlename = "<table border=1 >
 
-             <tr><th colspan='4' align='left'><h3>".$title."<h3></th></tr>
 
-             <tr>
 
-             <td>编号</td>
 
-             <td>仓库品名</td>
 
-             <td>打印时间</td>
 
-             <td>数量</td>
 
-             </tr></table><table><tr></tr>"; 
 
-             $filename = $title.".xls"; 
 
- 			$tail = "\n"; 
 
- 			
 
- 			$str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
 
-         	<head>
 
-         	</head><body>";
 
- 			$str .= $titlename; 
 
- 			foreach ($info_list as $key=>$value) 
 
- 			{ 
 
- 		    	$str .= "<tr style=' border-bottom:1 double #000;'>";
 
- 		    	foreach ($value as $ke=>$va) 
 
- 				{
 
- 					$tj = '';
 
- 					if($ke == 'number')
 
- 				    {
 
- 					    $str .= "<td style='padding-left:400px;'>".$va."</td>";//使用文本格式
 
- 				    }
 
- 					else
 
- 					{
 
- 				        $str .= "<td>".$va."</td>";//使用文本格式
 
- 					}
 
- 		        }
 
- 			    $str .= "</tr><tr></tr><tr></tr>\n";
 
- 		    }
 
- 		    $str .= $tail;
 
- 		    $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);
 
- 			//echo "<pre>";
 
- 			//print_r($info_list);
 
- 	    }
 
- 	}
 
- 	
 
- 	
 
- 	public function _xz()
 
- 	{
 
- 		if(isset($_GET['fexcel']))  
 
- 		{
 
- 		    if(isset($_SESSION['api']))
 
- 		    {
 
- 			    $user = $this->user->get_api($_SESSION['api']);
 
- 		        $wid="";
 
- 			    $userwh = explode('|',trim($user['warehouse'],'|'));
 
- 			    foreach ($userwh as $value) 
 
- 		        {
 
- 				    $wid .= " type = ".$value." or";
 
- 			    }
 
- 		    }
 
- 			$tc = $this->typeclass->find_all();
 
- 			$typeclass = array();
 
- 		foreach ($tc as $v)
 
- 		{
 
- 			$tcjm[$v['id']] = array($v['jm'],$v['classid']);
 
- 			$typeclass[$v['id']] = array('zh'=>$v['zh'],'classid'=>$v['classid'],'bm'=>$v['bm'],'title'=>$v['title'],'jm'=>$v['jm']);
 
- 		}
 
- 			
 
- 			$timetk = $this->input->get('timetk',true);
 
- 			$timetj = $this->input->get('timetj',true);
 
- 			$cz = $this->input->get('cz',true);
 
- 			
 
- 			if(!$cz)
 
- 			{
 
- 				$cz = 1;
 
- 			}
 
- 			$type = $this->input->get('type',true);
 
- 			$czwarehouse = $this->input->get('czwarehouse',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			$where = "type != '0'";
 
- 			$cxctime = "ctime".$cz;
 
- 			if($timetk)
 
-             {
 
-                 $where  .= " and $cxctime > '$timetk' and $cxctime < '$timetj'";
 
-             }
 
- 			if($cz)
 
-             {
 
-                 $where  .= " and cz like '%|".$cz."|%'";
 
-             }
 
- 			if($czwarehouse != '')
 
-             {
 
- 				$where  .= " and czwarehouse = '$czwarehouse'";
 
-             }
 
- 			$data = array();
 
- 			$datafy = array();
 
- 			$j = 0;
 
- 			$wh = array();
 
- 			$w = $this->warehouse->find_all('1=1','id,title');
 
- 			foreach ($w as $v) 
 
- 			{
 
- 				$wh[$v['id']] = $v['title'];
 
- 			}
 
- 			$info_list = $this->systemwigsout->find_all($where.' and ('.rtrim($wid,'or').')','type,number,shipremarks,printtime,fg');
 
- 			foreach ($info_list as $key=>$value)
 
- 		    {
 
- 				$info_list[$key]['type'] = $wh[$value['type']];
 
- 				if($value['fg'] > 0)
 
- 				{
 
- 					$info_list[$key]['fg'] = '返工';
 
- 				}
 
- 				else
 
- 				{
 
- 					$info_list[$key]['fg'] = '';
 
- 				}
 
- 				$dd = $this->fullordersmt->get_number($value['number']);
 
- 				if(!$dd)
 
- 				{
 
- 					$dd = $this->fullorder->get_number($value['number']);
 
- 				}
 
- 				if(!$dd)
 
- 				{
 
- 					$dd = $this->fullordertt->get_number($value['number']);
 
- 				}
 
- 				$classid = $this->classid->sku();
 
- 				$info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
 
- 				$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('<','>'),$value['shipremarks']);
 
- 				//$this->systemwigsout->save(array('xz'=>1),$value['id']);
 
- 				$fpdata = array();$bm = '03';
 
- 				if(stripos($dd['fpdata'],';') !== false)
 
- 				{
 
- 		   		    $fpdata = explode(';',rtrim($dd['fpdata'],';'));
 
- 		            foreach ($fpdata as $ke=>$va)
 
- 		            {
 
- 						$pm = $classid;
 
- 		                $jm = $classid;
 
- 						$bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
 
- 						$title = '';
 
- 						$va = str_replace(array('-163-','-164-','-165-','-166-'),'-',$va);
 
- 			            $fg = explode('|',$va);
 
- 						if(stripos($fg[0],',') !== false)
 
- 						{
 
- 							$ft = explode(',',$fg[0]);
 
- 			    			$features = explode('-',trim($ft[1],'-'));
 
- 							$features[] = $ft[0];
 
- 						}
 
- 						else
 
- 						{
 
- 							$features = explode('-',trim($fg[0],'-'));
 
- 						}
 
- 						foreach ($features as $v)
 
- 		                {
 
- 							if(isset($typeclass[$v]))
 
- 							{
 
- 								if($typeclass[$v]['bm'] != '')
 
- 								{
 
- 									$bmpx[$typeclass[$v]['classid']] = $typeclass[$v]['bm'];
 
- 								}
 
- 							}
 
- 							if($v != 0)
 
- 							{
 
- 								if(isset($typeclass[$v]))
 
- 								{
 
- 									if($typeclass[$v]['title'] == '9A')
 
- 									{
 
- 										$pm[$typeclass[$v]['classid']] = '9A';
 
- 									}
 
- 									else if($typeclass[$v]['title'] == '10A')
 
- 									{
 
- 										$pm[$typeclass[$v]['classid']] = '10A';
 
- 									}
 
- 									else
 
- 									{
 
- 										$clzh = $typeclass[$v]['zh'];
 
- 										if(stripos($typeclass[$v]['zh'],'|') !== false)
 
- 										{
 
- 											$clzh = explode('|',rtrim($typeclass[$v]['zh'],'|'));
 
- 											$clzh = $clzh[0];
 
- 										}
 
- 										$pm[$typeclass[$v]['classid']] = $clzh;
 
- 									}
 
- 								}
 
- 								if(isset($typeclass[$v]))
 
- 								{
 
- 									if($typeclass[$v]['jm'])
 
- 									{
 
- 						    			$jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
 
- 									}
 
- 								}
 
- 							}
 
- 						}
 
- 						$jm = array_filter($jm);//去除空值
 
- 						$jm = implode("-",$jm);
 
- 						$pm = array_filter($pm);//去除空值
 
- 						$zh = implode(" ",$pm);
 
- 						$zh = preg_replace("/\r\n|\r|\n/",'',trim($zh,' '));
 
- 						$dtnr = explode('-',trim($fg[0],'-'));
 
- 						$dj = '';$md = '';$ys = '';$title = '';
 
- 						foreach ($dtnr as $v)
 
- 		                {
 
- 							if(isset($typeclass[$v]))
 
- 							{
 
- 								if($typeclass[$v]['classid'] == '15')
 
- 								{
 
- 							        $title = $typeclass[$v]['title'];
 
- 								}
 
- 								else if($typeclass[$v]['classid'] == '8')
 
- 								{
 
- 							        $ys = $typeclass[$v]['title'];
 
- 								}
 
- 								else if($typeclass[$v]['classid'] == '13')
 
- 								{
 
- 							        $dj = $typeclass[$v]['title'];
 
- 								}
 
- 								else if($typeclass[$v]['classid'] == '10')
 
- 								{
 
- 							        $md = $typeclass[$v]['title'];
 
- 								}
 
- 							}
 
- 						}
 
- 						$fpdata[$ke] = array($zh,$fg[5],$dj,$ys,$title,$md,$jm,$bm.implode("",$bmpx),$fg[2]);//内容,尺寸,等级,颜色,数量,密度
 
-                     }
 
- 				}
 
- 				$info_list[$key]['fpdata'] = $fpdata;
 
-             }
 
- 			$transfer = $this->transfer->read($cz);
 
- 			$title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj).' '.$transfer['title'].'仓统计表'; 
 
-             $titlename = "<table border=1>
 
-            <tr>
 
- 		    <td>仓库</td>
 
-             <td>编号</td>
 
-             <td>仓库品名</td>
 
-             <td>打印时间</td>
 
- 			<td>状态</td>
 
- 			<td>
 
- 			<table border=1>
 
-             <tr><td colspan='10' align='center'>订单产品信息</td></tr>
 
-             <tr>
 
- 			<td>产品名称</td>
 
- 			<td>尺寸</td>
 
- 			<td>等级</td>
 
- 			<td>颜色</td>
 
- 			<td>花型</td>
 
- 			<td>密度</td>
 
- 			<td>用友料号</td>
 
- 			<td>用友编码</td>
 
- 			<td>数量</td>
 
- 			<td>总数量</td>
 
-             </tr>
 
-             </table>
 
- 			</td>
 
-             </tr>
 
-             </table>"; 
 
-             $filename = $title.".xls"; 
 
- 			$tail = "\n";
 
-             $this->excel->get_fz($info_list,$titlename,$filename,$tail);
 
- 	    }
 
- 	}
 
- 	
 
- 	public function _add()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['number']))
 
- 		{
 
- 			$where = "gtime = '".date('Ymd',time())."'";
 
- 			$number = $this->input->post('number',true);
 
- 			$id = $this->input->post('id',true);
 
- 			$type = $this->input->post('type',true);
 
- 			$time = $this->input->post('time',true);
 
- 			$time = strtotime($time);
 
- 			if($id)
 
-             {
 
- 				if($type)
 
-             	{
 
-                 	$where  .= " and type = '$type'";
 
-            		}
 
- 				else
 
- 				{
 
- 					$uw = '';
 
- 				    $u = $this->user->get_api($id);
 
- 				    $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;
 
- 				}
 
-             }
 
- 			if(!$number)
 
- 			{
 
- 				echo json_encode(array('msg'=>'编号不能为空!','success'=>false));exit;
 
- 			}
 
- 			if(!$type)
 
- 			{
 
- 				echo json_encode(array('msg'=>'请选择需要录入数据的仓库!','success'=>false));exit;
 
- 			}
 
- 			$nu = $this->fullorder->get_number($number);
 
- 			if(!$nu)
 
- 			{
 
- 				$nu = $this->fullordersmt->get_number($number);
 
- 			}
 
- 			if(!$nu)
 
- 			{
 
- 				$nu = $this->fullordertt->get_number($number);
 
- 			}
 
- 			if(!$nu)
 
- 			{
 
- 				echo json_encode(array('msg'=>'错误!未找到此编号的订单','success'=>false));exit;
 
- 			}
 
- 			if($nu['printtime'] == '0')
 
- 			{
 
- 				echo json_encode(array('msg'=>'错误,此单没有打印时间!请联系店员核实','success'=>false));exit;
 
- 			}
 
- 			
 
- 			$data = 0;
 
- 			$count = $this->systemwigsout->find_all($where);
 
- 			foreach ($count as $v) 
 
- 			{
 
- 				$data += $v['quantity']; 
 
- 			}
 
- 			$systemwigsout = $this->systemwigsout->get_number($number);
 
- 			if($systemwigsout)
 
- 			{
 
- 				$this->systemwigsout->save(array('quantity'=>$systemwigsout['quantity']+1),$systemwigsout['id']);
 
- 				echo json_encode(array('title'=>'添加成功','msg'=>$data+1,'music'=>'1','success'=>true));exit;
 
- 			}
 
- 			else
 
- 			{
 
- 				if($this->systemwigsout->insert(array('type'=>$type,'number'=>$number,'shipremarks'=>$nu['shipremarks'],'printtime'=>$nu['printtime'],'quantity'=>1,'gtime'=>date('YmdH',time()),'time'=>time())))
 
- 				{
 
- 					echo json_encode(array('title'=>'添加成功','msg'=>$data+1,'music'=>'1','success'=>true));exit;
 
- 				}
 
- 				else
 
- 				{
 
- 					echo json_encode(array('msg'=>'数据写入失败,请重试!','success'=>false));exit;
 
- 				}
 
- 			}
 
- 			
 
- 		}
 
- 	}
 
- 	
 
- 	public function _del()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 		}
 
- 		if(stripos($user['userid'],'peihuo') !== false)
 
- 		{
 
- 			$kx = 1;
 
- 		}
 
- 		else if(stripos($user['userid'],'gaozhen') !== false)
 
- 		{
 
- 			$kx = 2;
 
- 		}
 
- 		else if(stripos($user['userid'],'wancheng') !== false)
 
- 		{
 
- 			$kx = 3;
 
- 		}
 
- 		else if(stripos($user['userid'],'qvfa') !== false)
 
- 		{
 
- 			$kx = 4;
 
- 		}
 
- 		else if(stripos($user['userid'],'qianchuli') !== false)
 
- 		{
 
- 			$kx = 5;
 
- 		}
 
- 		else if(stripos($user['userid'],'houchuli') !== false)
 
- 		{
 
- 			$kx = 6;
 
- 		}
 
- 		else if(stripos($user['userid'],'faxingshi') !== false)
 
- 		{
 
- 			$kx = 7;
 
- 		}
 
- 		else if(stripos($user['userid'],'baozhuang') !== false)
 
- 		{
 
- 			$kx = 8;
 
- 		}
 
- 		else if(stripos($user['userid'],'sheji') !== false)
 
- 		{
 
- 			$kx = 9;
 
- 		}
 
- 		else if(stripos($user['userid'],'piaokou') !== false)
 
- 		{
 
- 			$kx = 10;
 
- 		}
 
- 		else if(stripos($user['userid'],'ck') !== false)
 
- 		{
 
- 			$kx = 11;
 
- 		}
 
- 		if(isset($post['delarr']))  
 
- 		{
 
-             $id_arr = $this->input->post('delarr');
 
-             $id_arr =  explode(',',rtrim($id_arr,','));
 
-             if(!$id_arr)
 
-             {
 
-                 echo json_encode(array('msg'=>'未选择需要删除的内容!','success'=>false));exit;
 
-             }
 
- 			if(count($id_arr) > 1)
 
-             {
 
-                 echo json_encode(array('msg'=>'每次只能删除一个!','success'=>false));exit;
 
-             }
 
-             //循环删除记录
 
- 			$a=0;
 
-             foreach ($id_arr as $v) 
 
- 		    {
 
- 				$systemwigsout = $this->systemwigsout->read($v);
 
- 				$czarray = explode('|',trim($systemwigsout['cz'],'|'));
 
- 				$cztimearray = explode('|',trim($systemwigsout['cztime'],'|'));
 
- 				if(count($czarray) == 1)
 
- 				{
 
- 					$this->systemwigsout->remove($v);
 
- 					continue;
 
- 				}
 
- 				foreach ($czarray as $ka=>$va) 
 
- 		        {
 
- 					if($va == $kx)
 
- 					{
 
- 						unset($czarray[$ka]);
 
- 						unset($cztimearray[$ka]);
 
- 					}
 
- 				}
 
- 				$cz = "|".implode("|",$czarray)."|";
 
- 				$cztime = "|".implode("|",$cztimearray)."|";
 
- 				$this->systemwigsout->save(array('cz'=>$cz,'cztime'=>$cztime),$v);
 
-             }
 
- 			echo json_encode(array('success'=>true));exit;
 
- 		}
 
- 	}
 
- 	
 
- 	public function _hb()
 
- 	{
 
- 		$dataorder = array();
 
- 		/*  订单加入键值-k  */
 
- 		$fdata = $this->fullorder->find_all('dtime > "'.(time()-50*24*3600).'" and printtime > 0','number,orderinfo,fpdata,shipremarks');
 
- 		foreach ($fdata as $v) 
 
- 		{
 
- 			$dataorder[$v['number']] = $v;
 
- 		}
 
- 		$sdata = $this->fullordersmt->find_all('dtime > "'.(time()-50*24*3600).'" and printtime > 0','number,orderinfo,fpdata,shipremarks');
 
- 		foreach ($sdata as $v) 
 
- 		{
 
- 			$dataorder[$v['number']] = $v;
 
- 		}
 
- 		$tdata = $this->fullordertt->find_all('dtime > "'.(time()-50*24*3600).'" and printtime > 0','number,orderinfo,fpdata,shipremarks');
 
- 		foreach ($sdata as $v) 
 
- 		{
 
- 			$dataorder[$v['number']] = $v;
 
- 		}
 
- 		/*  匹配ID加入  */
 
- 		$tc = array();$ztc = array();$tclass = array();
 
- 		$typeclass = $this->typeclass->find_all();
 
- 		foreach ($typeclass as $v) 
 
- 		{
 
- 			$ztc[$v['id']] = $v['zh'];
 
- 			$tc[$v['id']] = $v['title'];
 
- 			$tclass[$v['id']] = $v['classid'];
 
- 		}
 
- 		
 
- 		$dir = '/data/excel/'.date('Ymd',time()).'/';
 
- 		$config['upload_path'] = '.'.$dir ;
 
- 		$config['file_name'] = date('Ymd_His_',time()).rand(1000,9999);
 
-         $config['allowed_types'] = 'xls|xlsx|csv';
 
-         $config['max_size'] = 10240;
 
- 		$this->load->library('upload', $config);
 
- 		$this->upload->initialize($config);
 
-         if ($this->upload->do_upload('userfile'))
 
-         {
 
- 			$full_path = $dir.$this->upload->data('file_name');
 
- 			$fileName = '.' . $full_path;
 
-             if (!file_exists($fileName)) 
 
- 			{
 
- 				echo json_encode(array('msg'=>"上传失败,请重试",'success'=>false));exit;
 
-             }
 
- 			else
 
- 			{
 
- 				require_once "./data/excel/PHPExcel/IOFactory.php";
 
- 				$phpExcel = PHPExcel_IOFactory::load($fileName);// 载入当前文件
 
- 				$phpExcel->setActiveSheetIndex(0);// 设置为默认表
 
- 				$sheetCount = $phpExcel->getSheetCount();// 获取表格数量
 
- 				$row = $phpExcel->getActiveSheet()->getHighestRow();// 获取行数
 
- 				$column = $phpExcel->getActiveSheet()->getHighestColumn();// 获取列数
 
- 				++$column;//如果列数大于26行
 
- 				$list = array();
 
- 				for ($i = 2; $i <= $row; $i++) // 行数循环
 
- 				{
 
- 					$data = array();
 
-                     for ($c = 'A'; $c != $column; $c++)  // 列数循环
 
- 	                {
 
- 						$data[] = $phpExcel->getActiveSheet()->getCell($c . $i)->getValue();
 
-                     }
 
- 					$list[] = $data;
 
-                 }
 
- 			}
 
- 			$ed = array();$i = 0;$j = 0;$dcdata = array();$yc = '';
 
- 			$cmf_arr = array_column($list, '1');
 
-             array_multisort($cmf_arr, SORT_ASC, $list);
 
- 		    foreach ($list as $key=>$value)
 
- 		    {
 
- 				$number = $value['1'];
 
- 				$bbtime = $value['7'];
 
- 				if(stripos($number,'QM') !== false)
 
- 				{
 
- 					continue;
 
- 				}
 
- 				if(isset($dataorder[$number])) 
 
- 				{
 
- 					$thisnumber = $dataorder[$number];$thisshipremarks = array();
 
- 					if(stripos($thisnumber['fpdata'],';') !== false)
 
- 					{
 
- 		   		    	$fpdata = explode(';',rtrim($thisnumber['fpdata'],';'));
 
- 		            	foreach ($fpdata as $ke=>$va)
 
- 		            	{
 
- 							$title = '';
 
- 			            	$fg = explode('|',$va);
 
- 							$fg[0] = str_replace(array('163-','164-','165-','166-','-0-'),array('','','','','-'),$fg[0]);
 
- 							$cp = explode('-',rtrim($fg[0],'-'));
 
- 							if(isset($cp[5]))
 
- 							{
 
- 							   $tt = $ztc[$cp[5]];
 
- 							}
 
- 							else
 
- 							{
 
- 								$tt = '';
 
- 							}
 
- 							$md = '';
 
- 							foreach ($cp as $v)
 
- 		                	{
 
- 								if(!isset($tclass[$v]))
 
- 								{
 
- 									continue;
 
- 								}
 
- 								if($tclass[$v] == '10')
 
- 								{
 
- 									$md = $tc[$v];
 
- 								}
 
- 							}
 
- 							if(isset($cp[4]))
 
- 							{
 
- 							    $dchx = $tc[$cp[4]];
 
- 							}
 
- 							else
 
- 							{
 
- 								 $dchx = ' ';
 
- 							}
 
- 							$thisshipremarks[] = array($tt,$tc[$cp[3]],$md,$dchx,$fg[5],$fg[2]);//头套种类,颜色,密度,花型,尺寸,数量
 
-                     	}
 
- 					}
 
- 					$thisnumber['shipremarks'] = str_replace(array('<','>'),array('<','>'),$thisnumber['shipremarks']);
 
- 					$dcdata[] = array('number'=>$thisnumber['number'],'time'=>$bbtime,'shipremarks'=>$thisnumber['shipremarks'],'fpdata'=>$thisshipremarks);
 
- 				}
 
- 				else
 
- 				{
 
- 					$ed[] = array($number.'-系统未找到此订单信息');
 
- 					$i++;
 
- 					continue;
 
- 				}
 
- 			}
 
- 			if($i > 0)
 
- 			{
 
- 				$yc = $i.'条异常';
 
- 			}
 
- 			$title = date('Y-m-d H:i:s',time())." 产品详细信息"; 
 
-             $titlename = "<table border=1>
 
-             <tr><th colspan='29' align='left'><h3>".$title."<h3></th></tr>
 
-             <tr>
 
-             <td>订单编号</td>
 
-             <td>配货时间</td>
 
-             <td>仓库品名</td>
 
-             <td>
 
-             <table border=1>
 
-             <tr><td colspan='4' align='center'>订单产品信息</td></tr>
 
-             <tr>
 
- 			<td>种类</td>
 
- 			<td>颜色</td>
 
- 			<td>密度</td>
 
- 			<td>花型</td>
 
- 			<td>尺寸</td>
 
- 			<td>数量</td>
 
-             </tr>
 
-             </table>
 
-             </td>
 
- 			<td>总条数</td>
 
-             </tr>
 
-             </table>"; 
 
-             $filename = $title.".xls"; 
 
- 			$tail = "\n"; 
 
-             $downexcel = $this->get_fz($dcdata,$titlename,$filename,$tail);
 
- 			$time = date('Ymd',time());
 
- 				$dir = '/data/excel/'.$time.'/';
 
- 				$file_name = $title;
 
- 				if(!is_dir('.'.$dir))mkdir('.'.$dir,0777);
 
- 				$myfile = fopen(".".$dir.$file_name.".xls", "w") or die();
 
- 				fwrite($myfile,$downexcel);
 
- 				fclose($myfile);
 
- 				$goexcel = $dir.$file_name.'.xls';
 
- 				echo json_encode(array('msg'=>'操作成功 '.$yc,'goexcel'=>$goexcel,'success'=>true));exit;
 
- 			
 
-         }
 
- 		else
 
- 		{
 
- 			echo json_encode(array('msg'=>'上传失败!','t'=>$this->upload->display_errors(),'success'=>false));exit;
 
- 		}
 
-     }
 
- 	
 
- 	public function get_fz($info_list,$titlename,$filename,$tail)
 
- 	{
 
- 		$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 .= $titlename; 
 
- 		$str .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'>"; 
 
- 		foreach ($info_list as $key=>$value) 
 
- 		{ 
 
- 		    if($value['fpdata'] == '')
 
- 				{
 
- 					continue;
 
- 				}
 
- 		    $str .= "<tr>";
 
- 		    foreach ($value as $ke=>$va) 
 
- 			{
 
- 				if($ke == 'orderinfo' || $ke == 'waybill')
 
- 				{
 
- 					$str .= "<td align='left' style='vnd.ms-excel.numberformat:@'>".$va."</td>";
 
- 				}
 
- 				else if($ke != 'fpdata' && $ke != 'hl' && $ke != 'currencytitle')
 
- 				{
 
- 		            $str .= "<td align='left'>".$va."</td>"; 
 
- 				}
 
- 		    }
 
- 			$str .= "<td><table border=1>";
 
- 			$a = 0;
 
- 			foreach ($value['fpdata'] as $k=>$v) 
 
- 		    {
 
- 				$vd = '';
 
- 				foreach ($v as $vv) 
 
- 		        {
 
- 					$vd .= "<td>".$vv."</td>";
 
- 				}
 
- 				$str .= "<tr>".$vd."</tr>";
 
- 				$endv = is_numeric(end($v))?end($v):0;
 
- 				$a = $a + $endv;
 
- 			}
 
- 			$str .= "</table></td>"; 
 
- 			$str .= "<td>".$a."</td>";
 
- 		    $str .= "</tr>\n"; 
 
- 		}
 
- 		$str .= $tail;
 
- 		$str .= "</table></body></html>"; 
 
- 		return $str; 
 
- 		//return $str;
 
- 	}
 
- }
 
 
  |