$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"); } if ($parser != false) { header("Location: ./cierre_de_captacion.frm.php?s=true&k=" . $key . "&f={$fechaop}"); } //}
$msg .= $a["info"]; } if ($afectar == "si") { $cRec->setFinalizarRecibo(true); $msg .= $cRec->getMessages(); } break; case 857: $ForzarCorreccion = strtoupper($id); $Forzar = $ForzarCorreccion == "SI" ? true : false; $msg .= "================== REESTRUCTURANDO SALDOS DE INTERESES EN CREDITOS\r\n "; $msg .= "================== USUARIO: {$oficial} \r\n "; //Actualiza los Intereses Devengados y Pagados, asi como los no pagados en base a los movimientos que tengan. //lleva a cero los registros $xCUtils = new cUtileriasParaCreditos(); $msg .= $xCUtils->setAcumularIntereses($Forzar); break; case 858: $validar = strtolower($id); $sqlSocs = "SELECT\n\t\t\t\t\t\t\t\t`socios_general`.*\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t`socios_general` `socios_general`\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t(`socios_general`.`estatusactual` !=20) "; $rs = mysql_query($sqlSocs, cnnGeneral()); while ($rw = mysql_fetch_array($rs)) { $xSoc = new cSocio($rw["codigo"]); $xSoc->init($rw); //$DSoc = $xSoc-> $msg .= $xSoc->getValidacion(); } break; case 859: $clx = new cCajaLocal(99); $msg .= $clx->setReestablecerNumeracion();
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; }
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; }