load->library('session'); $this->load->_model('Model_typeclass','typeclass'); $this->load->_model('Model_fullorder','fullorder'); $this->load->_model('Model_fullordertt','fullordertt'); $this->load->_model('Model_fullordersmt','fullordersmt'); $this->load->_model('Model_shop','shop'); $this->load->_model('Model_user','user'); $this->load->_model('Model_excel','excel'); } //定义方法的调用规则 获取URI第二段值 public function _remap($arg,$arg_array) { if($arg == 'data') { $this->_data(); } else if($arg == 'hd') { $this->_hd(); } else if($arg == 'qm') { $this->_qm(); } else if($arg == 'bh') { $this->_bh(); } else if($arg == 'hsp') { $this->_hsp(); } else if($arg == 'list') { $this->_list(); } else if($arg == 'listread') { $this->_listread(); } else { $this->_index(); } } public function _index() { if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = ""; $usersp = explode('|',trim($user['shop'],'|')); foreach ($usersp as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or')); $this->data['wlshop'] = $wlshop; $this->_Template('systemdownload',$this->data); } public function getCombinationToString($val) { static $res = array(); if(empty($res)) { $res = $val; } else { $list = array(); foreach ($res as $k => $v) { foreach ($val as $key => $value) { $list[] = $v.','.$value; } } $res = $list; } return $res; } public function _data() { if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = "";$excelshop=""; $usersp = explode('|',trim($user['shop'],'|')); foreach ($usersp as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } $userexcel = explode('|',trim($user['excelshop'],'|')); foreach ($userexcel as $value) { $excelshop .= " shop = ".$value." or"; } if($excelshop != "") { $excelshop = "(".rtrim($excelshop,'or').")"; } } $post = $this->input->post(NULL, TRUE); if(isset($_GET['category'])) { $timetk = $this->input->get('timetk',true); $timetj = $this->input->get('timetj',true); $color = $this->input->get('color',true); $lowe = $this->input->get('lowe',true); $size = $this->input->get('size',true); $grade = $this->input->get('grade',true); $lacetype = $this->input->get('lacetype',true); $category = $this->input->get('category',true); $haircap = $this->input->get('haircap',true); $shop = $this->input->get('shop',true); $density = $this->input->get('density',true); $time = $this->input->get('time',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $cw = array(); $class = array();$classdata = array();$lx = array();$pm = array(); $a = $this->typeclass->find_all('classid=6 or classid=7 or classid=8 or classid=10 or classid=12 or classid=13 or classid=19 or classid=20 or classid=21 or classid=22 or classid=23 or classid=24'); foreach ($a as $val) { $class[] = '-'.$val['id'].'-'; } $b = $this->typeclass->find_all(); foreach ($b as $val) { $classdata[$val['id']] = $val['title']; $lx[$val['id']] = $val['classid']; $pm[$val['id']] = $val['zh']; } //Closure wigs $fpdata = ''; $category = explode('|',trim($category,'|')); foreach ($category as $value) { $fpdata .= "fpdata like '%".$value."%' or "; } if(count($category) > 1) { $fpdata = "(".trim($fpdata,' or ').")"; } else { $fpdata = trim($fpdata,' or '); } $where = ""; if($color) { $where .= "fpdata like '%$color%' and "; } if($size) { $where .= "fpdata like '%$size%' and "; } if($grade) { $where .= "fpdata like '%$grade%' and "; } if($shop) { $where .= "shop = '$shop' and "; } else { $where .= $excelshop." and "; } if($lowe) { $arraydata[] = explode(',',rtrim($lowe,',')); } else { $arraydata[] = array('z'); } if($density) { $arraydata[] = explode(',',rtrim($density,',')); } else { $arraydata[] = array('z'); } if($lacetype) { $arraydata[] = explode(',',rtrim($lacetype,',')); } else { $arraydata[] = array('z'); } if($haircap) { $arraydata[] = explode(',',rtrim($haircap,',')); } else { $arraydata[] = array('z'); } $res = array(); foreach ($arraydata as $k => $v) { $res = $this->getCombinationToString($v); } $warp = array();$cs = array(); if(!$res) { $res[0] = 1; } foreach ($res as $resval) { $wheredata = '';$btpm = ''; $resval = explode(',',rtrim($resval,',')); $lowe = $resval[0];$density = $resval[1];$lacetype = $resval[2];$haircap = $resval[3]; if($lowe != 'z') { $wheredata .= "fpdata like '%$lowe%' and "; $btpm .= $pm[$lowe]; } if($density != 'z') { $wheredata .= "fpdata like '%$density%' and "; $btpm .= $pm[$density]; } if($lacetype != 'z') { $wheredata .= "fpdata like '%$lacetype%' and "; } if($haircap != 'z') { $wheredata .= "fpdata like '%$haircap%' and "; $btpm .= $pm[$haircap]; } $dataa = $this->fullorder->find_all($wheredata.$where.$time." > '$timetk' and ".$time." < '$timetj' and ".$fpdata,'number,fpdata','id desc'); $datab = $this->fullordersmt->find_all($wheredata.$where.$time." > '$timetk' and ".$time." < '$timetj' and ".$fpdata,'number,fpdata','id desc'); $datac = $this->fullordertt->find_all($wheredata.$where.$time." > '$timetk' and ".$time." < '$timetj' and ".$fpdata,'number,fpdata','id desc'); $data = array_merge($dataa,$datab,$datac); //echo $where."librarytime > '$timetk' and librarytime < '$timetj' and ".$fpdata; //echo "
";
				//print_r($where);
				//exit;
				$cs = array();
				$pd = '';
		 		$p = $class;
  				$resdata = array();
  				foreach ($data as $val)
  				{
	  				$f = explode(';',trim($val['fpdata'],';'));
	  				foreach ($f as $v)
      				{
						if($color)
            			{
                			if(stripos($v,'-'.$color.'-') === false)
							{
								continue;
							}
            			}
						if($lowe != 'z')
            			{
                			if(stripos($v,'-'.$lowe.'-') === false)
							{
								continue;
							}
           		 		}
						if($size)
            			{
                			if(stripos($v,$size.',') === false)
							{
								continue;
							}
            			}
						if($grade)
            			{
                			if(stripos($v,'-'.$grade.'-') === false)
							{
								continue;
							}
            			}
						if($lacetype != 'z')
            			{
							$cs[] = $lacetype;
                			if(stripos($v,'-'.$lacetype.'-') === false)
							{
								continue;
							}
            			}
						if($density != 'z')
            			{
                			if(stripos($v,'-'.$density.'-') === false)
							{
								continue;
							}
            			}
						if($haircap != 'z')
            			{
                			if(stripos($v,'-'.$haircap.'-') === false)
							{
								continue;
							}
            			}
						$i = 0;
						foreach ($category as $value) 
		            	{
							if(stripos($v,'-'.$value.'-') !== false)
							{
								$i++;
							}
			        	}
						if($i > 0)
		   				{
							$e = explode('|',$v);
							$d = str_replace($p,'-',$e[0]);
							$q = str_replace(array('-163-','-164-','-165-','-166-'),'-',$e[0]);
							$q = explode('-',trim($q,'-'));
							$c = explode(',',$e[0]);
							if(!isset($resdata[$d]))
							{
			   					if(stripos($v,'-126-') !== false)
			   					{
									if(!isset($q[4]) || !isset($pm[$q[4]]))
									{
										continue;
									}
				                	@$resdata[$d] = array($e[2],rtrim($classdata[$c[0]],'inch'),$q[4],1);//数量、尺寸、曲度、无蕾丝颜色
			  					}
								else if(stripos($v,'-127-') !== false)
			   					{
			       					if(isset($q[9]))
				   					{
					   					$s = ($q[9] != 68 && $q[9] != 69)?1:2; 
				   					}
				   					else
				  					{
										$s = 1;
				   					}
				   					$bt = (!isset($q[8]))?$q[5]:$q[8];//360类型的蕾丝尺寸直接显示为类型名称
				   					if($lx[$q[5]] == '27')//如果是发块类型
				   					{
				       					$resdata[$d] = array($e[2],rtrim($classdata[$c[0]],'inch'),$q[5],$bt,$s);//数量、尺寸、类型、蕾丝尺寸、蕾丝颜色
				  					 }
			  					}
			   					else
			   					{
				   					if(isset($q[8]))
				   					{
					   					$s = ($q[8] != 68 && $q[8] != 69)?1:2; 
				   					}
				  					else
				  					{
					   					$s = 1;
				   					}
				   					if(@$lx[$q[5]] == '18')//如果是头套种类
				   					{
				       					$resdata[$d] = array($e[2],rtrim($classdata[$c[0]],'inch'),$q[5],$s);//数量、尺寸、头套种类、蕾丝颜色
				   					}
			   					}
							}
							else
							{
								if(isset($e[2]))
								{
							    	if(is_array($e[2]) || !is_numeric($e[2]))
							    	{
								    	$cw[] = $v;
								    	continue;
							    	}
							    	else
							    	{
               					    	 $resdata[$d][0] += $e[2];
							    	}
								}
							}
		   				}
	  				 }
 				 }
				 $data =  array();
				 foreach ($resdata as $v)
				 {
					 if(isset($v[4]))
					 {
						 if(!isset($data[$v[1].$v[2].$v[3].$v[4]]))
						 {
						 	$data[$v[1].$v[2].$v[3].$v[4]] = array($v[0],$v[1],$pm[$v[2]],$classdata[$v[3]],$v[4]);//$classdata[$v[2]]英文名,$pm[$v[2]]中文名
						 }
						 else
						 {
						 	$data[$v[1].$v[2].$v[3].$v[4]][0] += $v[0];
						 }
					 }
					 else
					 {
						 if(!isset($data[$v[1].$v[2].$v[3]]))
						 {
							 $data[$v[1].$v[2].$v[3]] = array($v[0],$v[1],$pm[$v[2]],$v[3]);//$classdata[$v[2]]英文名,$pm[$v[2]]中文名
						 }
						 else
						 {
						 	$data[$v[1].$v[2].$v[3]][0] += $v[0];
						 }
					 }
				 }
				 $list = array();
				 foreach ($data as $v)
				 {
				 	$x = (isset($v[4]))?$v[3]:$v[2];
	    			 if(!isset($list[$v[2]]))
					 {
						 $list[$v[2]] = array();
						 if(!isset($list[$v[2]][$x]))
		    			 {
							 $list[$v[2]][$x] = array();
							 $list[$v[2]][$x][] = $v;
						 }
						 else
						 {
						 	$list[$v[2]][$x][] = $v;
						 }
					 }
					 else
					 {
						 if(!isset($list[$v[2]][$x]))
		   				 {
						 	$list[$v[2]][$x] = array();
						 	$list[$v[2]][$x][] = $v;
						 }
						 else
						 {
						 	$list[$v[2]][$x][] = $v;
						 }
					 }
				 }
				 foreach ($list as $key=>$val)
				 {
					 foreach ($val as $k=>$va)
    				 {
						 $dd = array();
						 foreach ($va as $v)
        				 {
		    			 	$ss = (!isset($v[4]))?$v[3]:$v[4];
		   					 if(!isset($dd[$v['1']]))
		    				 {
			   				 	$dd[$v['1']] = array();
							 	$dd[$v['1']][$ss] = $v;
		   					 }
		    				 else
		    				 {
			    			 	$dd[$v['1']][$ss] = $v;
		    				 }
						 }
						 ksort($dd);
						 $list[$key][$k] = $dd;
    				 }
				 }
				 $warp[] = array($btpm,$list);
			}
			//echo count($list);
			//echo "
