|
|
@@ -3019,112 +3019,179 @@ class Specialstock extends Start_Controller {
|
|
|
{
|
|
|
if(isset($_GET['excel']))
|
|
|
{
|
|
|
- $category = $this->input->get('category',true);
|
|
|
- $size = $this->input->get('size',true);
|
|
|
- $grade = $this->input->get('grade',true);
|
|
|
- $color = $this->input->get('color',true);
|
|
|
- $lowe = $this->input->get('lowe',true);
|
|
|
- $sku = $this->input->get('sku',true);
|
|
|
- $warehouse = $this->input->get('warehouse',true);
|
|
|
- $purchase = $this->input->get('purchase',true);
|
|
|
- $ktime = $this->input->get('ktime',true);
|
|
|
- $jtime = $this->input->get('jtime',true);
|
|
|
- $ktime = strtotime($ktime);
|
|
|
- $jtime = strtotime($jtime);
|
|
|
- $where = "1=1";$gj = "";$ck = "";
|
|
|
- $pc = $this->input->get('pc',true);
|
|
|
- if($pc)
|
|
|
- {
|
|
|
- $pc = trim($pc,'x');
|
|
|
- $pc = explode('x',$pc);
|
|
|
- foreach ($pc as $v)
|
|
|
- {
|
|
|
- $where .= " and warehouse != '".$v."'";
|
|
|
- }
|
|
|
- }
|
|
|
- if($category)
|
|
|
- {
|
|
|
- $where .= " and features like '%-$category-%'";
|
|
|
- }
|
|
|
- if($size)
|
|
|
- {
|
|
|
- $where .= " and features like '%-$size-%'";
|
|
|
- }
|
|
|
- if($grade)
|
|
|
- {
|
|
|
- $where .= " and features like '%-$grade-%'";
|
|
|
- }
|
|
|
- if($color)
|
|
|
- {
|
|
|
- $where .= " and features like '%-$color-%'";
|
|
|
- }
|
|
|
- if($lowe)
|
|
|
- {
|
|
|
- $where .= " and features like '%-$lowe-%'";
|
|
|
- }
|
|
|
- if($warehouse)
|
|
|
- {
|
|
|
- $where .= " and warehouse = '$warehouse'";
|
|
|
- }
|
|
|
- if($purchase)
|
|
|
- {
|
|
|
- $where .= " and purchase = '$purchase'";
|
|
|
- }
|
|
|
- if($sku)
|
|
|
- {
|
|
|
- $where .= " and sku = '$sku'";
|
|
|
- }
|
|
|
- if($ktime && $jtime)
|
|
|
- {
|
|
|
- $where .= " and enter > '$ktime' and enter < '$jtime' and state != 9";
|
|
|
- }
|
|
|
- //数据排序
|
|
|
- $order_str = "id desc";
|
|
|
- if(empty($page))
|
|
|
- {
|
|
|
- $start = 0;
|
|
|
- $perpage = 1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $start = ($page - 1)*$perpage;
|
|
|
- }
|
|
|
- //取得信息列表
|
|
|
- $info_list = $this->specialstock->find_pc($where,'enter','*',$order_str);
|
|
|
- $list = array();
|
|
|
- foreach ($info_list as $value)
|
|
|
- {
|
|
|
- $ck = $this->warehouse->read($value['warehouse']);
|
|
|
- $warehouse = $ck['title'];
|
|
|
- $tkck = $this->warehouse->read($value['retreatwarehouse']);//退库仓库
|
|
|
- $retreatwarehouse = $tkck['title'];
|
|
|
- $gy = $this->purchase->read($value['purchase']);
|
|
|
- $purchase = $gy['title'];
|
|
|
- $cpid = '';
|
|
|
- $g = $this->specialstock->find_all($where.' and enter = "'.$value['enter'].'" '." and sku = '".$value['sku']."'",'cpid');
|
|
|
- foreach ($g as $v)
|
|
|
- {
|
|
|
- if($v['cpid'] != 0)
|
|
|
+ if($_GET['excel'] == '2'){
|
|
|
+ $category = $this->input->get('category',true);
|
|
|
+ $size = $this->input->get('size',true);
|
|
|
+ $grade = $this->input->get('grade',true);
|
|
|
+ $color = $this->input->get('color',true);
|
|
|
+ $lowe = $this->input->get('lowe',true);
|
|
|
+ $sku = $this->input->get('sku',true);
|
|
|
+ $warehouse = $this->input->get('warehouse',true);
|
|
|
+ $purchase = $this->input->get('purchase',true);
|
|
|
+ $ktime = $this->input->get('ktime',true);
|
|
|
+ $jtime = $this->input->get('jtime',true);
|
|
|
+ $ktime = strtotime($ktime);
|
|
|
+ $jtime = strtotime($jtime);
|
|
|
+ $this->db->select('sku, DATE_FORMAT(enter, "%Y-%m-%d %H:00:00") as enter_date, COUNT(*) as count');
|
|
|
+ $this->db->from('web_kucun');
|
|
|
+ if($category)
|
|
|
+ {
|
|
|
+ $this->db->where('features like "%-'.$category.'-%"');
|
|
|
+ }
|
|
|
+ if($size)
|
|
|
+ {
|
|
|
+ $this->db->where('features like "%-'.$size.'-%"');
|
|
|
+ }
|
|
|
+ if($grade)
|
|
|
+ {
|
|
|
+ $this->db->where('features like "%-'.$grade.'-%"');
|
|
|
+ }
|
|
|
+ if($color)
|
|
|
+ {
|
|
|
+ $this->db->where('features like "%-'.$color.'-%"');
|
|
|
+ }
|
|
|
+ if($lowe)
|
|
|
+ {
|
|
|
+ $this->db->where('features like "%-'.$lowe.'-%"');
|
|
|
+ }
|
|
|
+ if($sku)
|
|
|
+ {
|
|
|
+ $this->db->where('sku = "'.$sku.'"');
|
|
|
+ }
|
|
|
+ if($warehouse)
|
|
|
+ {
|
|
|
+ $this->db->where('warehouse = "'.$warehouse.'"');
|
|
|
+ }
|
|
|
+ if($purchase)
|
|
|
+ {
|
|
|
+ $this->db->where('purchase = "'.$purchase.'"');
|
|
|
+ }
|
|
|
+ if($sku)
|
|
|
+ {
|
|
|
+ $this->db->where('sku = "'.$sku.'"');
|
|
|
+ }
|
|
|
+ if($ktime && $jtime)
|
|
|
+ {
|
|
|
+ $this->db->where('enter > "'.$ktime.'" and enter < "'.$jtime.'" and state != 9');
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->db->group_by(['sku', DATE_FORMAT(enter, '%Y-%m-%d %H:00:00')]);
|
|
|
+ $this->db->order_by('sku', 'ASC');
|
|
|
+ $this->db->order_by('enter_date', 'ASC');
|
|
|
+ $query = $this->db->get();
|
|
|
+ $result = $query->result();
|
|
|
+ echo "<pre>";
|
|
|
+ prin_r($result);
|
|
|
+ exit;
|
|
|
+ }else{
|
|
|
+ $category = $this->input->get('category',true);
|
|
|
+ $size = $this->input->get('size',true);
|
|
|
+ $grade = $this->input->get('grade',true);
|
|
|
+ $color = $this->input->get('color',true);
|
|
|
+ $lowe = $this->input->get('lowe',true);
|
|
|
+ $sku = $this->input->get('sku',true);
|
|
|
+ $warehouse = $this->input->get('warehouse',true);
|
|
|
+ $purchase = $this->input->get('purchase',true);
|
|
|
+ $ktime = $this->input->get('ktime',true);
|
|
|
+ $jtime = $this->input->get('jtime',true);
|
|
|
+ $ktime = strtotime($ktime);
|
|
|
+ $jtime = strtotime($jtime);
|
|
|
+ $where = "1=1";$gj = "";$ck = "";
|
|
|
+ $pc = $this->input->get('pc',true);
|
|
|
+ if($pc)
|
|
|
+ {
|
|
|
+ $pc = trim($pc,'x');
|
|
|
+ $pc = explode('x',$pc);
|
|
|
+ foreach ($pc as $v)
|
|
|
{
|
|
|
- $cpid .= $v['cpid'].' ';
|
|
|
+ $where .= " and warehouse != '".$v."'";
|
|
|
}
|
|
|
}
|
|
|
- $list[] = array('details'=>$value['details'],'title'=>$value['title'],'time'=>date('Y-m-d H:i:s',$value['enter']),'number'=>count($g),'cpid'=>$cpid);
|
|
|
- }
|
|
|
- $title = date('Y-m-d',$ktime).'至'.date('Y-m-d',$jtime)."入库详情";
|
|
|
- $titlename = "<table border=1>
|
|
|
- <tr><th colspan='4' align='center'><h3>".$title."<h3></th></tr>
|
|
|
- <tr align='center'>
|
|
|
- <td>备注</td>
|
|
|
- <td>产品</td>
|
|
|
- <td>时间</td>
|
|
|
- <td>数量</td>
|
|
|
- <td>编码</td>
|
|
|
- </tr>
|
|
|
- </table>";
|
|
|
- $filename = $title.".xls";
|
|
|
- $tail = "";
|
|
|
- $this->excel->get_fz2($list,$titlename,$filename,$tail);
|
|
|
+ if($category)
|
|
|
+ {
|
|
|
+ $where .= " and features like '%-$category-%'";
|
|
|
+ }
|
|
|
+ if($size)
|
|
|
+ {
|
|
|
+ $where .= " and features like '%-$size-%'";
|
|
|
+ }
|
|
|
+ if($grade)
|
|
|
+ {
|
|
|
+ $where .= " and features like '%-$grade-%'";
|
|
|
+ }
|
|
|
+ if($color)
|
|
|
+ {
|
|
|
+ $where .= " and features like '%-$color-%'";
|
|
|
+ }
|
|
|
+ if($lowe)
|
|
|
+ {
|
|
|
+ $where .= " and features like '%-$lowe-%'";
|
|
|
+ }
|
|
|
+ if($warehouse)
|
|
|
+ {
|
|
|
+ $where .= " and warehouse = '$warehouse'";
|
|
|
+ }
|
|
|
+ if($purchase)
|
|
|
+ {
|
|
|
+ $where .= " and purchase = '$purchase'";
|
|
|
+ }
|
|
|
+ if($sku)
|
|
|
+ {
|
|
|
+ $where .= " and sku = '$sku'";
|
|
|
+ }
|
|
|
+ if($ktime && $jtime)
|
|
|
+ {
|
|
|
+ $where .= " and enter > '$ktime' and enter < '$jtime' and state != 9";
|
|
|
+ }
|
|
|
+ //数据排序
|
|
|
+ $order_str = "id desc";
|
|
|
+ if(empty($page))
|
|
|
+ {
|
|
|
+ $start = 0;
|
|
|
+ $perpage = 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $start = ($page - 1)*$perpage;
|
|
|
+ }
|
|
|
+ //取得信息列表
|
|
|
+ $info_list = $this->specialstock->find_pc($where,'enter','*',$order_str);
|
|
|
+ $list = array();
|
|
|
+ foreach ($info_list as $value)
|
|
|
+ {
|
|
|
+ $ck = $this->warehouse->read($value['warehouse']);
|
|
|
+ $warehouse = $ck['title'];
|
|
|
+ $tkck = $this->warehouse->read($value['retreatwarehouse']);//退库仓库
|
|
|
+ $retreatwarehouse = $tkck['title'];
|
|
|
+ $gy = $this->purchase->read($value['purchase']);
|
|
|
+ $purchase = $gy['title'];
|
|
|
+ $cpid = '';
|
|
|
+ $g = $this->specialstock->find_all($where.' and enter = "'.$value['enter'].'" '." and sku = '".$value['sku']."'",'cpid');
|
|
|
+ foreach ($g as $v)
|
|
|
+ {
|
|
|
+ if($v['cpid'] != 0)
|
|
|
+ {
|
|
|
+ $cpid .= $v['cpid'].' ';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $list[] = array('details'=>$value['details'],'title'=>$value['title'],'time'=>date('Y-m-d H:i:s',$value['enter']),'number'=>count($g),'cpid'=>$cpid);
|
|
|
+ }
|
|
|
+ $title = date('Y-m-d',$ktime).'至'.date('Y-m-d',$jtime)."入库详情";
|
|
|
+ $titlename = "<table border=1>
|
|
|
+ <tr><th colspan='4' align='center'><h3>".$title."<h3></th></tr>
|
|
|
+ <tr align='center'>
|
|
|
+ <td>备注</td>
|
|
|
+ <td>产品</td>
|
|
|
+ <td>时间</td>
|
|
|
+ <td>数量</td>
|
|
|
+ <td>编码</td>
|
|
|
+ </tr>
|
|
|
+ </table>";
|
|
|
+ $filename = $title.".xls";
|
|
|
+ $tail = "";
|
|
|
+ $this->excel->get_fz2($list,$titlename,$filename,$tail);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|