function jsaSetCreditosADespedidos($credito, $fecha, $observaciones)
{
    $msg = "";
    $xCred = new cCredito($credito);
    $xCred->init();
    $xdat = new cFecha(0);
    $fecha = $xdat->getFechaISO($fecha);
    $xCred->init();
    $socio = $xCred->getClaveDePersona();
    $xSoc = new cSocio($socio);
    $xSoc->init();
    $xCred->setCambioProducto(CREDITO_PRODUCTO_DESTINO_DESCARTADOS);
    $xCred->setResetPersonaAsociada($fecha, $observaciones);
    //Agregar operacion de desvinculacion
    $xRe = new cReciboDeOperacion(RECIBOS_TIPO_ESTADISTICO, false, DEFAULT_RECIBO);
    $xRe->init();
    $xRe->setNuevoMvto($fecha, $xCred->getSaldoActual(), OPERACION_CLAVE_DESVINCULACION, $xCred->getPeriodoActual(), "", 1, false, $socio, $credito, $fecha);
    $xRe->setFinalizarRecibo();
    $msg .= $xSoc->getMessages(OUT_TXT);
    $msg .= $xCred->getMessages(OUT_TXT);
    $msg .= $xRe->getMessages(OUT_TXT);
    $xRN = new cReglaDeNegocio();
    $xEmp = new cEmpresas($xCred->getClaveDeEmpresa());
    $xEmp->init();
    $oP = $xCred->getOPersona();
    $xRN->setVariables(array("nombre_de_persona" => $oP->getNombreCompleto(), "mensaje" => $observaciones, "saldo_del_credito" => $xCred->getSaldoActual(), "nombre_de_la_empresa" => $xEmp->getNombreCorto()));
    $xRN->setExecuteActions($xRN->reglas()->RN_NOMINA_AL_DESPEDIR);
    $xF = new cFileLog();
    $xF->setWrite($msg);
    $xF->setClose();
    return $xF->getLinkDownload("Descarga de Log");
}
function jsaGetIDE($socio, $monto, $tipo_de_pago)
{
    $xSoc = new cSocio($socio);
    $xSoc->init();
    $x = $xSoc->getIDExPagarByPeriodo(false, $monto, $tipo_de_pago);
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("idide", $x));
    return $tab->getString();
}
function jsaGuardarVerificacion($fecha, $oficial, $tipo, $id, $notas, $socio)
{
    $xF = new cFecha();
    $fecha = $xF->getFechaISO($fecha);
    $tipo = $tipo == "d" ? TPERSONAS_DIRECCIONES : TPERSONAS_ACTIVIDAD_ECONOMICA;
    $xSoc = new cSocio($socio);
    $xSoc->init();
    $xSoc->setVerificacion($tipo, $id, $fecha, $notas, $oficial);
    return $xSoc->getMessages(OUT_HTML);
}
function jsaGetNumeroBeneficiarios($idsocio)
{
    $xSoc = new cSocio($idsocio);
    $xSoc->init();
    $beneficiarios = $xSoc->getNumeroDeBeneficiarios();
    if (!isset($beneficiarios) or $beneficiarios == 0) {
        return "<p class='warn'>El socio no tiene Beneficiario Registrado</p>";
    } else {
        return "El socio tiene {$beneficiarios} Beneficiarios Registrado";
    }
}
function jsaGetDatosCuenta($cuenta, $socio, $dias)
{
    $xInv = new cCuentaInversionPlazoFijo($cuenta, $socio);
    $tasa = $xInv->getTasaAplicable($dias) * 100;
    $xSoc = new cSocio($socio);
    $xSoc->init();
    $cuentainteres = $xSoc->getCuentaDeCaptacionPrimaria(CAPTACION_TIPO_VISTA, CAPTACION_PRODUCTO_INTERESES);
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("idtasa", $tasa));
    $tab->add(TabSetValue::getBehavior("idcuentainteres", $cuentainteres));
    return $tab->getString();
}
/**
 * Funcion que obtiene el Nombre del socio
 *
 * @param integer $params
 * @return string
 */
