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();
    $OAEc = $xSoc->getOActividadEconomica();
    $tp = $xSoc->getEsPersonaFisica() == true ? 1 : 2;
    $nac = $xSoc->getPaisDeOrigen() == EACP_CLAVE_DE_PAIS ? 1 : 2;
    $detalles = $xRisk->mensajes_del_sistema()->v(OUT_TXT);
    $razones = $xRisk->razones_de_reporte()->v(OUT_TXT);
    //obtiene las razones de cada operacion presente.
    $recibo = $xRisk->documento_relacionado()->v();
    $cont = array();
    $linea = "";
    $cont[1] = $xLayout->getClave();
    $cont[2] = $FechaExtraccion;
    $cont[3] = $operaciones == 0 ? 1 : $operaciones;
    $cont[4] = "01" . $xT->cSerial(3, $supervisor);
    //clave nacional de entidad supervisora 1002 = CNBV
    $cont[5] = $casfin;
    $cont[6] = $xLoc->DomicilioLocalidadClave();
    // cambiar por la UIF
    $cont[7] = $xLoc->DomicilioCodigoPostal();
    // CP de la sucursal
 function add($persona, $tipo, $fecha, $valor, $documento, $tipo_de_documento = false, $usuario = false, $hora = false, $instrumento = false, $tipo_de_operacion = false, $tercero_relacionado = DEFAULT_SOCIO, $mensajes = "", $inmediato = false)
 {
     $hora = $hora == false ? date("Hi") : $hora;
     $usuario = $usuario == false ? getUsuarioActual() : $usuario;
     $tipo_de_documento = $tipo_de_documento == false ? iDE_RECIBO : $tipo_de_documento;
     $instrumento = setNoMenorQueCero($instrumento);
     if ($instrumento <= 0 or setNoMenorQueCero($tipo_de_operacion) <= 0) {
         switch ($tipo_de_documento) {
             case iDE_RECIBO:
                 $EqOps = new cSistemaEquivalencias(TOPERACIONES_RECIBOSTIPOS);
                 $EqTes = new cSistemaEquivalencias(TTESORERIA_TIPOS_DE_PAGO);
                 $xRec = new cReciboDeOperacion(false, false, $documento);
                 $instrumento = $EqTes->get($xRec->getTipoDePago());
                 $tipo_de_operacion = $EqOps->get($xRec->getTipoDeRecibo());
                 if ($xRec->isDivisaExtranjera() == true) {
                     $instrumento = AML_OPERACIONES_CLAVE_DIVISA;
                 }
                 if ($tipo_de_operacion == null) {
                     $tipo_de_operacion = "01";
                 }
                 break;
         }
     }
     if ($inmediato == true) {
         $inmediato = 1;
     }
     $inmediato = setNoMenorQueCero($inmediato);
     $xPR = new cAml_risk_register();
     $xPR->clave_de_riesgo($xPR->query()->getLastID());
     $xPR->escore($valor);
     $xPR->fecha_de_reporte($fecha);
     $xPR->hora_de_reporte($hora);
     $xPR->persona_relacionada($persona);
     $xPR->tipo_de_riesgo($tipo);
     $xPR->usuario_de_origen($usuario);
     $xPR->tipo_de_documento($tipo_de_documento);
     $xPR->documento_relacionado($documento);
     $xPR->estado_de_envio(SYS_UNO);
     $xPR->fecha_de_envio(0);
     $xPR->estado_de_envio(0);
     $xPR->fecha_de_checking(0);
     $xPR->oficial_de_checking(AML_OFICIAL_DE_CUMPLIMIENTO);
     $xPR->monto_total_relacionado(0);
     //cargar datos del recibo
     $xPR->instrumento_financiero($instrumento);
     //mejorar segun catalogo CNBV
     $xPR->tipo_de_operacion($tipo_de_operacion);
     $xPR->tercero_relacionado($tercero_relacionado);
     $xPR->mensajes_del_sistema($mensajes);
     $xPR->reporte_inmediato($inmediato);
     $ql = $xPR->query()->insert();
     $ql->save();
     $this->mMessages .= $ql->getMessages(OUT_TXT);
 }
 function obj()
 {
     $mObj = null;
     switch ($this->mTabla) {
         case TPERSONAS_RELACIONES:
             $mObj = new cSocios_relaciones();
             break;
         case TBANCOS_CUENTAS:
             $mObj = new cBancos_cuentas();
             break;
         case TOPERACIONES_RECIBOS:
             $mObj = new cOperaciones_recibos();
             break;
         case TOPERACIONES_MVTOS:
             $mObj = new cOperaciones_mvtos();
             break;
         case TBANCOS_OPERACIONES:
             $mObj = new cBancos_operaciones();
             break;
         case TBANCOS_CUENTAS:
             $mObj = new cBancos_cuentas();
             break;
         case TCREDITOS_REGISTRO:
             $mObj = new cCreditos_solicitud();
             break;
         case TTESORERIA_MVTOS:
             $mObj = new cTesoreria_cajas_movimientos();
             break;
         case TCATALOGOS_EMPRESAS:
             $mObj = new cSocios_aeconomica_dependencias();
             $this->mCampoDesc = $mObj->nombre_corto()->v();
             break;
         case TCATALOGOS_RELACIONES:
             $mObj = new cSocios_relacionestipos();
             $this->mCampoDesc = $mObj->descripcion_relacionestipos()->get();
             break;
         case TCATALOGOS_ACTIVIDADES_ECONOMICAS:
             $mObj = new cPersonas_actividad_economica_tipos();
             $this->mCampoDesc = $mObj->nombre_de_la_actividad()->get();
             break;
         case TCATALOGOS_LOCALIDADES:
             $mObj = new cCatalogos_localidades();
             $this->mCampoDesc = $mObj->nombre_de_la_localidad()->get();
             break;
         case TCAPTACION_CUENTAS:
             $mObj = new cCaptacion_cuentas();
             break;
         case TCATALOGOS_PAISES:
             $mObj = new cPersonas_domicilios_paises();
             $this->mCampoDesc = $mObj->nombre_oficial()->get();
             break;
         case TPERSONAS_DIRECCIONES:
             $mObj = new cSocios_vivienda();
             break;
         case TPERSONAS_GENERALES:
             $mObj = new cSocios_general();
             break;
         case TPERSONAS_MEMOS:
             $mObj = new cSocios_memo();
             break;
         case TPERSONAS_PERFIL_TRANSACCIONAL:
             $mObj = new cPersonas_perfil_transaccional();
             break;
         case TSEGUMIENTO_LLAMADAS:
             $mObj = new cSeguimiento_llamadas();
             break;
         case TSYSTEM_LOG:
             $mObj = new cGeneral_log();
             break;
         case TCREDITOS_PRODUCTOS_OTROS_PARAMETROS:
             $mObj = new cCreditos_productos_otros_parametros();
             break;
         case TPERSONAS_ACTIVIDAD_ECONOMICA:
             $mObj = new cSocios_aeconomica();
             break;
         case TUSUARIOS_NOTAS:
             $mObj = new cUsuarios_web_notas();
             break;
         case TAML_PERFIL_RIESGO:
             $mObj = new cAml_riesgo_perfiles();
             break;
         case TCATALOGOS_GRADO_RIESGO:
             $mObj = new cAml_risk_levels();
             $this->mCampoDesc = $mObj->nombre_del_nivel()->get();
             break;
         case TAML_REGISTRO_DE_RIESGOS:
             $mObj = new cAml_risk_register();
             $this->mCampoDesc = $mObj->mensajes_del_sistema()->get();
             break;
         case TAML_REGISTRO_DE_RIESGOS:
             $mObj = new cAml_alerts();
             $this->mCampoDesc = $mObj->mensaje()->get();
             break;
         default:
             $mObj = null;
             break;
     }
     if ($mObj != null) {
         $this->mClavePrincipal = $mObj->getKey();
     }
     return $mObj;
 }