function initPorCredito($idcredito, $dataCredito = false)
 {
     $xCred = new cCredito($idcredito);
     $xCred->init($dataCredito);
     $xF = new cFecha();
     if ($xCred->getTipoEnSistema() == CREDITO_PRODUCTO_NOMINA) {
         //cargar datos de la empresa
         $idemp = $xCred->getClaveDeEmpresa();
         $periocidad = $xCred->getPeriocidadDePago();
         $this->setPeriocidadDePago($periocidad);
         $this->mTipoCreditoSis = $xCred->getTipoEnSistema();
         $this->mClaveDePlan = setNoMenorQueCero($xCred->getNumeroDePlanDePagos());
         if ($this->mClaveDePlan > 0) {
             //TODO: validar fecha de primer pago en calculos automaticos
             $this->mFechaPrimerPago = $xCred->getFechaPrimeraParc();
         } else {
             $this->mFechaPrimerPago = $this->getFechaDePago($xCred->getFechaDeMinistracion(), 1);
         }
         if ($xCred->getFechaPrimeraParc() == $this->mFechaFail or $xF->getInt($xCred->getFechaPrimeraParc()) <= $xF->getInt($xCred->getFechaDeMinistracion())) {
             $this->mFechaPrimerPago = $this->getFechaDePago($xCred->getFechaDeMinistracion(), 1);
         }
         $xEmp = new cEmpresas($idemp);
         $xEmp->init();
         $DDias = $xEmp->getDiasDeNomina($periocidad);
         $this->mDiaDeAbono1 = isset($DDias[0]) ? setNoMenorQueCero($DDias[0]) : $this->mDiaDeAbono1;
         $this->mDiaDeAbono2 = isset($DDias[1]) ? setNoMenorQueCero($DDias[1]) : $this->mDiaDeAbono2;
         $this->mDiaDeAbono3 = isset($DDias[2]) ? setNoMenorQueCero($DDias[2]) : $this->mDiaDeAbono3;
     } else {
         $this->mFechaPrimerPago = $this->getFechaDePago($xCred->getFechaDeMinistracion(), 1);
     }
 }
