Mostrar las solicitudes de anticipo en autorizaciones
This commit is contained in:
@@ -62,6 +62,10 @@ 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()
|
||||
@@ -82,6 +86,11 @@ Partial Class Ventas_CatAutorizacionLimites
|
||||
End If
|
||||
ObjGral.Dispose()
|
||||
GvDatos.DataBind()
|
||||
|
||||
If DivAntNCIxC.Visible Then
|
||||
CargaAnticipos(CveCliente, FechaI, FechaF)
|
||||
End If
|
||||
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
@@ -367,4 +376,130 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user