导出模板方法上传

master
zhengyongxing 5 years ago
parent 602fb33fcc
commit ea140a430f

@ -1336,9 +1336,11 @@ function templatelist(){
*返回游戏名称
*/
function get_gamename($gid=0){
if($gid == 0){return "未知";}
$model = D("Game");
$list = $model->where("id=".$gid)->find();
// return $list;
return $list["game_name"];
}
@ -1826,4 +1828,85 @@ function getCompanyList() {
}
function excelUpStreamTemplate() {
header("Content-type: text/html; charset=gb2312");
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
Vendor("PHPExcel.PHPExcel");
$objPHPExcel = new \PHPExcel();
$objReader = \PHPExcel_IOFactory::createReader('Excel5');
//设置模板文件
$objPHPExcel = $objReader->load("Runtime/upstream.xls");
$objPHPExcel->getActiveSheet()->setCellValue('D2', 'chengzhi');
$objPHPExcel->getActiveSheet()->insertNewRowBefore(10,1)->mergeCells('J10:K10')->insertNewRowBefore(10,1)->mergeCells('J10:K10');
ob_end_clean();//清除缓冲区,避免乱码
header('pragma:public');
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="15415.xls"');
header("Content-Disposition:attachment;filename=15415.xls");//attachment新窗口打印inline本窗口打印
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
}
function excelDownStreamTemplate() {
header("Content-type: text/html; charset=gb2312");
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
Vendor("PHPExcel.PHPExcel");
$objPHPExcel = new \PHPExcel();
$objReader = \PHPExcel_IOFactory::createReader('Excel5');
//设置模板文件
$objPHPExcel = $objReader->load("upstream.xls");
$objPHPExcel->getActiveSheet()->setCellValue('D2', 'chengzhi');
$objPHPExcel->getActiveSheet()->insertNewRowBefore(10,1);
ob_end_clean();//清除缓冲区,避免乱码
header('pragma:public');
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="15415.xls"');
header("Content-Disposition:attachment;filename=15415.xls");//attachment新窗口打印inline本窗口打印
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
}
function getWithdrawNumber() {
$map = [];
$map['ext_field'] = ['neq',null];
$data = M('withdraw',"tab_")
->field("widthdraw_number")
->join("left join tab_statement as statement on tab_withdraw.widthdraw_number = statement.ext_field")
->where("ext_field is null")
->select();
return $data;
}
?>

Loading…
Cancel
Save