|
|
@@ -111,6 +111,8 @@ class Beihuogl extends Start_Controller {
|
|
|
$this->_updatestatus();
|
|
|
}elseif($arg == 'bhcxedit'){
|
|
|
$this->_bhcxedit($arg_array);
|
|
|
+ }elseif($arg == 'bhcxlistexcel'){
|
|
|
+ $this->_bhcxlistexcel();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -2430,10 +2432,18 @@ class Beihuogl extends Start_Controller {
|
|
|
if(empty($info)){
|
|
|
echo json_encode(['success'=>false,'msg'=>'数据不存在']);exit;
|
|
|
}
|
|
|
+ $update_data = [
|
|
|
+ 'status' => $status,
|
|
|
+ ];
|
|
|
+ $update_data['update_time'] = time();
|
|
|
if($status == 0 || $status == 2){
|
|
|
if($info['status'] != 1){
|
|
|
echo json_encode(['success'=>false,'msg'=>'当前状态不符合修改状态']);exit;
|
|
|
}
|
|
|
+
|
|
|
+ if($status == 2){
|
|
|
+ $update_data['hd_time'] = time();
|
|
|
+ }
|
|
|
}
|
|
|
if($status == 1){
|
|
|
if($info['status'] != 0){
|
|
|
@@ -2441,7 +2451,7 @@ class Beihuogl extends Start_Controller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if($this->bhsccx->save(['status' => $status],$id)){
|
|
|
+ if($this->bhsccx->save($update_data,$id)){
|
|
|
echo json_encode(['success'=>true,'msg'=>'修改成功']);exit;
|
|
|
}else{
|
|
|
echo json_encode(array('msg' => '错误,请重试!', 'success' => false));
|
|
|
@@ -2537,4 +2547,87 @@ class Beihuogl extends Start_Controller {
|
|
|
$this->_Template('beihuogl_bhcxshlist',$this->data);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private function _bhcxlistexcel(){
|
|
|
+ if($this->input->method() === 'post'){
|
|
|
+ exit("状态不正确");
|
|
|
+ }else{
|
|
|
+ $ktime = $this->input->get('ktime',true);
|
|
|
+ $jtime = $this->input->get('jtime',true);
|
|
|
+ $ktime = strtotime($ktime);
|
|
|
+ $jtime = strtotime($jtime);
|
|
|
+ $status = $this->input->get('status',true);
|
|
|
+ $cxr = $this->input->get('cxr',true);
|
|
|
+ $cxr = trim($cxr);
|
|
|
+ $shop_id = $this->input->get('shop_id',true);
|
|
|
+
|
|
|
+ $where = "add_time >= ".$ktime." and add_time < ".$jtime." ";
|
|
|
+
|
|
|
+ if(!empty($cxr)){
|
|
|
+ $where .= " and cxr like '%".$cxr."%' ";
|
|
|
+ }
|
|
|
+ if($status >= 0 ){
|
|
|
+ $where .= " and status = ".$status." ";
|
|
|
+ }
|
|
|
+ if($shop_id >= 0){
|
|
|
+ $where .= " and shop_id = ".$shop_id." ";
|
|
|
+ }
|
|
|
+ $list = $this->bhsccx->find_all($where);
|
|
|
+ if(!empty($list)){
|
|
|
+ $shop_list= $this->shop->find_all("1=1","id,shopname");
|
|
|
+ $shop_list = array_column($shop_list,'shopname','id');
|
|
|
+ foreach($list as $k=>$v){
|
|
|
+ $list[$k]['add_time'] = date("Y-m-d H:i",$v['add_time']);
|
|
|
+ $list[$k]['shop_id'] = isset($shop_list[$v['shop_id']])?$shop_list[$v['shop_id']]:"无";
|
|
|
+ $list[$k]['hd_time'] = empty($v['hd_time'])?'':date("Y-m-d H:i",$v['hd_time']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //生成excel
|
|
|
+ $filename = date("Ymd")."-撤销备货申请单.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>u9生产单号</td><td>中文品名</td><td>u9料号</td><td>撤后生产数量</td><td>撤销人</td><td>申请撤销时间</td><td>备注</td><td>审核时间</td></tr>";
|
|
|
+ foreach ($list as $key=>$value)
|
|
|
+ {
|
|
|
+ $str .= "<tr>";
|
|
|
+ $str .= "<td>". $value['shop_id']. "</td>";
|
|
|
+ $str .= "<td>". $value['bh_no']. "</td>";
|
|
|
+ $str .= "<td>". $value['u9sc_no']. "</td>";
|
|
|
+ $str .= "<td>". $value['zh']. "</td>";
|
|
|
+ $str .= "<td>". $value['jm']. "</td>";
|
|
|
+ $str .= "<td>". $value['after_num']. "</td>";
|
|
|
+ $str .= "<td>". $value['cxr']. "</td>";
|
|
|
+ $str .= "<td>". $value['add_time']. "</td>";
|
|
|
+ $str .= "<td>". $value['remark']. "</td>";
|
|
|
+ $str .= "<td>". $value['hd_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);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|