Correcion de eventos en shipments y no consultar existencias en devoluciones

This commit is contained in:
2019-08-22 10:46:33 -07:00
parent 2ebadb8e49
commit 0f8ce8a4a8
2 changed files with 147 additions and 115 deletions

View File

@@ -1311,31 +1311,32 @@ Partial Class Inventarios_RecepcionEntrega
Dim TxtCantidad = GvDatos.Rows(Gvr.RowIndex).FCTextBox("TbCantidadF")
If Gvr.DataKey("CantidadF").ToDecimal - TxtCantidad.Text.ToDecimal - 1 >= 0 Then
''VALIDA EXISTENCIA
If TipoMovimiento = 1 Then
Dim ObjInventario As New ClsInventarios
Dim Existencia = ObjInventario.GetExistenciasPS(Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=If(TipoEntrega = 2, 1, -1))
ObjInventario.Dispose()
If Not Existencia >= TxtCantidad.Text.ToDecimal + 1 Then
TxtCodigoPS.Text = ""
Alert($"No hay existencias suficientes del producto: <br/><b>""{Gvr.DataKey("Codigo")}-{Gvr.DataKey("PS")}""</b>. <br/>Solo hay disponibles <b>{Existencia.FormatoNumero}</b> en Almacen. Por favor Verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);")
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
Exit Sub
End If
Else
If DtExistencias IsNot Nothing Then
Dim Existencia = DtExistencias.SUM("Cantidad", $"CvePS = {Gvr.DataKey("CvePS")} AND CveUM = {Gvr.DataKey("CveUM").ToString.ToEntero}")
If Not Existencia >= TxtCantidad.Text.ToDecimal + 1 Then
TxtCodigoPS.Text = ""
Alert($"No hay existencias suficientes del producto: <br/><b>""{Gvr.DataKey("Codigo")}-{Gvr.DataKey("PS")}""</b>. <br/>Solo hay disponibles <b>{Existencia.FormatoNumero}</b> en Almacen. Por favor Verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);")
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
Exit Sub
End If
End If
If Not TipoDocto.Contiene("Dev") Then
If TipoMovimiento = 1 Then
Dim ObjInventario As New ClsInventarios
Dim Existencia = ObjInventario.GetExistenciasPS(Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=If(TipoEntrega = 2, 1, -1))
ObjInventario.Dispose()
If Not Existencia >= TxtCantidad.Text.ToDecimal + 1 Then
TxtCodigoPS.Text = ""
Alert($"No hay existencias suficientes del producto: <br/><b>""{Gvr.DataKey("Codigo")}-{Gvr.DataKey("PS")}""</b>. <br/>Solo hay disponibles <b>{Existencia.FormatoNumero}</b> en Almacen. Por favor Verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);")
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
Exit Sub
End If
Else
If DtExistencias IsNot Nothing Then
Dim Existencia = DtExistencias.SUM("Cantidad", $"CvePS = {Gvr.DataKey("CvePS")} AND CveUM = {Gvr.DataKey("CveUM").ToString.ToEntero}")
If Not Existencia >= TxtCantidad.Text.ToDecimal + 1 Then
TxtCodigoPS.Text = ""
Alert($"No hay existencias suficientes del producto: <br/><b>""{Gvr.DataKey("Codigo")}-{Gvr.DataKey("PS")}""</b>. <br/>Solo hay disponibles <b>{Existencia.FormatoNumero}</b> en Almacen. Por favor Verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);")
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
Exit Sub
End If
End If
End If
End If
If Gvr.DataKey("AplicaSerieLote") = "True" Then
TdSeriePS.Visible = True
TxtSeriePS.Focus()