<?php
/** Error reporting */
error_reporting(E_ALL);
 
/** Include path **/
ini_set('include_path', ini_get('include_path').';../Classes/');
 
/** PHPExcel */
include '../../function/PHPExcel.php';
 
/** PHPExcel_Writer_Excel2007 */
include '../../function/PHPExcel/Writer/Excel2007.php';
 
$excel = new PHPExcel();
$excel->setActiveSheetIndex(0);
$worksheet = $excel->getActiveSheet();
 
$worksheet->SetCellValue('A1', 'No');
$worksheet->SetCellValue('B1', 'Tgl SPB');
$worksheet->SetCellValue('C1', 'PIC');
$worksheet->SetCellValue('D1', 'Kode Barang');
$worksheet->SetCellValue('E1', 'Jumlah');
$worksheet->SetCellValue('F1', 'Keterangan');
$worksheet->SetCellValue('G1', 'No Unik');

$objWriter = PHPExcel_IOFactory::createWriter($excel, 'Excel5');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="template_transfer_brg_jadi"'.date("dmyHis").'".xls"');
header('Cache-Control: max-age=0');
$objWriter->save('php://output');
$excel->disconnectWorksheets();
unset($excel); 
?>