include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
include_once "../core/core.db.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//=====================================================================================================
$xHP = new cHPage("REPORTE DE ", HP_REPORT);
$xHP->setIncludes();
$fechaDeInicio = isset($_GET["on"]) ? $_GET["on"] : fechasys();
$fechaFinal = isset($_GET["off"]) ? $_GET["off"] : fechasys();
$oficial = elusuario($iduser);
$xHP->setNoDefaultCSS();
$xHP->addCSS(CSS_REPORT_FILE);
$arrEquivGenero = array(1 => "M", 2 => "F", 99 => "");
$sql = "SELECT\r\n\t\t\t\t\t`socios_cajalocal`.`clave_de_centro`,\r\n\t\t\t\t\t`socios_general`.`codigo`,\r\n\t\t\t\t\t`socios_general`.`fechanacimiento`,\r\n\t\t\t\t\t`socios_general`.`apellidopaterno`,\r\n\t\t\t\t\t`socios_general`.`apellidomaterno`,\r\n\t\t\t\t\t`socios_general`.`nombrecompleto`,\r\n\t\t\t\t\t`socios_general`.`fechaalta`,\r\n\t\t\t\t\t`socios_general`.`genero` \r\n\t\t\t\tFROM\r\n\t\t\t\t\t`socios_general` `socios_general` \r\n\t\t\t\t\t\tINNER JOIN `socios_cajalocal` `socios_cajalocal` \r\n\t\t\t\t\t\tON `socios_general`.`cajalocal` = `socios_cajalocal`.\r\n\t\t\t\t\t\t`idsocios_cajalocal` \r\n\t\t\t\tWHERE\r\n\t\t\t\t\t(`socios_general`.`fechaalta` >='{$fechaDeInicio}')\r\n\t\t\t\t\tAND\r\n\t\t\t\t\t(`socios_general`.`fechaalta` <='{$fechaFinal}') ";
$rs = getRecordset($sql);
header("Content-type: text/x-csv");
//header("Content-type: text/csv");
//header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=reporte-patmir-II.del_{$fechaDeInicio}.al_{$fechaFinal}.csv");
//echo $xHP->getHeader();
//echo $xHP->setBodyinit("initComponents();");
//echo getRawHeader();
/*
<!-- -->
<table       >
	<thead>