se agrego un filtro de busqueda sobre folios de movimientos y ahora para hacer una correción se puede hacer seccionado sin necesariamente mover toda la cantidad del movimiento

This commit is contained in:
Antonio Gonzalez
2020-07-27 10:36:31 -07:00
parent ab52b1867f
commit 5086d93d49
3 changed files with 39 additions and 9 deletions

View File

@@ -4780,13 +4780,14 @@ Public Class ClsInventarios
#Region "MOVIMIENTOS DETALLE SECCION ALMACEN" #Region "MOVIMIENTOS DETALLE SECCION ALMACEN"
Public Function GetMovimientosDetalleSeccionesAlmacen(CveAlmacen As Integer, CveClasificacion As Integer, CveEmpresa As Integer) As Boolean Public Function GetMovimientosDetalleSeccionesAlmacen(CveAlmacen As Integer, CveClasificacion As Integer, CveEmpresa As Integer, Folio As String) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Inv_MovimientosDetalleAjusteSeccionesGet") DataAdapter("PA_Inv_MovimientosDetalleAjusteSeccionesGet")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen
.Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@Folio", SqlDbType.NVarChar).Value = Folio
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)

View File

@@ -46,6 +46,10 @@
<asp:DropDownList ID="DdlClasificaciones" runat="server" DataValueField="CveClasificacion" DataTextField="Clasificacion" class="select2me" Width="300px"></asp:DropDownList> <asp:DropDownList ID="DdlClasificaciones" runat="server" DataValueField="CveClasificacion" DataTextField="Clasificacion" class="select2me" Width="300px"></asp:DropDownList>
</div> </div>
<label class="col-md-1 truncate" style="text-align:right;">Folio:</label>
<div class="col-md-3">
<asp:TextBox runat="server" ID="TxtFolioFiltro" Width="100px"/>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -62,10 +66,17 @@
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-Width="5%" /> <asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="FechaCaducidad" DataField="FechaCaducidad" ItemStyle-Width="5%" /> <asp:BoundField HeaderText="FechaCaducidad" DataField="FechaCaducidad" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="Sección Actual" DataField="SeccionAlmacen" ItemStyle-Width="15%" /> <asp:BoundField HeaderText="Sección Actual" DataField="SeccionAlmacen" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="Existencia" DataField="Existencia" DataFormatString="{0:#,###.##}" ItemStyle-Width="5%" /> <%--<asp:BoundField HeaderText="Existencia" DataField="Existencia" DataFormatString="{0:#,###.##}" ItemStyle-Width="5%" />--%>
<asp:TemplateField ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center"> <asp:TemplateField ItemStyle-Width="7%">
<ItemTemplate> <ItemTemplate>
<asp:CheckBox ID="Chk" Checked="false" runat="server"></asp:CheckBox> <%--<asp:Literal ID="LtlExistencia" runat="server" Text='<%# Eval("Existencia").ToString().Split("."c)(0) %>'></asp:Literal>--%>
<asp:TextBox ID="TxtCantidad" runat="server" Enabled="false" Text='<%# Eval("Existencia").ToString().Split("."c)(0) %>' Width="100%"/>
<asp:RangeValidator ID="RVR" Display="Dynamic" ControlToValidate="TxtCantidad" runat="server" MinimumValue="0" Type="Double" ErrorMessage="No cumple con la cantidad especificada"></asp:RangeValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="3%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:CheckBox ID="Chk" Checked="false" runat="server" OnCheckedChanged="Chk_Click" AutoPostBack="true"></asp:CheckBox>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Nueva Seccion" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center"> <asp:TemplateField HeaderText="Nueva Seccion" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">

View File

