From b079e768ab8efc6f9249eaed69b8d53410d0fb8f Mon Sep 17 00:00:00 2001 From: Raul Pimienta Date: Thu, 29 Aug 2019 13:19:49 -0700 Subject: [PATCH] Poder actualizar la fecha de pago en compra Se acomodo gridview principal --- App_Code/ClsCompras.vb | 17 +++++++++++++++ Compras/Compras.aspx | 23 +++++++++++--------- Compras/Compras.aspx.vb | 47 ++++++++++++++++++++++++++++++----------- 3 files changed, 65 insertions(+), 22 deletions(-) diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb index 1da48e7a6..a7f69b063 100644 --- a/App_Code/ClsCompras.vb +++ b/App_Code/ClsCompras.vb @@ -2921,6 +2921,23 @@ Public Class ClsCompras Return Retorno End Function + Public Function UpdateFechaVencimientoCompra(CveCompra As Integer, FechaVencimiento As Date, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Comp_ComprasFechaVencimientoUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@FechaVencimiento", SqlDbType.Date).Value = FechaVencimiento + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la fecha de vencimiento de la compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + #Region "REPORTE PUE SIN PAGO" Public Function GetPUESinPago(FI As DateTime, FF As DateTime, CveProveedor As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, Optional CveUsuario As Integer = -1) As Boolean diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 85648f022..3b9d4b659 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -654,23 +654,23 @@ <%-- 0 --%> - + <%-- 1 --%> - + <%-- 2 --%> - + <%-- 3 --%> - +
@@ -683,9 +683,9 @@ <%-- 4 --%> - + <%-- 5 --%> - + @@ -694,11 +694,11 @@ <%-- 6 --%> - + <%-- 7 --%> - + <%-- 8 --%> - + @@ -2228,7 +2228,7 @@ Fecha Pago: - +
@@ -2248,6 +2248,9 @@
+ + + diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index f9d14b40f..fb1ed92d5 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -2634,6 +2634,7 @@ Partial Class Compras_Compras DdlPS.Enabled = True TxtObsPS.Enabled = True LbAgregar.Enabled = True + LnkUpdateFechaPago.Visible = True End If BtnGuardar.Visible = False @@ -9947,18 +9948,18 @@ Partial Class Compras_Compras If Not (e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5) Then If e.Row.RowIndex = 0 Then - e.Row.Cells(0).Width = Unit.Pixel(15) - e.Row.Cells(1).Width = Unit.Pixel(45) - e.Row.Cells(2).Width = Unit.Pixel(70) - e.Row.Cells(3).Width = Unit.Pixel(230) - e.Row.Cells(4).Width = Unit.Pixel(202) - e.Row.Cells(5).Width = Unit.Pixel(155) - e.Row.Cells(6).Width = Unit.Pixel(155) - e.Row.Cells(7).Width = Unit.Pixel(50) - e.Row.Cells(8).Width = Unit.Pixel(80) - e.Row.Cells(9).Width = Unit.Pixel(80) - e.Row.Cells(10).Width = Unit.Pixel(43) - e.Row.Cells(11).Width = Unit.Pixel(43) + 'e.Row.Cells(0).Width = Unit.Pixel(15) + 'e.Row.Cells(1).Width = Unit.Pixel(45) + 'e.Row.Cells(2).Width = Unit.Pixel(70) + 'e.Row.Cells(3).Width = Unit.Pixel(230) + 'e.Row.Cells(4).Width = Unit.Pixel(202) + 'e.Row.Cells(5).Width = Unit.Pixel(155) + 'e.Row.Cells(6).Width = Unit.Pixel(155) + 'e.Row.Cells(7).Width = Unit.Pixel(50) + 'e.Row.Cells(8).Width = Unit.Pixel(80) + 'e.Row.Cells(9).Width = Unit.Pixel(80) + 'e.Row.Cells(10).Width = Unit.Pixel(43) + 'e.Row.Cells(11).Width = Unit.Pixel(43) If UsuarioActual.Empresa.UsaAC Then 'AndAlso (CveFactura > 0 Or CveCompra > 0) e.Row.Cells(12).Width = Unit.Pixel(150) @@ -18816,4 +18817,26 @@ Partial Class Compras_Compras AddPS2(EsNoDeducible:=EsNoDeducible) End Sub + Protected Sub LnkUpdateFechaPago_Click(sender As Object, e As EventArgs) + Dim ObjComp As New ClsCompras + Dim FechaPagoAnterior As String = "" + + If ObjComp.GetCompras(CveCompra, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then + If ObjComp.DtResultados.Rows.Count > 0 Then + FechaPagoAnterior = ObjComp.DtResultados.Rows(0)("FechaVencimiento").ToString.ToDate.ToShortDateString + End If + End If + + If FechaPagoAnterior = TxtFechaPago.Text Then + Alert("La fecha de pago seleccionada es igual que la anterior.", TipoMensaje.MsgAdvertencia) + ObjComp.Dispose() + Exit Sub + End If + + If ObjComp.UpdateFechaVencimientoCompra(CveCompra, TxtFechaPago.Text.ToDate, UsuarioActual.CveEmpresa) Then + Alert("Fecha de pago actualizada correctamente.") + End If + + ObjComp.Dispose() + End Sub End Class \ No newline at end of file