-- Cambio de autorizaciones de anticipo por tabla.

--PA_Vta_ClienteAnticiposNCIxC
--PA_Vta_VentaAnticipoAutorizadoUpdate
--PA_Vta_IxCAnticipoAutorizadoUpdate
This commit is contained in:
2025-01-15 21:15:49 -07:00
parent 5c2b610579
commit 9e858f6833
5 changed files with 122 additions and 275 deletions

View File

@@ -62,10 +62,6 @@ Partial Class Ventas_CatAutorizacionLimites
DdlEstatus.SelectedValue = "0"
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
DivAntNCIxC.Visible = True
End If
UpModal.Update()
End Sub
Private Sub CargaDatos()
@@ -87,10 +83,6 @@ Partial Class Ventas_CatAutorizacionLimites
ObjGral.Dispose()
GvDatos.DataBind()
If DivAntNCIxC.Visible Then
CargaAnticipos(CveCliente, FechaI, FechaF)
End If
UpDatos.Update()
End Sub
@@ -225,6 +217,10 @@ Partial Class Ventas_CatAutorizacionLimites
'cuando es la modalidad 3, es autorización directa sobre la venta ya asociada a la solicitud.
If UsuarioActual.Empresa.Funcionalidad(595) = "3" Then CveEstatusAutorizacion = 2
If gvRow.DataKey("TipoDocumento") = "Anticipo" Then
CveEstatusAutorizacion = 1
End If
Dim Importe As Decimal = gvRow.DataKey("Importe").ToDecimal().RoundSQL(2)
'AUTORIZACION DE IMPORTE,
'el cliente limite de 500, y saldo de 501. autorización que puede autorizar no puede ser mayor a 49 ( limite * 1.% - Saldo)
@@ -376,130 +372,4 @@ Partial Class Ventas_CatAutorizacionLimites
Public Overrides Sub VerifyRenderingInServerForm(control As Control)
End Sub
#End Region
Private Sub CargaAnticipos(CveCliente As Integer, FechaI As DateTime, FechaF As DateTime)
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCAutorizaciones(CveCliente, UsuarioActual.CveEmpresa, FechaI, FechaF) Then
GVAnticipos.DataSource = ObjMovtos.DtResultados
End If
ObjMovtos.Dispose()
GVAnticipos.DataBind()
End Sub
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()
Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero()
Dim CveCliente = GvRow.DataKey("CveCliente").ToEntero()
If CveVenta > 0 OrElse CveIE > 0 Then
Dim Actualizo As Boolean = False
Using ObjVentas As New ClsVentas
If GvRow.DataKey("Tipo").Contiene("NC", "Ant") Then
If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, True) Then
Alert("El anticipo se autorizó correctamente")
Actualizo = True
End If
ElseIf GvRow.DataKey("Tipo").Contiene("IxC") Then
If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, True) Then
Alert("El anticipo se autorizó correctamente")
Actualizo = True
End If
End If
End Using
If Actualizo Then
Dim ObjEventoBitacora As New ClsOIEventos
ObjEventoBitacora.AddEventoBitacora($"El anticipo se autorizó correctamente. Folio: <b>{GvRow.DataKey("Folio")}</b>", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1)
ObjEventoBitacora.Dispose()
End If
CargaDatos()
End If
UpDatos.Update()
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()
Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero()
Dim CveCliente = GvRow.DataKey("CveCliente").ToEntero()
If CveVenta > 0 OrElse CveIE > 0 Then
Dim Actualizo As Boolean = False
Using ObjVentas As New ClsVentas
If GvRow.DataKey("Tipo").Contiene("NC", "Ant") Then
If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then
Alert("El anticipo se desautorizó correctamente")
Actualizo = True
End If
ElseIf GvRow.DataKey("Tipo").Contiene("IxC") Then
If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, False) Then
Alert("El anticipo se desautorizó correctamente")
Actualizo = True
End If
End If
End Using
If Actualizo Then
Dim ObjEventoBitacora As New ClsOIEventos
ObjEventoBitacora.AddEventoBitacora($"El anticipo se desautorizó correctamente. Folio: <b>{GvRow.DataKey("Folio")}</b>", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1)
ObjEventoBitacora.Dispose()
End If
CargaDatos()
End If
UpDatos.Update()
End Sub
Protected Sub GVAnticipos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAnticipos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim AnticipoAutorizado = CBool(e.Row.DBCampo("AnticipoAutorizado"))
If AnticipoAutorizado Then
e.Row.FCLabel("LblEstatus").CssClass = "badge badge-success"
Else
e.Row.FCLabel("LblEstatus").CssClass = "badge badge-danger"
End If
If e.Row.DataKey("CveIE").ToString().ToEntero() > 0 Then
e.Row.FCLiteral("LtlFactura").Text = String.Format("<a class=""Texto"" href=""/Bancos/IE.aspx?CveIE={0}"">{1}</a>", e.Row.DataKey("CveIE"), e.Row.DataKey("Folio"))
Else
e.Row.FCLiteral("LtlFactura").Text = String.Format("<a class=""Texto"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">{1}</a>", e.Row.DataKey("CveVenta"), e.Row.DataKey("Folio"))
End If
If UsuarioActual.TienePermisoProceso(379) Then
If e.Row.DBCampo("CveVenta").ToString().ToEntero() > 0 AndAlso e.Row.DBCampo("Tipo").ToString().Contiene("NC", "Ant") Then
If Not AnticipoAutorizado 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
If e.Row.DBCampo("CveIE").ToString().ToEntero() > 0 AndAlso e.Row.DBCampo("Tipo").ToString().Contiene("IxC") Then
If Not AnticipoAutorizado 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 Class