Location: PHPKode > projects > Opensheet > opensheet/functions/export.xls.summary.php
<?php
#Add sessions
# Add overtime
if (isset($_GET['start'])  && isset($_GET['finish']) && isset($_GET['type'])) {

$start = $_GET['start'];
$finish = $_GET['finish'];
$type = $_GET['type'];

require_once 'Spreadsheet/Excel/Writer.php';
include ('base.functions.php');
include ('../classes/global.class.php');

#echo "<pre>";
$filename = 'export.xls';
// Creating workbook
$workbook = new Spreadsheet_Excel_Writer();
// Setting workbook version 8
$workbook->setVersion(8);
// Sending headers to browser
$workbook->send('export.xls');
// Adding worksheet

$worksheet =& $workbook->addWorksheet('ramboll');
$format_right =& $workbook->addFormat();
$format_right->setAlign('right');
$format_center =& $workbook->addFormat();
$format_center->setAlign('center');
$format_left =& $workbook->addFormat();
$format_left->setAlign('left');
// Setting worksheet encoding to UTF-8
$worksheet->setInputEncoding('UTF-8');
$worksheet->setColumn(0,1,40);
$worksheet->setColumn(2,2,10);
$worksheet->setColumn(3,3,20);
$worksheet->setColumn(4,6,40);
// Data input
// Header of a tables

$worksheet->write(0, 0, 'ФИО',$format_center);
$worksheet->write(0, 1, 'Проект',$format_center);
$worksheet->write(0, 2, 'Часы',$format_center);
$worksheet->write(0, 3, 'Индекс проекта',$format_center);
$worksheet->write(0, 4, 'Владелец проекта',$format_center);
$worksheet->write(0, 5, 'Тип проекта',$format_center);
$worksheet->write(0, 6, 'Группа пользователя',$format_center);


$stats =   new Stats;
$user  =   new Users;
$project = new Projects;
$group =   new Groups;	
$hours = $stats->getPrjHoursPerDayByUsers($start,$finish,$type);	
$s=1;
#print_r($hours);
foreach ($hours as $uid =>$value){
	foreach ($value as $pid => $data){
		foreach ($data as $proj_type=>$hours){
							
			$worksheet->write($s, 0, $user->getRealName($uid));
			$worksheet->write($s, 1, $project->getProjectName($pid));
			$worksheet->write($s, 2, $hours);
			$worksheet->write($s, 3, 0,$format_center);
			$worksheet->write($s, 4, $project->getProjOwner($pid),$format_center);
			$worksheet->write($s, 5, $proj_type,$format_center);
			$worksheet->write($s, 6, $user->getUserGroup($uid),$format_center);
			$s++;
		}
	}		

}	


// Sending the file
header("Content-Disposition: attachment; filename=export.xls");
header("Content-Type: application/octet-stream");
header("Content-Length: размер файла");
$workbook->close();
}
?>
Return current item: Opensheet