Cambios para aplicar lote y caducidad en la solicitud de traspaso

This commit is contained in:
HECTOR RODRIGUEZ
2021-03-12 18:03:16 -07:00
parent 4904993ec4
commit b7b1ec6b7b
3 changed files with 124 additions and 26 deletions

View File

@@ -50,6 +50,48 @@ Partial Class Inventarios_TrasladoSolicitud
End Set
End Property
Private Property AplicaSerie As Boolean
Get
If ViewState("AplicaSerie") Is Nothing Then
Return False
Else
Return CType(ViewState("AplicaSerie"), Boolean)
End If
End Get
Set(value As Boolean)
ViewState("AplicaSerie") = value
End Set
End Property
Private Property AplicaLote As Boolean
Get
If ViewState("AplicaLote") Is Nothing Then
Return False
Else
Return CType(ViewState("AplicaLote"), Boolean)
End If
End Get
Set(value As Boolean)
ViewState("AplicaLote") = value
End Set
End Property
Private Property AplicaCaducidad As Boolean
Get
If ViewState("AplicaCaducidad") Is Nothing Then
Return False
Else
Return CType(ViewState("AplicaCaducidad"), Boolean)
End If
End Get
Set(value As Boolean)
ViewState("AplicaCaducidad") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -152,10 +194,27 @@ Partial Class Inventarios_TrasladoSolicitud
Dim ObjClientes As New ClsClientes
If ObjInventarios.AddTrasladoSolicitudGet(CveTraspasoSolicitud, UsuarioActual.CveEmpresa) Then
If ObjInventarios.DtResultados.Rows.Count > 0 Then
If ObjInventarios.DtResultados.Rows.Count > 0 Then
For Each rowtp As DataRow In ObjInventarios.DtResultados.Rows
If Not AplicaSerie Then
AplicaSerie = rowtp("Serie").ToString <> ""
End If
If Not AplicaLote Then
AplicaLote = rowtp("Lote").ToString <> ""
End If
If Not AplicaCaducidad Then
AplicaCaducidad = rowtp("FechaCaducidad").ToString <> ""
End If
Next
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProductoServicio.SelectedValue.ToEntero).FiltroPrimero("")
GvDatos.Columns(4).Visible = False
GvDatos.Columns(5).Visible = AplicaSerie
GvDatos.Columns(6).Visible = AplicaLote
GvDatos.Columns(7).Visible = AplicaCaducidad
GvDatos.Columns(4).Visible = False
GvDatos.Columns(5).Visible = True
DivFolio.Visible = True
LbFolio.Text = ObjInventarios.DtResultados.Rows(0)("FolioTraspaso").ToString
TxtObservaciones.Text = ObjInventarios.DtResultados.Rows(0)("ObservacionesTraspaso").ToString
@@ -369,14 +428,14 @@ Partial Class Inventarios_TrasladoSolicitud
Row("CveUM") = DdlUM.SelectedValue.ToEntero
Row("UnidadMedida") = DdlUM.SelectedItem.Text
Row("Observaciones") = ""
Row("Lote") = "-1"
Row("Serie") = "-1"
Row("FechaCaducidad") = MinFecha
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
@@ -384,8 +443,9 @@ Partial Class Inventarios_TrasladoSolicitud
Row("FechaCaducidad") = TxtCaducidad.Text
GvDatos.Columns(7).Visible = True
FechaCaducidad = TxtCaducidad.Text.ToDate
RFVFechaCad.Enabled = True
Else
Row("FechaCaducidad") = MinFecha
FechaCaducidad = MinFecha
End If
@@ -393,8 +453,6 @@ Partial Class Inventarios_TrasladoSolicitud
If Div4.Visible Then
Row("Serie") = TxtSerie.Text
GvDatos.Columns(5).Visible = True
Else
Row("Serie") = "-1"
End If
@@ -621,7 +679,7 @@ Partial Class Inventarios_TrasladoSolicitud
For Each row As GridViewRow In GvDatos.Rows
CodigoPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=row.DataKey("CvePS").ToEntero).FiltroPrimeroValor("PSCodigo", "")
Existencia = ObjInventarios.GetExistenciasPS(row.DataKey("CvePS").ToEntero, row.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"))
Existencia = ObjInventarios.GetExistenciasPS(row.DataKey("CvePS").ToEntero, row.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), Lote:=row.DataKey("Lote").ToString, FechaCaducidad:=row.DataKey("FechaCaducidad").ToString.ToDate)
If Existencia - TempDT.SUM("Cantidad", $"CvePS = {row.DataKey("CvePS").ToEntero} AND CveUM = {row.DataKey("CveUM").ToEntero}") < 0 Then
MensajeExistencia.AppendFormat("<br/> - <b>{0}.</b> Existencia: {1}", CodigoPS, Existencia)
TieneErrorExistencia = True
@@ -666,9 +724,11 @@ Partial Class Inventarios_TrasladoSolicitud
Dim Precio As Double = Row.DataKey("Precio").ToEntero
Dim Observaciones As String = Row.DataKey("Observaciones")
Dim CveContratoDetalle As Integer = Row.DataKey("CveContratoDetalle").ToEntero
Dim Serie As String = Row.DataKey("Serie")
Dim Serie As String = Row.DataKey("Serie")
Dim Lote As String = Row.DataKey("Lote")
Dim FechaCaducidad As Date = Row.DataKey("FechaCaducidad").ToDate
If Not ObjInventarios.AddTrasladoSolicitudDetalle(CveTraspasoSolicitud, Cantidad, CveUM, CvePS, Precio, Observaciones, CveContratoDetalle, Serie) Then
If Not ObjInventarios.AddTrasladoSolicitudDetalle(CveTraspasoSolicitud, Cantidad, CveUM, CvePS, Precio, Observaciones, CveContratoDetalle, Serie, Lote, FechaCaducidad) Then
TieneError = True
Exit For
End If
@@ -1019,15 +1079,17 @@ Partial Class Inventarios_TrasladoSolicitud
DdlUM.SelectedValue = "-1"
DdlUM.DataBind()
DdlUM.SelectedValueExist(drPS("CveUnidadMedida").ToString)
Dim AplicaSerie As Boolean = drPS("AplicaSerie").ToString = "True"
Div4.Visible = AplicaSerie
AplicaSerie = drPS("AplicaSerie").ToString = "True"
Div4.Visible = AplicaSerie
AplicaLote = drPS("AplicaLote").ToString = "True"
divLote.Visible = AplicaLote
RFVLote.Enabled = AplicaLote
Dim AplicaLote As Boolean = drPS("AplicaLote").ToString = "True"
divLote.Visible = AplicaLote
Dim AplicaCaducidad As Boolean = drPS("AplicaCaducidad").ToString = "True"
AplicaCaducidad = drPS("AplicaCaducidad").ToString = "True"
divCaducidad.Visible = AplicaCaducidad
divCaducidad2.Visible = AplicaCaducidad
divCaducidad2.Visible = AplicaCaducidad
RFVFechaCad.Enabled = AplicaCaducidad
End If
UpPS.Update()
@@ -1180,5 +1242,23 @@ Partial Class Inventarios_TrasladoSolicitud
GvDatos.Columns(5).Visible = Mostrar
End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.FCLiteral("LtlSerie").ToString = "-1" Then
e.Row.FCLiteral("LtlSerie").Text = ""
End If
If e.Row.FCLiteral("LtlLote").ToString = "-1" Then
e.Row.FCLiteral("LtlLote").Text = ""
End If
If e.Row.FCLiteral("LtlFechaCaducidad").ToString.ToDate = MinFecha Then
e.Row.FCLiteral("LtlFechaCaducidad").Text = ""
End If
End If
End Sub
End Class