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;
}
 /**
  * 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;
 }
         $nombre = $rw["nombrecompleto"] . " " . $rw["apellidopaterno"] . " " . $rw["apellidomaterno"];
         $tcurp = $rw["mcurp"];
         $sqlDEL = "DELETE FROM socios_general WHERE codigo={$socio} AND fecha_de_revision!='{$fecha}' ";
         $x = my_query($sqlDEL);
         $sqlDEL2 = "DELETE FROM socios_general WHERE codigo={$socio} AND CHAR_LENGTH(curp) < {$tcurp} ";
         $x2 = my_query($sqlDEL2);
         if ($x["stat"] == false and $x2["stat"] == false) {
             $msg .= date("H:i:s") . "\t{$socio}\tSe **FALLO** AL ELIMINAR (" . $x["error"] . ") \r\n";
         } else {
             $msg .= date("H:i:s") . "\t{$socio}\tSe **ELIMINA** por estar {$reo} veces, se Omite el Registro con fecha {$fecha} y Grupo {$grupo} \r\n";
         }
     }
     break;
 case 842:
     $xCred = new cUtileriasParaCreditos();
     $msg .= $xCred->setCuadrarCreditosByMvtos();
     break;
 case 844:
     /**
      * Elimina la cache de sessiones
      */
     $sqlDel = "DELETE FROM usuarios_web_connected";
     $cmd = my_query($sqlDel);
     if ($cmd["stat"] == false) {
     } else {
         $msg .= date("H:i:s") . "\t\t\t SE BORRO LA CACHE DE SESSIONES \r\n";
     }
     break;
 case 845:
     //modifcando la numeracion de un socio a otro
     $numero_socio = $id;