<?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_once("Spreadsheet/Excel/Classes/PHPExcel.php");
require_once "Spreadsheet/Excel/Classes/PHPExcel/IOFactory.php";
require_once "../libs/funciones.php";
require_once("../clases/datosbd.class.php");




$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("Mi.DisXII.com")
							 ->setLastModifiedBy("Mi.DisXII.com")
							 ->setTitle("Office 2003 XLS")
							 ->setSubject("Office 2003 XLS")
							 ->setDescription("Document for Office 2003 XLS")
							 ->setKeywords("office 2003")
							 ->setCategory("Result file");

//Extraigo Configuracion General de notificaciones
$datosbd = new datosbd();
$datosbd->getConfig($_GET["RFCReceptor"]);
if($datosbd->noerror == -1){
	$datosbd->Alert($datosbd->mensaje);
}
if($datosbd->cConfig == null){
	$datosbd->Alert("No se encontro la configuración del receptor.");exit;
}
$tConfig = $datosbd->cConfig;
$notificar_fecha_inicio = $tConfig["notificar_fecha_inicio"];

include "hojaExcelLayoutFaltantesPago.php";

$objPHPExcel->setActiveSheetIndex(0);

header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="Docs_Faltantes_Pago_'.date("YmdHis").'.xls"');
header('Cache-Control: max-age=0');

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

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