function Common_695bad33e1f2af343f99c6a4ceb9d045($params)
{
    $nombre = MSG_NO_PARAM_VALID;
    $xT = new cTipos();
    $socio = $xT->cInt($params);
    $xSoc = new cSocio($socio);
    if ($xSoc->existe($socio) == true) {
        $xSoc->init();
        $nombre = $xSoc->getNombreCompleto(OUT_TXT);
    }
    return $nombre;
}
/** ---------------------------- Devuelve el Nombre del Socio---------------------------- */
function nombre($idsoc)
{
    $nombre = "";
    if (isset($idsoc)) {
        $idsoc = trim($idsoc);
        settype($idsoc, "integer");
        $xSoc = new cSocio($idsoc);
        $xSoc->init();
        $nombre = $xSoc->getNombreCompleto();
    }
    return $nombre;
}
function jsaGetValidacion($persona, $producto, $origen)
{
    $html = "";
    $xPd = new cCaptacionProducto($producto);
    if ($xPd->getClase() == CAPTACION_TIPO_PLAZO) {
        $html .= $xPd->getListaDeDias();
    }
    if ($xPd->getDestinoInteres() == CAPTACION_DESTINO_CTA_INTERES) {
        $xTxt2 = new cHText();
        $xSoc = new cSocio($persona);
        $xSoc->init();
        $html .= $xTxt2->getDeCuentaCaptacionInteres("", $xSoc->getCuentaDeCaptacionPrimaria(CAPTACION_TIPO_VISTA, CAPTACION_PRODUCTO_INTERESES));
    }
    //
    return $html;
}
function jsaGetPerfilDeProducto($producto, $persona)
{
    $OConv = new cProductoDeCredito($producto);
    $OConv->init();
    $tab = new TinyAjaxBehavior();
    $xSoc = new cSocio($persona);
    $pagos = $OConv->getNumeroPagosPreferente();
    $periocidad = $OConv->getPeriocidadPrefente();
    if ($xSoc->init() == true) {
        if ($xSoc->getClaveDeEmpresa() != FALLBACK_CLAVE_EMPRESA) {
            $xEmp = new cEmpresas($xSoc->getClaveDeEmpresa());
            $xEmp->init();
            $tab->add(TabSetValue::getBehavior('idproducto', $xEmp->getProductoPref()));
            $periocidad = $xEmp->getPeriocidadPref();
        }
    }
    $tab->add(TabSetValue::getBehavior('idnumerodepagos', $pagos));
    $tab->add(TabSetValue::getBehavior('idperiocidad', $periocidad));
    return $tab->getString();
}
function jsaSetDomicilioMismo($socio, $HDomicilio)
{
    $HDomicilio = strtoupper($HDomicilio);
    if ($HDomicilio == "MISMO") {
        $xSoc = new cSocio($socio);
        $xSoc->init();
        $DDom = $xSoc->getDatosDomicilio(99);
        $domicilio = $xSoc->getDomicilio();
        $cDom = new cSocios_aeconomica();
        $cDom->setData($DDom);
        $telefono = $cDom->telefono_ae()->v();
        $estado = $cDom->estado_ae()->v();
        $municipio = $cDom->municipio_ae()->v();
        $localidad = $cDom->localidad_ae()->v();
        $tab = new TinyAjaxBehavior();
        $tab->add(TabSetValue::getBehavior('idtelefono', $telefono));
        $tab->add(TabSetValue::getBehavior('identidadfederativa', $estado));
        $tab->add(TabSetValue::getBehavior('idmunicipio', $municipio));
        $tab->add(TabSetValue::getBehavior('idlocalidad', $localidad));
        $tab->add(TabSetValue::getBehavior('iddomiciliodeactividad', $domicilio));
        return $tab->getString();
    }
}
 function setClonar($saldo = false, $autorizado = false)
 {
     $saldo = $saldo == false ? $this->getSaldoActual() : $saldo;
     $autorizado = $autorizado == false ? $this->getMontoAutorizado() : $autorizado;
     //retorna numero de credito
     $xS = new cSocio($this->getClaveDePersona());
     $xS->init();
     $nuevoID = $xS->getIDNuevoDocto(iDE_CREDITO);
     $xCD = new cCreditos_solicitud();
     $xCD->numero_solicitud($nuevoID);
     $xCD->numero_socio($this->getClaveDePersona());
     $xCD->causa_de_mora($this->mCausaDeMora);
     $xCD->contrato_corriente_relacionado($this->mContratoCorriente);
     $xCD->descripcion_aplicacion($this->mDescripcionDestino);
     $xCD->destino_credito($this->mTipoDeDestino);
     $xCD->dias_autorizados($this->mDiasAutorizados);
     $xCD->docto_autorizacion("CLONADO DEL CREDITO " . $this->mNumeroCredito);
     $xCD->eacp(EACP_CLAVE);
     $xCD->estatus_actual($this->getEstadoActual());
     //$xCD->estatus_de_negociacion()
     $xCD->fecha_autorizacion($this->mFechaDeAutorizacion);
     $xCD->fecha_castigo("2018-01-01");
     $xCD->fecha_conciliada(fechasys());
     $xCD->fecha_ministracion($this->mFechaMinistracion);
     $xCD->fecha_mora($this->mFechaMora);
     $xCD->fecha_revision(fechasys());
     $xCD->fecha_solicitud($this->mFechaDeSolictud);
     $xCD->fecha_ultimo_mvto($this->mFechaUltimoMvtoCapital);
     $xCD->fecha_vencimiento($this->mFechaVencimiento);
     $xCD->fecha_vencimiento_dinamico($this->mFechaVencimientoLegal);
     $xCD->grupo_asociado($this->mGrupoAsociado);
     $xCD->idusuario(getUsuarioActual());
     $xCD->interes_diario($this->mInteresDiario);
     $xCD->interes_moratorio_devengado($this->mInteresMoratorioDev);
     $xCD->interes_moratorio_pagado($this->mInteresMoratorioPag);
     $xCD->interes_normal_devengado($this->mInteresNormalDevengado);
     $xCD->interes_normal_pagado($this->mInteresNormalPagado);
     $xCD->monto_autorizado($autorizado);
     $xCD->monto_parcialidad($this->mMontoFijoParcialidad);
     $xCD->monto_solicitado($autorizado);
     //igual que el autorizado
     $xCD->numero_pagos($this->getPagosAutorizados());
     $xCD->saldo_actual($saldo);
     $xCD->saldo_conciliado($saldo);
     $xCD->saldo_vencido(0);
     $xCD->sdo_int_ant(0);
     $xCD->sucursal(getSucursal());
     $xCD->pagos_autorizados($this->getPagosAutorizados());
     $xCD->periocidad_de_pago($this->getPeriocidadDePago());
     $xCD->periodo_notificacion(0);
     $xCD->periodo_solicitudes(EACP_PER_SOLICITUDES);
     $xCD->plazo_en_dias($this->mDiasAutorizados);
     $xCD->tipo_credito($this->mModalidadDeCredito);
     $xCD->tipo_autorizacion($this->mTipoDeAutorizacion);
     $xCD->tasa_ahorro($this->mTasaAhorro);
     $xCD->tasa_interes($this->mTasaInteres);
     $xCD->tasa_moratorio($this->mTasaMoratorio);
     $xCD->tipo_convenio($this->mTipoDeConvenio);
     $xCD->tipo_de_calculo_de_interes($this->mTipoDeCalculoDeInteres);
     $xCD->tipo_de_pago($this->mTipoDePago);
     $xCD->ultimo_periodo_afectado($this->mParcialidadActual);
     $xCD->query()->insert()->save();
     return $nuevoID;
 }
 function getDescripcion()
 {
     $xF = new cFecha(0);
     if ($this->mReciboIniciado == false) {
         $this->init();
     }
     $xSoc = new cSocio($this->mSocio);
     $xSoc->init();
     $desc = $this->mCodigoDeRecibo . "|" . $xF->getFechaCorta($this->mFechaDeOperacion) . "|" . $xSoc->getNombreCompleto();
     return $desc;
 }
    $hijos = " ";
    if ($rw["estadocivil"] != 1) {
        $regimen_matrimonial = "&nbsp;";
    }
    if ($rw["tipo_de_identificacion"] == 1) {
        $ife = $rw["documento_de_identificacion"];
    } else {
        $ife = "&nbsp;";
    }
    /**
     *composicion del estado laboral por consulta
     **/
    $estado_laboral = 99;
    //Obtener la informaci�n laboral
    $xSoc = new cSocio($socio);
    $xSoc->init($rw);
    $DLab = $xSoc->getDatosActividadEconomica();
    $estado_laboral = $arrELaboral[$DLab["tipo_aeconomica"]];
    //corrige valores vacios
    if (!isset($estado_laboral)) {
        $estado_laboral = 99;
    }
    //corrige la edad en a�os y asigna, si es menor de edad
    $edad = floor(restarfechas(fechasys(), $rw["fechanacimiento"]) / 365);
    if ($edad < 18) {
        $estado_laboral = "07";
    }
    $tr .= "\t<tr>\n\t\t\t\t<td>{$socio}</td>\n\t\t\t\t<td>{$ife}</td>\n\t\t\t\t<td>{$nombre}</td>\n\t\t\t\t<td>{$apellidopaterno}</td>\n\t\t\t\t<td>{$apellidomaterno}</td>\n\t\t\t\t<td>{$genero}</td>\n\t\t\t\t<td>01</td>\n\t\t\t\t<td>412</td>\n\t\t\t\t<td>{$sucursal}</td>\n\t\t\t\t<td>{$fecha_de_alta}</td>\n\t\t\t\t<td>{$estado_civil}</td>\n\t\t\t\t<td>{$regimen_matrimonial}</td>\n\t\t\t\t<td>{$estado_laboral}</td>\n\t\t\t\t<td>{$fecha_nacimiento}</td>\n\t\t\t\t<td>412</td>\n\t\t\t\t<td>{$hijos}</td>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td>{$rfc}</td>\n\t\t\t\t<td>{$curp}</td>\n\t\t\t</tr>";
}
echo "<table width='100%' >\n\t<tr>\n\t\t<th>Socio</th>\n\t\t<th>IFE</th>\n\t\t<th>Nombre</th>\n\t\t<th>Apellido Paterno</th>\n\t\t<th>Apellido Materno</th>\n\t\t<th>Sexo</th>\n\t\t<th>Idioma</th>\n\t\t<th>Nacionalidad</th>\n\t\t<th>Sucursal</th>\n\t\t<th>Fecha de Alta</th>\n\t\t<th>Estado Civil</th>\n\t\t<th>Regimen Matrimonial</th>\n\t\t<th>Estado Laboral</th>\n\t\t<th>Fecha de Nacimiento</th>\n\t\t<th>Pais de Nacimiento</th>\n\t\t<th>Numero de Hijos</th>\n\t\t<th>Fecha de Deceso</th>\n\t\t<th>R.F.C.</th>\n\t\t<th>C.U.R.P.</th>\n\t</tr>\n\t\t{$tr}\n</table>";
if ($input != OUT_EXCEL) {
</td>
		</tr>
	</tbody>
</table>
</fieldset>

<?php 
    $sqlconyuge = "SELECT numero_socio, CONCAT(nombres, ' ', apellido_paterno, ' ', apellido_materno)\n\t\t\t\t\tAS 'Nombre_Completo',\n\t \t\t\t\tCONCAT( telefono_residencia, ', ', telefono_movil) as 'telefonos', ocupacion\n\t\t\t\t\tfrom socios_relaciones where consanguinidad=3\n\t\t\t\t\tAND socio_relacionado={$idsocio}";
    $conyuge = obten_filas($sqlconyuge);
    $txtConyuge = "";
    //$conyuge[0] - $conyuge[1] - Tel(s): $conyuge[2] Ocupaci&oacute;n: $conyuge[3]
    $rwy = $xSocio->getDatosInArray();
    $idconyuge = $xSocio->getClaveDePersonaDeConyuge();
    if ($conyuge > 0) {
        $xCon = new cSocio($idconyuge);
        $xCon->init();
        $DConT = $xCon->getTelefonos();
        $txtConyuge .= $idconyuge . "-" . $xCon->getNombreCompleto();
        $txtConyuge .= " TEL(S): " . $DConT["principal"];
        $conyuge_ocup = $xCon->getDatosActividadEconomica();
        $txtConyuge .= " OCUPACI&Oacute;N: " . $conyuge_ocup["puesto"];
    }
    $genero = eltipo("socios_genero", $rwy[15]);
    $civil = eltipo("socios_estadocivil", $rwy[14]);
    $ocupacion = volcartabla("socios_aeconomica", 18, "socio_aeconomica={$idsocio}");
    $edad = (int) (restarfechas($nowdate, $rwy[11]) / 365) . " A&ntilde;os";
    $dependientes = $rwy["dependientes_economicos"];
    $telp = $rwy["telefono_principal"];
    $mail = $rwy["correo_electronico"];
    $grupo_assoc = $rwy["grupo_solidario"];
    //$regimen_mat =
             		$personalidad_juridica = 1, $grupo_solidario = DEFAULT_GRUPO, $observaciones = "",
             		
             		$identificado_con = 1, $documento_de_identificacion = "0", $codigo = false, $sucursal = false,
             		
             		$movil	= "", $correo = "", $dependientes = 0, $fecha = false, $riesgo = AML_PERSONA_BAJO_RIESGO, $clave_fiel = "", 
             		$pais = EACP_CLAVE_DE_PAIS
             		*/
             $idpersona = $xFi->getEntero($tmp->ID_PERSONA);
             if ($idpersona > 0) {
                 $xSoc->setOmitirAML();
                 $pass = $xSoc->add($xFi->getV($tmp->NOMBRES), $xFi->getV($tmp->PRIMER_APELLIDO), $xFi->getV($tmp->SEGUNDO_APELLIDO), $xFi->getV($tmp->ID_FISCAL), $xFi->getV($tmp->ID_POBLACIONAL), getCajaLocal(), $xFi->getV($tmp->FECHA_NACIMIENTO), $xFi->getV($tmp->CIUDAD_NACIMIENTO), DEFAULT_TIPO_INGRESO, $xFi->getV($tmp->ESTADO_CIVIL, DEFAULT_ESTADO_CIVIL, MQL_INT, $arrEcivil), $xFi->getV($tmp->GENERO, DEFAULT_GENERO, MQL_INT, $arrGenero), FALLBACK_CLAVE_EMPRESA, DEFAULT_REGIMEN_CONYUGAL, $xFi->getV($tmp->TIPO_PERSONA, FALLBACK_PERSONAS_FIGURA_JURIDICA, MQL_INT, $arrFJuridica), FALLBACK_CLAVE_DE_GRUPO, "", FALLBACK_PERSONAS_TIPO_IDENTIFICACION, $xFi->getV($tmp->ID_POBLACIONAL), $idpersona, getSucursal(), 0, "", 0, $xFi->getV($tmp->FECHA_ALTA));
                 //sucess
                 if ($pass == true) {
                     $ingreso = $xFi->getFlotante($tmp->INGRESOS_MENSUALES);
                     if ($ingreso > 0) {
                         if ($xSoc->init() == true) {
                             $xSoc->addActividadEconomica($xFi->getV($tmp->EMPRESA_TRABAJO, ""), $ingreso, $xFi->getV($tmp->OCUPACION, ""));
                         }
                     }
                 }
             }
             $msg .= $xSoc->getMessages();
         }
         $conteo++;
     }
 }
 $msg .= $xFi->getMessages();
 if (MODO_DEBUG == true) {
     $xLog = new cFileLog();
     $xLog->setWrite($msg);
     $xFRM->addToolbar($xLog->getLinkDownload("Archivo del proceso", ""));
function jsaGetNombreDirector($persona)
{
    $xSocio = new cSocio($persona);
    $xSocio->init();
    //idelmes0 idelanno0 ideldia0
    $tab = new TinyAjaxBehavior();
    //$tab -> add(TabSetvalue::getBehavior("idNumeroSocio", $socio));
    $tab->add(TabSetvalue::getBehavior("idnombredependencia", $xSocio->getNombreCompleto()));
    //$tab -> add(TabSetvalue::getBehavior('idObservaciones', $xSoc->getMessages() ));
    return $tab->getString();
}
function jsaPrevalidarCredito($socio, $solicitud, $numpagos, $periocidad, $convenio, $contrato, $fechaMin, $fechaVenc, $monto)
{
    $clave = md5($socio . $solicitud . ROTTER_KEY . date("Ymd"));
    $out = false;
    $msg = "";
    $ctrl = "";
    $xHO = new cHObject();
    $xBtn = new cHButton();
    $arrDatos = array("numero_de_solicitud" => $solicitud, "periocidad_de_pago" => $periocidad, "tipo_de_producto" => $convenio, "numero_de_pagos" => $numpagos, "contrato_corriente_relacionado" => $contrato, "fecha_de_ministracion" => $fechaMin, "fecha_de_vencimiento" => $fechaVenc);
    if ($socio == DEFAULT_SOCIO or $socio == 0) {
        $msg .= "ERROR\t{$socio}\tClave de Persona no Valido\r\n";
        $out = false;
    } else {
        if ($solicitud == DEFAULT_CREDITO or $solicitud == 0) {
            $msg .= "ERROR\t{$socio}\t{$solicitud}\tNumero de Credito no Valido\r\n";
            $out = false;
        } else {
            //Valorar Numero de Creditos por Socio
            $xSoc = new cSocio($socio);
            if ($xSoc->existe($socio) == false) {
                $msg .= "ERROR\t{$socio}\tEl Socio No Existe\r\n";
                $out = false;
            } else {
                $xSoc->init();
                $out = $xSoc->setPrevalidarCredito($arrDatos);
                $msg .= $xSoc->getMessages();
            }
        }
    }
    if ($out == true) {
        $msg .= "OK\tEL CREDITO HA SIDO VALIDADO POR EL SISTEMA - CUMPLE LOS REQUISITOS\r\n";
        $ctrl .= $xBtn->getBasic("TR.guardar credito", "jsFormularioValidado('{$clave}')", "guardar", "idvalidarok");
        $ctrl .= $xBtn->getBasic("TR.validar nuevamente", "jsPrevalidarCredito()", "checar", "idnuevavalidacion");
    } else {
        //$ctrl = "<input type=\"button\" name=\"cmdSubmit\" onclick=\"jsPrevalidarCredito();\" value=\"VALIDAR CREDITO NUEVAMENTE\" />";
        $ctrl .= $xBtn->getBasic("TR.validar nuevamente", "jsPrevalidarCredito()", "checar", "idnuevavalidacion");
    }
    $msg = $xHO->Out($msg, OUT_HTML);
    $svalidate = "{$msg} {$ctrl}";
    return $svalidate;
}
     $idtipoderelacion = parametro("idtipoderelacion", 0, MQL_INT);
     $dependiente = parametro("dependiente", false, MQL_BOOL);
     $idtipodeparentesco = parametro("idtipodeparentesco", DEFAULT_TIPO_CONSANGUINIDAD, MQL_INT);
     if ($origen_relacion == iDE_CREDITO) {
         $xCred = new cCredito($documentorelacionado);
         $xCred->init();
         $MontoAvalado = $xCred->getMontoAutorizado();
         $addAval = $xCred->addAval($persona, $MontoAvalado, $idtipoderelacion, $idtipodeparentesco, $dependiente, $idobservaciones);
         $msg .= $xCred->getMessages();
     }
     //captacion
     //persona
     if ($origen_relacion == iDE_SOCIO) {
         if ($personarelacionado > 0) {
             $xPer = new cSocio($personarelacionado);
             if ($xPer->init() == true) {
                 $addRel = $xPer->addRelacion($persona, $idtipoderelacion, $idtipodeparentesco, $dependiente, $idobservaciones);
             }
             $msg .= $xPer->getMessages();
         } else {
             $msg .= "ERROR\tError al agregar a la Relacion, no existe relacionado \r\n";
         }
     }
 }
 $xCat = new cPersonasCatalogoOtrosDatos();
 //AGREGAR PEP
 if ($espep == true and setNoMenorQueCero($persona) > 0) {
     $xSoc->addOtrosParametros($xCat->AML_PEP_PRINCIPAL, "1");
 }
 if ($esextranjero == true and setNoMenorQueCero($persona) > 0) {
     $xSoc->addOtrosParametros($xCat->PERSONAS_ES_EXTRANJERO, "1");
$xSoc = new cSocio($persona);
$xSoc->init();
$idnucleo = $xSoc->getIDNucleoDeRiesgo();
$xF->set($FechaFinal);
$FechaInicial = $xF->getDiaInicial();
$sql = "\r\nSELECT\r\n    `personas_relaciones_recursivas`.`persona`     AS `persona`,\r\n    \r\n    `personas_relaciones_recursivas`.`relacion`     AS `relacion`,\r\n\tCONCAT(`socios_general`.`nombrecompleto`,' ',\r\n\t`socios_general`.`apellidopaterno`, ' ',\r\n\t`socios_general`.`apellidomaterno`) AS  `nombre_de_relacion`,\r\n\t    \r\n    `personas_relaciones_recursivas`.`nivel`,\r\n    `operaciones_recibos`.`idusuario`                    AS `usuario`,\r\n    `usuarios`.`nombrecompleto` AS 'nombre_de_usuario',\r\n    \r\n     `operaciones_recibos`.`fecha_operacion`    AS `fecha`,\r\n    COUNT(`operaciones_recibos`.`idoperaciones_recibos`) AS `operaciones`,\r\n    SUM(`operaciones_recibos`.`total_operacion`) AS `monto`\r\n\t\r\n\r\nFROM\r\n\t`personas_relaciones_recursivas` `personas_relaciones_recursivas` \r\n\t\tINNER JOIN `socios_general` `socios_general` \r\n\t\tON `personas_relaciones_recursivas`.`relacion` = `socios_general`.\r\n\t\t`codigo` \r\n\t\t\tINNER JOIN `operaciones_recibos` `operaciones_recibos` \r\n\t\t\tON `operaciones_recibos`.`numero_socio` = \r\n\t\t\t`personas_relaciones_recursivas`.`persona` \r\n\t\t\t\tINNER JOIN `usuarios` `usuarios` \r\n\t\t\t\tON `operaciones_recibos`.`idusuario` = `usuarios`.`idusuarios` \r\nWHERE\r\n    (`operaciones_recibos`.`origen_aml` >0)\r\n\tAND (`personas_relaciones_recursivas`.`persona` = {$idnucleo})\r\n\tAND (`operaciones_recibos`.`fecha_operacion` >='{$FechaInicial}')\r\n    GROUP BY\r\n        `personas_relaciones_recursivas`.`persona`,\r\n        `operaciones_recibos`.`idusuario`,\r\n        `operaciones_recibos`.`fecha_operacion`,\r\n        `personas_relaciones_recursivas`.`relacion`\r\n\t\t\t\t\r\n\t\t";
$titulo = "";
$archivo = "";
$xRPT = new cReportes($titulo);
$xRPT->setFile($archivo);
$xRPT->setOut($out);
$xRPT->setSQL($sql);
$xRPT->setTitle($xHP->getTitle());
//============ Reporte
$xSoc2 = new cSocio($idnucleo);
$xSoc2->init();
$xT = new cTabla($sql, 2);
$xT->setTipoSalida($out);
//$xT->setFootSum(array( 4 => "monto", 9 => "unidades", 10 => "equivalencia"));
$body = $xRPT->getEncabezado($xHP->getTitle(), $FechaInicial, $FechaFinal);
$xRPT->setBodyMail($body);
$xRPT->addContent($body);
//$xT->setEventKey("jsGoPanel");
//$xT->setKeyField("creditos_solicitud");
$xRPT->addContent($xSoc->getFicha(true));
$xRPT->addContent($xSoc2->getFicha(true));
$xRPT->addContent($xT->Show($xHP->getTitle()));
//$xT		= new cTabla($xL->getListadoDePerfil($persona) );
//$xRPT->addContent( $xT->Show(  ) );
if (MODO_DEBUG == true) {
    $periodo_inicial = date("Ym", $xF->getInt($FechaInicial));
 function getFicha($fieldset = false, $trTool = "", $extendido = false)
 {
     $Dcta = $this->getDatosInArray();
     $xF = new cFecha();
     $xLi = new cSQLListas();
     $xQL = new MQL();
     $rw = $Dcta;
     $cuenta = $rw["numero_cuenta"];
     $modalidad = $rw["tipo"];
     $FApertura = getFechaMX($rw["fecha_apertura"]);
     $tasa = $rw["tasa_otorgada"];
     $producto = $rw["subproducto"];
     $saldo = $rw["saldo_cuenta"];
     $mancomunantes = $this->mNombreMancomunados;
     $observaciones = $rw["observaciones"];
     $tool = $trTool;
     $thead = "";
     $xL = new cLang();
     if ($extendido == true) {
         $xSoc = new cSocio($this->getClaveDePersona());
         $xSoc->init();
         $nombrepersona = $xSoc->getNombreCompleto();
         $thead .= "<tr><th  class='izq'>" . $xL->getT("TR.nombre completo") . "</th>";
         $thead .= "<td colspan='3'>{$nombrepersona}</td><tr>";
     }
     //eOperations		= false;
     if (trim($mancomunantes) == "") {
     } else {
         $tool .= "<tr><th>" . $xL->getT("TR.Mancomunados") . "</th><td colspan='3'>{$mancomunantes}</td><tr>";
     }
     //Obtener Mancomunantes
     /*$SQLMan			= $xLi->getListadoDeRelaciones($this->getClaveDePersona(), $this->getNumeroDeCuenta(), PERSONAS_REL_MANCOMUNADO );
     		$rsMan				= $xQL->getDataRecord($SQLMan);
     		if($xQL->getNumberOfRows() > 0){
     			$tool			.= "<tr><th colspan='4'>" . $xL->getT("TR.Mancomunados") . "</th><tr>";
     			foreach ($rsMan as $rowM){
     				//$idmanco	= 
     				$tool		.= "<tr>";
     				$tool		.= "<td>";
     				$tool		.= "</tr>";
     			}
     		}*/
     if ($this->mTipoDeCuenta == CAPTACION_TIPO_PLAZO) {
         $thead = $thead == "" ? "" : "<thead>{$thead}</thead>";
         $exoFicha = "\n\t\t\t\t<table id='ficha-captacion'>\n\t\t\t\t\t{$thead}\n\t\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.clave_de_cuenta") . "</th>\n\t\t\t\t\t<td>" . $this->mNumeroCuenta . "</td>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.Producto") . "</th>\n\t\t\t\t\t<td>" . $Dcta["subproducto"] . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.Fecha de Operacion") . "</th>\n\t\t\t\t\t<td>" . $xF->getFechaCorta($Dcta["apertura"]) . "</td>\n\t\t\t\t\t<th class='izq'>Fecha de Vencimiento</th>\n\t\t\t\t\t<td>" . $xF->getFechaCorta($Dcta["vencimiento"]) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.tasa actual") . "</th>\n\t\t\t\t\t<td class='mny'> %  " . $Dcta["tasa"] * 100 . "</td>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.dias de Inversion") . "</th>\n\t\t\t\t\t<td class='mny'>" . $Dcta["dias"] . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.saldo") . "</th><td class='mny'>" . getFMoney($Dcta["saldo"]) . "</td>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.observaciones") . "</th><td>" . $Dcta["observaciones"] . "</td>\n\t\t\t\t</tr>\n\t\t\t\t{$tool}\n\t\t\t\t</tbody>\n\t\t\t\t</table>";
     } elseif ($this->mTipoDeCuenta == CAPTACION_TIPO_VISTA) {
         $thead = $thead == "" ? "" : "<thead>{$thead}</thead>";
         $exoFicha = "\n\t\t\t\t<table id='ficha-captacion'>\n\t\t\t\t{$thead}\n\t\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.clave_de_cuenta") . "</th><td>{$cuenta}</td>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.Fecha de Registro") . "</th><td>" . $xF->getFechaCorta($FApertura) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.tipo") . "</th><td>{$modalidad}</td>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.producto") . "</th><td>{$producto}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.tasa") . "</th><td class='mny'>% " . getFMoney($tasa * 100) . "</td>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.saldo") . "</th><td class='mny'>" . getFMoney($saldo) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='izq'>" . $xL->getT("TR.notas") . "</th><td colspan='3'>{$observaciones}</td>\n\t\t\t\t</tr>\n\t\t\t\t{$tool}\n\t\t\t\t</tbody>\n\t\t\t\t</table>";
     } else {
     }
     if ($fieldset == true) {
         $exoFicha = "<fieldset>\n\t\t\t\t\t\t\t\t<legend>&nbsp;&nbsp;" . $xL->getT("TR.Ficha de datos") . "&nbsp;&nbsp;</legend>\n\t\t\t\t\t\t\t\t{$exoFicha}\n\t\t\t\t\t\t\t</fieldset>";
     }
     return $exoFicha;
 }
    header("Content-Disposition: attachment; filename={$filename}");
    header("Pragma: no-cache");
    header("Expires: 0");
}
//Arrays de Conversion
$arrTipoPersona = array(9 => 1, 1 => 2, 3 => 3, 4 => 4, 2 => 5, 5 => 6);
//Array de Estado Civil
$arrEstadoCivil = array(2 => "S", 3 => "S", 5 => "S", 99 => "S", 6 => "V", 1 => "C", 4 => "U");
$arrTipoVivienda = array(1 => "P", 2 => "R", 3 => "P", 4 => "F", 5 => "P", 99 => "P");
$sql = "SELECT\n\t*\nFROM\n\t`socios_general` `socios_general`\n\t";
$rs = mysql_query($sql, cnnGeneral());
//
echo "<table>";
while ($rw = mysql_fetch_array($rs)) {
    $soc = new cSocio($rw["codigo"]);
    $soc->init($rw);
    $a = $rw["codigo"];
    $b = $rw["grupo_solidario"];
    $c = $rw["apellidopaterno"];
    $d = $rw["apellidomaterno"];
    $e = $rw["nombrecompleto"];
    $f = "S";
    $g = $arrTipoPersona[$rw["personalidad_juridica"]];
    $h = $rw["fechaalta"];
    $dom = $soc->getDatosDomicilio();
    $i = $dom["calle"] . " " . $dom["numero_exterior"];
    $j = "";
    $k = "";
    $l = $dom["codigo_postal"];
    $m = $rw["fechanacimiento"];
    $n = $rw["rfc"];
$codigo_postal = parametro("idcodigopostal");
$referencia = parametro("idreferencia");
$numero_interior = parametro("idnumero");
$curp = parametro("curp");
$observaciones = parametro("observaciones");
$consanguinidad = parametro("consan");
$depende = parametro("depende");
$ocupacion = parametro("ocupacion");
$rfc = "";
$grupo_solidario = DEFAULT_GRUPO;
$genero = DEFAULT_GENERO;
$tipo_persona = TIPO_JURIDICO_FISICA;
$numero_de_socio = $numero_de_socio == DEFAULT_SOCIO ? false : $numero_de_socio;
$xRel = new cSocio($numero_de_socio);
//$email					= $xRel->getCorreoElectronico();
if ($xRel->existe() != true) {
    $xRel->add($nombres, $apellido_paterno, $apellido_materno, $rfc, $curp, getCajaLocal(), $fecha_de_nacimiento, "", TIPO_INGRESO_RELACION, DEFAULT_ESTADO_CIVIL, $genero, DEFAULT_EMPRESA, DEFAULT_REGIMEN_CONYUGAL, $tipo_persona, $grupo_solidario, $observaciones, DEFAULT_TIPO_IDENTIFICACION, "", false, false, $telefono_movil, "", 0);
    if (trim($calle) != "") {
        $xRel->addVivienda($calle, $numero, $codigo_postal, "", $referencia, $telefono_fijo, $telefono_movil, TIPO_DOMICILIO_PRINCIPAL, TIPO_VIVIENDA_PROPIA, TIPO_DOMICILIO_PARTICULAR, DEFAULT_TIEMPO, $colonia, "calle");
    }
    if (trim($ocupacion) != "") {
        $xRel->addActividadEconomica("", 0, $ocupacion, DEFAULT_TIEMPO, DEFAULT_EMPRESA);
    }
    $xRel->init();
    $numero_de_socio = $xRel->getCodigo();
}
$xSoc = new cSocio($idsocio);
$xSoc->addRelacion($numero_de_socio, $tipo_de_relacion, $consanguinidad, $depende, $observaciones, $monto_relacionado, $porcentaje_relacionado);
//echo $xRel->getMessages("txt");
//echo $xSoc->getMessages("txt");
header("location:referencias.directas.frm.php?msg=OK&socio=" . $idsocio);
 function setActualizarRiesgoPorNucleo()
 {
     //si todos son riesgo
     $xLi = new cSQLListas();
     $xQL = new MQL();
     $sql = $xLi->getListadoDePersonasExpuestas($this->mClaveDePersona);
     $rs = $xQL->getDataRecord($sql);
     $xCat = new cPersonasCatalogoOtrosDatos();
     foreach ($rs as $rows) {
         $idpersona = $rows["numero_socio"];
         $afinidad = $rows["grado_de_afinidad"];
         $consanguinidad = $rows["grado_de_consanguinidad"];
         $vinculoeconom = $rows["tiene_vinculo_patrimonial"];
         //agregar
         $tipoaml = $consanguinidad > 0 ? $xCat->AML_PEP_CONSANGUINIDAD : "";
         $tipoaml = ($afinidad > 0 and $tipoaml == "") ? $xCat->AML_PEP_AFINIDAD : $tipoaml;
         $tipoaml = ($vinculoeconom > 0 and $tipoaml == "") ? $xCat->AML_PEP_VINCULO_ECONOM : $tipoaml;
         if ($tipoaml != "") {
             $xRel = new cSocio($idpersona);
             if ($xRel->init() == true) {
                 $xRel->addOtrosParametros($tipoaml, "1");
                 $this->mMessages .= $xRel->getMessages();
             }
         }
     }
 }
$xTa->addTH("Es PEP");
$xTa->addTH("Lista Negra");
$xTa->addTH("Grado de Riesgo");
$xTa->addTH("Servicios");
$xTa->addTH("Monto Otorgado");
$xTa->addTH("Monto Actual");
$xTa->addTH("Perfil Transaccional");
$xTa->addTH("Numero Maximo de Operaciones");
$xTa->addTH("Monto Maximo de Operaciones");
$xTa->endRow();
$xT = new cFileImporter();
foreach ($rs as $rows) {
    $xDSoc->setData($rows);
    $codigo_de_socio = $xDSoc->codigo()->v();
    $xSoc = new cSocio($codigo_de_socio);
    $xSoc->init($rows);
    $xSoc->getOEstats()->initDatosDeCredito();
    $saldoCred = setNoMenorQueCero($xSoc->getCreditosComprometidos());
    if ($saldoCred > 0) {
        $xTa->initRow();
        $xTa->addTD($xSoc->getSucursal());
        $xTa->addTD(htmlentities($xSoc->getNombreCompleto()));
        $xTa->addTD($xF->getFechaMX($xSoc->getFechaDeNacimiento()));
        $xTa->addTD("MEXICANA");
        $xTa->addTD($xSoc->getRFC());
        $xOAE = $xSoc->getOActividadEconomica();
        if ($xOAE == null) {
            $xTa->addTD(" ");
            $xTa->addTD(" ");
        } else {
            $idclave = $xOAE->getClaveDeActividad();
$sqlrec = "SELECT * FROM operaciones_recibos WHERE idoperaciones_recibos={$idrecibo}";
//echo $sqlrec; exit;
$datos = obten_filas($sqlrec);
$idsocio = $datos["numero_socio"];
$tiporec = $datos["tipo_docto"];
$docto = $datos["docto_afectado"];
$eltitulo = eltipo("operaciones_recibostipo", $tiporec);
$sumaRecibo = $datos["total_operacion"];
$fechaRecibo = $datos["fecha_operacion"];
echo "\n\t<p class='bigtitle'>CONSTANCIA DE DEPOSITO A PLAZO</p>\n\t<hr />";
$totaloperacion = $datos["total_operacion"];
$total_fmt = number_format($totaloperacion, 2, '.', ',');
$montoletras = convertirletras($totaloperacion);
// obtiene datos del socio
$xSoc = new cSocio($idsocio);
$xSoc->init();
$DSoc = $xSoc->getDatosInArray();
$domicilio_del_socio = $xSoc->getDomicilio();
$nombre_del_socio = $xSoc->getNombreCompleto();
if ($idsocio != 1) {
    $nombre = $nombre_del_socio;
} else {
    $nombre = mifila($sqlrec, "cadena_distributiva");
}
$direccion = $domicilio_del_socio;
$rfc = $DSoc["rfc"];
$curp = $DSoc["curp"];
// obtiene datos del documento que ayudaran al detalle en contabilidad
$observaciones = mifila($sqlrec, "observacion_recibo");
//
$sql_d_mvto = "SELECT * FROM operaciones_mvtos\n\t\t\t\t\t\tWHERE recibo_afectado={$idrecibo}\n\t\t\t\t\t\tAND tipo_operacion=500 ";
 function getOPersona()
 {
     if ($this->mObjPersona == null) {
         $xSoc = new cSocio($this->mClaveDePersona);
         if ($xSoc->init($this->mClaveDePersona) == true) {
             $this->mMessages .= "OK\tPersona Cargada con el ID " . $xSoc->getCodigo() . "\r\n";
             $this->mObjPersona = $xSoc;
         } else {
             $this->mMessages .= "ERROR\tAl cargar persona con el ID " . $this->mClaveDePersona . "\r\n";
         }
     }
     return $this->mObjPersona;
 }
function jsaSetEnviarParaAsociada($idpersona)
{
    $xSoc = new cSocio($idpersona);
    $xSoc->init();
    $xSoc->setMontoAhorroPreferente(0);
    return $xSoc->getMessages();
}
 function setActualizarPorPersona()
 {
     $xPer = new cSocio($this->mClaveDePersona);
     $ready = false;
     if ($xPer->init() == true) {
         $xT = new cT_03f996214fba4a1d05a68b18fece8e71();
         $xT->setData($this->mDatosInArray);
         $xT->apellidomaterno($xPer->getApellidoPaterno());
         $xT->apellidomaterno($xPer->getApellidoMaterno());
         $xT->nombres($xPer->getNombre());
         $ready = $xT->query()->update()->save($this->getID());
         if ($ready == false) {
             $this->mMessages .= "ERROR\tAl actualizar el usuario " . $this->getID() . " Desde la persona " . $this->mClaveDePersona . "\r\n";
         } else {
             $this->mMessages .= "OK\tSe actualizo el usuario " . $this->getID() . " desde la persona " . $this->mClaveDePersona . "\r\n";
             $ready = true;
         }
     }
     return $ready;
 }
function jsaVincularEmpresa($credito, $observaciones, $empresa)
{
    $msg = "";
    $xCred = new cCredito($credito);
    $xCred->init();
    $xdat = new cFecha(0);
    $fecha = $xdat->get();
    // FechaISO($fecha);
    $xCred->init();
    $socio = $xCred->getClaveDePersona();
    $xSoc = new cSocio($socio);
    $xSoc->init();
    $xCred->setCambioProducto(CREDITO_PRODUCTO_NOMINA);
    $xCred->setResetPersonaAsociada($fecha, $observaciones, $empresa);
    //Agregar operacion de desvinculacion
    $xRe = new cReciboDeOperacion(RECIBOS_TIPO_ESTADISTICO, false, DEFAULT_RECIBO);
    $xRe->init();
    $xRe->setNuevoMvto($fecha, $xCred->getSaldoActual(), OPERACION_CLAVE_VINCULACION, $xCred->getPeriodoActual(), "", 1, false, $socio, $credito, $fecha);
    $xRe->setFinalizarRecibo();
    $msg .= $xSoc->getMessages(OUT_TXT);
    $msg .= $xCred->getMessages(OUT_TXT);
    $msg .= $xRe->getMessages(OUT_TXT);
    $xF = new cFileLog();
    $xF->setWrite($msg);
    $xF->setClose();
    return $xF->getLinkDownload("Descarga de Log");
}
$xRPT->setOut($out);
//filtrar domicilio -> socio -> credito -> letra
$sql = $xL->getListadoDeCobranza($idnomina);
$base_contrato = contrato(401, "texto_del_contrato");
$Dep = new cEmpresas($empresa);
$Dep->init();
$nempresa = $Dep->getNombre();
$TCobros = 0;
$rs = getRecordset($sql);
$ppn = 1;
$contar = 1;
while ($rw = mysql_fetch_array($rs)) {
    //cargar datos de la parcialidad
    $numero_de_socio = $rw["persona"];
    $cSoc = new cSocio($numero_de_socio);
    $cSoc->init();
    $DSoc = $cSoc->getDatosInArray();
    $ficha_socio = $cSoc->getFicha();
    $numero_credito = $rw["credito"];
    $xCred = new cCredito($numero_credito, $numero_de_socio);
    $xCred->init();
    $DCred = $xCred->getDatosInArray();
    $svar_info_cred = $xCred->getShortDescription();
    $variable_lugar = "";
    $monto_inicial = 0;
    $monto_inicial_letras = 0;
    $numero_dias = 0;
    $variable_fecha_vencimiento = "";
    $nombre_mancomunados = "";
    $variable_tasa_otorgada = "";
    $monto_parcialidad = $rw["monto"];