diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb
index c48d73aee..68de58744 100644
--- a/App_Code/ClsMovimientos.vb
+++ b/App_Code/ClsMovimientos.vb
@@ -521,6 +521,27 @@ Public Class ClsMovimientos
OnError("Ocurrió un error al consultar los Anticipos del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
+ Return Retorno
+ End Function
+
+ Public Function GetAnticiposNCIxCAutorizaciones(CveCliente As Integer, CveEmpresa As Integer, FechaI As DateTime, FechaF As DateTime) As Boolean
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Vta_ClienteAnticiposNCIxCAutorizaciones")
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveCliente", SqlDbType.Int).Value = CveCliente
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@FechaI", SqlDbType.DateTime).Value = FechaI
+ .Add("@FechaF", SqlDbType.DateTime).Value = FechaF
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As SqlException
+ OnError("Ocurrió un error al consultar los autorizaciones de anticipos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+
Return Retorno
End Function
Public Function GetRemisionesNCCliente(CveCliente As Integer, MostarDetalle As Boolean, Optional CveMoneda As Integer = -1, Optional CveClienteSucursal As Integer = -1) As Boolean
diff --git a/Ventas/CatAutorizacionLimites.aspx b/Ventas/CatAutorizacionLimites.aspx
index f935dd655..43d8496b1 100644
--- a/Ventas/CatAutorizacionLimites.aspx
+++ b/Ventas/CatAutorizacionLimites.aspx
@@ -104,48 +104,119 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <%-- 30--%>
-
-
-
-
-
-
-
- <%-- 45--%>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ Solicitudes de autorizaciones
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%-- 30--%>
+
+
+
+
+
+
+
+ <%-- 45--%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Anticipos, notas de crédito e ingresos por comprobar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ventas/CatAutorizacionLimites.aspx.vb b/Ventas/CatAutorizacionLimites.aspx.vb
index 65c8f7c49..fa753e9fe 100644
--- a/Ventas/CatAutorizacionLimites.aspx.vb
+++ b/Ventas/CatAutorizacionLimites.aspx.vb
@@ -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:
{GvRow.DataKey("Folio")}", "", 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:
{GvRow.DataKey("Folio")}", "", 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("
{1}", e.Row.DataKey("CveIE"), e.Row.DataKey("Folio"))
+ Else
+ e.Row.FCLiteral("LtlFactura").Text = String.Format("
{1}", 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