|
|
@@ -137,6 +137,9 @@ class Whlabel_bh extends Start_Controller {
|
|
|
else if($arg == "cj_transfer_scanout_xzlog"){
|
|
|
$this->_cj_transfer_scanout_xzlog();
|
|
|
}
|
|
|
+ else if($arg == 'excelbhdc'){
|
|
|
+ $this->_excelbhdc();
|
|
|
+ }
|
|
|
else if($arg == 'excelwchz'){
|
|
|
$this->_excelwchz();
|
|
|
}
|
|
|
@@ -3157,4 +3160,135 @@ class Whlabel_bh extends Start_Controller {
|
|
|
header( "Expires: 0" );
|
|
|
exit($str);
|
|
|
}
|
|
|
+
|
|
|
+ public function _excelbhdc(){
|
|
|
+ $orderinfo = $this->input->get('number',true);
|
|
|
+ $color = $this->input->get('color',true);
|
|
|
+ $pm = $this->input->get('pm',true);
|
|
|
+ $purchase = $this->input->get('purchase',true);
|
|
|
+ $transfer = $this->input->get('transfer',true);
|
|
|
+ $lx = $this->input->get('lx',true);
|
|
|
+ $crk_select = $this->input->get('crk',true);
|
|
|
+ $timetk = $this->input->get('timetk',true);
|
|
|
+ $timetj = $this->input->get('timetj',true);
|
|
|
+ $timetk = strtotime($timetk);
|
|
|
+ $timetj = strtotime($timetj);
|
|
|
+ $where = "1=1";
|
|
|
+ if($transfer)
|
|
|
+ {
|
|
|
+ $ctime = 'ctime'.$transfer;
|
|
|
+ $where .= " and $ctime > '$timetk' and $ctime < '$timetj'";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $where .= " and time > '$timetk' and time < '$timetj'";
|
|
|
+ }
|
|
|
+ if($orderinfo)
|
|
|
+ {
|
|
|
+ $where .= " and orderinfo like '%$orderinfo%'";
|
|
|
+ }
|
|
|
+ if($transfer)
|
|
|
+ {
|
|
|
+ $where .= " and rk like '%|".$transfer."|%'";
|
|
|
+ }
|
|
|
+ if($purchase)
|
|
|
+ {
|
|
|
+ $where .= " and purchase = '$purchase'";
|
|
|
+ }
|
|
|
+ if($pm)
|
|
|
+ {
|
|
|
+ $where .= " and pm like '%$pm%'";
|
|
|
+ }
|
|
|
+ if($color)
|
|
|
+ {
|
|
|
+ $where .= " and features like '%-".$color."-%'";
|
|
|
+ }
|
|
|
+ if(!empty($crk_select)){
|
|
|
+ $where_arr = [];
|
|
|
+ $where_arr['time >='] =$timetk;
|
|
|
+ $where_arr['time <='] = $timetj;
|
|
|
+ if($transfer > 0){
|
|
|
+ $where_arr['lx'] =$transfer;
|
|
|
+ }
|
|
|
+
|
|
|
+ $cr_model = $this->db->from('whlabel_bh_transfer_cr')->select('id,fid,is_over,lx,time,type');
|
|
|
+ if($crk_select == 1){
|
|
|
+ $where_arr['type'] =1;
|
|
|
+ $cr_tmp_list = $cr_model->where($where_arr)->get()->result_array();
|
|
|
+ }else{
|
|
|
+ $where_arr['type'] = 2;
|
|
|
+ $cr_tmp_list = $cr_model->where($where_arr)->get()->result_array();
|
|
|
+ }
|
|
|
+ $fids = array_column($cr_tmp_list,'fid');
|
|
|
+ $ids = array_unique($fids);
|
|
|
+ if(empty($ids)){
|
|
|
+ $where .= " and id = 0 ";
|
|
|
+ }else{
|
|
|
+ $where .= " and id in (".implode(",",$ids).")";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //取得信息列表
|
|
|
+ $info_list = $this->whlabel_bh_transfer->find_all($where,'id,orderinfo,pm,shipremarks,ts,printtime');
|
|
|
+ $transfer = $this->transfer->find_all();
|
|
|
+ $t = array();$ot = array();
|
|
|
+ foreach ($transfer as $v)
|
|
|
+ {
|
|
|
+ $t[$v['id']] = $v['title'];
|
|
|
+ $ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
|
|
|
+ }
|
|
|
+ //格式化数据
|
|
|
+ foreach ($info_list as $key=>$value)
|
|
|
+ {
|
|
|
+ $info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
|
|
|
+ //$log_list= $this->whlabel_bh_transfer_cr->find_all("fid = ".$value['id']);
|
|
|
+ // $tmp_operate_str = "";
|
|
|
+ // foreach($log_list as $k=>$v){
|
|
|
+ // $tmp_operate_str.= $t[$v['lx']]."".($v['type']==1?'入库':'出库').":".date('Y-m-d H:i:s',$v['time'])."<br>";
|
|
|
+ // }
|
|
|
+
|
|
|
+ // $info_list[$key]['time'] = trim($tmp_operate_str,'<br>');
|
|
|
+ }
|
|
|
+
|
|
|
+ $filename = date("Ymd",$ktime)."~".date("Ymd",$jtime).$transfer_info['title']."备货流转.xls";
|
|
|
+ $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 .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'>";
|
|
|
+ $str .= "<tr><td>编号</td><td>品名</td><td>备注</td><td>数量</td><td>打印时间</td></tr>";
|
|
|
+ foreach ($final_list as $key=>$value)
|
|
|
+ {
|
|
|
+ $str .= "<tr>";
|
|
|
+ $str .= "<td>". $value['orderinfo']. "</td>";
|
|
|
+ $str .= "<td>". $value['pm']. "</td>";
|
|
|
+ $str .= "<td>". $value['shipremarks']. "</td>";
|
|
|
+ $str .= "<td>". $value['ts']. "</td>";
|
|
|
+ $str .= "<td>". $value['printtime']. "</td>";
|
|
|
+
|
|
|
+ $str .= "</tr>";
|
|
|
+ }
|
|
|
+ $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);
|
|
|
+
|
|
|
+ }
|
|
|
}
|