Cambios para mostrar el lote y fecha de caducidad

This commit is contained in:
HECTOR RODRIGUEZ
2021-03-05 10:23:14 -07:00
parent ac4d0c2e4b
commit b56559b36c
3 changed files with 91 additions and 25 deletions

View File

@@ -95,7 +95,9 @@ Partial Class Inventarios_TrasladoSolicitud
TempDT.Columns.Add("CveContratoDetalle", Type.GetType("System.Int32"))
'TempDT.Columns.Add("CveContratoDetalle", Type.GetType("System.Int32"))
'TempDT.Columns.Add("CveDireccionEnvio", Type.GetType("System.Int32"))
TempDT.Columns.Add("Serie", Type.GetType("System.String"))
TempDT.Columns.Add("Serie", Type.GetType("System.String"))
TempDT.Columns.Add("Lote", Type.GetType("System.String"))
TempDT.Columns.Add("FechaCaducidad", Type.GetType("System.DateTime"))
TempDT.Columns.Add()
End Sub
@@ -322,6 +324,7 @@ Partial Class Inventarios_TrasladoSolicitud
RegistraScript(String.Format("$('#{0}').modal();", "ModalPS"))
End Sub
Private Sub BtnAgregarPS_Click(sender As Object, e As EventArgs) Handles BtnAgregarPS.Click
Dim Existencia As Boolean
If Not DdlProductoServicio.SelectedValue.ToEntero > 0 Then
Alert("Tiene que seleccionar un producto.", TipoMensaje.MsgAdvertencia)
Exit Sub
@@ -329,35 +332,63 @@ Partial Class Inventarios_TrasladoSolicitud
If Not AddPSTemporal() Then
Exit Sub
End If
TxtCantidad.Text = ""
DdlProductoServicio.SelectedText = ""
DdlProductoServicio.SelectedValue = "-1"
DdlUM.SelectedIndex = 0
GvDatos.DataSource = TempDT
GvDatos.DataBind()
If ChkSeguirAgregando.Checked Then
TxtCantidad.Focus()
Else
RegistraScript("$('#ModalPS').hide();", "EscondeAgregar")
End If
UpPS.Update()
UpDatos.Update()
End If
'If ObjInventario.GetExistenciasPS(DdlProductoServicio.SelectedValue.ToEntero, DdlUM.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, PendientePorSurtir:=1, Lote:=TxtLote.Text.ToString, FechaCaducidad:=TxtCaducidad.Text.ToString) >= TxtCantidad.Text.ToDouble Then
TxtCantidad.Text = ""
DdlProductoServicio.SelectedText = ""
DdlProductoServicio.SelectedValue = "-1"
DdlUM.SelectedIndex = 0
TxtCaducidad.Text = ""
TxtSerie.Text = ""
TxtLote.Text = ""
GvDatos.DataSource = TempDT
GvDatos.DataBind()
If ChkSeguirAgregando.Checked Then
TxtCantidad.Focus()
Else
RegistraScript("$('#ModalPS').hide();", "EscondeAgregar")
End If
UpPS.Update()
UpDatos.Update()
End Sub
Private Function AddPSTemporal() As Boolean
Dim Row As DataRow = TempDT.NewRow()
Dim Lote As String
Dim FechaCaducidad As Date
Row("Cantidad") = TxtCantidad.Text.Trim.ToDouble
Row("CvePS") = DdlProductoServicio.SelectedValue.ToEntero
Row("CodigoPS") = DdlProductoServicio.SelectedText
Row("Precio") = 0
Row("CveUM") = DdlUM.SelectedValue.ToEntero
Row("UnidadMedida") = DdlUM.SelectedItem.Text
Row("Observaciones") = ""
Row("Observaciones") = ""
If divLote.Visible Then
Row("Lote") = TxtLote.Text
GvDatos.Columns(6).Visible = True
Lote = TxtLote.Text.ToString
Else
Row("Lote") = "-1"
Lote = "-1"
End If
If divCaducidad.Visible Then
Row("FechaCaducidad") = TxtCaducidad.Text
GvDatos.Columns(7).Visible = True
FechaCaducidad = TxtCaducidad.Text.ToDate
Else
Row("FechaCaducidad") = MinFecha
FechaCaducidad = MinFecha
End If
If Div4.Visible Then
Row("Serie") = TxtSerie.Text
@@ -366,8 +397,10 @@ Partial Class Inventarios_TrasladoSolicitud
Row("Serie") = "-1"
End If
Dim ObjInventarios As New ClsInventarios
Dim Existencia As Double = ObjInventarios.GetExistenciasPS(DdlProductoServicio.SelectedValue.ToEntero, DdlUM.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"))
Dim Existencia As Double = ObjInventarios.GetExistenciasPS(DdlProductoServicio.SelectedValue.ToEntero, DdlUM.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), Lote:=Lote, FechaCaducidad:=FechaCaducidad)
ObjInventarios.Dispose()
If Existencia - TxtCantidad.Text.Trim.ToDouble - TempDT.SUM("Cantidad", $"CvePS = {DdlProductoServicio.SelectedValue.ToEntero} AND CveUM = {DdlUM.SelectedValue.ToEntero}") < 0 Then
@@ -988,6 +1021,14 @@ Partial Class Inventarios_TrasladoSolicitud
DdlUM.SelectedValueExist(drPS("CveUnidadMedida").ToString)
Dim AplicaSerie As Boolean = drPS("AplicaSerie").ToString = "True"
Div4.Visible = AplicaSerie
Dim AplicaLote As Boolean = drPS("AplicaLote").ToString = "True"
divLote.Visible = AplicaLote
Dim AplicaCaducidad As Boolean = drPS("AplicaCaducidad").ToString = "True"
divCaducidad.Visible = AplicaCaducidad
divCaducidad2.Visible = AplicaCaducidad
End If
UpPS.Update()
UpDatos.Update()