$NombreOtorganteAnterior = "";
 //
 $NumeroOtorganteAnterior = "";
 $linea .= "{$ClaveActualOtorgante}|{$NombreOtorgante}|{$CuentaActual}|{$TipoDeResponsabilidad}|{$TipoDeCuenta}|{$TipoDeContrato}|{$ClaveUnidadMonetaria}|{$ValorActivoValuacion}|";
 $linea .= "{$NumeroDePagos}|{$FrecuenciaDePagos}|{$MontoPagar}|{$FechaAperturaCuenta}|{$FechaUltimoPago}|{$FechaUltimaCompra}|{$FechaCierreCuenta}|{$FechaCorte}|";
 $linea .= "{$Garantia}|{$CreditoMaximo}|{$SaldoActual}|{$LimiteCredito}|{$SaldoVencido}|{$NumeroPagosVencidos}|{$PagoActual}|{$HistoricoPagos}|{$ClavePrevencion}|";
 $linea .= "{$TotalPagosReportados}|{$ClaveOtorganteAnterior}|{$NombreOtorganteAnterior}|{$NumeroOtorganteAnterior}|";
 $SaldoInsoluto = $xCR->getMonto($xCred->getSaldoActual($FechaFinal));
 $linea .= "{$FechaDePrimerIncumplimiento}|{$SaldoInsoluto}|";
 $NombreOtorgante = $xCR->getNombreOtorgante();
 $DomicilioDevolucion = "";
 //str_replace(",", ";",  EACP_DOMICILIO_CORTO);
 //============================== ELEMENTOS DE CONTROL
 $linea .= "{$TotalSaldosActuales}|{$TotalSaldosVencidos}|{$TotalElementosNombres}|{$TotalElementosDireccion}|{$TotalElementosEmpleo}|{$TotalElementosCuenta}|{$NombreOtorgante}|{$DomicilioDevolucion}";
 //
 if ($xSoc->getEsPersonaFisica() == true) {
     if ($toJson == true) {
         $arrLinea = explode("|", $linea);
         $jsonNew = array();
         foreach ($itemJson as $ix => $item) {
             $jsonNew[$item] = isset($arrLinea[$ix]) ? $arrLinea[$ix] : "ERORR";
         }
         $lineaJson[] = $jsonNew;
     } else {
         echo $linea . "\r\n";
     }
 } else {
     //OMITIDO
     $xLog->add("WARN\t{$idpersona}-{$idcredito}\t{$sucres}\tOmitir por ser Persona Moral " . $xSoc->getNombre() . "\r\n", $xLog->DEVELOPER);
 }
 $icnt++;
$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();
    $OAEc = $xSoc->getOActividadEconomica();
    $tp = $xSoc->getEsPersonaFisica() == true ? 1 : 2;
    $nac = $xSoc->getPaisDeOrigen() == EACP_CLAVE_DE_PAIS ? 1 : 2;
    $detalles = $xRisk->notas_de_checking()->v(OUT_TXT);
    $razones = $xRisk->razones_de_reporte()->v(OUT_TXT);
    $tipo_de_obj = $xRisk->tipo_de_documento()->v();
    $tercero = $xRisk->tercero_relacionado()->v();
    //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;
 $c4Tbl->addTool(2);
 $xHTabs->addTab($oFrm->lang("NOTAS"), $c4Tbl->Show());
 //1
 $xHTabs->addTab("TR.DOMICILIO", "");
 //2
 $xHTabs->addTab(PERSONAS_TITULO_PARTES, "");
 //3
 $xHTabs->addTab("TR.ACTIVIDAD_ECONOMICA", "");
 //tab4
 // Tabla de Relacion Patrimonial
 $xHTabs->addTab("TR.PATRIMONIO", "");
 //tab5?
 //=======================================================================
 $cnt = "";
 $xB = new cBases();
 $mems = $xSoc->getEsPersonaFisica() == true ? $xB->getMembers_InArray(false, BASE_DOCTOS_PERSONAS_FISICAS) : $xB->getMembers_InArray(false, BASE_DOCTOS_PERSONAS_MORALES);
 $rsDocs = $ql->getDataRecord($xql->getListadoDePersonasDoctos($idsocio));
 $xTbl = new cHTabla();
 foreach ($rsDocs as $rows) {
     $iddocto = $rows["archivo_de_documento"];
     $fecha = $xF->getFechaByInt($rows["fecha_de_carga"]);
     $xTbl->initRow();
     $xTbl->addTD($rows["tipo"]);
     $xTbl->addTD($xF->getFechaCorta($fecha));
     $xTbl->addTD($xBtn->getBasic($rows["archivo_de_documento"], "var xPers = new PersGen();xPers.getDocumento({persona:{$idsocio}, docto: '" . $rows["archivo_de_documento"] . "'});", $oFrm->ic()->TIPO));
     $xTbl->addTD($rows["observaciones"]);
     $xTbl->endRow();
 }
 $xHTabs->addTab("TR.DOCUMENTOS", $xTbl->get());
 //tabs
 if (getEsModuloMostrado(USUARIO_TIPO_OFICIAL_AML) == true) {
$xDoc = new cDocumentos();
$DDATA = $_REQUEST;
$persona = isset($DDATA["persona"]) ? $DDATA["persona"] : DEFAULT_SOCIO;
$action = isset($DDATA["action"]) ? $DDATA["action"] : SYS_CERO;
//$jxc = new TinyAjax();
//$jxc ->exportFunction('datos_del_pago', array('idsolicitud', 'idparcialidad'), "#iddatos_pago");
//$jxc ->process();
echo $xHP->getHeader();
$jsb = new jsBasicForm("frmdocumentos");
//$jxc ->drawJavaScript(false, true);
$ByType = "";
echo $xHP->setBodyinit();
if ($persona != DEFAULT_SOCIO) {
    $xSoc = new cSocio($persona);
    $xSoc->init();
    $ByType = $xSoc->getEsPersonaFisica() == true ? BASE_DOCTOS_PERSONAS_FISICAS : BASE_DOCTOS_PERSONAS_MORALES;
}
$xFRM = new cHForm("frmfirmas", "personas_documentos.frm.php?action=" . SYS_UNO . "&persona={$persona}");
$xFRM->setEnc("multipart/form-data");
$xFRM->setTitle($xHP->getTitle());
$xBtn = new cHButton();
$xTxt = new cHText();
$xTxt2 = new cHText();
$xTxtF = new cHText();
$xSel = new cHSelect();
$xImg = new cHImg();
if ($action == SYS_CERO) {
    $xTxtF->setDivClass("");
    //$xTxtF->setProperty("class", "")
    $xFRM->OFile("idnuevoarchivo", "", "TR.Cargar Documento");
    $xFRM->OText("iddocumento", "", "TR.Nombre del Archivo", true, $xImg->get24("common/search.png", " onclick='jsGetDocto()' "));