Reconstruir costos

This commit is contained in:
HECTOR RODRIGUEZ
2021-04-14 10:12:42 -07:00
parent cd42929271
commit fbd9e32492
3 changed files with 57 additions and 1 deletions

View File

@@ -3571,6 +3571,26 @@ Public Class ClsInventarios
Return Retorno
End Function
Public Function ReconstruirCostos(CvePS As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Inv_ReconstruirCostos")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener al reconstruir los costos del producto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#End Region
#Region " INVENTARIOS - OC "

View File

@@ -62,7 +62,7 @@
<asp:UpdatePanel ID="UpGvProductos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div style="height:650px; overflow-y: scroll;" >
<asp:GridView ID="GvProdcutos" runat="server" AutoGenerateColumns="False" DataKeyNames="CvePS" CssClass="table table-striped table-advance table-hover" Style="text-align: center; float: right; width: 100%; font-size: medium;" GridLines="None">
<asp:GridView ID="GvProdcutos" runat="server" AutoGenerateColumns="False" DataKeyNames="CvePS, PS" CssClass="table table-striped table-advance table-hover" Style="text-align: center; float: right; width: 100%; font-size: medium;" GridLines="None">
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
<HeaderTemplate>
@@ -82,6 +82,18 @@
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpReconstruir" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div style="width: 100%; text-align: center;">
<div>
<br />
<asp:Button ID="BtnReconstruir" runat="server" Text="Guardar" CssClass="btn btn-primary" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>

View File

@@ -58,7 +58,31 @@ Partial Class Inventario_ReconstruirCostos
End If
ObjPS.Dispose()
End Sub
Private Sub BtnReconstruir_Click(sender As Object, e As EventArgs) Handles BtnReconstruir.Click
Dim objInv As New ClsInventarios
Dim TieneError As Boolean = False
Dim Producto As String = ""
For Each Gvr As GridViewRow In GvProdcutos.Rows
If Gvr.FCCheckBox("ChkProducto").Checked Then
Dim CvePS As Integer = Gvr.DataKey("CvePS").ToEntero
If Not objInv.ReconstruirCostos(CvePS, UsuarioActual.CveEmpresa) Then
TieneError = True
Producto += String.Format("{0} <br/>", Gvr.DataKey("PS").ToString)
End If
End If
Next
If TieneError Then
Alert(String.Format("Error al reconstruir los costos en los siguientes productos: {0}", Producto), TipoMensaje.MsgError)
Else
Alert("Se realizo el cambio correctamente", TipoMensaje.MsgConfirmacion)
End If
objInv.Dispose()
End Sub
End Class