export.php

来自「极限网络智能办公系统 Office Automation V3.0官方100%源」· PHP 代码 · 共 41 行

PHP
41
字号
<?
include_once 'inc/auth.php';
include_once 'inc/utility_all.php';
$EXCEL_OUT = '部门名称,部门排序号,上级部门,部门电话,部门传真,部门职能
';
$query = 'SELECT * from DEPARTMENT order by DEPT_PARENT,DEPT_NO';
$cursor = exequery ($connection, $query);
while ($ROW = mysql_fetch_array ($cursor))
{
	$DEPT_NO = format_cvs ($ROW['DEPT_NO']);
	$DEPT_NAME = format_cvs ($ROW['DEPT_NAME']);
	$TEL_NO = format_cvs ($ROW['TEL_NO']);
	$FAX_NO = format_cvs ($ROW['FAX_NO']);
	$DEPT_PARENT = format_cvs ($ROW['DEPT_PARENT']);
	$DEPT_FUNC = '"' . format_cvs ($ROW['DEPT_FUNC']) . '"';
	if ($DEPT_PARENT != 0)
	{
		$query = 'SELECT * from DEPARTMENT where DEPT_ID=' . $DEPT_PARENT;
		$cursor1 = exequery ($connection, $query);
		if ($ROW1 = mysql_fetch_array ($cursor1))
		{
			$DEPT_PARENT = format_cvs ($ROW1['DEPT_NAME']);
		}
	}
	else
	{
		$DEPT_PARENT = '';
	}
	$EXCEL_OUT .= ($DEPT_NAME . ',' . $DEPT_NO . ',' . $DEPT_PARENT . ',' . $TEL_NO . ',' . $FAX_NO . ',' . $DEPT_FUNC . '
');
}
ob_end_clean ();
header ('Cache-control: private');
header ('Content-type: application/vnd.ms-excel');
header ('Accept-Ranges: bytes');
header ('Accept-Length: ' . strlen ($EXCEL_OUT));
header ('Content-Length: ' . strlen ($EXCEL_OUT));
header ('Content-Disposition: attachment; filename= OA部门.csv');
echo $EXCEL_OUT;
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?