⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 excel.php

📁 泛微协同办公系统标准版E-office V5.5的源代码内含泛微办公系统V5.5自动注册文件。
💻 PHP
字号:
<?php

header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
include_once( "inc/auth.php" );
include_once( "inc/utility_all.php" );
include_once( "report_query.php" );
$sql = "SELECT * FROM flow_report WHERE REPORT_ID=".$_REQUEST['REPORT_ID']."";
$rs = exequery( $connection, $sql );
$row = mysql_fetch_array( $rs );
$reportname = $row['REPORT_NAME'];
$file_name = $reportname.date( "YdmHis" ).".xls";
if ( $_REQUEST['REPORT_TYPE'] == "year" )
{
	$unit = "月";
	$title = "月份\t";
}
if ( $_REQUEST['REPORT_TYPE'] == "month" )
{
	$unit = "日";
	$title = "日\t";
}
if ( $_REQUEST['REPORT_TYPE'] == "week" )
{
	$unit = "星期";
	$title = "星期\t";
}
if ( $_REQUEST['REPORT_TYPE'] == "day" )
{
	$unit = "时";
	$title = "时\t";
}
if ( 0 < count( $arrayData ) )
{
	$i = 0;
	for ( ;	$i < count( $arrayData[1] );	++$i	)
	{
		if ( $arrayData[1][$i]['FIELD_IMG'] == 1 )
		{
			$title .= $arrayData[1][$i]['FIELD_NAME']."\t";
		}
	}
}
$title .= "合计\t\r";
$content = "";
if ( 0 < count( $arrayData ) )
{
	$totalX = array( );
	$i = 1;
	for ( ;	$i <= count( $arrayData );	++$i	)
	{
		$content .= $i.$unit."\t";
		$totalY = 0;
		$j = 0;
		for ( ;	$j < count( $arrayData[$i] );	++$j	)
		{
			if ( $arrayData[$i][$j]['FIELD_IMG'] == 1 )
			{
				$totalY += $arrayData[$i][$j]['FIELD_VALUE'];
				$content .= $arrayData[$i][$j]['FIELD_VALUE']."\t";
				$totalX[$j] += $arrayData[$i][$j]['FIELD_VALUE'];
			}
		}
		$totalXY += $totalY;
		$content .= $totalY."\t\r";
	}
	$content .= "合计\t";
	while ( list( $key, $var ) = each( $totalX ) )
	{
		$content .= $var."\t";
	}
	$content .= $totalXY."\t\r";
}
ob_end_clean( );
header( "Cache-control: private" );
header( "Content-type: application/vnd.ms-excel" );
header( "Accept-Ranges: bytes" );
header( "Accept-Length: ".strlen( $title.$content ) );
header( "Content-Disposition: attachment; filename=".$file_name );
echo $title.$content;
?>

⌨️ 快捷键说明

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