Poder actualizar la fecha de pago en compra

Se acomodo gridview principal
This commit is contained in:
Raul Pimienta
2019-08-29 13:19:49 -07:00
parent 3716bbadfc
commit b079e768ab
3 changed files with 65 additions and 22 deletions

View File

@@ -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

View File

@@ -654,23 +654,23 @@
<asp:GridView ID="GvPS" ShowHeader="false" runat="server" AutoGenerateColumns="False" DataKeyNames="CvePS,Cantidad,CveUM,UM,PU,Descuento,OtrosGastos,CvePresupuestoEgreso,PS,Clasificacion,CveClasificacion,CveOrdenCompraDetalle,IVA,IVAPorcentaje,RetIVAPorcentaje,RetISRPorcentaje,IEPSPSPorcentaje,Obs,Total,CveProyecto,CveSubProyecto,Proyecto,SubProyecto,Consec,CveTipoGasto,NoDeducible" GridLines="none" BorderWidth="0" EmptyDataText="Sin Productos o Servicios agregados" CssClass="table GvPS table-striped table-hover table-advance Widthall ScrollAD mysmallbtn">
<Columns>
<%-- 0 --%>
<asp:TemplateField>
<asp:TemplateField ItemStyle-Width="15px" >
<ItemTemplate>
<label data-toogle="tooltip" class=' <%# IIf(Eval("CvePS").ToString() = "0", "label label-sm label-danger manita", "")%>'>
<asp:Label ID="LtlConsecutivo" runat="server" Text='<%# Eval("Consec", "{0:N0}") %>' Font-Size="6pt"></asp:Label></label>
</ItemTemplate>
</asp:TemplateField>
<%-- 1 --%>
<asp:BoundField DataField="Cantidad" DataFormatString="{0:#,##0.00####}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Cantidad" DataFormatString="{0:#,##0.00####}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="45px" />
<%-- 2 --%>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle">
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" ItemStyle-Width="70px">
<ItemTemplate>
<asp:Label ID="LtlUnidadMedida" CssClass="centrarUM" runat="server" Text='<%# Eval("UM") %>'></asp:Label>
<asp:LinkButton ID="LBAplicarEquivalencia" OnClick="LBAplicarEquivalencia_Click" data-toggle="tooltip" title="Aplicar conversión de equivalencia" Text="" runat="server" Visible="false"> <i class="fa fa-magic"></i></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<%-- 3 --%>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top">
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ItemStyle-Width="300px">
<ItemTemplate>
<div style="float: left; width: 100%;">
<span style="width: 100%; border-bottom: 1px solid gray;">
@@ -683,9 +683,9 @@
</ItemTemplate>
</asp:TemplateField>
<%-- 4 --%>
<asp:BoundField DataField="Obs" />
<asp:BoundField DataField="Obs" ItemStyle-Width="350px" />
<%-- 5 --%>
<asp:TemplateField>
<asp:TemplateField ItemStyle-Width="200px" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<span style="width: 145px; border-bottom: 1px solid gray;">
<asp:Label ID="LblProyecto" runat="server" Text='<%# Eval("Proyecto", "{0}<br />") %>' Visible='<%# if(UsuarioActual.Empresa.Tipo_CentroCosto <> 1 And UsuarioActual.Empresa.Tipo_CentroCosto <> 2, True, False) %>'></asp:Label>
@@ -694,11 +694,11 @@
</ItemTemplate>
</asp:TemplateField>
<%-- 6 --%>
<asp:BoundField DataField="TipoGasto" />
<asp:BoundField DataField="TipoGasto" ItemStyle-Width="180px" />
<%-- 7 --%>
<asp:BoundField DataField="PU" DataFormatString="{0:#,##0.00####}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PU" DataFormatString="{0:#,##0.00####}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="100px" />
<%-- 8 --%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="80px">
<ItemTemplate>
<asp:Label ID="LblIVAPorcentaje" runat="server" Text='<%# String.Format("{0} {1}", (CDbl(Eval("IVAPorcentaje").ToString) * 100).ToString("#####"), If(CDbl(Eval("IVAPorcentaje").ToString) * 100 > 0, "%", "")) %>'></asp:Label>
</ItemTemplate>
@@ -2228,7 +2228,7 @@
</tr>
<tr>
<td align="left" style="width: 75px">Fecha Pago:</td>
<td align="left">
<td align="left" style="width: 100px">
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy">
<asp:TextBox ID="TxtFechaPago" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" ClientIDMode="Static"></asp:TextBox>
<span class="input-group-btn ">
@@ -2248,6 +2248,9 @@
</div>
</td>
<td align="left" >
<asp:LinkButton runat="server" Visible="false" ID="LnkUpdateFechaPago" OnClick="LnkUpdateFechaPago_Click" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea actualizar la fecha de pago de la compra?" data-btn-ok-label="si" Text="<i class='fa fa-check' style='color:green'></i>" CssClass="btn btn-default btn-circle btn-xs" ToolTip="Actualizar Fecha de Pago" />
</td>
</tr>
<tr>
<td align="left">

View File

@@ -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