function jsa_getDatosDeCredito($solicitud)
{
    $xCred = new cCredito($solicitud);
    $xCred->initCredito();
    $xF = new cFecha();
    $xT = new cTipos();
    $dCreds = $xCred->getDatosDeCredito();
    $periocidad = $xCred->getPeriocidadDePago();
    $FMinistracion = $xCred->getFechaDeMinistracion();
    $contrato_corriente = $xCred->getContratoCorriente();
    $xPlanGen = new cPlanDePagosGenerador();
    $xPlanGen->initPorCredito($solicitud);
    $FPrimerAb = $xPlanGen->getFechaDePrimerPago();
    $xF = new cFecha(0, $FMinistracion);
    $FM_d = $xF->dia();
    $FM_a = $xF->anno();
    $FM_m = $xF->mes();
    $xF2 = new cFecha(1, $FPrimerAb);
    $xF2->set($FPrimerAb);
    $PA_d = $xF2->dia();
    $PA_a = $xF2->anno();
    $PA_m = $xF2->mes();
    $tab = new TinyAjaxBehavior();
    //setLog("$PA_d --- $PA_m ---- $PA_a  - - - - - $FPrimerAb");
    $tab->add(TabSetvalue::getBehavior('ideldia1', $FM_d));
    $tab->add(TabSetvalue::getBehavior('idelmes1', $FM_m));
    $tab->add(TabSetvalue::getBehavior('idelanno1', $FM_a));
    $tab->add(TabSetvalue::getBehavior('ideldia0', $PA_d));
    $tab->add(TabSetvalue::getBehavior('idelmes0', $PA_m));
    $tab->add(TabSetvalue::getBehavior('idelanno0', $PA_a));
    $tab->add(TabSetvalue::getBehavior('idDescripcionSolicitud', $xCred->getShortDescription()));
    $tab->add(TabSetvalue::getBehavior('idcuenta', $contrato_corriente));
    //$xCred->getPeriocidadDePago() != CREDITO_TIPO_PERIOCIDAD_CATORCENAL
    if ($xCred->getTipoEnSistema() == CREDITO_PRODUCTO_NOMINA) {
        $tab->add(TabSetvalue::getBehavior('idFormaDePago', $xCred->getTipoDePago()));
        //setLog("El pago es " . $xCred->getPeriocidadDePago() );
        if ($xCred->getPeriocidadDePago() != CREDITO_TIPO_PERIOCIDAD_CATORCENAL) {
            $tab->add(TabSetvalue::getBehavior('idtipo_plan_pagos', CREDITO_TIPO_DIAS_DE_PAGO_PERSONALIZADOS));
        }
    }
    return $tab->getString();
}
$persona = parametro("persona", DEFAULT_SOCIO, MQL_INT);
$persona = parametro("socio", $persona, MQL_INT);
$persona = parametro("idsocio", $persona, MQL_INT);
$credito = parametro("credito", DEFAULT_CREDITO, MQL_INT);
$credito = parametro("idsolicitud", $credito, MQL_INT);
$credito = parametro("solicitud", $credito, MQL_INT);
$cuenta = parametro("cuenta", DEFAULT_CUENTA_CORRIENTE, MQL_INT);
$cuenta = parametro("idcuenta", $cuenta, MQL_INT);
$jscallback = parametro("callback");
$tiny = parametro("tiny");
$form = parametro("form");
$action = parametro("action", SYS_NINGUNO);
$xHP->init();
$xFRM = new cHForm("frm", "plan_de_pagos");
if ($credito > DEFAULT_CREDITO) {
    $xCred = new cCredito($credito);
    $xCred->init();
    $persona = $xCred->getClaveDePersona();
    $xFRM->OHidden("idsolicitud", $credito, "");
    $xFRM->OHidden("idsocio", $persona, "");
    $xFRM->addHElem($xCred->getFicha(true, "", false, true));
    if ($xCred->getTipoEnSistema() == CREDITO_PRODUCTO_NOMINA) {
    }
} else {
    $xFRM->addJsBasico();
    $xFRM->addCreditBasico();
    $xFRM->addSubmit();
}
echo $xFRM->get();
$jxc->drawJavaScript(false, true);
$xHP->fin();
 function init($arrData = false, $credito = false, $dataPagos = false)
 {
     $fecha = $this->mFechaDeCorte;
     $credito = $credito == false ? $this->mClaveDeCredito : $credito;
     $xCred = new cCredito($credito);
     $xCred->init($arrData);
     $xCred->initPagosEfectuados($dataPagos, $fecha);
     //setLog($dataPagos);
     $xSoc = new cSocio($xCred->getClaveDePersona());
     $xSoc->init();
     $this->mInfoLinea[1] = $this->getText($this->getClaveDeOtorgante());
     $this->mInfoLinea[2] = $this->getText($this->getNombreOtorgante());
     $this->mInfoLinea[3] = $this->getFechaDeReporte();
     $this->mInfoLinea[4] = $this->getText($xSoc->getApellidoPaterno());
     $this->mInfoLinea[5] = $this->getText($xSoc->getApellidoMaterno());
     $this->mInfoLinea[6] = "";
     $nombres = explode(" ", $xSoc->getNombre(), 2);
     $this->mInfoLinea[7] = isset($nombres[SYS_CERO]) ? $this->getText($nombres[SYS_CERO]) : "";
     $this->mInfoLinea[8] = isset($nombres[SYS_UNO]) ? $this->getText($nombres[SYS_UNO]) : "";
     $this->mInfoLinea[9] = $this->getDate($xSoc->getFechaDeNacimiento());
     $this->mInfoLinea[10] = $this->getText($xSoc->getRFC());
     $this->mInfoLinea[11] = isset($this->mTituloPersonal[$xSoc->getTipoGenero()]) ? $this->mTituloPersonal[$xSoc->getTipoGenero()] : "";
     //Hiber Tadeo
     $this->mInfoLinea[12] = $this->getEstadoCivil($xSoc->getEstadoCivil());
     $this->mInfoLinea[13] = $this->mEquivGenero[$xSoc->getTipoGenero()];
     //TODO: terminar defuncion/muerte de la persona
     $this->mInfoLinea[14] = "";
     $this->mInfoLinea[15] = "";
     $xDom = $xSoc->getODomicilio();
     if ($xDom == null) {
         for ($i = 16; $i <= 23; $i++) {
             $this->mInfoLinea[$i] = "";
         }
     } else {
         $this->mInfoLinea[16] = $this->getText($xDom->getCalleConNumero());
         $this->mInfoLinea[17] = "";
         $this->mInfoLinea[18] = $this->getText($xDom->getColonia());
         $this->mInfoLinea[19] = $this->getText($xDom->getMunicipio());
         $this->mInfoLinea[20] = $this->getText($xDom->getCiudad());
         $this->mInfoLinea[21] = $this->getText($xDom->getClaveDeEstadoEnSIC());
         $this->mInfoLinea[22] = $this->getText($xDom->getCodigoPostal());
         $xTel = $xSoc->getTelefonoPrincipal();
         //Hiber Tadeo
         $this->mInfoLinea[23] = $xTel == 0 ? "" : $xTel;
         //Hiber Tadeo
     }
     $xAE = $xSoc->getOActividadEconomica();
     if ($xAE == null) {
         $this->mInfoLinea[24] = $this->getText($xSoc->getRFC(true));
         //Para Finsureste debe de ser este RFC del cliente
         $this->mInfoLinea[33] = 0;
     } else {
         $this->mInfoLinea[24] = $this->getText($xSoc->getRFC(true));
         //Para Finsureste debe de ser este RFC del cliente//$this->getText($xAE->getNombreEmpresa());
         $this->mInfoLinea[33] = $this->getText($xDom->getCalleConNumero());
         //Para Finsureste debe de ser direccion del cliente //Hiber Tadeo Aca es direccion
     }
     //direccion 2
     $this->mInfoLinea[25] = "";
     $this->mInfoLinea[26] = $this->getText($xDom->getColonia());
     //Para Finsureste
     $this->mInfoLinea[27] = $this->getText($xDom->getMunicipio());
     //Para Finsureste
     $this->mInfoLinea[28] = $this->getText($xDom->getCiudad());
     //Para Finsureste
     $this->mInfoLinea[29] = $this->getText($xDom->getClaveDeEstadoEnSIC());
     //Para Finsureste
     $this->mInfoLinea[30] = $this->getText($xDom->getCodigoPostal());
     //Para Finsureste
     $this->mInfoLinea[31] = $xTel == 0 ? "" : $xTel;
     //Hiber Tadeo  //Para Finsureste
     $this->mInfoLinea[32] = "";
     $this->mInfoLinea[34] = $this->getClaveDeOtorgante();
     $this->mInfoLinea[35] = $this->getText($this->getNombreOtorgante());
     $this->mInfoLinea[36] = $xCred->getNumeroDeCredito();
     $this->mInfoLinea[38] = $this->getTipoDeCuenta($xCred->getTipoDePago());
     //datos del convenio
     $DConv = $xCred->getOProductoDeCredito();
     $this->mInfoLinea[37] = $this->getTipoDeResponsabilidad($DConv->getTipoDeIntegracion());
     $this->mInfoLinea[39] = $DConv->getTipoDeContratoCR();
     //"PL";//$DConv->getTipoDeContratoCR(); //Hiber Tadeo CL=LINEA DE CREDITO PL=PRESTAMO PERSONAL
     $this->mInfoLinea[40] = AML_CLAVE_MONEDA_LOCAL;
     //TODO: mejorar
     $this->mInfoLinea[41] = $xCred->getPagosAutorizados();
     if ($xCred->getTipoEnSistema() == CREDITO_PRODUCTO_NOMINA) {
         //TODO: Parchar con el de TADEO
         $this->mInfoLinea[42] = "P";
     } else {
         $this->mInfoLinea[42] = $this->mEquivFrecPagos[$xCred->getPeriocidadDePago()];
     }
     $this->mInfoLinea[43] = $this->getDate($xCred->getFechaDeMinistracion());
     $this->mInfoLinea[44] = $this->getMonto($xCred->getMontoDeParcialidad());
     $this->mInfoLinea[45] = $this->getDate($xCred->getFechaUltimoDePago());
     $this->mInfoLinea[46] = $this->getDate($xCred->getFechaDeMinistracion());
     $this->mInfoLinea[47] = "";
     //$this->getDate("2029-12-31" );
     if ($xCred->getSaldoActual($fecha) <= TOLERANCIA_SALDOS) {
         $this->mInfoLinea[47] = $this->getDate($xCred->getFechaUltimoDePago());
     }
     $this->mInfoLinea[48] = $this->getFechaDeReporte();
     $DCapacidad = $xSoc->getOCapacidadDePago();
     $this->mInfoLinea[49] = $this->getMonto($DCapacidad->getMontoDeCreditoMaximo());
     $this->mInfoLinea[50] = $this->getMonto($xCred->getSaldoIntegrado($fecha));
     //$xCred->getSaldoActual();
     $this->mInfoLinea[51] = $this->getMonto($DCapacidad->getLimiteDeCredito());
     $this->mInfoLinea[52] = $this->getMonto($xCred->getSaldoVencido());
     //53 numero de pagos vencidos
     $this->mInfoLinea[53] = 0;
     //54 forma mop
     $this->mInfoLinea[54] = $xCred->getMOP($fecha);
     // ($this->mOut == OUT_CSV) ? "01" : "'01";
     //55 clave de observacion, segun catalogo
     $this->mInfoLinea[55] = "";
     //56 clave de otorgante anterior
     //57 nombre otorgante anterior
     $this->mInfoLinea[56] = "";
     $this->mInfoLinea[57] = "";
     $this->mInfoLinea[58] = "";
     //Numero de cuenta anterior en caso de cartera tranferida
     $this->mInfoLinea[59] = $xCred->getFechaDePrimerAtraso() == null ? "" : $this->getDate($xCred->getFechaDePrimerAtraso());
     //TODO: Fecha de Primera atraso
     $this->mInfoLinea[60] = $this->getMonto($xCred->getSaldoActual($fecha));
     //Saldo Insoluto del Principal
     $this->mInfoLinea[61] = $this->getMonto($xCred->getMontoUltimoPago());
     // $xCred->getMontoDeParcialidad();//0; //TODO: Monto de Ultimo pago
     if (MODO_DEBUG == true) {
         $this->mMessages .= $xCred->getMessages(OUT_TXT);
     }
 }
 $defaultPago = OPERACION_PAGO_COMPLETO;
 switch ($periocidad) {
     case CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO:
         $oFrm->addToolbar($xhBtn->getBasic("TR.ABONO ORDINARIO", "jsGetPago('ao')", "dinero", "pc2", false));
         $oFrm->addToolbar($xhBtn->getBasic("TR.PAGO COMPLETO", "jsGetPago('pc')", "dinero", "pc1", false));
         break;
     default:
         $oFrm->addToolbar($xhBtn->getBasic("TR.LETRA COMPLETA", "jsGetPago('plc')", "dinero", "pc2", false));
         $oFrm->addToolbar($xhBtn->getBasic("TR.LETRA VARIABLE", "jsGetPago('pli')", "dinero", "pc3", false));
         $oFrm->addToolbar($xhBtn->getBasic("TR.PAGO COMPLETO", "jsGetPago('pc')", "dinero", "pc1", false));
         $defaultPago = OPERACION_PAGO_LETRA_COMPLETA;
         break;
 }
 $oFrm->addToolbar($xhBtn->getRegresar("../index.xul?p=frmcaja/frmcobrosdecreditos.php", true));
 $oFrm->addToolbar($xhBtn->getBasic("TR.Recargar", "jsCargarFrame()", "refrescar", "idrefrescar", false));
 if (MODO_DEBUG == true and $xCred->getTipoEnSistema() != CREDITO_PRODUCTO_NOMINA) {
     $xLog = new cFileLog(false, true);
     $xLog->setWrite($msg);
     $xLog->setClose();
     $oFrm->addToolbar($xLog->getLinkDownload("Log de descargas", ""));
 }
 $xSelP->addEvent("showInCommand()", "onblur");
 $xTxt = new cHText("idobservaciones");
 $html = "";
 $oFrm->addFooterBar("<h3>FECHA DE PAGO : [" . $xF->getFechaDDMM($Fecha) . "] NUMERO DE PARCIALIDAD: [{$parcialidad}]</h3>");
 $html .= $xCred->getFicha(false, "", false, true);
 $xHCob->setEvents("onblur='jsGetPago()'");
 $html .= $xHCob->get(false, "", "", false);
 $html .= $xTxt->get("idobservaciones", "", "Observaciones");
 $html .= "<iframe id=\"idFPrincipal\" src=\"./../principal.php\" width='100%' height=\"800px\" ></iframe>";
 $oFrm->addHElem($html);