$oFech = new cHDate(); $oSel = new cSelect(""); $oUL = new cHUl(); $oTa = new cHTextArea(); $xCE = new cCreditos_estatus(); $xSelEA = $xCE->query()->html()->select($xCE->descripcion_estatus()->get()); $xCP = new cCreditos_periocidadpagos(); $xSelCP = $xCP->query()->html()->select($xCP->descripcion_periocidadpagos()->get()); $xCTP = new cCreditos_tipo_de_pago(); $xSelTP = $xCTP->query()->html()->select($xCTP->descripcion()->get()); $xPP = new cCreditos_tipoconvenio(); $xSelPP = $xPP->query()->html()->select($xPP->descripcion_tipoconvenio()->get()); $oFRM = new cHForm("frmrenegociar", "", "idfrmrenegociar"); $oFRM->addHElem($xSelPP->get("idpdto", "Producto Actual", $xCred->getClaveDeProducto())); $oFRM->addHElem($xSelCP->get("idperiocidad", "Nueva Periocidad", $xCred->getPeriocidadDePago())); $oFRM->addHElem($xSelTP->get("idtipopago", "Nuevo Tipo de Pago", $xCred->getTipoDePago())); $oFRM->addHElem($oTxt->getDeMoneda("idmonto", "Monto a Renegociar", $xCred->getSaldoActual())); $oFRM->addHElem($oTxt->getDeMoneda("idpagos", "Pagos nuevos", $xCred->getPagosAutorizados())); $oFRM->addHElem($oTxt->getDeMoneda("idtasa", "Tasa Nueva", $xCred->getTasaDeInteres() * 100)); //$oFRM->addHElem( $oTxt->getDeMoneda("idinteres", "Interes a Renegociar", $xCred->getInteresNormalPorPagar() ) ); $oFRM->addHElem($oTa->get("idobservaciones", "", "Observaciones")); $oFRM->addHTML("<p class='aviso' id='resultados'></p>"); $oFRM->addHTML($oUL->li("Se Clona el Credito")->li("Eliminar Plan de Pagos")->li("Reestructurar SDPM")->li("Recalcular Intereses Devengados")->li("Cambiar el Numero de Pagos")->li("Generar Movimiento de Fin de Mes")->end()); $oFRM->addHElem($oBtn->getBasic("Guardar", "jsGuardarCambios", "guardar", "idguardar")); $oFRM->addHElem($oBtn->getBasic("Cancelar", "jsCancelarCambios", "cancelar", "idcancelar")); echo $oFRM->get(); echo $xHP->setBodyEnd(); $jsb->show(); $jxc->drawJavaScript(false, true); ?> <!-- HTML content -->
$oFrm6->addHElem($oTxt->getDeMoneda("idtasa", $xFRM->lang("Tasa", "Actual"), $xCred->getTasaDeInteres() * 100)); $oFrm6->addHElem($oTxt->getDeMoneda("idtasamora", "TR.Tasa Moratorio", $xCred->getTasaDeMora() * 100)); $oFrm6->addHTML($oUL->li("Modificar el Monto que se autorizó")->li("Eliminar Plan de Pagos")->li("Recalcular Intereses Devengados")->li("Reestructurar SDPM")->end()); //$oFrm6->addHTML("<p class='aviso'></p>"); $oFrm6->addFootElement($oBtn->getBasic($lguardar, "jsaCambiarProducto();jsTipTimer()", "guardar", "idsapdto")); $oFrm6->addFootElement($oBtn->getBasic($lcancelar, "jsCancelarAccion()", "cancelar", "idcancela6")); echo $oFrm6->get(); ?> </div> <!-- PERIOCIDAD DE PAGO --> <div class="inv" id="divperiocidad"> <?php $oFrm5 = new cHForm("frmperiocidad", "", "idfrmperiocidad"); $oFrm5->addHElem($xSelCP->get("idperiocidad", $xFRM->lang("Nueva", "Periocidad"), $xCred->getPeriocidadDePago())); $oFrm5->addHElem($xSelTP->get("idtipopago", $xFRM->lang(array("Nuevo", "Tipo de", "Pago")), $xCred->getTipoDePago())); $oFrm5->addHElem($oTxt->getDeMoneda("idpagos", $xFRM->lang("Numero de", "Pagos"), $xCred->getPagosAutorizados())); $oFrm5->addHElem($oFch->get($xFRM->lang("Fecha de", "Vencimiento"), $xCred->getFechaDeVencimiento(), 2)); $oFrm5->OMoneda("idpagoactual", $xCred->getPeriodoActual(), "TR.Ultima Parcialidad"); $oFrm5->addHTML($oUL->li("Eliminar Plan de Pagos")->li("Reestructurar SDPM")->li("Recalcular Intereses Devengados")->li("Cambiar el Numero de Pagos")->li("Generar Movimiento de Fin de Mes")->end()); $oFrm5->addFootElement($oBtn->getBasic($lguardar, "jsaCambiarPeriocidad();jsTipTimer()", "guardar", "idmonto")); $oFrm5->addFootElement($oBtn->getBasic($lcancelar, "jsCancelarAccion()", "cancelar", "idcancela")); echo $oFrm5->get(); ?> </div> <!-- ELIMINAR --> <div class="inv" id="diveliminar"> <h3>Acciones</h3> <ul> <li>Eliminar Credito</li>
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); } }
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(); }
function setReestructurarSDPM($SoloConSaldos = false, $credito = false, $forzarTodos = false, $fechaCorte = false, $fechaInicial = false, $EliminarTodo = true) { //FIXME: probar con saldo anterior $fechaCorte = $fechaCorte == false ? fechasys() : $fechaCorte; $msg = ""; $wCredito1 = $credito != false ? " `creditos_mvtos_asdpm`.`documento` = {$credito}" : " `documento` > 0 "; $wCredito2 = $credito != false ? " numero_de_credito = {$credito} " : " numero_de_credito > 0"; $ByRTM = $credito != false ? " " : " SQL_CACHE "; $wFecha1 = " AND (fecha >='{$fechaInicial}' AND fecha <='{$fechaCorte}' ) "; $wFecha2 = " AND (`fecha_actual` >= '{$fechaInicial}' AND `fecha_actual`<='{$fechaCorte}' ) "; $ql = new MQL(); $arrEstatusD = array(OPERACION_CLAVE_MINISTRACION, 111, 114, 115); $arrEstatus = array(OPERACION_CLAVE_MINISTRACION => CREDITO_ESTADO_VIGENTE, 111 => CREDITO_ESTADO_VENCIDO, 114 => CREDITO_ESTADO_VIGENTE, 115 => CREDITO_ESTADO_MOROSO); //Eliminar el SDPM if ($EliminarTodo == true) { $DAction = $ql->setRawQuery("DELETE FROM creditos_sdpm_historico WHERE {$wCredito2} {$wFecha2} "); if (MODO_DEBUG == true) { $msg .= "WARN\tEliminando SDPM\r\n"; } } if ($credito != false) { $ql->setRawQuery("DELETE FROM operaciones_mvtos WHERE docto_afectado={$credito} AND tipo_operacion = 420"); if (MODO_DEBUG == true) { $msg .= "WARN\tEliminando Operaciones 420 del credito {$credito}\r\n"; } } $msg .= "Socio\tCredito\tFecha\tMonto\tSaldo\tDias\tOperacion\tEstatus\tInteres\tMoratorios\r\n"; //Generar saldos de credito por mes $sql = "SELECT {$ByRTM}\n\t\t`creditos_mvtos_asdpm`.`socio`,\n\t\t`creditos_mvtos_asdpm`.`documento`,\n\t\t`creditos_mvtos_asdpm`.`recibo`,\n\t\t`creditos_mvtos_asdpm`.`fecha`,\n\t\t`creditos_mvtos_asdpm`.`operacion`,\n\t\t`creditos_mvtos_asdpm`.`monto`,\n\t\t`creditos_mvtos_asdpm`.`afectacion`\n\t\tFROM `creditos_mvtos_asdpm`\tWHERE {$wCredito1} {$wFecha1} "; //setLog($sql); $rsM = $ql->getDataRecord($sql); $saldo = 0; $creditoA = 0; $xT = new cTipos(); $xF = new cFecha(); $FECHA_DE_ULTIMO_PAGO = "1998-01-01"; $CREDITO_SALDO_ANTERIOR = 0; $MvtoAnterior = OPERACION_CLAVE_MINISTRACION; $ESTADO_ACTUAL = CREDITO_ESTADO_VIGENTE; $DIVISOR_DE_INTERESES = EACP_DIAS_INTERES; $DCred = array(); $IsCredNew = true; $xCred = null; foreach ($rsM as $rw) { $socio = $xT->cInt($rw["socio"]); $credito = $xT->cInt($rw["documento"]); $fecha = $rw["fecha"]; $nota = ""; // $IsCredNew = true; if ($creditoA != $credito) { $saldo = 0; $FECHA_DE_ULTIMO_PAGO = $fecha; $ESTADO_ACTUAL = CREDITO_ESTADO_VIGENTE; $xCred = new cCredito($credito, $socio); $xCred->init(); $DCred = $xCred->getDatosDeCredito(); $CREDITO_SALDO_ANTERIOR = 0; //si es Ministracion if ($MvtoAnterior == OPERACION_CLAVE_MINISTRACION) { $FECHA_DE_ULTIMO_PAGO = $xCred->getFechaDeMinistracion(); } $msg .= "------------------------\tNUEVO_CREDITO : {$credito}------------------------------\r\n"; if ($EliminarTodo == false) { my_query("DELETE FROM creditos_sdpm_historico WHERE numero_de_credito = {$credito} {$wFecha2}"); } } else { $IsCredNew = false; } $OProd = $xCred->getOProductoDeCredito(); $recibo = $rw["recibo"]; $operacion = $rw["operacion"]; $afectacion = $rw["afectacion"]; $monto = $xT->cFloat($rw["monto"], 2); $periocidad = $xCred->getPeriocidadDePago(); $FechaVencimiento = $xCred->getFechaDeVencimiento(); //(!isset( $DCred["fecha_vencimiento_dinamico"])) ? $xCred->getFechaDeVencimiento() : $DCred["fecha_vencimiento_dinamico"]; $DiaInteresMax = $xF->setSumarDias(INTERES_DIAS_MAXIMO_A_DEVENGAR, $FechaVencimiento); $dias_transcurridos = $xF->setRestarFechas($fecha, $FECHA_DE_ULTIMO_PAGO); $saldo_calculado = $dias_transcurridos * $saldo; //No poner la afectacion $saldo += $xT->cFloat($monto * $afectacion, 2); // si es normal, calcular normal, si es mora: Calcular mora y normal, si es vencido: calcular normal y mora $interes = 0; $moratorio = 0; $TASA_NORMAL = $xCred->getTasaDeInteres(); $TASA_MORA = $xCred->getTasaDeMora(); $TIPO_DE_PAGO = $xCred->getTipoDePago(); $PAGOS_SIN_CAPITAL = $xCred->getPagosSinCapital(); $MONTO_ORIGINAL_DE_CREDITO = $xCred->getMontoAutorizado(); $saldoBase = $xT->cFloat($saldo, 2); if ($operacion == OPERACION_CLAVE_PAGO_CAPITAL and $saldo == 0) { $saldoBase = $CREDITO_SALDO_ANTERIOR; } if ($MvtoAnterior == OPERACION_CLAVE_MINISTRACION) { $saldoBase = $CREDITO_SALDO_ANTERIOR; $saldo_calculado = $dias_transcurridos * $CREDITO_SALDO_ANTERIOR; } $SALDO_ACTUAL = $xCred->getSaldoActual(); $BASE_NORMAL = $saldo_calculado; $BASE_MORA = $saldo_calculado; eval($OProd->getPreModInteres()); //considerar si es un maximo de x dias devengar en vencidos switch ($ESTADO_ACTUAL) { case CREDITO_ESTADO_VIGENTE: $interes = $BASE_NORMAL * $TASA_NORMAL / $DIVISOR_DE_INTERESES; break; case CREDITO_ESTADO_VENCIDO: //validar si tiene un maximo de dias transcurridos de devengado if ($xF->getInt($fecha) <= $xF->getInt($DiaInteresMax)) { $interes = $BASE_NORMAL * $TASA_NORMAL / $DIVISOR_DE_INTERESES; $moratorio = $BASE_MORA * $TASA_MORA / $DIVISOR_DE_INTERESES; } else { $interes = 0; $moratorio = 0; $nota = "Despues del {$DiaInteresMax} no se acumula Interes, Vencimiento : {$FechaVencimiento}"; } break; case CREDITO_ESTADO_MOROSO: $interes = $BASE_NORMAL * $TASA_NORMAL / $DIVISOR_DE_INTERESES; $moratorio = $BASE_MORA * $TASA_MORA / $DIVISOR_DE_INTERESES; break; } //END_SWITCH $interes = $xT->cFloat($interes, 2); if ($periocidad == CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO) { $moratorio = $xT->cFloat($moratorio, 2); //0; //2012-04-10 } else { //$moratorio = 0; } eval($OProd->getPosModInteres()); $msg .= "{$socio}\t{$credito}\t{$fecha}\t{$monto}\t{$saldo}\t{$dias_transcurridos}\t{$operacion}\t{$ESTADO_ACTUAL}\t{$interes}\t{$moratorio}\t{$nota}\r\n"; if ($xF->getInt($fecha) <= $xF->getInt(SYS_FECHA_DE_MIGRACION)) { $interes = 0; $moratorio = 0; if (MODO_DEBUG == true) { $msg .= "WARN\tOMITIR Interes {$interes} y MORA por {$moratorio} por estar antes de la migracion {$fecha}\r\n"; } } if ($xF->getInt($fecha) <= $xF->getInt($fechaCorte)) { $msgSDPM = $xCred->addSDPM($interes, $moratorio, $FECHA_DE_ULTIMO_PAGO, $saldo, $ESTADO_ACTUAL, $fecha, $operacion, $saldo_calculado); //if(MODO_DEBUG == true){ $msg .= $msgSDPM; } } if ($saldo <= TOLERANCIA_SALDOS) { $msg .= "------------------------------------------------------\r\n"; } $creditoA = $credito; $FECHA_DE_ULTIMO_PAGO = $fecha; $CREDITO_SALDO_ANTERIOR = $saldo; $MvtoAnterior = $operacion; /* * si existe la operacion de cambio de estatus, validar en el array, y actualizar el valor * Este estatus se aplicara en el siguiente */ if (in_array($operacion, $arrEstatusD)) { $ESTADO_ACTUAL = $arrEstatus[$operacion]; } } return $msg; }