diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 45b8f3792..8cc4b1e42 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -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 " diff --git a/Inventarios/ReconstruirCostos.aspx b/Inventarios/ReconstruirCostos.aspx index 715d99527..46211a81d 100644 --- a/Inventarios/ReconstruirCostos.aspx +++ b/Inventarios/ReconstruirCostos.aspx @@ -62,7 +62,7 @@
- + @@ -82,6 +82,18 @@ + + + +
+
+
+ + +
+
+
+
diff --git a/Inventarios/ReconstruirCostos.aspx.vb b/Inventarios/ReconstruirCostos.aspx.vb index 45fcd50fd..1f082cf1d 100644 --- a/Inventarios/ReconstruirCostos.aspx.vb +++ b/Inventarios/ReconstruirCostos.aspx.vb @@ -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}
", 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 \ No newline at end of file