function jsaSetTotal($recibo) { $xRec = new cReciboDeOperacion(false, true, $recibo); $xRec->init(); $xRec->setGenerarBancos(false); $xRec->setGenerarPoliza(false); $xRec->setGenerarTesoreria(false); $xRec->setForceUpdateSaldos(true); $xRec->setFinalizarRecibo(true); $msg = ""; if ($xRec->getOrigen() == TESORERIA_RECIBOS_ORIGEN_MIXTO or $xRec->getOrigen() == TESORERIA_RECIBOS_ORIGEN_CRED) { $credito = $xRec->getCodigoDeDocumento(); $xUtil = new cUtileriasParaCreditos(); $msg .= $xUtil->setCuadrarCreditosByMvtos($credito); } $msg .= $xRec->getMessages(OUT_TXT); return $msg; }
$xLog = new cFileLog($aliasFil); $ql = new MQL(); $xRec = new cReciboDeOperacion(12); $xRec->setGenerarPoliza(); $xRec->setForceUpdateSaldos(); $idrecibo = $xRec->setNuevoRecibo(DEFAULT_SOCIO, DEFAULT_CREDITO, $fechaop, 1, 12, "CIERRE_DE_COLOCACION_{$fechaop}", DEFAULT_CHEQUE, DEFAULT_TIPO_PAGO, DEFAULT_RECIBO_FISCAL, DEFAULT_GRUPO); $xRec->setNumeroDeRecibo($idrecibo); $messages .= "=======================================================================================\r\n"; $messages .= "=========================\t\t" . EACP_NAME . " \r\n"; $messages .= "=========================\t\t" . getSucursal() . " \r\n"; $messages .= "=======================================================================================\r\n"; $messages .= "=========================\t\tINICIANDO EL CIERRE DE COLOCACION ====================\r\n"; $messages .= "=========================\t\tRECIBO: {$idrecibo}\t\t\t\t ====================\r\n"; //reconstruir db de pagos $ql->setRawQuery("CALL `proc_historial_de_pagos` "); $xCUtils = new cUtileriasParaCreditos(); $messages .= $xCUtils->setEstatusDeCreditos($idrecibo, $fechaop, false, true); if (date("Y-m-t", strtotime($fechaop)) == date("Y-m-d", strtotime($fechaop))) { $messages .= $xCUtils->setGenerarMvtoFinDeMes($xF->getDiaInicial(), $xF->getDiaFinal()); } if (CREDITO_CIERRE_FORZAR_DEVENGADOS == true) { $messages .= $xCUtils->setReestructurarSDPM_Planes(true, false, false, false, $xF->getDiaInicial(), false); $messages .= $xCUtils->setReestructurarSDPM(true, false, false, false, false, $xF->getDiaInicial(), false); $messages .= $xCUtils->setRegenerarInteresDevengado(false, $xF->get(), $xF->get()); } $messages .= $xCUtils->setAcumularIntereses(); $xRec->setFinalizarRecibo(true); $xLog->setWrite($messages); $xLog->setClose(); if (ENVIAR_MAIL_LOGS == true) { $xLog->setSendToMail("TR.Eventos del Cierre del colocacion");
function setReestructurarIntereses($FechaInicial = false, $FechaFinal = false, $ForceMoratorios = false) { $xT = new cTipos(); $msg = ""; $socio = $this->getClaveDePersona(); $solicitud = $this->getNumeroDeCredito(); $xCUtils = new cUtileriasParaCreditos(); $FechaFinal = $FechaFinal == false ? fechasys() : $FechaFinal; $FechaInicial = $FechaInicial == false ? "1998-01-01" : $FechaInicial; if ($this->getEsAfectable() == true) { if ($this->getTipoDePago() == CREDITO_TIPO_PAGO_UNICO or $this->getPeriocidadDePago() == CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO) { my_query("DELETE FROM operaciones_recibos WHERE numero_socio={$socio} AND docto_afectado={$solicitud} AND tipo_docto=11"); my_query("DELETE FROM operaciones_mvtos WHERE socio_afectado={$socio} AND docto_afectado={$solicitud}\n\t\t\t\tAND (tipo_operacion=410 OR tipo_operacion=411 OR tipo_operacion=412 OR tipo_operacion=413 \n\t\t\t\tOR tipo_operacion=1005 OR tipo_operacion=601)"); } if (CREDITO_PURGAR_ESTADOS == true) { my_query("DELETE FROM operaciones_mvtos WHERE socio_afectado={$socio} AND docto_afectado={$solicitud}\tAND ( tipo_operacion=111 OR tipo_operacion=113 OR tipo_operacion=114 OR tipo_operacion=115)"); } //Reestructurar Estatus $msg .= $xCUtils->setEstatusDeCreditos(DEFAULT_RECIBO, $FechaFinal, false, true, $solicitud); //Reestructurar Intereses if ($this->getEstadoActual() != CREDITO_ESTADO_VIGENTE) { //$this-> //$msg .= $cUCredit->setRegenerarCreditosAVencidos( $fecha ); //$msg .= $cUCredit->setRegenerarCreditosAMora( $fecha ); $DEstado = $this->setDetermineDatosDeEstatus($FechaFinal); $EstadoCalculado = $DEstado[SYS_ESTADO]; $msg .= "WARN\tRE_ESTATUS\tRecalcular Estatus de " . $this->getEstadoActual() . " A {$EstadoCalculado}\n"; switch ($EstadoCalculado) { case CREDITO_ESTADO_VIGENTE: $this->setEnviarVigente($FechaFinal, $this->getPeriodoActual(), DEFAULT_RECIBO); break; case CREDITO_ESTADO_MOROSO: $this->setEnviarMoroso($this->mFechaMora, $this->getPeriodoActual(), DEFAULT_RECIBO); break; case CREDITO_ESTADO_VENCIDO: $this->setEnviarVencido($this->mFechaVencimientoLegal, $this->getPeriodoActual(), DEFAULT_RECIBO); break; } } else { $msg .= "ESTATUS\tSin Cambios de Estado : " . $this->getEstadoActual() . "\n"; } $msg .= $xCUtils->setGenerarMvtoFinDeMes($FechaInicial, $FechaFinal, $solicitud, true); if ($this->getPeriocidadDePago() == CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO) { $msg .= $xCUtils->setReestructurarSDPM(false, $solicitud); } else { $msg .= $xCUtils->setReestructurarSDPM_Planes(false, $solicitud); } $msg .= $xCUtils->setRegenerarInteresDevengado($solicitud, $FechaInicial, $FechaFinal, $ForceMoratorios); $msg .= $xCUtils->setAcumularIntereses(false, $solicitud); } else { $msg .= "NO_PROCESADO\tCredito No Afectable\n"; } $this->mMessages .= $msg; $this->init(); return $msg; }
/** * Revierte las Afectaciones del Recibo */ function setRevertir($ForzarEliminar = false) { $sucess = true; $arrValuesRev = array("-1" => "1", "1" => "-1", "0" => "0"); $xQL = new MQL(); $xLog = new cCoreLog(); $sqlM = "SELECT\n\t\t\t\t\t\t`operaciones_mvtos`.*,\n\t\t\t\t\t\t`operaciones_tipos`.*,\n\t\t\t\t\t\t`operaciones_mvtos`.`recibo_afectado`\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`operaciones_mvtos` `operaciones_mvtos`\n\t\t\t\t\t\t\tINNER JOIN `operaciones_tipos` `operaciones_tipos`\n\t\t\t\t\t\t\tON `operaciones_mvtos`.`tipo_operacion` = `operaciones_tipos`.\n\t\t\t\t\t\t\t`idoperaciones_tipos`\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t(`operaciones_mvtos`.`recibo_afectado` =" . $this->mCodigoDeRecibo . ")"; $xLog->add("======================== REVERSION DE RECIBO[" . $this->mCodigoDeRecibo . "] \r\n"); $original = ""; $rs = $xQL->getDataRecord($sqlM); //getRecordset($sqlM); if ($this->init() == true) { $original = "====[" . base64_encode(json_encode($this->getDatosInArray())) . "]===="; if ($rs) { foreach ($rs as $rw) { //$rw = mysql_fetch_array($rs)){ $codigo = $rw["idoperaciones_mvtos"]; $docto = $rw["docto_afectado"]; $socio = $rw["socio_afectado"]; $preservar_mvto = $rw["preservar_movimiento"]; $CodeRevertir = $rw["formula_de_cancelacion"]; $monto = $rw["afectacion_real"]; $afectacion = $rw["valor_afectacion"]; $recibo = $rw["recibo_afectado"]; $colocacion = array(); $captacion = array(); //selecciona un comportamiento segun el Origen del Recibo switch ($this->mAplicadoA) { case "colocacion": //cargar datos del credito $Credito = new cCredito($docto, $socio); $Credito->init(); $colocacion = $Credito->getDatosDeCredito(); break; case "captacion": //cargar datos de la cuenta $Cuenta = new cCuentaALaVista($docto); $Cuenta->init(); $captacion = $Cuenta->getDatosInArray(); break; case "mixto": //cargar datos de la cuenta y del credito $Credito = new cCredito($docto, $socio); $Credito->init(); $colocacion = $Credito->getDatosDeCredito(); $Cuenta = new cCuentaALaVista($docto); $Cuenta->init(); $captacion = $Cuenta->getDatosInArray(); $this->mMessages .= "WARN\tEL Recibo es Mixto, se carga tanto Captacion como Colocacion\r\n"; break; default: $this->mMessages .= "WARN\tEL Recibo es " . $this->mAplicadoA . ", NO SE CARGA CODIGO\r\n"; break; } eval($CodeRevertir); if ($preservar_mvto == '1' and $ForzarEliminar == false) { $SQL_DM = "UPDATE operaciones_mvtos\n\t\t\t\t\t\t\t\t\t\t\tSET afectacion_estadistica=afectacion_real,\n\t\t\t\t\t\t\t\t\t\t\tafectacion_real = 0, afectacion_contable=0,\n\t\t\t\t\t\t\t\t\t\t\tafectacion_cobranza=0, valor_afectacion=0,\n\t\t\t\t\t\t\t\t\t\t\testatus_mvto = 99,\n\t\t\t\t\t\t\t\t\t\t\tdocto_neutralizador = " . $this->mCodigoDeRecibo . ",\n\t\t\t\t\t\t\t\t\t\t\trecibo_afectado\t= " . DEFAULT_RECIBO . "\n\t\t\t\t\t\t\t\t\t\t\tWHERE idoperaciones_mvtos = {$codigo}\n\t\t\t\t\t\t\t\t\t\t\t"; $xLog->add("Actualizando el Movimiento {$codigo}\r\n", $xLog->DEVELOPER); } else { $SQL_DM = "DELETE FROM operaciones_mvtos\n\t\t\t\t\t\t\t\t\t\t\tWHERE idoperaciones_mvtos = {$codigo}"; $xLog->add("Eliminado el Movimiento {$codigo}\r\n", $xLog->DEVELOPER); } my_query($SQL_DM); //Actualizar Saldos if (isset($Cuenta)) { $Cuenta->setUpdateSaldoByMvtos(); } if (isset($Credito)) { $xUtil = new cUtileriasParaCreditos(); $xUtil->setCuadrarCreditosByMvtos($docto); } } } //Elimnar Prepoliza $xLog->add("WARN\tEliminando Prepolizas\r\n", $xLog->DEVELOPER); $sqlDP = "DELETE FROM contable_polizas_proforma\tWHERE numero_de_recibo = " . $this->mCodigoDeRecibo . ""; my_query($sqlDP); //Eliminar Recibo $sqlDR = "DELETE FROM operaciones_recibos WHERE idoperaciones_recibos =" . $this->mCodigoDeRecibo . ""; my_query($sqlDR); //Agregar Tesoreria y Bancos $xLog->add("WARN\tEliminando Operaciones de Caja\r\n", $xLog->DEVELOPER); $DelTesoreria = "DELETE FROM `tesoreria_cajas_movimientos` WHERE `recibo`= " . $this->mCodigoDeRecibo . ""; my_query($DelTesoreria); $xLog->add("WARN\tEliminando Operaciones de Bancos\r\n", $xLog->DEVELOPER); $DelBancos = "DELETE FROM `bancos_operaciones` WHERE `recibo_relacionado` = " . $this->mCodigoDeRecibo . ""; my_query($DelBancos); } $xCE = new cErrorCodes(); //setLog($this->mMessages . json_encode($this->getDatosInArray()), $xCE->RECIBO_ELIMINADO); $xLog->guardar($xLog->OCat()->RECIBO_ELIMINADO); $this->mMessages .= $xLog->getMessages(); if ($this->isPagable() == true) { //agregar Aviso. $xRuls = new cReglaDeNegocio(); $xRuls->setVariables(array("mensaje" => $this->getMessages(), "original" => $original)); $xRuls->setExecuteActions($xRuls->reglas()->RN_DATOS_AL_ELIMINAR_RECIBO); } return $sucess; }
function jsaSetCambiarPersona($credito, $nuevapersona) { $xUtil = new cUtileriasParaCreditos(); $xUtil->setCambiarPersonaDeCredito($credito, $nuevapersona); return $xUtil->getMessages(OUT_HTML); }
<?php //===================================================================================================== //=====> INICIO_H include_once "../core/go.login.inc.php"; include_once "../core/core.error.inc.php"; include_once "../core/core.html.inc.php"; include_once "../core/core.init.inc.php"; $theFile = __FILE__; //$permiso = getSIPAKALPermissions($theFile); //if($permiso === false){ header ("location:../404.php?i=999"); } $_SESSION["current_file"] = addslashes($theFile); //<===== FIN_H //===================================================================================================== $xP = new cHPage("Pruebas de la Clase Creditos", HP_FORM); $xUtils = new cUtileriasParaCreditos(); echo $xP->getHeader(); echo $xP->setBodyinit(); // $fecha = parametro("fecha", fechasys()); /* Fecha_Cierre_Credito,Forma_Pago_Mop ( Que solo puede salir viendo cuantos dias transcurridos del credito han pasado) y Monto_Ultimo_Pago creo que con eso ya sale para hoy * */ $credito_de_pruebas = parametro("credito", 209999801, MQL_INT); //Crear formularios $xFRM = new cHForm("frmTest", "./test.php"); $xHTxt = new cHText(""); //==================================================================================================== $xFRM->addHElem("<p class='aviso'>Pruebas de la Clase Creditos</p>"); $xCred = new cCredito($credito_de_pruebas); $xCred->init();
$xCol->fecha_de_revision(fechasys()); $DMun = $ql->getDataRow("SELECT * FROM `general_municipios` WHERE `clave_de_municipio`= " . $xLoc->clave_de_municipio()->v() . " AND `clave_de_entidad`=" . $xLoc->clave_de_estado()->v()); $NMun = ""; if (isset($DMun["nombre_del_municipio"])) { $NMun = $DMun["nombre_del_municipio"]; } $xCol->municipio_colonia($NMun); $xCol->nombre_colonia($xLoc->nombre_de_la_localidad()->v()); $xCol->sucursal(getSucursal()); $xCol->tipo_colonia("Colonia"); $xCol->idgeneral_colonia($xLoc->clave_de_localidad()->v()); $xCol->query()->insert()->save(); } break; case 21101: $xUtils = new cUtileriasParaCreditos(); $msg .= $xUtils->setActualizarPrimerPago(); break; case 8201: $xUAml = new cUtileriasParaAML(); $msg .= $xUAml->setGenerarPerfilesPorActividadEconomica(); break; case 8202: $ForzarCorreccion = strtoupper($id) == "SI" ? true : false; $xUAml = new cUtileriasParaAML(); $msg .= $xUAml->setActualizarNivelDeRiesgo($ForzarCorreccion); break; case 8203: $xUPers = new cPersonas_utils(); $xUPers->setCrearArbolRelaciones(); break;
function setEliminarInteresesDeCreditosPagados() { $msg = ""; //============================================================================== $fecha = fechasys(); $cheque = DEFAULT_CHEQUE; $recibo_fiscal = "NA"; $observaciones = "GENERADO_EN_LA_UTILERIA_883"; //============================================================================== $CRecibo = new cReciboDeOperacion(1, false); //Set a Mvto Contable //$CRecibo->setGenerarPoliza(); //$CRecibo->setGenerarTesoreria(); $recibo = $CRecibo->setNuevoRecibo(DEFAULT_SOCIO, DEFAULT_CREDITO, $fecha, 1, 1, $observaciones, $cheque, "ninguno", $recibo_fiscal, DEFAULT_GRUPO); $CRecibo->setNumeroDeRecibo($recibo); // $sql = "SELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t`creditos_solicitud` `creditos_solicitud`\n\t\t\tWHERE\n\t\t\t\t(`creditos_solicitud`.`saldo_actual` <= 0) AND\n\t\t\t\t(\n\t\t\t\t\t(`creditos_solicitud`.`interes_moratorio_devengado` != 0)\n\t\t\tOR\n\t\t\t\t\t(`creditos_solicitud`.`interes_normal_devengado` != 0)\n\t\t\t\t)"; $rs = mysql_query($sql, cnnGeneral()); while ($rw = mysql_fetch_array($rs)) { $socio = $rw["numero_socio"]; $solicitud = $rw["numero_solicitud"]; $OpNormal = 420; //420; $OpMora = 421; //431; $MontoM = 0; $MontoN = 0; //terminado: oct/2011 $interesDN = $rw["interes_normal_devengado"]; $interesDM = $rw["interes_moratorio_devengado"]; $interesPN = $rw["interes_normal_pagado"]; $interesPM = $rw["interes_moratorio_pagado"]; if ($interesDN > $interesPN) { $OpNormal = 140; $MontoN = $interesDN - $interesPN; } else { $MontoN = $interesPN - $interesDN; } if ($interesDM > $interesPM) { $OpNormal = 141; $MontoM = $interesDM - $interesPM; } else { $MontoM = $interesPM - $interesDM; } if ($MontoN > 0) { $CRecibo->setNuevoMvto($fecha, $MontoN, $OpNormal, 1, " Ajuste por {$MontoN} de {$interesDN} | {$interesPN} ", 1, TM_CARGO, $socio, $solicitud); $msg .= "{$socio}\t{$solicitud}\tINTERES_NORMAL_DEV\tAjuste por {$MontoN} de {$interesDN} | {$interesPN} \r\n"; } else { } if ($MontoM > 0) { $CRecibo->setNuevoMvto($fecha, $MontoN, $OpMora, 1, "Ajuste por {$MontoM} de {$interesDM} | {$interesPM}", 1, TM_CARGO, $socio, $solicitud); $msg .= "{$socio}\t{$solicitud}\tINTERES_MOR_DEV\tAjuste por {$MontoM} {$interesDM} | {$interesPM} \r\n"; } else { } } $msg .= $CRecibo->getMessages("txt"); $xCUtils = new cUtileriasParaCreditos(); $msg .= $xCUtils->setAcumularIntereses(true); return $msg; }