function add($cuenta, $Operacion, $DoctoDeSoporte, $recibo, $beneficiario, $monto, $persona = false, $fecha = false, $autorizo = false, $descuento = 0, $cuenta_de_origen = false, $tipo_de_exhibicion = "", $moneda = AML_CLAVE_MONEDA_LOCAL) { $xF = new cFecha(); $cuenta = setNoMenorQueCero($cuenta); $recibo = setNoMenorQueCero($recibo); $cuenta_de_origen = setNoMenorQueCero($cuenta_de_origen); $monto = setNoMenorQueCero($monto); $DoctoDeSoporte = setNoMenorQueCero($DoctoDeSoporte); $persona = setNoMenorQueCero($persona) == 0 ? DEFAULT_SOCIO : setNoMenorQueCero($persona); $autorizo = setNoMenorQueCero($autorizo); $id = 0; if ($recibo > 0 and $persona <= DEFAULT_SOCIO) { $xRec = new cReciboDeOperacion(false, false, $recibo); if ($xRec->init() == true) { $persona = $persona <= DEFAULT_SOCIO ? $xRec->getCodigoDeSocio() : $persona; $tipo_de_exhibicion = $tipo_de_exhibicion == "" ? $xRec->getTipoDePago() : $tipo_de_exhibicion; $fecha = $fecha == false ? $xRec->getFechaDeRecibo() : $fecha; if (trim($beneficiario) == "") { if ($xRec->getOPersona() != null) { $beneficiario = $xRec->getOPersona()->getNombreCompleto(OUT_TXT); } } } } $fecha = $xF->getFechaISO($fecha); $tipo_de_exhibicion = $tipo_de_exhibicion == "" ? "transferencia" : $tipo_de_exhibicion; if ($cuenta > 0 and $monto > 0) { $xOp = new cBancos_operaciones(); $xOp->idcontrol($xOp->query()->getLastID()); $xOp->beneficiario($beneficiario); $xOp->clave_de_conciliacion(0); $xOp->clave_de_moneda($moneda); $xOp->cuenta_bancaria($cuenta); $xOp->cuenta_de_origen($cuenta_de_origen); $xOp->eacp(EACP_CLAVE); $xOp->estatus($this->AUTORIZADO); $xOp->fecha_expedicion($fecha); $xOp->idusuario(getUsuarioActual()); $xOp->monto_descontado($descuento); $xOp->monto_real($monto); $xOp->numero_de_documento($DoctoDeSoporte); $xOp->numero_de_socio($persona); $xOp->recibo_relacionado($recibo); $xOp->sucursal(getSucursal()); $xOp->tipo_de_exhibicion($tipo_de_exhibicion); $xOp->tipo_operacion($Operacion); $xOp->usuario_autorizo($autorizo); $id = $xOp->query()->insert()->save(); } return $id; }
$oficial = elusuario($iduser); $xT = new cTipos(); $xFRM = new cHForm("frmrecibo"); $xF = new cFecha(); $recibo = parametro("recibo", false); $xQl = new MQL(); echo $xHP->getHeader(); if ($recibo == false) { header("location:../404.php?i=" . DEFAULT_CODIGO_DE_ERROR); } $arrQ = array("aumento" => 1, "disminucion" => -1, "ninguna" => 0); //capturar datos del recibo $xRec = new cReciboDeOperacion(false, false, $recibo); $xRec->init(); $DRec = $xRec->getDatosInArray(); $idsocio = $xRec->getCodigoDeSocio(); // $DRec["numero_socio"]; $numero_de_socio = $xRec->getCodigoDeSocio(); //$DRec["numero_socio"]; $afectaCaja = $arrQ[$DRec["afectacion_en_flujo_efvo"]]; //datos del socio $cSoc = new cSocio($numero_de_socio); $DSoc = $cSoc->getDatosInArray(); $numero_caja_local = $DSoc["cajalocal"]; $cCL = new cCajaLocal($numero_caja_local); $caja_local = $cCL->getNombre(); $variable_nombre_del_socio = $idsocio == DEFAULT_SOCIO ? $DRec["cadena_distributiva"] : $cSoc->getNombreCompleto(); $tipo_de_pago = $xRec->getTipoDePago(); //$variable_nombre_del_cajero // $tipoderecibo = $DRec["tipo_docto"];
function setPolizaPorRecibo($recibo, $generador = false) { $sucess = false; $QL = new MQL(); $xLogg = new cCoreLog(); //$arrEquivEfvo = //if (GENERAR_CONTABILIDAD == true){ $xLogg->add("=======\tGENERAR POLIZA POR RECIBO NUM {$recibo}\r\n", $xLogg->DEVELOPER); $xT = new cCatalogoOperacionesDeCaja(); $centro_de_costo = DEFAULT_CENTRO_DE_COSTO; //($generador == GENERAR_POLIZAS_AL_CIERRE) AND if (setNoMenorQueCero($recibo) > 0) { $xRec = new cReciboDeOperacion(false, false, $recibo); if ($xRec->init() == true) { $sucess = true; //Obten datos del recibo para la Poliza $sqlRec = "SELECT\r\n\t\t\t\t\t\t\t`operaciones_recibos`.*,\r\n\t\t\t\t\t\t\t`operaciones_recibostipo`.`tipo_poliza_generada`,\r\n\t\t\t\t\t\t`operaciones_recibostipo`.`afectacion_en_flujo_efvo`\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t`operaciones_recibos` `operaciones_recibos`\r\n\t\t\t\t\t\t\t\tINNER JOIN `operaciones_recibostipo`\r\n\t\t\t\t\t\t\t\t`operaciones_recibostipo`\r\n\t\t\t\t\t\t\t\tON `operaciones_recibos`.`tipo_docto` =\r\n\t\t\t\t\t\t\t\t`operaciones_recibostipo`.\r\n\t\t\t\t\t\t\t\t`idoperaciones_recibostipo`\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t(`operaciones_recibos`.`idoperaciones_recibos` = {$recibo})\r\n\t\t\t\t\t\tLIMIT 0,1 "; $dRec = obten_filas($sqlRec); $tipo_de_pago = $xRec->getTipoDePago(); //Corrige los cargos de la PolizaS $total_poliza = 0; $SQLSumCargos = "SELECT SUM(monto) AS 'total' FROM contable_polizas_proforma\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE contable_operacion = '" . TM_CARGO . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND numero_de_recibo={$recibo} "; $TMPCargos = mifila($SQLSumCargos, "total"); $SQLSumAbonos = "SELECT SUM(monto) AS 'total' FROM contable_polizas_proforma\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE contable_operacion = '" . TM_ABONO . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND numero_de_recibo={$recibo} "; $TMPAbonos = mifila($SQLSumAbonos, "total"); if ($TMPCargos > $TMPAbonos) { $diferencia = $TMPAbonos - $TMPCargos; $diferencia = $diferencia < 0 ? $diferencia * -1 : $diferencia; $total_poliza = $TMPCargos; setPolizaProforma($recibo, $xT->getTipoOperacionByTipoPago($tipo_de_pago), $diferencia, 1, 1, TM_ABONO); $xLogg->add("OK\tCUADRAR\tABONO\tOperacion Agregada por DESCUADRE en {$tipo_de_pago} por {$diferencia}\r\n", $xLogg->DEVELOPER); //$xLogg->add( , $xLogg->DEVELOPER); } elseif ($TMPCargos < $TMPAbonos) { $diferencia = $TMPCargos - $TMPAbonos; $diferencia = $diferencia < 0 ? $diferencia * -1 : $diferencia; $total_poliza = $TMPAbonos; setPolizaProforma($recibo, $xT->getTipoOperacionByTipoPago($tipo_de_pago), $diferencia, 1, 1, TM_CARGO); $xLogg->add("OK\tCUADRAR\tCARGOS\tOperacion Agregada por DESCUADRE en {$tipo_de_pago} por {$diferencia}\r\n", $xLogg->DEVELOPER); } else { $total_poliza = $TMPCargos; } //tipos de Poliza 1=ingreso, 2=egreso, 3 Diario, 4=orden 5 $xD = new cFecha(0, $xRec->getFechaDeRecibo()); $numero_de_recibo = $recibo; $tipo_de_poliza = $xRec->getOTipoRecibo()->getTipoPolizaContable(); $fecha_de_poliza = $xRec->getFechaDeRecibo(); $ejercicio_de_poliza = $xD->anno(); $periodo_de_poliza = $xD->mes(); $recibo_fiscal = strlen($xRec->getReciboFiscal()) > 2 ? ";RF:" . $xRec->getReciboFiscal() : ""; $observacion_recibo = $xRec->getObservaciones(); $cheque = strlen($xRec->getNumeroDeCheque()) > 2 ? ";Ch:" . $xRec->getNumeroDeCheque() : ""; $concepto_poliza = substr("R:" . $numero_de_recibo . $recibo_fiscal . $cheque . ";" . $xRec->getObservaciones(), 0, 80); $flujo_efectivo = $xRec->getOTipoRecibo()->getAfectacionEnEfvo(); $socio = $xRec->getCodigoDeSocio(); $propietario = $xRec->getCodigoDeUsuario(); $xLogg->add("=====\tRECIBO TIPO: " . $xRec->getTipoDeRecibo() . " SUMA: " . $xRec->getTotal() . " \r\n", $xLogg->DEVELOPER); //------------------ Agregar Poliza $xPol = new cPoliza($tipo_de_poliza, false, $ejercicio_de_poliza, $periodo_de_poliza); $xPol->add($concepto_poliza, $fecha_de_poliza, false, 0, 0, $propietario, $centro_de_costo, $recibo); $numero_de_poliza = $xPol->get(); $xLogg->add("=====\tPOLIZA NUM: {$numero_de_poliza} | TIPO: {$tipo_de_poliza} | EJERCICIO: {$ejercicio_de_poliza} | PERIODO: {$periodo_de_poliza}\r\n", $xLogg->DEVELOPER); $sucess = $xPol->mRaiseError == true ? false : true; //------------------ Leer la PROFORMA $sqlMvtosToPoliza = "SELECT\r\n\t\t\t\t\t`contable_polizas_proforma`.*,\r\n\t\t\t\t\t`operaciones_tipos`.*\r\n\t\t\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t`operaciones_tipos` `operaciones_tipos`\r\n\t\t\t\t\t\tINNER JOIN `contable_polizas_proforma`\r\n\t\t\t\t\t\t`contable_polizas_proforma`\r\n\t\t\t\t\t\tON `operaciones_tipos`.`idoperaciones_tipos` =\r\n\t\t\t\t\t\t`contable_polizas_proforma`.`tipo_de_mvto`\r\n\t\t\t\t\t\tAND `contable_polizas_proforma`.`numero_de_recibo` = {$numero_de_recibo}\r\n\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t`contable_polizas_proforma`.`contable_operacion` DESC,\r\n\t\t\t\t\t\t`contable_polizas_proforma`.`socio`,\r\n\t\t\t\t\t\t`contable_polizas_proforma`.`tipo_de_mvto`\t\t\t\t\r\n\t\t\t\t\t"; if ($sucess == true) { $rs = $QL->getDataRecord($sqlMvtosToPoliza); foreach ($rs as $rw) { $cuenta = CUENTA_DE_CUADRE; $nombre = ""; $socio = $rw["socio"]; if (CONTABLE_CUENTAS_POR_SOCIO == true) { $xSoc = new cSocio($socio, true); $nombre = $xSoc->getNombreCompleto(); } $documento = $rw["documento"]; $monto_movimiento = $rw["monto"]; $tipoOp = $rw["tipo_de_mvto"]; $tipo_movimiento = $rw["contable_operacion"]; $RecUsr = $rw["idusuario"]; $cuenta_bancaria = $rw["banco"]; $cargo_movimiento = 0; $abono_movimiento = 0; if ($tipo_movimiento == TM_CARGO) { $cargo_movimiento = $monto_movimiento; $abono_movimiento = 0; } else { $cargo_movimiento = 0; $abono_movimiento = $monto_movimiento; } $formula = $rw["cuenta_contable"]; //Corregir de urgencia: OK: 06Oct2011 $sForms = new cValorarFormulas(); $cuenta = $sForms->getCuentaContable($socio, $documento, $formula, $RecUsr, $xRec->getNumeroDeCheque(), $cuenta_bancaria); $xLogg->add($sForms->getMessages(), $xLogg->DEVELOPER); //tipo de cuenta es Abonos a efectivo if ($cuenta != "NO_CONTABILIZAR") { $xCuenta = new cCuentaContable($cuenta); $xCuenta->init(); $cuenta = $xCuenta->get(); //Carga los datos del Oficial if ($xCuenta->getEsCuentaDeCirculante() == true) { $xOf = new cSystemUser($RecUsr); $xOf->init(); $nombre = $xOf->getNombreCompleto(); $xLogg->add("OK\tCUENTA_ADD\tLa Cuenta {$cuenta} de Carga por Usuario [ {$nombre} ]\r\n", $xLogg->DEVELOPER); } else { $xLogg->add("OK\tCUENTA\tLa Cuenta de Trabajo es {$cuenta} Originado del Socio {$socio}\r\n", $xLogg->DEVELOPER); } //verifica para dar de alta a la cuenta $Existentes = $xCuenta->getCountCuenta(); if ($Existentes == false) { $xLogg->add("WARN\tCUENTA_ADD\tLa Cuenta de Trabajo {$cuenta} NO EXISTE, se AGREGA\r\n", $xLogg->DEVELOPER); $cuenta = $xCuenta->add($nombre); if ($xCuenta->mRaiseError == true) { //$msg .= "ERROR\tLa Cuenta de Trabajo $cuenta NO EXISTE\r\n"; //$msg = $xCuenta->getMessages(); } } $xCuenta->init(); $xPol->addMovimiento($cuenta, $cargo_movimiento, $abono_movimiento, "{$socio}", "{$documento}:{$tipoOp}", false, $fecha_de_poliza); //$xLogg->add("WARN\tNO_CONT\tAGREGAR $cuenta, $cargo_movimiento, $abono_movimiento\r\n" , $xLogg->DEVELOPER); $xLogg->add($xCuenta->getMessages(), $xLogg->DEVELOPER); } else { $xLogg->add("WARN\tNO_CONT\tEl Movimiento de {$socio} | {$documento} | {$tipoOp} de Monto {$monto_movimiento} se OMITE\r\n", $xLogg->DEVELOPER); } } $xPol->setFinalizar(); } //sucess $xLogg->add($xPol->getMessages(), $xLogg->DEVELOPER); $this->mIDDePoliza = $xPol->getCodigo(); } } //END VALUE.- GENERAR AL FINAL //} //END VALUE.- GENERAR CONTABILIDAD $this->mMessages .= $xLogg->getMessages(); return $xLogg->getMessages(); }
// cambiar por la UIF $cont[7] = $xLoc->DomicilioCodigoPostal(); // CP de la sucursal $docto_relacionado = $OAEc == null ? $OAEc->getNumeroDeSeguridadSocial() : $xRisk->documento_relacionado()->v(); //($xRec->getCodigoDeDocumento() == DEFAULT_CREDITO) ? $xRec->getCodigoDeRecibo() : $xRec->getCodigoDeDocumento(); $fecha_de_op = $xF->getFechaByInt($xRisk->fecha_de_reporte()->v()); $instrumento = $xRisk->instrumento_financiero()->v(); $tipo_de_op = $xRisk->tipo_de_operacion()->v(); $total = $xRisk->monto_total_relacionado()->v(); $moneda = AML_CLAVE_MONEDA_LOCAL; //TODO: Agregar soporte para captación y colocación switch ($tipo_de_obj) { case iDE_RECIBO: $xRec = new cReciboDeOperacion(false, false, $recibo); if ($xRec->init() == true) { if ($xRec->getCodigoDeSocio() == $tercero) { $tipo_de_op = $xEquivOps->get($xRec->getTipoDeRecibo()); $instrumento = $xEquivInst->get($xRec->getTipoDePago()); $moneda = $xRec->getMoneda(); $total = $xRec->getTotal(); } else { $msg .= "ERROR\tLa persona {$tercero} no es misma del recibo {$recibo}- " . $xRec->getCodigoDeSocio() . "\r\n"; $totalerrores++; } } else { $msg .= "ERROR\tRecibo no existe {$recibo}\r\n"; $totalerrores++; } break; case iDE_CREDITO: break;
$aviso = "El Registro no se Guardo, Revise sus Valores, EL Monto se lleva a Cero"; $strGet .= "msg=" . htmlentities($aviso); echo $xHP->getJsBack($aviso, $strGet); } else { $msg = "El Registro se ha Guardado Exitosamente"; } } if ($cargar != "" and $origen = "recibo") { $xRec = new cReciboDeOperacion(false, true, $cargar); $xRec->init(); $monto = $xRec->getTotal(); $documento = $xRec->getCodigoDeDocumento(); $recibo = $cargar; $fecha = $xRec->getFechaDeRecibo(); $operacion = BANCOS_OPERACION_DEPOSITO; $socio = $xRec->getCodigoDeSocio(); $xSoc = new cSocio($socio, true); $beneficiario = $xSoc->getNombreCompleto(); } $jsb = new jsBasicForm("bancos_operaciones", iDE_OPERACION); $jsb->setIncludeOnlyCommons(); //$jsb->show(); //$jxc ->drawJavaScript(false, true); echo $jsb->setIncludeJQuery(); echo $xHP->setBodyinit(); $xTxt = new cHText(); $xBtn = new cHButton(); $xFRM = new cHForm("bancos_operaciones", "movimientos_bancarios.frm.php"); //id, label value, size, class, options[]) $xSel = new cSelect("idcuenta", "idcuenta", TBANCOS_CUENTAS); $xSel->setOptionSelect($numero_de_cuenta);
function setRecibo($recibo) { $xRec = new cReciboDeOperacion(false, false, $recibo); if ($xRec->init() == true) { $this->setPersona($xRec->getCodigoDeSocio()); $OTipo = $xRec->getOTipoRecibo(); $origen = $OTipo->getOrigen(); $afectEfvo = $OTipo->getAfectacionEnEfvo(); $xCant = new cCantidad($xRec->getTotal()); $QL = new MQL(); $xF = new cFecha(); $describe = ""; $xCta = null; $xCred = null; //Bases de Operaciones de Captacion en Inversiones $xB3100 = new cBases(3100); $DB3100 = $xB3100->getMembers_InArray(); $xB3200 = new cBases(3200); $DB3200 = $xB3200->getMembers_InArray(); switch ($origen) { case RECIBOS_ORIGEN_MIXTO: $this->setCredito($xRec->getCodigoDeDocumento()); break; case RECIBOS_ORIGEN_COLOCACION: $this->setCredito($xRec->getCodigoDeDocumento()); break; case RECIBOS_ORIGEN_CAPTACION: $this->setCuentaDeCaptacion($xRec->getCodigoDeDocumento()); break; } $this->mArr["variable_tipo_de_recibo"] = $OTipo->getNombre(); $this->mArr["variable_datos_del_pago"] = $xRec->getDatosDeCobro(); $this->mArr["variable_numero_de_recibo"] = $recibo; $this->mArr["variable_docto_fecha_larga_actual"] = $xF->getFechaLarga($xRec->getFechaDeRecibo()); $this->mArr["variable_observacion_del_recibo"] = $xRec->getObservaciones(); $this->mArr["variable_monto_del_recibo_en_letras"] = $xCant->letras(); $this->mArr["variable_monto_del_recibo"] = $xCant->moneda(); ///$this->mArr["variable_nombre_del_cajero"] = $xRec->getOUsuario()->getNombreCompleto(); $this->mEsRecibo = true; $this->setUsuario($xRec->getCodigoDeUsuario()); //obtener operaciones $this->mRecibo = $recibo; $sqlmvto = "SELECT\n\t\t\t`operaciones_mvtos`.`socio_afectado` AS `numero_de_socio`,\n\t\t\t`operaciones_mvtos`.`docto_afectado` AS `numero_de_documento`,\n\t\t\t`operaciones_mvtos`.`recibo_afectado` AS `numero_de_recibo`,\n\t\t\t`operaciones_mvtos`.`idoperaciones_mvtos` AS `numero_del_movimiento`,\n\t\t\t`operaciones_tipos`.`descripcion_operacion` AS `concepto_del_movimiento`,\n\t\t\t`operaciones_mvtos`.`afectacion_real` AS `monto_del_movimiento`,\n\t\t\t`operaciones_mvtos`.`valor_afectacion` AS `naturaleza_del_movimiento`,\n\t\t\t`operaciones_tipos`.`nombre_corto` \t\t\tAS `concepto_nombre_corto`,\n\t\t\t`operaciones_mvtos`.`periodo_socio` \tAS `parcialidad`,\n\t\t\t`operaciones_mvtos`.`detalles` \t\t\t\tAS `observacion_del_mvto`,\n\t\t\t`operaciones_mvtos`.`tipo_operacion`\t\tAS `tipo_de_movimiento`\n\t\t\tFROM\n\t\t\t`operaciones_mvtos` `operaciones_mvtos`\tINNER JOIN `operaciones_tipos` `operaciones_tipos` ON `operaciones_mvtos`.`tipo_operacion` = `operaciones_tipos`.`idoperaciones_tipos`\n\t\t\tWHERE (`operaciones_mvtos`.`recibo_afectado` = {$recibo} ) ORDER BY `operaciones_mvtos`.`afectacion_real` DESC"; $rs = $QL->getDataRecord($sqlmvto); //destino_del_movimiento foreach ($rs as $row) { $rwx = $row; $tipo = $row["tipo_de_movimiento"]; $docto = $row["numero_de_documento"]; $rwx["monto_del_movimiento"] = getFMoney($row["monto_del_movimiento"] * $row["naturaleza_del_movimiento"] * $afectEfvo); $rwx["destino_del_movimiento"] = " " . $row["numero_de_documento"]; if (in_array($tipo, $DB3100) == true or in_array($tipo, $DB3200)) { if ($origen == RECIBOS_ORIGEN_MIXTO) { //TODO: Cargar datos de la cuenta de captacion y mostrar sus caracteristicas } else { //if($xCta == null){ $xCta = new cCuentaDeCaptacion($docto); $xCta->init(); } $rwx["destino_del_movimiento"] .= "|" . $this->mArr["variable_tipo_de_cuenta"]; } } else { $rwx["destino_del_movimiento"] .= "|" . substr($this->mArr["variable_tipo_de_credito"], 0, 5); $rwx["destino_del_movimiento"] .= "|" . substr($this->mArr["variable_estado_de_credito"], 0, 3); $rwx["destino_del_movimiento"] .= "|" . $row["parcialidad"] . "/" . $this->mArr["variable_credito_numero_de_pagos"]; } $this->mDataMvto[] = $rwx; } } }
function jsaAjustarTotal($recibo, $nuevoTotal, $nuevaletra) { $xRec = new cReciboDeOperacion(false, true, $recibo); $xRec->init(); $xRec->setGenerarBancos(false); $xRec->setGenerarPoliza(false); $xRec->setGenerarTesoreria(false); $xRec->setForceUpdateSaldos(true); $total = $xRec->getTotal(); $QL = new MQL(); $DMov = new cOperaciones_mvtos(); $msg = ""; if ($nuevoTotal < $total) { $NRec = new cReciboDeOperacion($xRec->getTipoDeRecibo(), false, $recibo); $idNRec = $NRec->setNuevoRecibo($xRec->getCodigoDeSocio(), $xRec->getCodigoDeDocumento(), $xRec->getFechaDeRecibo(), 0, $xRec->getTipoDeRecibo(), "AJUSTE DEL RECIBO {$recibo}"); $NRec->setForceUpdateSaldos(true); $NRec->setGenerarBancos(false); $NRec->setGenerarPoliza(false); $NRec->setGenerarTesoreria(false); /*`idoperaciones_mvtos`, `operaciones_mvtos`.`fecha_operacion`, `operaciones_mvtos`.`fecha_afectacion`, `operaciones_mvtos`.`recibo_afectado`, `operaciones_mvtos`.`socio_afectado`, `operaciones_mvtos`.`docto_afectado`, `operaciones_mvtos`.`tipo_operacion`, `operaciones_mvtos`.`afectacion_real` */ $sql = "SELECT\n\t\t\t`operaciones_mvtos`.*\n\n\t\tFROM\n\t\t\t`operaciones_mvtos` `operaciones_mvtos` \n\t\t\t\tINNER JOIN `operaciones_tipos` `operaciones_tipos` \n\t\t\t\tON `operaciones_mvtos`.`tipo_operacion` = `operaciones_tipos`.\n\t\t\t\t`idoperaciones_tipos` \n\t\tWHERE\n\t\t\t(`operaciones_mvtos`.`recibo_afectado` ={$recibo}) \n\t\tORDER BY\n\t\t\t`operaciones_mvtos`.`tipo_operacion` DESC "; $rs = $QL->getDataRecord($sql); $arrops = array(); foreach ($rs as $rw) { $DMov->setData($rw); $NMonto = $DMov->afectacion_real()->v(); $IDOpe = $DMov->idoperaciones_mvtos()->v(); if ($nuevoTotal > 0) { $nuevoTotal -= $NMonto; $msg .= $IDOpe . " \t {$nuevoTotal} DE {$NMonto}\r\n"; if ($nuevoTotal < 0) { $msg .= "CUADRAR {$NMonto} DE {$nuevoTotal} \r\n"; $nuevoTotal = $nuevoTotal * -1; $dif = $NMonto - $nuevoTotal; $sql = "UPDATE operaciones_mvtos \n\t\t\t\t\t\t\tSET afectacion_real={$dif}, afectacion_cobranza={$dif}, afectacion_contable={$dif},\n\t\t\t\t\t\t\tafectacion_estadistica={$dif} WHERE idoperaciones_mvtos={$IDOpe} "; $x = my_query($sql); $msg .= $x[SYS_INFO]; //agregar el movimiento al nuevo recibo con cargos $NRec->setNuevoMvto($DMov->fecha_operacion()->v(), $nuevoTotal, $DMov->tipo_operacion()->v(), $DMov->periodo_socio()->v(), "SEPARACION DEL MVTO {$IDOpe} {$nuevoTotal}", $DMov->valor_afectacion()->v(), false, $DMov->socio_afectado()->v(), $DMov->docto_afectado()->v(), $DMov->fecha_afectacion()->v(), $DMov->fecha_vcto()->v(), $DMov->saldo_anterior()->v(), $DMov->saldo_actual()->v()); //listo $nuevoTotal = 0; } } else { $arrops[$DMov->idoperaciones_mvtos()->v()] = $DMov->afectacion_real()->v(); } } //$total = $total * -1; foreach ($arrops as $operacion => $monto) { $x = my_query("UPDATE operaciones_mvtos SET recibo_afectado={$idNRec} WHERE idoperaciones_mvtos={$operacion}"); //100 - 50 //$dif = $monto - $total; $msg .= $x[SYS_INFO]; } $NRec->setFinalizarRecibo(true); $msg .= $NRec->getMessages(OUT_TXT); $xRec->setFinalizarRecibo(true); } else { $msg .= "WARN\tNO SE MODIFICA NADA({$nuevoTotal}|{$total})\r\n"; } $msg .= $xRec->getMessages(OUT_TXT); return $msg; }