";
			//print_r($warp);
			//exit;

			$str = "
       	 	
        	
        	";
			foreach ($warp as $list)
			{
			foreach ($list[1] as $key=>$val)
			{
				$btnum = count($val);
				$str .= "";
				foreach ($val as $k=>$v)
            	{
            		$str .="";
				}
           		$str .=  "
".$k.' '.$list[0]." 中棕 透明
"; $str .= ""; foreach ($val as $k=>$v) { $str .= ""; } $str .= "
"; foreach ($v as $sk=>$s) { $xk1 = (isset($s[1]))?$s[1][0]:0; $xk2 = (isset($s[2]))?$s[2][0]:0; $str .=""; } $str .= "
".$sk."".$xk1."".$xk2."
"; } } $str .= ""; header( "Content-Type: application/vnd.ms-excel; name='excel'" ); header( "Content-type: application/octet-stream" ); header( "Content-Disposition: attachment; filename=".time().'.xls' ); header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); header( "Pragma: no-cache" ); header( "Expires: 0" ); exit($str); } } public function _hd()//区分HD和其他颜色 { if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = "";$excelshop=""; $usersp = explode('|',trim($user['shop'],'|')); foreach ($usersp as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } $userexcel = explode('|',trim($user['excelshop'],'|')); foreach ($userexcel as $value) { $excelshop .= " shop = ".$value." or"; } if($excelshop != "") { $excelshop = "(".rtrim($excelshop,'or').")"; } } $post = $this->input->post(NULL, TRUE); if(isset($_GET['category'])) { $timetk = $this->input->get('timetk',true); $timetj = $this->input->get('timetj',true); $color = $this->input->get('color',true); $lowe = $this->input->get('lowe',true); $size = $this->input->get('size',true); $grade = $this->input->get('grade',true); $lacetype = $this->input->get('lacetype',true); $category = $this->input->get('category',true); $haircap = $this->input->get('haircap',true); $shop = $this->input->get('shop',true); $density = $this->input->get('density',true); $time = $this->input->get('time',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $cw = array(); $class = array();$classdata = array();$lx = array();$pm = array(); $a = $this->typeclass->find_all('classid=6 or classid=7 or classid=8 or classid=10 or classid=12 or classid=13 or classid=19 or classid=20 or classid=21 or classid=22 or classid=23 or classid=24'); foreach ($a as $val) { $class[] = '-'.$val['id'].'-'; } $b = $this->typeclass->find_all(); foreach ($b as $val) { $classdata[$val['id']] = $val['title']; $lx[$val['id']] = $val['classid']; $pm[$val['id']] = $val['zh']; } //Closure wigs $fpdata = ''; $category = explode('|',trim($category,'|')); foreach ($category as $value) { $fpdata .= "fpdata like '%".$value."%' or "; } if(count($category) > 1) { $fpdata = "(".trim($fpdata,' or ').")"; } else { $fpdata = trim($fpdata,' or '); } $where = ""; if($color) { $where .= "fpdata like '%$color%' and "; } if($size) { $where .= "fpdata like '%$size%' and "; } if($grade) { $where .= "fpdata like '%$grade%' and "; } if($shop) { $where .= "shop = '$shop' and "; } else { $where .= $excelshop." and "; } if($lowe) { $arraydata[] = explode(',',rtrim($lowe,',')); } else { $arraydata[] = array('z'); } if($density) { $arraydata[] = explode(',',rtrim($density,',')); } else { $arraydata[] = array('z'); } if($lacetype) { $arraydata[] = explode(',',rtrim($lacetype,',')); } else { $arraydata[] = array('z'); } if($haircap) { $arraydata[] = explode(',',rtrim($haircap,',')); } else { $arraydata[] = array('z'); } $res = array(); foreach ($arraydata as $k => $v) { $res = $this->getCombinationToString($v); } $warp = array();$cs = array(); if(!$res) { $res[0] = 1; } foreach ($res as $resval) { $wheredata = '';$btpm = ''; $resval = explode(',',rtrim($resval,',')); $lowe = $resval[0];$density = $resval[1];$lacetype = $resval[2];$haircap = $resval[3]; if($lowe != 'z') { $wheredata .= "fpdata like '%$lowe%' and "; $btpm .= $pm[$lowe]; } if($density != 'z') { $wheredata .= "fpdata like '%$density%' and "; $btpm .= $pm[$density]; } if($lacetype != 'z') { $wheredata .= "fpdata like '%$lacetype%' and "; } if($haircap != 'z') { $wheredata .= "fpdata like '%$haircap%' and "; $btpm .= $pm[$haircap]; } $dataa = $this->fullorder->find_all($wheredata.$where.$time." > '$timetk' and ".$time." < '$timetj' and ".$fpdata,'number,fpdata','id desc'); $datab = $this->fullordersmt->find_all($wheredata.$where.$time." > '$timetk' and ".$time." < '$timetj' and ".$fpdata,'number,fpdata','id desc'); $datac = $this->fullordertt->find_all($wheredata.$where.$time." > '$timetk' and ".$time." < '$timetj' and ".$fpdata,'number,fpdata','id desc'); $data = array_merge($dataa,$datab,$datac); //echo $where."librarytime > '$timetk' and librarytime < '$timetj' and ".$fpdata; //echo "
";
				//print_r($where);
				//exit;
				$cs = array();
				$pd = '';
		 		$p = $class;
  				$resdata = array();
  				foreach ($data as $val)
  				{
	  				$f = explode(';',trim($val['fpdata'],';'));
	  				foreach ($f as $v)
      				{
						if($color)
            			{
                			if(stripos($v,'-'.$color.'-') === false)
							{
								continue;
							}
            			}
						if($lowe != 'z')
            			{
                			if(stripos($v,'-'.$lowe.'-') === false)
							{
								continue;
							}
           		 		}
						if($size)
            			{
                			if(stripos($v,$size.',') === false)
							{
								continue;
							}
            			}
						if($grade)
            			{
                			if(stripos($v,'-'.$grade.'-') === false)
							{
								continue;
							}
            			}
						if($lacetype != 'z')
            			{
							$cs[] = $lacetype;
                			if(stripos($v,'-'.$lacetype.'-') === false)
							{
								continue;
							}
            			}
						if($density != 'z')
            			{
                			if(stripos($v,'-'.$density.'-') === false)
							{
								continue;
							}
            			}
						if($haircap != 'z')
            			{
                			if(stripos($v,'-'.$haircap.'-') === false)
							{
								continue;
							}
            			}
						$i = 0;
						foreach ($category as $value) 
		            	{
							if(stripos($v,'-'.$value.'-') !== false)
							{
								$i++;
							}
			        	}
						if($i > 0)
		   				{
							$e = explode('|',$v);
							$d = str_replace($p,'-',$e[0]);
							$q = str_replace(array('-163-','-164-','-165-','-166-'),'-',$e[0]);
							$q = explode('-',trim($q,'-'));
							$c = explode(',',$e[0]);
							if(!isset($resdata[$d]))
							{
			   					if(stripos($v,'-126-') !== false)
			   					{
									if(!isset($q[4]) || !isset($pm[$q[4]]))
									{
										continue;
									}
				                	@$resdata[$d] = array($e[2],rtrim($classdata[$c[0]],'inch'),$q[4],1);//数量、尺寸、曲度、无蕾丝颜色
			  					}
								else if(stripos($v,'-127-') !== false)
			   					{
			       					if(isset($q[9]))
				   					{
					   					$s = ($q[9] != 335)?1:2; 
				   					}
				   					else
				  					{
										$s = 1;
				   					}
				   					$bt = (!isset($q[8]))?$q[5]:$q[8];//360类型的蕾丝尺寸直接显示为类型名称
				   					if($lx[$q[5]] == '27')//如果是发块类型
				   					{
				       					$resdata[$d] = array($e[2],rtrim($classdata[$c[0]],'inch'),$q[5],$bt,$s);//数量、尺寸、类型、蕾丝尺寸、蕾丝颜色
				  					 }
			  					}
			   					else
			   					{
				   					if(isset($q[8]))
				   					{
					   					$s = ($q[8] != 335)?1:2; 
				   					}
				  					else
				  					{
					   					$s = 1;
				   					}
				   					if(@$lx[$q[5]] == '18')//如果是头套种类
				   					{
				       					$resdata[$d] = array($e[2],rtrim($classdata[$c[0]],'inch'),$q[5],$s);//数量、尺寸、头套种类、蕾丝颜色
				   					}
			   					}
							}
							else
							{
								if(isset($e[2]))
								{
							    	if(is_array($e[2]) || !is_numeric($e[2]))
							    	{
								    	$cw[] = $v;
								    	continue;
							    	}
							    	else
							    	{
               					    	 $resdata[$d][0] += $e[2];
							    	}
								}
							}
		   				}
	  				 }
 				 }
				 $data =  array();
				 foreach ($resdata as $v)
				 {
					 if(isset($v[4]))
					 {
						 if(!isset($data[$v[1].$v[2].$v[3].$v[4]]))
						 {
						 	$data[$v[1].$v[2].$v[3].$v[4]] = array($v[0],$v[1],$pm[$v[2]],$classdata[$v[3]],$v[4]);//$classdata[$v[2]]英文名,$pm[$v[2]]中文名
						 }
						 else
						 {
						 	$data[$v[1].$v[2].$v[3].$v[4]][0] += $v[0];
						 }
					 }
					 else
					 {
						 if(!isset($data[$v[1].$v[2].$v[3]]))
						 {
							 $data[$v[1].$v[2].$v[3]] = array($v[0],$v[1],$pm[$v[2]],$v[3]);//$classdata[$v[2]]英文名,$pm[$v[2]]中文名
						 }
						 else
						 {
						 	$data[$v[1].$v[2].$v[3]][0] += $v[0];
						 }
					 }
				 }
				 $list = array();
				 foreach ($data as $v)
				 {
				 	$x = (isset($v[4]))?$v[3]:$v[2];
	    			 if(!isset($list[$v[2]]))
					 {
						 $list[$v[2]] = array();
						 if(!isset($list[$v[2]][$x]))
		    			 {
							 $list[$v[2]][$x] = array();
							 $list[$v[2]][$x][] = $v;
						 }
						 else
						 {
						 	$list[$v[2]][$x][] = $v;
						 }
					 }
					 else
					 {
						 if(!isset($list[$v[2]][$x]))
		   				 {
						 	$list[$v[2]][$x] = array();
						 	$list[$v[2]][$x][] = $v;
						 }
						 else
						 {
						 	$list[$v[2]][$x][] = $v;
						 }
					 }
				 }
				 foreach ($list as $key=>$val)
				 {
					 foreach ($val as $k=>$va)
    				 {
						 $dd = array();
						 foreach ($va as $v)
        				 {
		    			 	$ss = (!isset($v[4]))?$v[3]:$v[4];
		   					 if(!isset($dd[$v['1']]))
		    				 {
			   				 	$dd[$v['1']] = array();
							 	$dd[$v['1']][$ss] = $v;
		   					 }
		    				 else
		    				 {
			    			 	$dd[$v['1']][$ss] = $v;
		    				 }
						 }
						 ksort($dd);
						 $list[$key][$k] = $dd;
    				 }
				 }
				 $warp[] = array($btpm,$list);
			}
			//echo count($list);
			//echo "
";
			//print_r($warp);
			//exit;

			$str = "
       	 	
        	
        	";
			foreach ($warp as $list)
			{
			foreach ($list[1] as $key=>$val)
			{
				$btnum = count($val);
				$str .= "";
				foreach ($val as $k=>$v)
            	{
            		$str .="";
				}
           		$str .=  "
".$k.' '.$list[0]." 其它 HD
"; $str .= ""; foreach ($val as $k=>$v) { $str .= ""; } $str .= "
"; foreach ($v as $sk=>$s) { $xk1 = (isset($s[1]))?$s[1][0]:0; $xk2 = (isset($s[2]))?$s[2][0]:0; $str .=""; } $str .= "
".$sk."".$xk1."".$xk2."
"; } } $str .= ""; header( "Content-Type: application/vnd.ms-excel; name='excel'" ); header( "Content-type: application/octet-stream" ); header( "Content-Disposition: attachment; filename=".time().'.xls' ); header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); header( "Pragma: no-cache" ); header( "Expires: 0" ); exit($str); } } public function _bh() { if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = "";$exsp = "";$excelshop=""; $usersp = explode('|',trim($user['shop'],'|')); foreach ($usersp as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } $userexcel = explode('|',trim($user['excelshop'],'|')); foreach ($userexcel as $value) { $excelshop .= " shop = ".$value." or"; $exsp .= " id = ".$value." or"; } if($excelshop != "") { $excelshop = "(".rtrim($excelshop,'or').")"; } } $cs = array();//测试 $post = $this->input->post(NULL, TRUE); if(isset($_GET['excel'])) { $shop = $this->input->get('shop',true); $color = $this->input->get('color',true); $grade = $this->input->get('grade',true); $lowe = $this->input->get('lowe',true); $lacetype = $this->input->get('lacetype',true); $time = $this->input->get('time',true); $timetk = $this->input->get('timetk',true); $timetj = $this->input->get('timetj',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = "fpdata like '%-128-%' and ";//头套 $fpdata = ''; if($lacetype) { $lacetypefp = ''; $lacetypedata = explode(',',trim($lacetype,',')); foreach ($lacetypedata as $value) { $lacetypefp .= "fpdata like '%-".$value."-%' or "; } $fpdata .= " and (".rtrim($lacetypefp,' or').")"; } if($lowe) { $lowefp = ''; $lowedata = explode(',',trim($lowe,',')); foreach ($lowedata as $value) { $lowefp .= "fpdata like '%-".$value."-%' or "; } $fpdata .= " and (".rtrim($lowefp,' or').")"; } if($shop) { $where .= "shop = '$shop' and "; } else { $where .= $excelshop." and "; } if($color) { $where .= "fpdata like '%$color%' and "; } if($grade) { $where .= "fpdata like '%$grade%' and "; } $density = array(); $size = array(); $haircap = array(); $md = $this->typeclass->find_all("classid = '10'");//密度 foreach ($md as $val) { $density[$val['id']] = ''; } $cd = $this->typeclass->find_all("classid = '14'",'*','id asc');//长度 and id != '774' and bqsku < 32之前的限制 foreach ($cd as $val) { $size[$val['id']] = $density; } $fm = $this->typeclass->find_all("classid = '6'"); foreach ($fm as $val) { $haircap[$val['id']] = $size; } $dataa = $this->fullorder->find_all($where.$time." > '$timetk' and ".$time." < '$timetj'".$fpdata,'number,fpdata','id desc'); $datab = $this->fullordersmt->find_all($where.$time." > '$timetk' and ".$time." < '$timetj'".$fpdata,'number,fpdata','id desc'); $datac = $this->fullordertt->find_all($where.$time." > '$timetk' and ".$time." < '$timetj'".$fpdata,'number,fpdata','id desc'); $data = array_merge($dataa,$datab,$datac); $fpdata = array(); foreach ($data as $val) { $f = explode(';',trim($val['fpdata'],';')); foreach ($f as $v) { if(stripos($v,'-128-') === false) { continue; } if($color) { if(stripos($v,'-'.$color.'-') === false) { continue; } } if($grade) { if(stripos($v,'-'.$grade.'-') === false) { continue; } } if($lowe) { $arraylowe = explode(',',trim($lowe,',')); $i = 0; foreach ($arraylowe as $vv) { if(stripos($v,'-'.$vv.'-') === false) { $i++; } } if($i == count($arraylowe)) { continue; } } if($lacetype) { $arraylacetype = explode(',',trim($lacetype,',')); $i = 0; foreach ($arraylacetype as $vv) { if(stripos($v,'-'.$vv.'-') === false) { $i++; } } if($i == count($arraylacetype)) { continue; } } $fdd = explode('|',trim($v,'|')); $fddf = explode('-',trim($fdd[0],'-')); if(isset($fddf[7])) { $fpdata[] = array($fddf[4],$fddf[5],$fddf[7],trim($fddf[0],','),$fddf[6],$fdd[2],$val['number']);//曲度,蕾丝种类,密度,长度,发帽大小,数量 } } } $tc = array(); $qbtc = $this->typeclass->find_all(); foreach ($qbtc as $val) { $tc[$val['id']] = $val['bqsku']; } $zh = array(); $qbzh = $this->typeclass->find_all(); foreach ($qbzh as $val) { $zh[$val['id']] = $val['zh']; } $qd = array();$td = ''; $qddata = $this->typeclass->find_all("classid = '15'"); foreach ($qddata as $val) { $qd[$val['id']] = 0; $td .= ''.$val['bqsku'].''; } $zdata = array(); foreach ($fpdata as $val) { if(isset($zdata[$val[0].'|'.$val[1]])) { if(isset($zdata[$val[0].'|'.$val[1]][$val[4]][$val[3]][$val[2]])) { if($zdata[$val[0].'|'.$val[1]][$val[4]][$val[3]][$val[2]] == '') { $zdata[$val[0].'|'.$val[1]][$val[4]][$val[3]][$val[2]] = $val[5]; } else { $zdata[$val[0].'|'.$val[1]][$val[4]][$val[3]][$val[2]] += $val[5]; } } } else { $zdata[$val[0].'|'.$val[1]] = $haircap; if(isset($zdata[$val[0].'|'.$val[1]][$val[4]][$val[3]][$val[2]])) { $zdata[$val[0].'|'.$val[1]][$val[4]][$val[3]][$val[2]] = $val[5]; } } } foreach ($zdata as $key=>$value) { foreach ($value as $ke=>$va) { foreach ($va as $kk=>$vv) { $i = 0; foreach ($vv as $v) { if($v == '') { $i++; } } if($i == count($density)) { unset($zdata[$key][$ke][$kk]); } } } } foreach ($zdata as $key=>$value) { $i = 0; foreach ($value as $ke=>$va) { if(empty($va)) { $i++; } if($i == count($value)) { unset($zdata[$key]); } } } //sort($zdata);//排序 //echo count($list); //echo "
";
			//print_r($zdata);
			//exit;

			$str = "
       	 	
        	
        	";
			foreach ($zdata as $key=>$value) 
			{ 
			    $str .= ""; 
			    $key =  explode('|',$key);
		    	$str .= "";
				$y = 0;
				foreach ($value as $ke=>$va)
				{
					$y++;
					if($y == 2)
					{
						$backgrounda = '#ffff00';
						$backgroundb = '#bad5df';
					}
					else
					{
						$backgrounda = '#e2efda';
						$backgroundb = '#9bc2e6';
					}
					$str .= "";
				}
				$str .= "

".$zh[$key[0]].' '.$zh[$key[1]]."

"; $str .= ""; foreach ($density as $kk=>$vv) { $str .= ""; } $str .= ""; foreach ($va as $kk=>$vv) { $str .= ""; foreach ($vv as $v) { $str .= ""; } $str .= ""; } $str .= "

".$zh[$ke]."

尺寸/密度".$tc[$kk]."
".$tc[$kk]."".$v."


"; } $str .= ""; header( "Content-Type: application/vnd.ms-excel; name='excel'" ); header( "Content-type: application/octet-stream" ); header( "Content-Disposition: attachment; filename=".time().'.xls' ); header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); header( "Pragma: no-cache" ); header( "Expires: 0" ); exit($str); } $wlshop = $this->shop->find_all('1=1 and '.rtrim($exsp,'or')); $this->data['wlshop'] = $wlshop; $this->_Template('systemdownload_bh',$this->data); } public function _hsp() { if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = "";$excelshop=""; $usersp = explode('|',trim($user['shop'],'|')); foreach ($usersp as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } $userexcel = explode('|',trim($user['excelshop'],'|')); foreach ($userexcel as $value) { $excelshop .= " shop = ".$value." or"; } if($excelshop != "") { $excelshop = "(".rtrim($excelshop,'or').")"; } } $cs = array();//测试 $post = $this->input->post(NULL, TRUE); if(isset($_GET['excel'])) { $type = $this->input->get('type',true); $lace = $this->input->get('lace',true); $color = $this->input->get('color',true); $grade = $this->input->get('grade',true); $lacetype = $this->input->get('lacetype',true); $time = $this->input->get('time',true); $timetk = $this->input->get('timetk',true); $timetj = $this->input->get('timetj',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); if($type == 1) { $where = "fpdata like '%-128-%' and ".$excelshop." and ";//头套 } else { if($lace == 1) { $where = "fpdata like '%-127-%' and fpdata NOT LIKE '%-335-%' and ".$excelshop." and "; } else { $where = "fpdata like '%-127-%' and fpdata like '%-335-%' and ".$excelshop." and "; } } $fpdata = '';$px = array();$fl = array(); if($lacetype) { $lacetypefp = ''; $lacetypedata = explode(',',trim($lacetype,',')); foreach ($lacetypedata as $value) { $value = explode('|',$value); $px[$value[0]] = ''; $val = explode('-',$value[1]); foreach ($val as $k=>$v) { $fl[$v] = $value[0]; $lacetypefp .= " fpdata like '%-".$v."-%' or "; } } $fpdata .= " and (".rtrim($lacetypefp,' or').")"; } $colortitle = ''; if($color) { $where .= " fpdata like '%-$color-%' and "; $colortitle = $this->typeclass->read($color); $colortitle = $colortitle['zh']; } if($grade) { $where .= " fpdata like '%-$grade-%' and "; } $size = array();$cc = array(); $cd = $this->typeclass->find_all("classid = '14' and id != '774' and id != '6' and id != '99' and id != '100'",'*','id asc');//长度 foreach ($cd as $val) { $cc[] = $val['bqsku']; $size[$val['id']] = 0; } $dataa = $this->fullorder->find_all($where." $time > '$timetk' and $time < '$timetj'".$fpdata,'number,fpdata','id desc'); $datab = $this->fullordersmt->find_all($where." $time > '$timetk' and $time < '$timetj'".$fpdata,'number,fpdata','id desc'); $datac = $this->fullordertt->find_all($where." $time > '$timetk' and $time < '$timetj'".$fpdata,'number,fpdata','id desc'); $data = array_merge($dataa,$datab,$datac); $fpdata = array();$cs[] = array(); foreach ($data as $val) { $f = explode(';',trim($val['fpdata'],';')); foreach ($f as $v) { $v = str_replace(array('-163-','-164-','-165-','-166-'),'-',$v); if($type == 1 && stripos($v,'-128-') === false) { continue; } else if($type == 2 && stripos($v,'-127-') === false) { continue; } if($color) { if(stripos($v,'-'.$color.'-') === false) { continue; } } if($grade) { if(stripos($v,'-'.$grade.'-') === false) { continue; } } if($lacetype) { $arraylacetype = explode(',',trim($lacetype,',')); $i = 0;$j = 0; foreach ($arraylacetype as $vv) { $value = explode('|',$vv); $value = explode('-',trim($value[1],'-')); $j += count($value); foreach ($value as $val) { if(stripos($v,'-'.$val.'-') === false) { $i++; } } } if($i == $j) { continue; } } $fdd = explode('|',trim($v,'|')); $fddf = explode('-',trim($fdd[0],'-')); if($type == 1) { if(isset($fddf[7]) && isset($fl[$fddf[5]])) { $fpdata[] = array($fl[$fddf[5]],trim($fddf[0],','),$fdd[2]);//蕾丝种类,长度,数量 } } else if($type == 2) { if(isset($fl[$fddf[8]])) { $fpdata[] = array($fl[$fddf[8]],trim($fddf[0],','),$fdd[2]);//蕾丝种类,长度,数量 } } } } foreach ($fpdata as $val) { if(isset($zdata[$val[0]])) { if(isset($zdata[$val[0]][$val[1]])) { $zdata[$val[0]][$val[1]] += $val[2]; } } else { $zdata[$val[0]] = $size; if(isset($zdata[$val[0]][$val[1]])) { $zdata[$val[0]][$val[1]] += $val[2]; } } } /** foreach ($zdata as $key=>$value) { foreach ($value as $ke=>$va) { if($va == '0') { unset($zdata[$key][$ke]); } } } **/ $tc = array(); $qbtc = $this->typeclass->find_all(); foreach ($qbtc as $val) { $tc[$val['id']] = $val['bqsku']; } $zh = array(); $qbzh = $this->typeclass->find_all(); foreach ($qbzh as $val) { $zh[$val['id']] = $val['zh']; } //$px = array('13*4'=>'','4*4'=>'','5*5'=>'','6*6'=>'','13*6'=>'','360'=>'','HD13*4'=>'','HD4*4'=>'','HD5*5'=>'','HD6*6'=>'','HD13*6'=>''); foreach ($zdata as $k=>$v) { $px[$k] = $v; } foreach ($px as $k=>$v) { if(!$v) { unset($px[$k]); } } $zdata = $px; //sort($zdata);//排序 //echo count($list); //echo "
";
			//print_r($zdata);
			//exit;

			$str = "
       	 	
        	
        	";
			
			    $str .= ""; 
		    	$str .= "";
				$str .= "";
				foreach ($zdata as $key=>$value) 
			    { 
				    $str .= "";
				}
				$str .= "
".date('Y-m-d',$timetk).' ~ '.date('Y-m-d',$timetj).' '.$colortitle."
"; $str .= ""; foreach ($cc as $kk=>$vv) { $str .= ""; $str .= ""; } $str .= "
尺寸
".$vv."
"; foreach ($value as $kk=>$vv) { if($vv == '0') { $str .= ""; } else { $str .= ""; } $str .= ""; } $str .= "
".$key."
".$vv."


"; $str .= ""; header( "Content-Type: application/vnd.ms-excel; name='excel'" ); header( "Content-type: application/octet-stream" ); header( "Content-Disposition: attachment; filename=".time().'.xls' ); header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); header( "Pragma: no-cache" ); header( "Expires: 0" ); exit($str); } $this->_Template('systemdownload_hsp',$this->data); } public function _qm()//曲度和密度 { if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = "";$excelshop=""; $usersp = explode('|',trim($user['shop'],'|')); foreach ($usersp as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } $userexcel = explode('|',trim($user['excelshop'],'|')); foreach ($userexcel as $value) { $excelshop .= " shop = ".$value." or"; } if($excelshop != "") { $excelshop = "(".rtrim($excelshop,'or').")"; } } $post = $this->input->post(NULL, TRUE); if(isset($_GET['excel'])) { $timetk = $this->input->get('timetk',true); $timetj = $this->input->get('timetj',true); //$lacetype = $this->input->get('lacetype',true); $lacetype = ''; $time = $this->input->get('time',true); $timetk = time()-30*24*3600; $timetj = time(); $where = "fpdata like '%-128-%' and shop != '9' and shop != '26' and ".$excelshop." and ";//头套 $fpdata = ''; if($lacetype) { $lacetype = explode(',',trim($lacetype,',')); foreach ($lacetype as $value) { $fpdata .= "fpdata like '%-".$value."-%' or "; } $fpdata = " and (".rtrim($fpdata,' or').")"; } $dataa = $this->fullorder->find_all($where."librarytime > '$timetk' and librarytime < '$timetj'".$fpdata,'number,fpdata','id desc'); $datab = $this->fullordersmt->find_all($where."librarytime > '$timetk' and librarytime < '$timetj'".$fpdata,'number,fpdata','id desc'); $datac = $this->fullordertt->find_all($where."librarytime > '$timetk' and librarytime < '$timetj'".$fpdata,'number,fpdata','id desc'); $data = array_merge($dataa,$datab,$datac); $fpdata = array(); foreach ($data as $val) { $f = explode(';',trim($val['fpdata'],';')); foreach ($f as $v) { if($lacetype) { foreach ($lacetype as $vv) { if(stripos($v,'-'.$vv.'-') !== false) { $fdd = explode('|',trim($val['fpdata'],'|')); $fddf = explode('-',trim($fdd[0],'-')); if(isset($fddf[7])) { $fpdata[] = array($fddf[4],$fddf[5],$fddf[7]);//曲度,蕾丝种类,密度 } } } } else { $fdd = explode('|',trim($val['fpdata'],'|')); $fddf = explode('-',trim($fdd[0],'-')); if(isset($fddf[7])) { $fpdata[] = array($fddf[4],$fddf[5],$fddf[7]);//曲度,蕾丝种类,密度 } } } } $tc = array(); $qbtc = $this->typeclass->find_all(); foreach ($qbtc as $val) { $tc[$val['id']] = $val['bqsku']; } $qd = array();$td = ''; $qddata = $this->typeclass->find_all("classid = '15'"); foreach ($qddata as $val) { $qd[$val['id']] = 0; $td .= ''.$val['bqsku'].''; } $zdata = array(); foreach ($fpdata as $val) { /** if(isset($zdata[$tc[$val[1]].' '.$tc[$val[2]]])) { if(isset($zdata[$tc[$val[1]].' '.$tc[$val[2]]][$val[0]])) { $zdata[$tc[$val[1]].' '.$tc[$val[2]]][$val[0]] += 1; } } else { $zdata[$tc[$val[1]].' '.$tc[$val[2]]] = $qd; } **/ if(isset($zdata[$val[1].'|'.$val[2]])) { if(isset($zdata[$val[1].'|'.$val[2]][$val[0]])) { $zdata[$val[1].'|'.$val[2]][$val[0]] += 1; } } else { $zdata[$val[1].'|'.$val[2]] = $qd; if(isset($zdata[$val[1].'|'.$val[2]][$val[0]])) { $zdata[$val[1].'|'.$val[2]][$val[0]] += 1; } } } //echo count($list); //echo "
";
			//print_r($zdata);
			//exit;

			$str = "
       	 	
        	
        	";
			$str .= "
			".$td."
			
产品
"; $str .= ""; foreach ($zdata as $key=>$value) { $key = explode('|',$key); $str .= ""; foreach ($value as $ke=>$va) { if($va > 0) { $str .= ""; } else { $str .= ""; } } $str .= "\n"; } $str .= ""; header( "Content-Type: application/vnd.ms-excel; name='excel'" ); header( "Content-type: application/octet-stream" ); header( "Content-Disposition: attachment; filename=".time().'.xls' ); header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); header( "Pragma: no-cache" ); header( "Expires: 0" ); exit($str); } } public function _list() { if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = ""; $usersp = explode('|',trim($user['shop'],'|')); foreach ($usersp as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or')); $this->data['wlshop'] = $wlshop; $this->_Template('systemdownload_list',$this->data); } public function _listread() { if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = "";$excelshop=""; $usersp = explode('|',trim($user['shop'],'|')); foreach ($usersp as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } $userexcel = explode('|',trim($user['excelshop'],'|')); foreach ($userexcel as $value) { $excelshop .= " shop = ".$value." or"; } if($excelshop != "") { $excelshop = "(".rtrim($excelshop,'or').")"; } } $post = $this->input->post(NULL, TRUE); if(isset($_GET['category'])) { $timetk = $this->input->get('timetk',true); $timetj = $this->input->get('timetj',true); $color = $this->input->get('color',true); $lowe = $this->input->get('lowe',true); $size = $this->input->get('size',true); $grade = $this->input->get('grade',true); $lacetype = $this->input->get('lacetype',true); $category = $this->input->get('category',true); $shop = $this->input->get('shop',true); $time = $this->input->get('time',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $cw = array(); $class = array();$classdata = array();$lx = array();$pm = array();$ttzllist = array();$hxlist = array(); $a = $this->typeclass->find_all('classid=6 or classid=7 or classid=8 or classid=10 or classid=12 or classid=13 or classid=19 or classid=20 or classid=21 or classid=22 or classid=23 or classid=24'); foreach ($a as $val) { $class[] = '-'.$val['id'].'-'; } $b = $this->typeclass->find_all(); foreach ($b as $val) { $classdata[$val['id']] = $val['title']; $lx[$val['id']] = $val['classid']; $pm[$val['id']] = $val['zh']; } $ttzl = $this->typeclass->find_all("classid = '18'"); foreach ($ttzl as $val) { $ttzllist[$val['id']] = $val['classid']; } $hx = $this->typeclass->find_all("classid = '15'"); foreach ($hx as $val) { $hxlist[$val['id']] = $val['classid']; } //Closure wigs $fpdata = ''; $category = explode('|',trim($category,'|')); foreach ($category as $value) { $fpdata .= "fpdata like '%".$value."%' or "; } if(count($category) > 1) { $fpdata = "(".trim($fpdata,' or ').")"; } else { $fpdata = trim($fpdata,' or '); } $where = "shop != '9' and shop != '26' and "; if($color) { $where .= "fpdata like '%$color%' and "; } if($lowe) { $where .= "fpdata like '%$lowe%' and "; } if($size) { $where .= "fpdata like '%$size%' and "; } if($grade) { $where .= "fpdata like '%$grade%' and "; } if($lacetype) { $where .= "fpdata like '%$lacetype%' and "; } if($shop) { $where .= "shop = '$shop' and "; } else { $where .= $excelshop." and "; } $dataa = $this->fullorder->find_all($where.$time." > '$timetk' and ".$time." < '$timetj' and ".$fpdata,'number,fpdata','id desc'); $datab = $this->fullordersmt->find_all($where.$time." > '$timetk' and ".$time." < '$timetj' and ".$fpdata,'number,fpdata','id desc'); $datac = $this->fullordertt->find_all($where.$time." > '$timetk' and ".$time." < '$timetj' and ".$fpdata,'number,fpdata','id desc'); $data = array_merge($dataa,$datab,$datac); //echo $where."librarytime > '$timetk' and librarytime < '$timetj' and ".$fpdata; //echo "
";
			//print_r($data);
			//exit;
			
			$pd = '';
		 	$p = $class;
  			$resdata = array();
  			foreach ($data as $val)
  			{
	  			$f = explode(';',trim($val['fpdata'],';'));
	  			foreach ($f as $v)
      			{
					if($color)
            		{
                		if(stripos($v,'-'.$color.'-') === false)
						{
							continue;
						}
            		}
					if($lowe)
            		{
                		if(stripos($v,'-'.$lowe.'-') === false)
						{
							continue;
						}
           		 	}
					if($size)
            		{
                		if(stripos($v,$size.',') === false)
						{
							continue;
						}
            		}
					if($grade)
            		{
                		if(stripos($v,'-'.$grade.'-') === false)
						{
							continue;
						}
            		}
					if($lacetype)
            		{
                		if(stripos($v,'-'.$lacetype.'-') === false)
						{
							continue;
						}
            		}
					$i = 0;
					foreach ($category as $value) 
		            {
						if(stripos($v,'-'.$value.'-') !== false)
						{
							$i++;
						}
			        }
					if($i > 0)
		   			{
						$e = explode('|',$v);
						$d = str_replace($p,'-',$e[0]);
						$q = str_replace(array('-163-','-164-','-165-','-166-','-782-','-79-','-80-','-81-','-497-'),'-',$e[0]);
						$fl = explode(',',$q);//分离出尺寸和其它内容
						$cpkey = str_replace('-','',$fl[1]);
						$tt = explode('-',trim($fl[1],'-'));
						$title = '';$fla='';$flb='';
						foreach ($tt as $value) 
		                {
							if(isset($ttzllist[$value]))
							{
								if($ttzllist[$value] == '18')
							    {
									$fla = $value;
								}
							}
							if(isset($hxlist[$value]))
							{
								if($hxlist[$value] == '15')
							    {
									$flb = $value;
								}
							}
						}
						//$c = explode(',',$e[0]);
						if(!isset($resdata[$fla.$flb]) && $fla != '' && $flb != '')
						{
							if(stripos($pm[$fla],'|') !== false)
							{
								$pm[$fla] = explode('|',$pm[$fla]);
								$pm[$fla] = $pm[$fla][0];
							}
							if(stripos($pm[$flb],'|') !== false)
							{
								$pm[$flb] = explode('|',$pm[$flb]);
								$pm[$flb] = $pm[$flb][0];
							}
							$title = $pm[$fla].' '. $pm[$flb];
			   				$resdata[$fla.$flb] = array('t'=>$title,'82'=>0,'83'=>0,'84'=>0,'85'=>0,'86'=>0,'87'=>0,'88'=>0,'89'=>0,'90'=>0,'91'=>0,'92'=>0,'93'=>0,'94'=>0,'95'=>0,'96'=>0,'97'=>0,'98'=>0,'99'=>0,'100'=>0,'469'=>0);
							if(isset($resdata[$fla.$flb][$fl[0]]))
							{
							    $resdata[$fla.$flb][$fl[0]] += $e[2]; 
							}
						}
						else if ($fla != '' && $flb != '' && isset($resdata[$fla.$flb][$fl[0]]))
						{
							 $resdata[$fla.$flb][$fl[0]] += $e[2]; 
						}
		   			}
	  			 }
 			 }
			 rsort($resdata);
			//echo count($list);
			//echo "
";
			//print_r($list);
			//exit;

            
			$str = "
       	 	
        	
        	";
			$str .= "
".$tc[$key[0]].' '.$tc[$key[1]]."".$va."".$va."
产品 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44
"; $str .= ""; foreach ($resdata as $key=>$value) { $str .= ""; foreach ($value as $ke=>$va) { if(is_numeric($va)) { if($va > 0) { $str .= ""; } else { $str .= ""; } } else { $str .= ""; } } $str .= "\n"; } $str .= ""; header( "Content-Type: application/vnd.ms-excel; name='excel'" ); header( "Content-type: application/octet-stream" ); header( "Content-Disposition: attachment; filename=".time().'.xls' ); header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); header( "Pragma: no-cache" ); header( "Expires: 0" ); exit($str); } } }
".$va."".$va."".$va."