From 3e034bbbc8e44b7acfc5a665a4c4a405d19c31ba Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 27 May 2020 13:56:11 -0700 Subject: [PATCH] -- cambios de performance y validar al editar un concepto, que valide existencia --- Ventas/Ventas.aspx.vb | 57 ++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index d1d61a0b7..eb6abe994 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -5955,15 +5955,17 @@ Partial Class Ventas If Not UsuarioActual.TienePermisoProceso(169) Then ' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR Dim CvePS As Integer = DatarowPS("CvePS").ToString().ToEntero() - Dim CveUM As Integer = DatarowPS("CveUM").ToString().ToEntero() + Dim CveUM As Integer = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida").SelectedValue.ToEntero() 'DatarowPS("CveUM").ToString().ToEntero() Dim CveTipoPS As Integer = DatarowPS("CveTipoPS").ToString().ToEntero() - CantidadInventario = GvPS.Rows(e.RowIndex).DataKey("CantidadInventario").ToString().ToDecimal + CantidadInventario = GvPS.Rows(e.RowIndex).DataKey("CantidadInventario").ToDecimal + Dim CveUMInicial As Integer = GvPS.Rows(e.RowIndex).DataKey("CveUM").ToEntero Dim ValidaExistencia As Boolean = True If (CantidadInventario > 0) OrElse (Cantidad <= CantidadOriginal) Then 'si ya hay algo surtido, que no valide existencia ValidaExistencia = False End If + If CveUM <> CveUMInicial Then ValidaExistencia = True 'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS If UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119))) Then @@ -6066,6 +6068,7 @@ Partial Class Ventas Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia) + MensajeCosto.Clear() e.Cancel = True Exit Sub End If @@ -6079,6 +6082,7 @@ Partial Class Ventas MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) End If Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) + MensajeCosto.Clear() e.Cancel = True Exit Sub End If @@ -6127,6 +6131,7 @@ Partial Class Ventas PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) TmpDT.Rows(e.RowIndex)("PorcentajeIEPS") = 0 + DrPS = Nothing End If Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (ObjDescuento.ImporteDescuento)) @@ -6699,6 +6704,7 @@ Partial Class Ventas If MensajeCosto.ToString().Length > 1 Then Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) + MensajeCosto.Clear() Exit Sub End If @@ -6815,6 +6821,7 @@ Partial Class Ventas Next Alert(str.ToString(), TipoMensaje.MsgAdvertencia) dttsat.Dispose() + str.Clear() Exit Sub End If dttsat.Dispose() @@ -7409,6 +7416,7 @@ Partial Class Ventas Dim Liga = If(UsuarioActual.CveRol = 1165 Or UsuarioActual.CveEmpresa = 119, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", If(CveEmpresaCRM > 0, $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={CveEmpresaCRM}"";", $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}&Opt=3"";")) Alert(MensajeAlert.ToString(), TipoMensaje.MsgInformacion, Liga) + MensajeAlert.Clear() 'LIMPIA CONDICIONES DE PAGO - CONTADO RBLPago.SelectedValue = "1" @@ -7435,6 +7443,7 @@ Partial Class Ventas ObjContr.Dispose() ObjDocCliente.Dispose() 'ObjFolios.Dispose() + ErrorList.Clear ErrorList = Nothing MensajeAlert = Nothing If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose() @@ -7457,13 +7466,17 @@ Partial Class Ventas ObjContr.Dispose() ObjDocCliente.Dispose() 'ObjFolios.Dispose() + ErrorList.Clear() ErrorList = Nothing MensajeAlert = Nothing If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose() TmpDT = TmpDTError.Copy End If + ObjFactura = Nothing + Obj2 = Nothing End If + End If End Sub @@ -10152,10 +10165,10 @@ Partial Class Ventas Exit For Else ViewState("SeGuardoPrePoliza") = True - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then - ErrorPrepoliza = True - Exit For - End If + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then + ErrorPrepoliza = True + Exit For + End If 'se hace acreditamiento de impuestos 'IVA X TRASLADAR Dim EsAnticipoEspecial As Boolean = False @@ -10208,10 +10221,10 @@ Partial Class Ventas End If - End If - End If + End If + End If Next End If @@ -16721,7 +16734,7 @@ Partial Class Ventas End If End If - + TextoExistencia.Clear() Return TieneError End Function 'Protected Sub LbVerInventario_Click(sender As Object, e As EventArgs) Handles LbVerInventario.Click @@ -19163,7 +19176,7 @@ Partial Class Ventas Else ResultadoMail = 0 End If - + sb.Clear() End If End Sub @@ -19181,7 +19194,7 @@ Partial Class Ventas End If LbCancelarDescripcion.Text = SbCondiciones.ToString() - + SbCondiciones.Clear() UpCancelarDocumento.Update() End Sub @@ -19226,7 +19239,7 @@ Partial Class Ventas RegistraScript("$('#ModalCancelarDocumento').modal();") UpCancelarDocumento.Update() - + sb.Clear() Else CancelarDocumento() End If @@ -20649,7 +20662,7 @@ Partial Class Ventas RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error") Exit Sub End If - + MensajeAlert.Clear() Dim MensajeSinExistencias As New StringBuilder Dim ObjInventarios As New ClsInventarios @@ -20693,7 +20706,7 @@ Partial Class Ventas Else RegistraScript("playsonidito('beep-07.wav')", "Existo") End If - + MensajeSinExistencias.Clear() End Sub Protected Sub GvSerie_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvSerie.RowDeleting @@ -21772,13 +21785,12 @@ Partial Class Ventas Cuerpo.AppendLine("") End If Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString()) + Cuerpo.Clear() Exit Select End Select - - End Sub Private Sub GuardarBitacora(CveVenta As Integer, RutaAdjunto As String, Obser As String) Dim ObjEventos As New ClsOIEventos() @@ -23519,6 +23531,7 @@ Partial Class Ventas DtCotizacionesPS = ObjClientes.DtResultados End If ObjClientes.Dispose() + Cves.Clear() If Not AgregaPSCotizacion() Then Alert("Ocurrió un error validar las partidas de las cotizaciones seleccionadas. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) @@ -23893,6 +23906,7 @@ Partial Class Ventas sb.Remove(sb.Length - 1, 1) CargaConceptosRemisionPorFacturar(sb.ToString(), If(ChkRemProductos.Checked, 2, 1)) + sb.Clear() End Select Dim CveTipoDocto = DdlTipoComprobante.SelectedValue @@ -23938,7 +23952,10 @@ Partial Class Ventas DdlContrato.DataSource = DtContratos.FiltraParametros($"CveContrato = {CveContrato}") DdlContrato.DataBind() End If - + MensajeRemisiones.Clear() + ObsOC.Clear() + ObsPedido.Clear() + ObsInv.Clear() End If End If @@ -24263,6 +24280,7 @@ Partial Class Ventas DtPedidos2PS = ObjVentas.DtResultados End If ObjVentas.Dispose() + Cves.Clear() If Not AgregaPSPedido2() Then Alert("Ocurrió un error validar las partidas de los pedidos seleccionadas. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) @@ -24295,6 +24313,10 @@ Partial Class Ventas TxtPedidoContrato.Text = If(ObsPedido.ToString().Length > 0, ObsPedido.ToString().Substring(0, ObsPedido.ToString().Length - 2), "") TxtObsAlmacen.Text = If(ObsInv.ToString().Length > 0, ObsInv.ToString().Substring(0, ObsInv.ToString().Length - 2), "") + MensajePedidos2.Clear() + ObsOC.Clear() + ObsPedido.Clear() + ObsInv.Clear() UpModalPedidos2.Update() UpFacturar.Update() @@ -25333,6 +25355,7 @@ Partial Class Ventas ErrorList.Add("Ocurrió un error al agregar la bitacora de Póliza Virtual.") End If ObjEventos.Dispose() + Msg.Clear() Else Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia) End If