@@ -33,7 +33,8 @@ Partial Class Inventarios_AjustesSeccionAlmacen
Private Sub CargaDatos() Private Sub CargaDatos()
Dim ObjInv As New ClsInventarios Dim ObjInv As New ClsInventarios
If ObjInv.GetMovimientosDetalleSeccionesAlmacen(DdlAlmacen.SelectedValue.ToEntero, DdlClasificaciones.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then Dim FolioAux As String = If(TxtFolioFiltro.Text.Length > 0, TxtFolioFiltro.Text, "-1")
If ObjInv.GetMovimientosDetalleSeccionesAlmacen(DdlAlmacen.SelectedValue.ToEntero, DdlClasificaciones.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, FolioAux) Then
GvD.DataSource = ObjInv.DtResultados GvD.DataSource = ObjInv.DtResultados
End If End If
@@ -48,6 +49,14 @@ Partial Class Inventarios_AjustesSeccionAlmacen
e.Row.FCDropDownList("DDlS").DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero) e.Row.FCDropDownList("DDlS").DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero)
e.Row.FCDropDownList("DDlS").DataBind() e.Row.FCDropDownList("DDlS").DataBind()
Dim ExistenciasAux As Decimal = e.Row.DataKey("Existencia").ToDecimal
e.Row.FCRangeValidator("RVR").Enabled = ExistenciasAux > 0
If ExistenciasAux > 0 Then
e.Row.FCRangeValidator("RVR").MaximumValue = ExistenciasAux
Else
e.Row.FCCheckBox("Chk").Visible = False
e.Row.FCRangeValidator("RVR").MaximumValue = 0
End If
End If End If
End Sub End Sub
@@ -77,11 +86,12 @@ Partial Class Inventarios_AjustesSeccionAlmacen
Dim CveMovimientoDetalleEntrada As Integer = 0 Dim CveMovimientoDetalleEntrada As Integer = 0
Dim Cont As Integer = 0 Dim Cont As Integer = 0
Dim Lista As New Hashtable Dim Lista As New Hashtable
Dim Cantidad As Decimal = 0
For Each gvr As GridViewRow In GvD.Rows For Each gvr As GridViewRow In GvD.Rows
'que este seleccionado y que tenga diferente seccion 'que este seleccionado y que tenga diferente seccion
If gvr.FCCheckBox("Chk").Checked AndAlso gvr.FCDropDownList("DDlS").SelectedValue.ToEntero <> gvr.DataKey("CveSeccionAlmacen").ToEntero Then If gvr.FCCheckBox("Chk").Checked AndAlso gvr.FCDropDownList("DDlS").SelectedValue.ToEntero <> gvr.DataKey("CveSeccionAlmacen").ToEntero Then
Cantidad = gvr.FCTextBox("TxtCantidad").Text.ToDecimal()
If gvr.DataKey("CveSeccionAlmacen").ToEntero > 0 Then If gvr.DataKey("CveSeccionAlmacen").ToEntero > 0 Then
ObjPS.UpdateAplicaSeccionAlmacen(gvr.DataKey("CvePS").ToEntero, UsuarioActual.CveEmpresa, True) ObjPS.UpdateAplicaSeccionAlmacen(gvr.DataKey("CvePS").ToEntero, UsuarioActual.CveEmpresa, True)
Else Else
@@ -89,7 +99,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen
End If End If
If Not Lista.ContainsKey(gvr.DataKey("CvePS").ToEntero) Then Lista.Add(gvr.DataKey("CvePS").ToEntero, gvr.FCDropDownList("DDlS").SelectedValue.ToEntero) 'guardo que dato le corresponde If Not Lista.ContainsKey(gvr.DataKey("CvePS").ToEntero) Then Lista.Add(gvr.DataKey("CvePS").ToEntero, gvr.FCDropDownList("DDlS").SelectedValue.ToEntero) 'guardo que dato le corresponde
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, gvr.DataKey("Existencia").ToDecimal, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, 0, -1, CveSeccionAlmacen:=gvr.DataKey("CveSeccionAlmacen").ToEntero, Serie:=gvr.DataKey("Serie"), Lote:=gvr.DataKey("Lote"), FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToDate) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, 0, -1, CveSeccionAlmacen:=gvr.DataKey("CveSeccionAlmacen").ToEntero, Serie:=gvr.DataKey("Serie"), Lote:=gvr.DataKey("Lote"), FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToDate) Then
ErrorMovInv = True ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de salida" TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For Exit For
@@ -109,7 +119,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen
For Each Row As DataRow In resultado.Rows For Each Row As DataRow In resultado.Rows
Dim CvePS = Row("CvePS").ToString().ToEntero() Dim CvePS = Row("CvePS").ToString().ToEntero()
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal() 'Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
Dim PU As Decimal = Row("PUOriginal").ToString().ToDecimal() Dim PU As Decimal = Row("PUOriginal").ToString().ToDecimal()
Dim CveUM As Integer = Row("CveUM").ToString().ToEntero() Dim CveUM As Integer = Row("CveUM").ToString().ToEntero()
Dim CveSeccionAlmacen As Integer = Lista(Row("CvePS").ToString().ToEntero()) 'GvD.Rows(ind).FCDropDownList("DDlS").SelectedValue.ToEntero ' IfNull(Row("CveSeccionAlmacen"), "-1").ToString().ToEntero() Dim CveSeccionAlmacen As Integer = Lista(Row("CvePS").ToString().ToEntero()) 'GvD.Rows(ind).FCDropDownList("DDlS").SelectedValue.ToEntero ' IfNull(Row("CveSeccionAlmacen"), "-1").ToString().ToEntero()
@@ -288,7 +298,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen
Try Try
Dim DtExistenciasSecciones As DataTable = Nothing Dim DtExistenciasSecciones As DataTable = Nothing
If ObjInventario.GetMovimientosDetalleSeccionesAlmacen(DdlAlmacenExcel.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then If ObjInventario.GetMovimientosDetalleSeccionesAlmacen(DdlAlmacenExcel.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, "-1") Then
DtExistenciasSecciones = ObjInventario.DtResultados.Copy() DtExistenciasSecciones = ObjInventario.DtResultados.Copy()
End If End If
@@ -447,4 +457,12 @@ Partial Class Inventarios_AjustesSeccionAlmacen
End If End If
End Sub End Sub
Protected Sub Chk_Click(sender As Object, e As EventArgs)
Dim row As GridViewRow = (CType((CType(sender, CheckBox)).NamingContainer, GridViewRow))
Dim ExistenciaBackup As Integer = row.DataKey("Existencia").ToEntero()
row.FCTextBox("TxtCantidad").Enabled = Not row.FCTextBox("TxtCantidad").Enabled
If Not row.FCTextBox("TxtCantidad").Enabled Then
row.FCTextBox("TxtCantidad").Text = ExistenciaBackup
End If
End Sub
End Class End Class