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 jsaCargarDatosDeConvenio($convenio)
{
    $OConv = new cProductoDeCredito($convenio);
    $OConv->init();
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior('idnumpagos', $OConv->getNumeroPagosPreferente()));
    if ($OConv->getEsProductoDeNomina() == false) {
        //false por	que lo determina la empresa
        $tab->add(TabSetValue::getBehavior('idperiocidadpagos', $OConv->getPeriocidadPrefente()));
    }
    //$tab -> add(TabSetValue::getBehavior('idnumpagos', $OConv->obj()->pagos_maximo()->v()));
    return $tab->getString();
}
 function getOProductoDeCredito($TipoDeConvenio = false)
 {
     $TipoDeConvenio = $TipoDeConvenio == false ? $this->getClaveDeProducto() : $TipoDeConvenio;
     $xP = new cProductoDeCredito($TipoDeConvenio);
     $xP->init();
     return $xP;
 }
 //obtener parametros extras en una array
 //su valor es del producto
 $xCred = new cCredito($idcredito, $rw["numero_socio"]);
 $xCred->init($rw);
 if (isset($DPagos[$idcredito])) {
     $xCred->initPagosEfectuados($DPagos[$idcredito], $FechaFinal);
     ///$xLog->add("OK\t$icnt\tDatos del credito $idpersona|$idcredito SI existen \r\n", $xLog->DEVELOPER);
 } else {
     $xLog->add("WARN\t{$idpersona}-{$idcredito}\t{$sucres}\t{$icnt}\tDatos de Pago del credito {$idpersona}|{$idcredito} no existen \r\n", $xLog->DEVELOPER);
 }
 $ClaveActualOtorgante = $xCR->getClaveDeOtorgante();
 // ENTIDAD_CLAVE_SIC;
 $NombreOtorgante = $xCR->getNombreOtorgante();
 $CuentaActual = $rw["numero_solicitud"];
 $xTConv = new cProductoDeCredito($rw["tipo_convenio"]);
 $xTConv->init();
 $DTConv = $xTConv->getOtrosParametrosInArray();
 $TipoDeResponsabilidad = isset($DTConv["SIC_TIPO_DE_RESPONSABILIDAD"]) ? $DTConv["SIC_TIPO_DE_RESPONSABILIDAD"] : "I";
 //individual
 $TipoDeCuenta = isset($DTConv["SIC_TIPO_DE_CUENTA"]) ? $DTConv["SIC_TIPO_DE_CUENTA"] : "F";
 //Pagos fijos
 $TipoDeContrato = strtoupper($xCred->getOProductoDeCredito()->getTipoDeContratoCR());
 // isset($DTConv["SIC_TIPO_DE_CONTRATO"]) ? $DTConv["SIC_TIPO_DE_CONTRATO"] : "DESCONOCIDO";
 $ClaveUnidadMonetaria = "MX";
 $ValorActivoValuacion = 0;
 $NumeroDePagos = $xCred->getPagosAutorizados();
 $FrecuenciaDePagos = $xCR->getEPeriocidad($xCred->getPeriocidadDePago());
 $MontoPagar = $xCR->getMonto($xCred->getSaldoActual($FechaFinal));
 //Acabar, valor de la letra actual o saldo?
 $FechaAperturaCuenta = $xCR->getDate($xCred->getFechaDeMinistracion());
 $FechaUltimoPago = $xCR->getDate($xCred->getFechaUltimoDePago());
} else {
    $sucess = false;
}
if ($sucess == true) {
    $grupo_asociado = $xSoc->getClaveDeGrupo();
    if ($periocidad == CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO) {
        $dias_solicitados = $xFecha->setRestarFechas($fecha_vencimiento, $fecha_ministracion);
    } elseif ($periocidad == CREDITO_TIPO_PERIOCIDAD_DIARIO) {
        $dias_solicitados = $xFecha->setRestarFechas($fecha_vencimiento, $fecha_ministracion);
        $numeropagos = $dias_solicitados - $xFecha->getDiasHabilesEnRango($fecha_vencimiento, $fecha_ministracion);
    } else {
        $dias_solicitados = $numeropagos * $periocidad;
        $fecha_vencimiento = $xFecha->setSumarDias($dias_solicitados, $fecha_ministracion);
    }
    $xConv = new cProductoDeCredito($tipoconvenio);
    $xConv->init();
    if (USE_OFICIAL_BY_PRODUCTO == true) {
        $oficial_de_seguimiento = $xConv->getOficialDeSeguimiento();
    }
    if ($esrenovado == true) {
        $TipoDeAutorizacion = CREDITO_AUTORIZACION_RENOVADO;
        $msg .= "WARN\tCredito marcado como Renovado \r\n";
    }
    $xCred = new cCredito();
    $result = $xCred->add($tipoconvenio, $persona, $contrato_corriente, $monto_solicitado, $periocidad, $numeropagos, $dias_solicitados, $rubro_destino, false, $grupo_asociado, $amp_destino, $observaciones, $oficial_de_credito, $fecha_solicitud, $tipo_de_pago, INTERES_POR_SALDO_INSOLUTO, false, $fecha_ministracion, $xSoc->getClaveDeEmpresa(), $TipoDeAutorizacion);
    if ($result == false) {
        $xFRM->addToolbar($xBtn->getRegresar("solicitud_de_credito.frm.php", true));
        $xFRM->addAviso($xHP->lang(MSG_ERROR_SAVE));
        $xFL = new cFileLog();
        $xFL->setWrite($xCred->getMessages(OUT_TXT));
        $xFL->setWrite($xSoc->getMessages());