diff --git a/Inventarios/ResguardoMaterial.aspx b/Inventarios/ResguardoMaterial.aspx index 335d66be0..c5ed23c79 100644 --- a/Inventarios/ResguardoMaterial.aspx +++ b/Inventarios/ResguardoMaterial.aspx @@ -491,8 +491,25 @@ - - + + + + + + + +
+ + + + + + + + +
+
+
diff --git a/Inventarios/ResguardoMaterial.aspx.vb b/Inventarios/ResguardoMaterial.aspx.vb index 28e392832..ee8ee8694 100644 --- a/Inventarios/ResguardoMaterial.aspx.vb +++ b/Inventarios/ResguardoMaterial.aspx.vb @@ -83,6 +83,15 @@ Partial Class Inventarios_ResguardoMaterial End Set End Property + Private Property ValidaLoteCaducidad As Boolean + Get + Return CType(ViewState("ValidaLoteCaducidad"), Boolean) + End Get + Set(value As Boolean) + ViewState("ValidaLoteCaducidad") = value + End Set + End Property + Private Property CantidadTotal As Decimal Get @@ -502,41 +511,6 @@ Partial Class Inventarios_ResguardoMaterial End If - 'ThSerie.Visible = False - 'TrSerie.Visible = False - 'TxtnSerie.Visible = False - 'GvM.Columns(5).Visible = False - 'GvM.Columns(4).Visible = False - - 'Dim Contador As Integer = 0 - 'Dim UltimoRenglon As Integer = DtMovimientos.Rows.Count - 1 - 'Dim MostrarSerie As Boolean = False - 'Dim MostrarSeccion As Boolean = False - 'While Contador <= UltimoRenglon And (Not MostrarSerie And Not MostrarSeccion) - ' Dim Dr As DataRow = DtMovimientos.Rows(Contador) - ' MostrarSerie = If(Not MostrarSerie, Dr("Serie").ToString <> "", True) - ' MostrarSeccion = If(Not MostrarSerie, Dr("SeccionAlmacen").ToString <> "", True) - ' Contador += 1 - 'End While - - 'ThSerie.Visible = MostrarSerie - 'TrSerie.Visible = MostrarSerie - 'GvM.Columns(5).Visible = MostrarSerie - - 'GvM.Columns(4).Visible = MostrarSeccion - - 'For Each Dr As DataRow In DtMovimientos.Rows - ' If Dr("Serie").ToString <> "" Then - ' ThSerie.Visible = True - ' TrSerie.Visible = True - ' GvM.Columns(5).Visible = True - ' Exit For - ' End If - ' If Dr("SeccionAlmacen").ToString <> "" Then - ' GvM.Columns(4).Visible = True - ' End If - 'Next - GvM.DataSource = DtMovimientos GvM.DataBind() End Sub @@ -608,6 +582,23 @@ Partial Class Inventarios_ResguardoMaterial dtt.Dispose() End If + If (ValidaLoteCaducidad) OrElse (UsuarioActual.CveEmpresa <> 119) Then + If CBool(e.Row.DBCampo("AplicaCaducidad")) Then + e.Row.FCTextBox("TxtCaducidad").Visible = True + e.Row.FCLinkButton("LnkCaducidad").Visible = True + Else + e.Row.FCTextBox("TxtCaducidad").Visible = False + e.Row.FCLinkButton("LnkCaducidad").Visible = False + End If + + If CBool(e.Row.DBCampo("AplicaLote")) Then + e.Row.FCTextBox("TxtLote").Visible = True + Else + e.Row.FCTextBox("TxtLote").Visible = False + End If + + End If + End If End Sub @@ -689,8 +680,8 @@ Partial Class Inventarios_ResguardoMaterial Private Sub CargaGvMLiberacion() GvMLiberacion.Columns(5).Visible = DtMovimientosLiberacion.MAX("Serie").ToString <> "" - GvMLiberacion.Columns(6).Visible = DtMovimientosLiberacion.MAX("Lote").ToString <> "" - GvMLiberacion.Columns(7).Visible = DtMovimientosLiberacion.MAX("FechaCaducidad").ToString.ToDate > MinFecha + GvMLiberacion.Columns(6).Visible = DtMovimientosLiberacion.MAX("AplicaLote").ToString = "True" + GvMLiberacion.Columns(7).Visible = DtMovimientosLiberacion.MAX("AplicaCaducidad").ToString = "True" ' .ToDate > MinFecha GvMLiberacion.Columns(8).Visible = DtMovimientosLiberacion.MAX("CveSeccionAlmacen").ToString.ToEntero > 0 Or DtMovimientosLiberacion.MAX("AplicaSeccion") = "True" @@ -896,6 +887,8 @@ Partial Class Inventarios_ResguardoMaterial CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenLiberación, 3, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Observaciones:=TxtObservacionesLiberacion.Text, CvePersonal:=CvePersonalLiberacion, CveAlmacenDestino:=DdlAlmacenDestinoLiberacion.SelectedValue.ToEntero, CveProveedor:=CveProveedorLiberacion, CveCliente:=CveClienteLiberacion, MovimientoFijo:=True, Modulo:="ResgMat3") FolioSalida = ObjInventario.Folio Dim DiccionarioSecciones As New HybridDictionary + Dim DiccionarioLote As New HybridDictionary + Dim DiccionarioCaducidad As New HybridDictionary If CveMovimientoSalida <= 0 Then TieneError = True @@ -906,12 +899,19 @@ Partial Class Inventarios_ResguardoMaterial Dim Cont As Integer = 0 For Each Gvr As GridViewRow In GvMLiberacion.Rows If Gvr.FCTextBox("TxtCantidad").Text.ToDouble > 0 Then - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Gvr.FCTextBox("TxtCantidad").Text.ToDouble, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("PU").ToString.ToDecimal, -1, CveSeccionAlmacen:=Gvr.DataKey("CveSeccionAlmacen").ToEntero, Serie:=Gvr.DataKey("Serie").ToString, Observaciones:=Gvr.DataKey("Observaciones").ToString) Then + Dim Lote As String = "-1" + Dim FechaCaducidad As Date = MinFecha + If Gvr.datakey("Lote") <> "" Then Lote = Gvr.datakey("Lote") + If Gvr.datakey("FechaCaducidad").todate > MinFecha Then FechaCaducidad = Gvr.datakey("FechaCaducidad").todate + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Gvr.FCTextBox("TxtCantidad").Text.ToDouble, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("PU").ToString.ToDecimal, -1, CveSeccionAlmacen:=Gvr.DataKey("CveSeccionAlmacen").ToEntero, Serie:=Gvr.DataKey("Serie").ToString, Lote:=Lote, FechaCaducidad:=FechaCaducidad, Observaciones:=Gvr.DataKey("Observaciones").ToString, CveMovimientoDetalleEntrada:=Gvr.DataKey("CveMovimientoDetalle").toentero) Then MensajeError = "Ocurrió un error al guardar los detalles del movimiento de salida. Por favor vuelva a intentar." TieneError = True Exit For Else DiccionarioSecciones.Add(ObjInventario.CveMovimientoDetalle, Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue) + DiccionarioLote.Add(ObjInventario.CveMovimientoDetalle, Gvr.FCTextBox("TxtLote").Text) + DiccionarioCaducidad.Add(ObjInventario.CveMovimientoDetalle, Gvr.FCTextBox("TxtCaducidad").Text.todate) End If End If Cont += 1 @@ -932,7 +932,11 @@ Partial Class Inventarios_ResguardoMaterial Importe = ObjInventario.DtResultados.SUMD("Total").RoundAD For Each Dr As DataRow In ObjInventario.DtResultados.Rows Dim CveSeccionAlmacen As Integer = DiccionarioSecciones(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString.ToEntero - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString, Observaciones:=Dr("Observaciones").ToString) Then + Dim Lote As String = "-1" + Dim FechaCaducidad As Date = MinFecha + If DiccionarioLote(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString <> "" Then Lote = DiccionarioLote(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString + If DiccionarioCaducidad(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString.todate > MinFecha Then FechaCaducidad = DiccionarioCaducidad(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString.todate + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString, Lote:=Lote, FechaCaducidad:=FechaCaducidad, Observaciones:=Dr("Observaciones").ToString) Then TieneError = True MensajeError = "Ocurrió un error al guardar los movimientos de entrada" Exit For @@ -1099,6 +1103,14 @@ Partial Class Inventarios_ResguardoMaterial End Sub Private Sub DdlAlmacenDestinoLiberacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlAlmacenDestinoLiberacion.SelectedIndexChanged + Dim CveSubProyecto As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenDestinoLiberacion.selectedvalue.toentero).FiltroPrimeroValor("CveSubProyecto").ToEntero + 'RMF condición temporal + If UsuarioActual.CveEmpresa = 119 AndAlso CveSubProyecto.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347)) Then + ValidaLoteCaducidad = True + Else + ValidaLoteCaducidad = False + End If + CargaResguardos() End Sub End Class