-- cambios de performance y validar al editar un concepto, que valide existencia

This commit is contained in:
rrene
2020-05-27 13:56:11 -07:00
parent ad40879607
commit 3e034bbbc8

View File

@@ -5955,15 +5955,17 @@ Partial Class Ventas
If Not UsuarioActual.TienePermisoProceso(169) Then ' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR If Not UsuarioActual.TienePermisoProceso(169) Then ' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR
Dim CvePS As Integer = DatarowPS("CvePS").ToString().ToEntero() 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() 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 Dim ValidaExistencia As Boolean = True
If (CantidadInventario > 0) OrElse (Cantidad <= CantidadOriginal) Then 'si ya hay algo surtido, que no valide existencia If (CantidadInventario > 0) OrElse (Cantidad <= CantidadOriginal) Then 'si ya hay algo surtido, que no valide existencia
ValidaExistencia = False ValidaExistencia = False
End If End If
If CveUM <> CveUMInicial Then ValidaExistencia = True
'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS '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 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) Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia)
MensajeCosto.Clear()
e.Cancel = True e.Cancel = True
Exit Sub Exit Sub
End If End If
@@ -6079,6 +6082,7 @@ Partial Class Ventas
MensajeCosto.AppendFormat("El precio indicado es: <b>${0:#,###.00}</b> ({1}% de ganancia) <br/>", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) MensajeCosto.AppendFormat("El precio indicado es: <b>${0:#,###.00}</b> ({1}% de ganancia) <br/>", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero)
End If End If
Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia)
MensajeCosto.Clear()
e.Cancel = True e.Cancel = True
Exit Sub Exit Sub
End If End If
@@ -6127,6 +6131,7 @@ Partial Class Ventas
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
TmpDT.Rows(e.RowIndex)("PorcentajeIEPS") = 0 TmpDT.Rows(e.RowIndex)("PorcentajeIEPS") = 0
DrPS = Nothing
End If End If
Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (ObjDescuento.ImporteDescuento)) Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (ObjDescuento.ImporteDescuento))
@@ -6699,6 +6704,7 @@ Partial Class Ventas
If MensajeCosto.ToString().Length > 1 Then If MensajeCosto.ToString().Length > 1 Then
Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia)
MensajeCosto.Clear()
Exit Sub Exit Sub
End If End If
@@ -6815,6 +6821,7 @@ Partial Class Ventas
Next Next
Alert(str.ToString(), TipoMensaje.MsgAdvertencia) Alert(str.ToString(), TipoMensaje.MsgAdvertencia)
dttsat.Dispose() dttsat.Dispose()
str.Clear()
Exit Sub Exit Sub
End If End If
dttsat.Dispose() 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"";")) 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) Alert(MensajeAlert.ToString(), TipoMensaje.MsgInformacion, Liga)
MensajeAlert.Clear()
'LIMPIA CONDICIONES DE PAGO - CONTADO 'LIMPIA CONDICIONES DE PAGO - CONTADO
RBLPago.SelectedValue = "1" RBLPago.SelectedValue = "1"
@@ -7435,6 +7443,7 @@ Partial Class Ventas
ObjContr.Dispose() ObjContr.Dispose()
ObjDocCliente.Dispose() ObjDocCliente.Dispose()
'ObjFolios.Dispose() 'ObjFolios.Dispose()
ErrorList.Clear
ErrorList = Nothing ErrorList = Nothing
MensajeAlert = Nothing MensajeAlert = Nothing
If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose() If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
@@ -7457,13 +7466,17 @@ Partial Class Ventas
ObjContr.Dispose() ObjContr.Dispose()
ObjDocCliente.Dispose() ObjDocCliente.Dispose()
'ObjFolios.Dispose() 'ObjFolios.Dispose()
ErrorList.Clear()
ErrorList = Nothing ErrorList = Nothing
MensajeAlert = Nothing MensajeAlert = Nothing
If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose() If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
TmpDT = TmpDTError.Copy TmpDT = TmpDTError.Copy
End If End If
ObjFactura = Nothing
Obj2 = Nothing
End If End If
End If End If
End Sub End Sub
@@ -10152,10 +10165,10 @@ Partial Class Ventas
Exit For Exit For
Else Else
ViewState("SeGuardoPrePoliza") = True 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 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 ErrorPrepoliza = True
Exit For Exit For
End If End If
'se hace acreditamiento de impuestos 'se hace acreditamiento de impuestos
'IVA X TRASLADAR 'IVA X TRASLADAR
Dim EsAnticipoEspecial As Boolean = False Dim EsAnticipoEspecial As Boolean = False
@@ -10208,10 +10221,10 @@ Partial Class Ventas
End If End If
End If
End If End If
End If End If
End If
Next Next
End If End If
@@ -16721,7 +16734,7 @@ Partial Class Ventas
End If End If
End If End If
TextoExistencia.Clear()
Return TieneError Return TieneError
End Function End Function
'Protected Sub LbVerInventario_Click(sender As Object, e As EventArgs) Handles LbVerInventario.Click 'Protected Sub LbVerInventario_Click(sender As Object, e As EventArgs) Handles LbVerInventario.Click
@@ -19163,7 +19176,7 @@ Partial Class Ventas
Else Else
ResultadoMail = 0 ResultadoMail = 0
End If End If
sb.Clear()
End If End If
End Sub End Sub
@@ -19181,7 +19194,7 @@ Partial Class Ventas
End If End If
LbCancelarDescripcion.Text = SbCondiciones.ToString() LbCancelarDescripcion.Text = SbCondiciones.ToString()
SbCondiciones.Clear()
UpCancelarDocumento.Update() UpCancelarDocumento.Update()
End Sub End Sub
@@ -19226,7 +19239,7 @@ Partial Class Ventas
RegistraScript("$('#ModalCancelarDocumento').modal();") RegistraScript("$('#ModalCancelarDocumento').modal();")
UpCancelarDocumento.Update() UpCancelarDocumento.Update()
sb.Clear()
Else Else
CancelarDocumento() CancelarDocumento()
End If End If
@@ -20649,7 +20662,7 @@ Partial Class Ventas
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error") RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error")
Exit Sub Exit Sub
End If End If
MensajeAlert.Clear()
Dim MensajeSinExistencias As New StringBuilder Dim MensajeSinExistencias As New StringBuilder
Dim ObjInventarios As New ClsInventarios Dim ObjInventarios As New ClsInventarios
@@ -20693,7 +20706,7 @@ Partial Class Ventas
Else Else
RegistraScript("playsonidito('beep-07.wav')", "Existo") RegistraScript("playsonidito('beep-07.wav')", "Existo")
End If End If
MensajeSinExistencias.Clear()
End Sub End Sub
Protected Sub GvSerie_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvSerie.RowDeleting 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("</tr></table>") Cuerpo.AppendLine("</tr></table>")
End If End If
Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString()) Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString())
Cuerpo.Clear()
Exit Select Exit Select
End Select End Select
End Sub End Sub
Private Sub GuardarBitacora(CveVenta As Integer, RutaAdjunto As String, Obser As String) Private Sub GuardarBitacora(CveVenta As Integer, RutaAdjunto As String, Obser As String)
Dim ObjEventos As New ClsOIEventos() Dim ObjEventos As New ClsOIEventos()
@@ -23519,6 +23531,7 @@ Partial Class Ventas
DtCotizacionesPS = ObjClientes.DtResultados DtCotizacionesPS = ObjClientes.DtResultados
End If End If
ObjClientes.Dispose() ObjClientes.Dispose()
Cves.Clear()
If Not AgregaPSCotizacion() Then If Not AgregaPSCotizacion() Then
Alert("Ocurrió un error validar las partidas de las cotizaciones seleccionadas. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) 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) sb.Remove(sb.Length - 1, 1)
CargaConceptosRemisionPorFacturar(sb.ToString(), If(ChkRemProductos.Checked, 2, 1)) CargaConceptosRemisionPorFacturar(sb.ToString(), If(ChkRemProductos.Checked, 2, 1))
sb.Clear()
End Select End Select
Dim CveTipoDocto = DdlTipoComprobante.SelectedValue Dim CveTipoDocto = DdlTipoComprobante.SelectedValue
@@ -23938,7 +23952,10 @@ Partial Class Ventas
DdlContrato.DataSource = DtContratos.FiltraParametros($"CveContrato = {CveContrato}") DdlContrato.DataSource = DtContratos.FiltraParametros($"CveContrato = {CveContrato}")
DdlContrato.DataBind() DdlContrato.DataBind()
End If End If
MensajeRemisiones.Clear()
ObsOC.Clear()
ObsPedido.Clear()
ObsInv.Clear()
End If End If
End If End If
@@ -24263,6 +24280,7 @@ Partial Class Ventas
DtPedidos2PS = ObjVentas.DtResultados DtPedidos2PS = ObjVentas.DtResultados
End If End If
ObjVentas.Dispose() ObjVentas.Dispose()
Cves.Clear()
If Not AgregaPSPedido2() Then If Not AgregaPSPedido2() Then
Alert("Ocurrió un error validar las partidas de los pedidos seleccionadas. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) 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), "") 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), "") 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() UpModalPedidos2.Update()
UpFacturar.Update() UpFacturar.Update()
@@ -25333,6 +25355,7 @@ Partial Class Ventas
ErrorList.Add("Ocurrió un error al agregar la bitacora de Póliza Virtual.") ErrorList.Add("Ocurrió un error al agregar la bitacora de Póliza Virtual.")
End If End If
ObjEventos.Dispose() ObjEventos.Dispose()
Msg.Clear()
Else Else
Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia) Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia)
End If End If