//header("Content-type: text/x-csv"); header("Content-type: text/plain"); //header("Content-type: application/csv"); header("Content-Disposition: attachment; filename={$archivo}"); echo $rpt; if ($definitivo == true) { //Guardar $sqlUpdate = " UPDATE `aml_risk_register` SET `estado_de_envio` = 1, `fecha_de_envio`= " . $xF->getInt() . "\n\t\t\tWHERE (SELECT `tipo_de_riesgo` FROM `aml_risk_catalog` WHERE\n\t\t\t(`clave_de_control`= `aml_risk_register`.`tipo_de_riesgo`= " . AML_CLAVE_OPERACIONES_INTERNAS . "\n\t\t\t\tOR\n\t\t\t`clave_de_control`= `aml_risk_register`.`tipo_de_riesgo`= " . AML_CLAVE_OPERACIONES_INUSUALES . ")\n\t\t\tAND (getFechaByInt(`aml_risk_register`.`fecha_de_reporte`) <='{$FechaFinal}')\n\t\t\tAND (`aml_risk_register`.`estado_de_envio` =0)\n\t\t\tAND (`aml_risk_register`.`reporte_inmediato` =1)\t\t\t\n\t\t\t"; $query->setRawQuery($sqlUpdate); //enviar por mail al administrador $xMail = new cNotificaciones(); $xMail->sendMail($archivo, $rpt, ADMIN_MAIL); } } else { $xRPT = new cReportes(); $xRPT->setOut(OUT_HTML); $xRPT->addContent($xRPT->getHInicial($xHP->getTitle(), $FechaInicial, $FechaFinal)); $arrTitulos = array(); foreach ($Estructura as $indice => $propiedades) { $xCampo = new cReportes_LayoutTipos($propiedades); $arrTitulos[] = $xCampo->getNombre(); } $xHTable->addTitles($arrTitulos); if ($msg != "") { $xRPT->addFooterBar("<h3>El reporte contiene los siguientes errores</h3>" . $msg); } $xRPT->addContent($xHTable->get()); $xRPT->setToPrint(); echo $xRPT->render(true); } }