|
@@ -2863,6 +2863,92 @@ class Transfer extends Start_Controller {
|
|
|
$this->_Template('transfer_cqrk',$this->data);
|
|
|
}
|
|
|
public function _cqrkexcel(){
|
|
|
+ $api = $this->input->get('api',true);
|
|
|
+
|
|
|
+ $transfer = $this->input->get('transfer',true);
|
|
|
+
|
|
|
+ $timetk = $this->input->get('timetk',true);
|
|
|
+ $timetj = $this->input->get('timetj',true);
|
|
|
+ $timetk = strtotime($timetk);
|
|
|
+ $timetj = strtotime($timetj);
|
|
|
+
|
|
|
+
|
|
|
+ $transfer_list = $this->transfer->find_all();
|
|
|
+ $t = $transfer_list = array_column($transfer_list, 'title', 'id');
|
|
|
+ $where = 'extra_status in (2,3) ';
|
|
|
+
|
|
|
+ //数据排序
|
|
|
+ $order_str = "id desc";
|
|
|
+
|
|
|
+
|
|
|
+ if($transfer){
|
|
|
+ $where .= " and lx = '$transfer'";
|
|
|
+ }else{
|
|
|
+ $transfer = $this->transfer->find_all('id not in (8,9,11,12,15,16)');
|
|
|
+ $transfer_ids = array_column($transfer, 'id');
|
|
|
+ $transfer_ids = implode(",",$transfer_ids);
|
|
|
+ $where .= " and lx in (".$transfer_ids.") ";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $where .= " and time > '$timetk' and time < '$timetj'";
|
|
|
+
|
|
|
+ $list = $this->systemtransfer_cr->find_all($where,'*',$order_str);
|
|
|
+
|
|
|
+ $final_list = [];
|
|
|
+ foreach ($list as $key => $value) {
|
|
|
+
|
|
|
+
|
|
|
+ $info = $this->systemtransfer->read($value['fid']);
|
|
|
+
|
|
|
+ $final_list[$key]['number'] = isset($info['number'])?$info['number']:'';
|
|
|
+ $final_list[$key]['pm'] = $info['pm'];
|
|
|
+ $final_list[$key]['lx_name'] = isset($transfer_list[$value['lx']])?$transfer_list[$value['lx']]:'';
|
|
|
+ $final_list[$key]['time'] = date('Y-m-d H:i:s',$info['time']);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
+ $filename = date("Y-m-d")."超期3天未流转单导出.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></tr>";
|
|
|
+ foreach ($final_list as $key=>$value)
|
|
|
+ {
|
|
|
+ if(empty($value['number'])){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $str .= "<tr>";
|
|
|
+ $str .= "<td>". $value['number']. "</td>";
|
|
|
+ $str .= "<td>". $value['pm']. "</td>";
|
|
|
+ $str .= "<td>". $value['lx_name']. "</td>";
|
|
|
+ $str .= "<td>". $value['time']. "</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);
|
|
|
}
|
|
|
}
|