<?php
/*
Autor: Lic. Carlos Alberto Vaca Coronado
Version: 3.2.0
*/
session_name('portal_absa');
session_start();
if(!isset($_SESSION['usuario_p_prov_absa']) || trim($_SESSION['usuario_p_prov_absa']) == "" || trim(strtoupper($_SESSION["URL_PORTAL"]."admin.php")) != trim(strtoupper($_SERVER['HTTP_REFERER']))){
	?><script>window.location.href="<?=$_SESSION["URL_PORTAL"]."index.php"?>"</script><?
	exit;
}
//error_reporting(E_ALL);
require("Spreadsheet/Excel/Classes/PHPExcel.php");
require "Spreadsheet/Excel/Classes/PHPExcel/IOFactory.php";
require "../conexion/conectar.php";
require_once "../libs/funciones.php";

$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("DIS")
							 ->setLastModifiedBy("DIS")
							 ->setTitle("Office 2007 XLSX")
							 ->setSubject("Office 2007 XLSX")
							 ->setDescription("Document for Office 2007 XLSX")
							 ->setKeywords("office 2007")
							 ->setCategory("Result file");

$conexion = new CONDB();
$conexion->conectar();

include "hojaExcelPagosREP.php";

$objPHPExcel->setActiveSheetIndex(0);
$nombreArchivo = date("YmdHis");
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.$nombreArchivo.'.xlsx"');
header('Cache-Control: max-age=0');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');

$objWriter->save('php://output');
//$objWriter->save('test.xls');
?>