From 9e858f68339444e5eeab7cda1c132825235990b9 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 15 Jan 2025 21:15:49 -0700 Subject: [PATCH] -- Cambio de autorizaciones de anticipo por tabla. --PA_Vta_ClienteAnticiposNCIxC --PA_Vta_VentaAnticipoAutorizadoUpdate --PA_Vta_IxCAnticipoAutorizadoUpdate --- Ventas/CatAutorizacionLimites.aspx | 50 +--------- Ventas/CatAutorizacionLimites.aspx.vb | 138 +------------------------- Ventas/Clientes.aspx | 4 +- Ventas/Clientes.aspx.vb | 134 ++++++++++++------------- Ventas/PVCobranza.aspx.vb | 71 ++++++++----- 5 files changed, 122 insertions(+), 275 deletions(-) diff --git a/Ventas/CatAutorizacionLimites.aspx b/Ventas/CatAutorizacionLimites.aspx index 43d8496b1..141f85fc6 100644 --- a/Ventas/CatAutorizacionLimites.aspx +++ b/Ventas/CatAutorizacionLimites.aspx @@ -123,7 +123,7 @@
- @@ -169,54 +169,6 @@
-
-
-
-
- Anticipos, notas de crédito e ingresos por comprobar -
-
-
-
-
- " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
- diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 3341f52e7..a216b96a8 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -1946,9 +1946,9 @@ Partial Class Clientes End If ObjMovtos.Dispose() - If UsuarioActual.Empresa.Funcionalidad(185) = "1" AndAlso UsuarioActual.TienePermisoProceso(379) Then - GVAnticipos.Columns(7).Visible = True - End If + 'If UsuarioActual.Empresa.Funcionalidad(185) = "1" AndAlso UsuarioActual.TienePermisoProceso(379) Then + ' GVAnticipos.Columns(7).Visible = True + 'End If GVAnticipos.DataBind() GVAnticiposHistorial.DataBind() @@ -10753,82 +10753,82 @@ 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() - Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero() + '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() - If CveVenta > 0 OrElse CveIE > 0 Then - Dim Actualizo As Boolean = False + ' 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 + ' 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 - If ObjEventoBitacora.AddEventoBitacora($"El anticipo se autorizó correctamente. Folio: {GvRow.DataKey("Folio")}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then - GvEB.DataSource = ObjEventoBitacora.DtResultados - End If - ObjEventoBitacora.Dispose() - GvEB.DataBind() + ' If Actualizo Then + ' Dim ObjEventoBitacora As New ClsOIEventos + ' If ObjEventoBitacora.AddEventoBitacora($"El anticipo se autorizó correctamente. Folio: {GvRow.DataKey("Folio")}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then + ' GvEB.DataSource = ObjEventoBitacora.DtResultados + ' End If + ' ObjEventoBitacora.Dispose() + ' GvEB.DataBind() - UPEventoBitacora.Update() - CargaEventoBitacora() - End If + ' UPEventoBitacora.Update() + ' CargaEventoBitacora() + ' End If - End If + ' End If - CargaAnticipos() - End Sub + ' CargaAnticipos() + '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() + '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() - 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 - CargaAnticipos() + ' 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 + ' CargaAnticipos() - If Actualizo Then - Dim ObjEventoBitacora As New ClsOIEventos - If ObjEventoBitacora.AddEventoBitacora($"El anticipo se desautorizó correctamente. Folio: {GvRow.DataKey("Folio")}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then - GvEB.DataSource = ObjEventoBitacora.DtResultados - End If - ObjEventoBitacora.Dispose() - GvEB.DataBind() + ' If Actualizo Then + ' Dim ObjEventoBitacora As New ClsOIEventos + ' If ObjEventoBitacora.AddEventoBitacora($"El anticipo se desautorizó correctamente. Folio: {GvRow.DataKey("Folio")}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then + ' GvEB.DataSource = ObjEventoBitacora.DtResultados + ' End If + ' ObjEventoBitacora.Dispose() + ' GvEB.DataBind() - UPEventoBitacora.Update() - CargaEventoBitacora() - End If + ' UPEventoBitacora.Update() + ' CargaEventoBitacora() + ' End If - End If - End Sub + ' End If + 'End Sub End Class diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 3d6b8452f..04ad5ce26 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -25,6 +25,18 @@ Partial Class Ventas_PVCobranza End Set End Property + Private Property CveVendedor As Integer + Get + If ViewState("CveVendedor") Is Nothing Then + ViewState("CveVendedor") = -1 + End If + Return ViewState("CveVendedor").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveVendedor") = value + End Set + End Property + Private Property CveVentaCancelacion As Integer Get If ViewState("CveVentaCancelacion") Is Nothing Then @@ -970,6 +982,8 @@ Partial Class Ventas_PVCobranza LtlTipoAnticipo.Text = "" HdnTipoAmortizacion.Value = "" CveCliente = -1 + CveVendedor = -1 + If TmpDTAnticiposNCIxCCliente IsNot Nothing Then TmpDTAnticiposNCIxCCliente.Clear() @@ -1959,17 +1973,16 @@ Partial Class Ventas_PVCobranza DdlTipoAmortizacionAnticipo_SelectedIndexChanged(DdlTipoAmortizacionAnticipo, EventArgs.Empty) End If - If CveCliente <= 0 Then - Dim DbRowVenta As DataRow = Nothing - Dim ObjVentas As New ClsVentas - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then - DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("") - End If - ObjVentas.Dispose() + Dim DbRowVenta As DataRow = Nothing + Dim ObjVentas As New ClsVentas + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then + DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("") + End If + ObjVentas.Dispose() - If DbRowVenta IsNot Nothing Then - CveCliente = DbRowVenta("CveCliente").ToString().ToEntero() - End If + If DbRowVenta IsNot Nothing Then + CveCliente = DbRowVenta("CveCliente").ToString().ToEntero() + CveVendedor = DbRowVenta("CveVendedor").ToString().ToEntero() End If If CveCliente > 0 Then @@ -2125,6 +2138,19 @@ Partial Class Ventas_PVCobranza End If End If + Dim CveVenta As Integer = gvr.DataKey("CveVenta").ToEntero() + Dim CveIE As Integer = gvr.DataKey("CveIE").ToEntero() + + Dim ObjVta As New ClsVentas + If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, gvr.DataKey("CveCliente").ToEntero(), CveVendedor, Importe, 0, UsuarioActual.CveUsuario, 1, TipoDocumento:="Ant", DiasVencidos:=1, CveVenta:=CveVenta, CveIE:=CveIE) Then + Dim msgAlert = "La autorización se agregó correctamente." + If EnvioMsg Then + msgAlert = $"{msgAlert} Se envió una notificación de autorización a los usuarios" + End If + Alert(msgAlert, TipoMensaje.MsgInformacion) + End If + ObjVta.Dispose() + UpAnticipos.Update() End Sub @@ -2291,20 +2317,19 @@ Partial Class Ventas_PVCobranza DivConceptoNC.Visible = False End If - If CveCliente <= 0 Then - Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero - Dim DbRowVenta As DataRow = Nothing - Dim ObjVentas As New ClsVentas - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then - DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("") - End If - ObjVentas.Dispose() - - If DbRowVenta IsNot Nothing Then - CveCliente = DbRowVenta("CveCliente").ToString().ToEntero() - End If - + Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero + Dim DbRowVenta As DataRow = Nothing + Dim ObjVentas As New ClsVentas + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("") End If + ObjVentas.Dispose() + + If DbRowVenta IsNot Nothing Then + CveCliente = DbRowVenta("CveCliente").ToString().ToEntero() + CveVendedor = DbRowVenta("CveVendedor").ToString().ToEntero() + End If + If CveCliente > 0 Then CargaAnticipos(CveCliente)