From 5eba91c6b441f8bb13f03e5fd2d38b3563185674 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 10 Jan 2020 13:27:41 -0700 Subject: [PATCH] Vinculacion de NC en compras, PA de poliza virutal en ventas.aspx --- App_Code/ClsAcumuladores.vb | 16 +++++++++- Compras/Compras.aspx.vb | 61 ++++++++++++++++++++----------------- 2 files changed, 48 insertions(+), 29 deletions(-) diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb index 614160d81..3821f21de 100644 --- a/App_Code/ClsAcumuladores.vb +++ b/App_Code/ClsAcumuladores.vb @@ -753,7 +753,21 @@ Public Class ClsAcumuladores SqlAdapter.Fill(Data) Retorno = True Catch ex As SqlException - OnError("Ocurrió un al agregar la garantia detalle. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un al obtener la garantía detalle. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + Public Function GetGarantiasPolizaVirtual(CveVenta As Integer) As Boolean + Dim Retorno As Boolean = False + SqlDataAdapter("PA_Acum_GarantiasPolizaVirtualGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un al obtener la información de poliza virtual.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno End Function diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 6d3b6c35f..d654889be 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -13590,35 +13590,40 @@ Partial Class Compras_Compras ' guardardevolucion(ObjInventario, cvecompra, subtotal, Now.ToDate) 'End Sub Protected Sub BtnVinculaDevolucion_Click(sender As Object, e As EventArgs) - Dim subtotaldevolucion As Double = 0 - Dim realizadevolucion As Boolean = False + Try + Dim subtotaldevolucion As Double = 0 + Dim realizadevolucion As Boolean = False + + + 'Calculo los subtotales para comparar con la NC + Dim cantidad As Double = 0.0 + + For Each Dr As GridViewRow In GVDevolucion.Rows + cantidad = Dr.FCTextBox("TxtCantidad").Text.ToDouble + If cantidad > 0 Then + realizadevolucion = True + subtotaldevolucion += Dr.DataKey("PU").ToString.ToDouble * cantidad + End If + Next + + 'si no esta vinculado a nc simplemente me lo brinco + If realizadevolucion Then + 'si el subtotal es iwal a la nc lo guardo si no marco error + If TxtSubTotal.Text.ToDouble > subtotaldevolucion - 1 AndAlso TxtSubTotal.Text.ToDouble < subtotaldevolucion + 1 Then + + VinculaDevolucion() + + Else + Alert("El Total de la NC debe ser igual al total de la devolucion", TipoMensaje.MsgAdvertencia) + End If + Else + Alert("No se ha seleccionado nada para la devolución. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + End If + Catch ex As Exception + OnError("Ocurrió un error al realizar la vinculación", ex) + End Try - 'Calculo los subtotales para comparar con la NC - Dim cantidad As Double = 0.0 - - For Each Dr As GridViewRow In GVDevolucion.Rows - cantidad = Dr.FCTextBox("TxtCantidad").Text.ToDouble - If cantidad > 0 Then - realizadevolucion = True - subtotaldevolucion += Dr.DataKey("PU").ToString.ToDouble * cantidad - End If - Next - - 'si no esta vinculado a nc simplemente me lo brinco - If realizadevolucion Then - 'si el subtotal es iwal a la nc lo guardo si no marco error - If TxtSubTotal.Text.ToDouble > subtotaldevolucion - 1 AndAlso TxtSubTotal.Text.ToDouble < subtotaldevolucion + 1 Then - - VinculaDevolucion() - - Else - Alert("El Total de la NC debe ser igual al total de la devolucion", TipoMensaje.MsgAdvertencia) - End If - Else - Alert("No se ha seleccionado nada para la devolución. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - End If - End Sub Private Sub VinculaDevolucion() @@ -13681,7 +13686,7 @@ Partial Class Compras_Compras GvOC1.DataSource = DTOCTemp Dim DTCVEOCS As DataTable = DTOCTemp.FiltraParametros("", "", {"CveOrdenCompra"}) - If DTCVEOCS.Rows.Count > 1 Then + If DTCVEOCS IsNot Nothing AndAlso DTCVEOCS.Rows.Count > 1 Then GvOC1.Columns(0).Visible = True Else GvOC1.Columns(0).Visible = False