-cambios en validacion de uso de Secciones Almacen, Serie,Lote, Caducidad
This commit is contained in:
@@ -3,10 +3,29 @@
|
||||
Partial Class Inventarios_PrestamosdeProveedor
|
||||
Inherits ClsPaginas
|
||||
|
||||
Private Property CveProveedor As Integer
|
||||
Get
|
||||
Return ViewState("CveProveedor").ToString.ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveProveedor") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property CveMovimiento As Integer
|
||||
Get
|
||||
Return ViewState("CveMovimiento").ToString.ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveMovimiento") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Sub Inventarios_PrestamosdeProveedor_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CargaCombos()
|
||||
|
||||
CveMovimiento = 0
|
||||
CveProveedor = 0
|
||||
|
||||
CargaDatos()
|
||||
End If
|
||||
@@ -42,8 +61,9 @@ Partial Class Inventarios_PrestamosdeProveedor
|
||||
If ObjInv.PrestamosdeProveedorGet(tCveProveedor, tFolio, UsuarioActual.CveEmpresa) Then
|
||||
GvD.DataSource = ObjInv.DtResultados
|
||||
Dim Dr As Data.DataRow = ObjInv.DtResultados.FiltroPrimero("")
|
||||
If Dr IsNot Nothing Then
|
||||
HdnCveProveedor.Value = Dr("CveProveedor")
|
||||
If Dr IsNot Nothing AndAlso tFolio > 0 Then
|
||||
CveProveedor = Dr("CveProveedor").ToString.ToEntero
|
||||
CveMovimiento = Dr("CveMovimiento").ToString.ToEntero
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -93,14 +113,14 @@ Partial Class Inventarios_PrestamosdeProveedor
|
||||
If gvr.FCCheckBox("Chk").Checked AndAlso gvr.FCTextBox("TxtCantidad").Text.ToDecimal > 0 Then
|
||||
ValidaMovtos += gvr.FCTextBox("TxtCantidad").Text.ToDecimal
|
||||
If gvr.FCTextBox("TxtCantidad").Text.ToDecimal > 0 Then
|
||||
Dim SerieLote As String = "-1"
|
||||
Dim Serie As String = "-1"
|
||||
Dim Lote As String = "-1"
|
||||
Dim Batch As String = "-1"
|
||||
If gvr.DataKey("SerieLote") <> "" Then SerieLote = gvr.DataKey("SerieLote")
|
||||
Dim FechaCaducidad As Date = MinFecha
|
||||
If gvr.DataKey("Serie") <> "" Then Serie = gvr.DataKey("Serie")
|
||||
If gvr.DataKey("Lote") <> "" Then Lote = gvr.DataKey("Lote")
|
||||
If gvr.DataKey("Batch") <> "" Then Batch = gvr.DataKey("Batch")
|
||||
If gvr.DataKey("FechaCaducidad").ToDate > MinFecha Then FechaCaducidad = gvr.DataKey("FechaCaducidad")
|
||||
|
||||
Dim Valido = ValidaExistencia(gvr.FCTextBox("TxtCantidad").Text.ToDecimal, gvr.DataKey("CvePS").ToEntero, gvr.DataKey("CveUM").ToEntero, SerieLote, Lote, Batch)
|
||||
Dim Valido = ValidaExistencia(gvr.FCTextBox("TxtCantidad").Text.ToDecimal, gvr.DataKey("CvePS").ToEntero, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CveSeccionAlmacen").ToEntero, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad)
|
||||
If Not Valido Then
|
||||
Alert("No hay existencia del producto a devolver.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
@@ -127,14 +147,12 @@ Partial Class Inventarios_PrestamosdeProveedor
|
||||
'REGISTRA LA SALIDA Y ENTRADA (TRASPASO)
|
||||
|
||||
Dim Fecha As Date = TxtFechaEntrega.Text.ToDate
|
||||
|
||||
Dim CveMovimientoSalida As Integer
|
||||
Dim tCveProveedor As Integer = HdnCveProveedor.Value.ToEntero
|
||||
Dim CvePS As Integer = 0
|
||||
|
||||
'AGREGAMOS LA SALIDA
|
||||
CveMovimientoSalida = ObjInventario.AddMovimiento(DdlAlmacenOrigen.SelectedValue.ToEntero, 29, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1,
|
||||
Observaciones:=TxtObservacionesEntrega.Text.Trim, CveProveedor:=tCveProveedor, Modulo:="PresP")
|
||||
Observaciones:=TxtObservacionesEntrega.Text.Trim, CveProveedor:=CveProveedor, CveMovimientoRelacionado:=CveMovimiento, Modulo:="PresP")
|
||||
Folio = ObjInventario.Folio
|
||||
|
||||
If CveMovimientoSalida <= 0 Then
|
||||
@@ -149,7 +167,7 @@ Partial Class Inventarios_PrestamosdeProveedor
|
||||
If gvr.FCCheckBox("Chk").Checked AndAlso gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal > 0 Then
|
||||
CveMovimientoDetalleEntrada = gvr.DataKey("CveMovimientoDetalle").ToString.ToEntero
|
||||
CvePS = gvr.DataKey("CvePS").ToString.ToEntero
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal, gvr.DataKey("CveUM").ToString.ToEntero, gvr.DataKey("CvePS").ToString.ToEntero, 0, -1, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada, SerieLote:=gvr.DataKey("SerieLote").ToString, Lote:=gvr.DataKey("Lote").ToString, Batch:=gvr.DataKey("Batch").ToString) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal, gvr.DataKey("CveUM").ToString.ToEntero, gvr.DataKey("CvePS").ToString.ToEntero, 0, -1, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada, Serie:=gvr.DataKey("Serie").ToString, Lote:=gvr.DataKey("Lote").ToString, FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToString.ToDate) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al guardar los movimientos de salida"
|
||||
Exit For
|
||||
@@ -220,13 +238,13 @@ Partial Class Inventarios_PrestamosdeProveedor
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function ValidaExistencia(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional SerieLote As String = "-1", Optional Lote As String = "-1", Optional Batch As String = "-1") As Boolean
|
||||
Private Function ValidaExistencia(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, CveSeccionAlmacen As Integer, Serie As String, Lote As String, FechaCaducidad As Date) As Boolean
|
||||
Dim Retorno = True
|
||||
|
||||
Dim Inv As New ClsInventarios
|
||||
Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFechaEntrega.Text.ToDate.ToString("yyyy/MM/dd 23:59"), SerieLote:=SerieLote, Lote:=Lote, Batch:=Batch)
|
||||
Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFechaEntrega.Text.ToDate.ToString("yyyy/MM/dd 23:59"), Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveSeccionAlmacen:=CveSeccionAlmacen)
|
||||
Inv.Dispose()
|
||||
'- DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUnidadMedida} {If(SerieLote <> "-1", $" AND SerieLote = '{SerieLote}'", "")}")
|
||||
|
||||
|
||||
If Existencia - Cantidad < 0 Then
|
||||
If Existencia < 0 Then
|
||||
|
||||
Reference in New Issue
Block a user