$production = ($out == OUT_TXT or $out == OUT_CSV) ? true : false;
$FechaExtraccion = $FechaFinal;
$FechaTitulo = date("ymd", strtotime($FechaFinal));
$casfin = EACP_CLAVE_CASFIN;
$delimitador = $xLayout->getSeparador();
$msg = "";
$supervisor = 2;
//$xCatalogoActividades	= new cPersonaActividadEconomica();
$sql = "SELECT\n\t\t*\nFROM\n\t`aml_risk_catalog` `aml_risk_catalog`\n\t\tINNER JOIN `aml_risk_register` `aml_risk_register`\n\t\tON `aml_risk_catalog`.`clave_de_control` = `aml_risk_register`.\n\t\t`tipo_de_riesgo`\nWHERE\n\t(`aml_risk_catalog`.`tipo_de_riesgo` = " . AML_CLAVE_OPERACIONES_INTERNAS . "\n\tOR\n\t`aml_risk_catalog`.`tipo_de_riesgo` = " . AML_CLAVE_OPERACIONES_INUSUALES . ")\t\t\n\t\n\tAND \n\t(`aml_risk_register`.`estado_de_envio` =0)\n\tAND\n\t(`aml_risk_register`.`reporte_inmediato` =1)\n\tORDER BY `aml_risk_register`.`fecha_de_reporte`\n";
$xTBL = new cTabla($sql);
$rpt = "";
$rs = $query->getDataRecord($sql);
$xEquivOps = new cSistemaEquivalencias(TOPERACIONES_RECIBOSTIPOS);
$xEquivOps->init($xEquivOps->PLD_OPERACIONES);
$xEquivInst = new cSistemaEquivalencias(TTESORERIA_TIPOS_DE_PAGO);
$xEquivInst->init($xEquivInst->PLD_OPERACIONES);
//$xEquivIns
$operaciones = 0;
$totalerrores = 0;
foreach ($rs as $data) {
    $xRisk = new cAml_risk_register();
    $xRisk->setData($data);
    $persona = $xRisk->persona_relacionada()->v();
    // $data["persona"];
    $fechaDetec = $xF->getFechaByInt($xRisk->fecha_de_reporte()->v());
    //$data["fecha"]);
    //$tipo_de_riesgo	=  $data["tipo_de_riesgo"];
    //obtener listado de operaciones en el mes
    $xAML = new cAMLPersonas($persona);
    $xSoc = new cSocio($persona, true);
    $ODom = $xSoc->getODomicilio();