From 6f7dcb9ca56b62df5896b4ce53d46dd7fc10fad2 Mon Sep 17 00:00:00 2001 From: liuweiwen <“529520975@qq.com> Date: Mon, 13 Jan 2020 15:16:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E4=B8=8B=E6=B8=B8?= =?UTF-8?q?=E5=AF=B9=E8=B4=A6=E5=8D=95=E5=AF=BC=E5=87=BA=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 7cc7e1fd0..7b558b442 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -1830,7 +1830,7 @@ function getCompanyList() { //上游cp对账单导出 function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money) { - header("Content-type: text/html; charset=gb2312"); + header("Content-type: text/html; charset=utf-8"); error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); @@ -1901,10 +1901,15 @@ function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_ $objPHPExcel->getActiveSheet()->setCellValue("J" . ($line+3), $data['pay_company']['bank_account']); $objPHPExcel->getActiveSheet()->setCellValue("J" . ($line+4), $data['pay_company']['opening_bank']); + $statement_begin_time = date('Y.m.d', $data['statement_begin_time']);//对账开始时间 + $statement_end_time = date('Y.m.d',$data['statement_end_time']);//对账截止时间 + + $fileName = "{$data['second_party_info']['partner']}&{$data['first_party_info']['partner']}-对账单{$statement_begin_time}-{$statement_end_time}"; + ob_end_clean();//清除缓冲区,避免乱码 header('pragma:public'); - header('Content-type:application/vnd.ms-excel;charset=utf-8;name="上游结算单.xls"'); - header("Content-Disposition:attachment;filename=上游结算单.xls");//attachment新窗口打印inline本窗口打印 + header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls'); + header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印 $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); exit; @@ -1929,8 +1934,8 @@ function excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_al //设置模板文件 $objPHPExcel = $objReader->load("Public/Admin/excel/down_stream.xls"); - $statement_begin_time = set_show_time($data['statement_begin_time']);//对账开始时间 - $statement_end_time = set_show_time($data['statement_end_time']);//对账截止时间 + $statement_begin_time = date('Y.m.d', $data['statement_begin_time']);//对账开始时间 + $statement_end_time = date('Y.m.d',$data['statement_end_time']);//对账截止时间 $objPHPExcel->getActiveSheet()->setCellValue('A1', "《 {$data['company_name']} 》结算单 ({$statement_begin_time}-{$statement_end_time}"); @@ -1983,11 +1988,12 @@ function excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_al $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+9), $data['second_party_info']['bank_account']);//银行账号 $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+10), $data['second_party_info']['opening_bank']);//开户行 - $filename = '下游结算单'; + $fileName = "{$data['second_party_info']['partner']}&{$data['first_party_info']['jfCompany']}-对账单{$statement_begin_time}-{$statement_end_time}"; +// dd($fileName); ob_end_clean();//清除缓冲区,避免乱码 header('pragma:public'); - header('Content-type:application/vnd.ms-excel;charset=utf-8;name="15415.xls"'); - header("Content-Disposition:attachment;filename=$filename.xls");//attachment新窗口打印inline本窗口打印 + header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls'); + header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印 $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); exit;