--Autorizacion de anticipos

This commit is contained in:
2024-05-24 19:35:39 -07:00
parent 48e70ed778
commit 934b225773
5 changed files with 88 additions and 3 deletions

View File

@@ -751,6 +751,22 @@ Public Class ClsVentas
Return Retorno
End Function
Public Function UpdateVentaAnticipoAutorizado(CveVenta As Integer, Autorizado As Boolean) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentaAnticipoAutorizadoUpdate")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@Autorizado", SqlDbType.Bit).Value = Autorizado
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al actualizar el estatus del anticipo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function UpdateFechaVencimientoVenta(CveVenta As Integer, FechaVencimiento As Date) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasFechaVencimientoUpdate")

View File

@@ -2301,6 +2301,12 @@
<asp:HyperLink ID="HLDevolverDinero" Visible="false" NavigateUrl="#" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-usd'></i>" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Autorización" ItemStyle-HorizontalAlign="Center" Visible="false">
<ItemTemplate>
<asp:LinkButton ID="LnkAutorizar" Visible="false" NavigateUrl="#" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" runat="server" OnClick="LnkAutorizarAnticipo_Click" />
<asp:LinkButton ID="LnkCancelar" Visible="false" NavigateUrl="#" CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-close'></i>" runat="server" OnClick="LnkCancelarAnticipo_Click" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>

View File

@@ -1873,7 +1873,12 @@ Partial Class Clientes
GVAnticiposHistorial.DataSource = Nothing
DtAnticipoHistorial = Nothing
End If
ObjMovtos.Dispose()
ObjMovtos.Dispose()
If UsuarioActual.Empresa.Funcionalidad(185) = "1" AndAlso UsuarioActual.TienePermisoProceso(379) Then
GVAnticipos.Columns(7).Visible = True
End If
GVAnticipos.DataBind()
GVAnticiposHistorial.DataBind()
@@ -1889,7 +1894,6 @@ Partial Class Clientes
RegistraScript("OrdenarGVAnticiposHistorial();")
End If
End Sub
Private Sub CargaOrdenesServiciosCliente()
Dim ObjOS As New ClsOS
@@ -2957,10 +2961,24 @@ Partial Class Clientes
e.Row.FCHyperLink("HLDevolverDinero").Visible = True
e.Row.FCHyperLink("HLDevolverDinero").NavigateUrl = $"/Bancos/IE.aspx?Opcion=DevDinV&P={Parametros}"
End If
End If
If UsuarioActual.Empresa.Funcionalidad(185) = "1" AndAlso UsuarioActual.TienePermisoProceso(379) AndAlso CType(sender, GridView).ID = "GVAnticipos" Then
If e.Row.DBCampo("CveVenta").ToString().ToEntero() > 0 AndAlso e.Row.DBCampo("Tipo").ToString() = "Ant" Then
If e.Row.DBCampo("AnticipoAutorizado").ToString() = "False" Then
e.Row.FCLinkButton("LnkAutorizar").Visible = True
e.Row.FCLinkButton("LnkCancelar").Visible = False
Else
e.Row.FCLinkButton("LnkAutorizar").Visible = False
e.Row.FCLinkButton("LnkCancelar").Visible = True
End If
End If
End If
End If
End Sub
#End Region
#Region "R H"
@@ -10691,6 +10709,31 @@ Partial Class Clientes
End Function
Protected Sub LnkAutorizarAnticipo_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
Dim CveVenta As Integer = GvRow.DataKey("CveVenta").ToEntero()
If CveVenta > 0 Then
Using ObjVentas As New ClsVentas
If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, True) Then
Alert("El anticipo se autorizó correctamente")
End If
End Using
CargaAnticipos()
End If
End Sub
Protected Sub LnkCancelarAnticipo_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
Dim CveVenta As Integer = GvRow.DataKey("CveVenta").ToEntero()
If CveVenta > 0 Then
Using ObjVentas As New ClsVentas
If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then
Alert("El anticipo se desautorizó correctamente")
End If
End Using
CargaAnticipos()
End If
End Sub
End Class

View File

@@ -4615,6 +4615,9 @@
<div style="max-height: 300px; overflow-y: auto;">
<div class="row" style="margin-left: 0px; text-align: right" align="left">
<div class="col-md-2">
<asp:LinkButton ID="LnkRecargaAnticipos" Visible="false" NavigateUrl="#" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-refresh'></i> Actualizar" runat="server" OnClick="LnkRecargaAnticipos_Click" />
</div>
<div style="margin-right: 15px">
<input type="text" id="TxtBusquedaAnticipos" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaAnticipos','{0}')", GVAnticipos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaAnticipos','{0}')", GVAnticipos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>

View File

@@ -7194,7 +7194,13 @@ Partial Class Ventas
End If
ObjCliente.Dispose()
If CveCliente > 0 Then CargaAnticipos(CveCliente) : UpAnticipos.Update()
If CveCliente > 0 Then
CargaAnticipos(CveCliente)
If UsuarioActual.Empresa.Funcionalidad(185) = "1" Then
LnkRecargaAnticipos.Visible = True
End If
UpAnticipos.Update()
End If
If CveCliente > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveVenta <= 0 Then
DivVentasUsados.Visible = True
@@ -16823,6 +16829,12 @@ Partial Class Ventas
GVAnticipos.Columns(8).Visible = True
End If
If UsuarioActual.Empresa.Funcionalidad(185) = "1" Then
If e.Row.DBCampo("Tipo").ToString() = "Ant" AndAlso e.Row.DBCampo("AnticipoAutorizado").ToString() = "False" Then
e.Row.FCCheckBox("Chk" & e.Row.RowIndex).Enabled = False
End If
End If
If e.Row.DBCampo("CveMoneda").ToString().ToEntero() = DdlMoneda.SelectedValue.ToEntero() Then
e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).Visible = False
@@ -38401,5 +38413,10 @@ Partial Class Ventas
Protected Sub LnkRecargaAnticipos_Click(sender As Object, e As EventArgs)
If CveCliente > 0 Then
CargaAnticipos(CveCliente)
End If
End Sub
End Class