diff --git a/Inventarios/InventarioFisicoDetalle.aspx b/Inventarios/InventarioFisicoDetalle.aspx index 6a15e7ad1..e7c1feb0c 100644 --- a/Inventarios/InventarioFisicoDetalle.aspx +++ b/Inventarios/InventarioFisicoDetalle.aspx @@ -229,7 +229,7 @@
- +
@@ -240,7 +240,7 @@
- +
@@ -259,12 +259,22 @@
-
-
- +
+ +
+ + <%--Seleccione--%> + + +
+
+
+
+
+
diff --git a/Inventarios/InventarioFisicoDetalle.aspx.vb b/Inventarios/InventarioFisicoDetalle.aspx.vb index a1678237c..a5abf5a98 100644 --- a/Inventarios/InventarioFisicoDetalle.aspx.vb +++ b/Inventarios/InventarioFisicoDetalle.aspx.vb @@ -6,7 +6,7 @@ Imports Extensiones Imports Microsoft.Reporting.WebForms Partial Class Inventarios_InventarioFisicoDetalle - Inherits ClsPaginas + Inherits ClsPaginas #Region "Propiedades" Public Property DtEquivalencias() As DataTable Get @@ -39,9 +39,18 @@ Partial Class Inventarios_InventarioFisicoDetalle Set(value As DataTable) ViewState("DtVentas") = value End Set - End Property + End Property + Private Property CveAlmacenes As String + Get + Return ViewState("CveAlmacenes").ToString + End Get + Set(value As String) + ViewState("CveAlmacenes") = value + End Set + End Property + #End Region - + Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not IsPostBack Then If Request("CveInventarioFisico") IsNot Nothing AndAlso Request("CveInventarioFisico").ToString.ToEntero > 0 Then @@ -51,10 +60,10 @@ Partial Class Inventarios_InventarioFisicoDetalle End If End If - End Sub - - - + End Sub + + + #Region " USUARIOS " Private Sub CargaUsuarios() ddlUsuario.DataSource = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltraParametros("Estatus = 1", "Nombre") @@ -82,9 +91,9 @@ Partial Class Inventarios_InventarioFisicoDetalle UPAgregarPro.Update() UPPInventario.Update() - End Sub + End Sub #End Region - + #Region " CARGA DATOS " Private Sub CargaDatos(CveInventarioFisico As Integer, CveEmpresa As Integer, Optional CveUsuario As Integer = -1) @@ -135,13 +144,16 @@ Partial Class Inventarios_InventarioFisicoDetalle If ObjInventario.GetInventarioFisicoDetallesAlmacen(CveInventarioFisico, UsuarioActual.CveEmpresa) Then Dim dt As DataTable = ObjInventario.DtResultados Dim str As New StringBuilder + Dim CveAlmacenesStr As New StringBuilder If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then For Each dr As DataRow In dt.Rows str.AppendFormat("{0},", dr("almacen")) + CveAlmacenesStr.AppendFormat("{0},", dr("CveAlmacen")) Next End If LblAlmacenes.Text = str.ToString + CveAlmacenes = CveAlmacenesStr.ToString.Substring(0, CveAlmacenesStr.Length - 1) End If If ObjInventario.GetInventarioFisicoDetallesClasificacion(CveInventarioFisico, UsuarioActual.CveEmpresa) Then @@ -246,11 +258,11 @@ Partial Class Inventarios_InventarioFisicoDetalle RegistraScript("OrdenarGV();") End If UPPInventario.Update() - End Sub + End Sub #End Region - + #Region " AGREGAR " - + Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click Dim Valido As Boolean = False @@ -260,8 +272,9 @@ Partial Class Inventarios_InventarioFisicoDetalle Dim CodigoBarras As String = If(TxtCodigoBarras.Text.Trim <> "", TxtCodigoBarras.Text.Trim, "-1").Replace("'", "''") ' scanner cambian los guiones por apostrofes Dim Serie As String = TxtCodigoSerie.Text.Trim Dim Lote As String = If(TxtLote.Text.Length > 0, TxtLote.Text, "-1") - Dim FechaCaducidad As String=MinFecha.ToString + Dim FechaCaducidad As String = MinFecha.ToString Dim CveSeccionAlmacen As Integer = -1 + Dim SeccionAlmacen As String = "" Dim Cantidad = TxtCantidadProducto.Text.ToDouble @@ -279,11 +292,13 @@ Partial Class Inventarios_InventarioFisicoDetalle Dim AplicaCaducidad As Boolean = dr("AplicaCaducidad") = "1" Dim AplicaLote As Boolean = dr("AplicaLote") = "1" Dim AplicaSerie As Boolean = dr("AplicaSerie") = "1" + Dim AplicaSeccion As Boolean = dr("AplicaSeccion") = "1" 'divSeccionAlmacen.Visible = AplicaSeccion divLote.Visible = AplicaLote divFechaCaducidad.Visible = AplicaCaducidad divSerie.Visible = AplicaSerie + UPAgregarPro.Update() If AplicaSerie And Serie = "" Then @@ -294,7 +309,7 @@ Partial Class Inventarios_InventarioFisicoDetalle RFVSerie.ValidationGroup = " " Exit Sub End If - If AplicaLote And Lote = "" Then + If AplicaLote And (Lote = "" Or Lote = "-1") Then RFVLote.Enabled = True RFVLote.Visible = True RFVLote.SetFocusOnError = True @@ -313,13 +328,46 @@ Partial Class Inventarios_InventarioFisicoDetalle End If FechaCaducidad = If(TxtFechaCaducidad.Text.Length > 0, TxtFechaCaducidad.Text, MinFecha.ToString) End If - + If AplicaSeccion Then + Dim ObjInv As New ClsInventarios + Dim SeccionesAlmacenDelProducto As New DataTable + If ObjInv.GetProductosServiciosAlmacenSeccion(CveProducto, -1, -1, UsuarioActual.CveEmpresa) Then + SeccionesAlmacenDelProducto = ObjInv.DtResultados.FiltraParametros(String.Format("CveAlmacen IN ({0})", CveAlmacenes)) + End If + 'Dim SeccionesAlmacenDelProducto As DataTable = (UsuarioActual.CveEmpresa, -1, CveProducto) '.FiltraParametros(String.Format("CveAlmacen IN ({0})", CveAlmacenes)) + 'Alert(SeccionesAlmacenDelProducto.Rows.Count.ToString) + If SeccionesAlmacenDelProducto.Rows.Count = 1 Then + CveSeccionAlmacen = SeccionesAlmacenDelProducto.FiltroPrimeroValor("CveSeccionAlmacen") + Else + divSeccion.Visible = AplicaSeccion + If DdlSeccionAlmacen.Items.Count = 0 Then + DdlSeccionAlmacen.DataSource = SeccionesAlmacenDelProducto + DdlSeccionAlmacen.DataBind() + DdlSeccionAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + + If DdlSeccionAlmacen.SelectedValue = "-1" Then + RfvSeccionAlmacen.Enabled = True + RfvSeccionAlmacen.Visible = True + RfvSeccionAlmacen.SetFocusOnError = True + RfvSeccionAlmacen.Validate() + RfvSeccionAlmacen.ValidationGroup = " " + Exit Sub + End If + CveSeccionAlmacen = DdlSeccionAlmacen.SelectedValue.ToEntero + End If + ObjInv.Dispose() + SeccionAlmacen = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("SeccionAlmacen", String.Format("CveSeccionAlmacen = {0}", CveSeccionAlmacen)) + End If + RFVSerie.ValidationGroup = "GrpIngresar" RFVSerie.Enabled = False RFVLote.ValidationGroup = "GrpIngresar" RFVLote.Enabled = False RFVCaducidad.ValidationGroup = "GrpIngresar" RFVCaducidad.Enabled = False + RfvSeccionAlmacen.ValidationGroup = "GrpIngresar" + RfvSeccionAlmacen.Enabled = False 'VALIDA QUE LA SERIE NO SEA IGUAL AL CODIGO O CODIGOBARRAS If Serie <> "" And (Serie.ToUpper = dr("Codigo").ToString.ToUpper Or Serie.ToUpper = dr("CodigoBarras").ToString.ToUpper) Then @@ -331,7 +379,7 @@ Partial Class Inventarios_InventarioFisicoDetalle Using Inventarios As New ClsInventarios If Inventarios.AddInventarioFisicoDetalle(CveInventarioFisico, CveProducto, CveUnidadMedida, If(AplicaSerie, 1, Cantidad), Serie, UsuarioActual.CveUsuario, - CveSeccionAlmacen:=-1, Lote:=Lote, FechaCaducidad:=FechaCaducidad.ToDate) Then + CveSeccionAlmacen:=CveSeccionAlmacen, Lote:=Lote, FechaCaducidad:=FechaCaducidad.ToDate) Then GvIFDUltimoRegistrado.Columns(4).Visible = CveSeccionAlmacen > 0 GvIFDUltimoRegistrado.Columns(5).Visible = Serie <> "" @@ -344,7 +392,7 @@ Partial Class Inventarios_InventarioFisicoDetalle GvIFDUltimoRegistrado.Rows(0).Cells(1).Text = dr("CodigoBarras").ToString GvIFDUltimoRegistrado.Rows(0).Cells(2).Text = dr("Codigo").ToString GvIFDUltimoRegistrado.Rows(0).Cells(3).Text = dr("PSCodigo").ToString - GvIFDUltimoRegistrado.Rows(0).Cells(4).Text = "" + GvIFDUltimoRegistrado.Rows(0).Cells(4).Text = SeccionAlmacen GvIFDUltimoRegistrado.Rows(0).Cells(5).Text = TxtCodigoSerie.Text.Trim GvIFDUltimoRegistrado.Rows(0).Cells(6).Text = Lote GvIFDUltimoRegistrado.Rows(0).Cells(7).Text = FechaCaducidad @@ -371,6 +419,7 @@ Partial Class Inventarios_InventarioFisicoDetalle divLote.Visible = False divFechaCaducidad.Visible = False divSerie.Visible = False + divSeccion.Visible = False RegistraScript("playsonidito('beep-07.wav')") Else TxtCodigoSerie.Text = "" @@ -386,6 +435,7 @@ Partial Class Inventarios_InventarioFisicoDetalle divLote.Visible = False divFechaCaducidad.Visible = False divSerie.Visible = False + divSeccion.Visible = False TxtLote.Text = "" TxtFechaCaducidad.Text = "" Alert("No se encontró el producto, favor de escribirlo correctamente.", TipoMensaje.MsgError) @@ -395,9 +445,9 @@ Partial Class Inventarios_InventarioFisicoDetalle DivBuscador.Visible = False UPPInventario.Update() - End Sub + End Sub #End Region - + #Region " ELIMINAR " Protected Sub gvInventarioFisicoDetalle_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvIFD.RowDeleting If ddlUsuario.SelectedValue = UsuarioActual.CveUsuario.ToString OrElse UsuarioActual.TienePermisoProceso(283) Then @@ -425,9 +475,9 @@ Partial Class Inventarios_InventarioFisicoDetalle Alert("No se puede eliminar un producto registrado por otro usuario.", TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") End If - End Sub + End Sub #End Region - + #Region " FINALIZAR " Protected Sub btnFin_Click(sender As Object, e As EventArgs) Handles btnFin.Click If btnFin.Text.Contains("Iniciar") Then @@ -475,9 +525,9 @@ Partial Class Inventarios_InventarioFisicoDetalle UPAgregarPro.Update() UPPInventario.Update() - End Sub + End Sub #End Region - + #Region " VER AVANCE " Protected Sub LBAvance_Click(sender As Object, e As EventArgs) Response.Redirect($"~/Inventarios/RepAnomalias.aspx?CveInventarioFisico={CveInventarioFisico}&EsAvance=1") diff --git a/Inventarios/RepAnomalias.aspx b/Inventarios/RepAnomalias.aspx index 3751b969e..61dc09004 100644 --- a/Inventarios/RepAnomalias.aspx +++ b/Inventarios/RepAnomalias.aspx @@ -198,6 +198,7 @@ + @@ -232,6 +233,7 @@ + diff --git a/Inventarios/RepAnomalias.aspx.vb b/Inventarios/RepAnomalias.aspx.vb index a71900ab2..12433a1ec 100644 --- a/Inventarios/RepAnomalias.aspx.vb +++ b/Inventarios/RepAnomalias.aspx.vb @@ -194,6 +194,9 @@ Partial Class Inventarios_RepAnomalias e.Row.Cells(8).Text = "0" End If + If e.Row.Cells(7).Text = MinFecha Then + e.Row.Cells(7).Text = "" + End If e.Row.FCLabel("Lblc").Text = e.Row.RowIndex + 1 End If @@ -273,9 +276,10 @@ Partial Class Inventarios_RepAnomalias #End Region Private Sub BanderaSerieLoteCad(Gv As GridView, resultado As DataTable) - Gv.Columns(4).Visible = resultado.MAX("Serie") <> "" - Gv.Columns(5).Visible = resultado.MAX("Lote") <> "" - Gv.Columns(6).Visible = resultado.MAX("FechaCaducidad").ToDate > MinFecha + Gv.Columns(4).Visible = resultado.MAX("CveSeccionAlmacen").ToEntero > 0 + Gv.Columns(5).Visible = resultado.MAX("Serie") <> "" + Gv.Columns(6).Visible = resultado.MAX("Lote") <> "" + Gv.Columns(7).Visible = resultado.MAX("FechaCaducidad").ToDate > MinFecha End Sub End Class