--Cambios en autorizacion de anticipos

This commit is contained in:
2025-03-31 19:49:35 -07:00
parent 32ef9142e1
commit 419d6d2572
2 changed files with 11 additions and 30 deletions

View File

@@ -826,27 +826,13 @@ Public Class ClsVentas
Return Retorno
End Function
Public Function UpdateVentaAnticipoAutorizado(CveVenta As Integer, Autorizado As Boolean) As Boolean
Public Function UpdateAnticipoAutorizado(CveVenta As Integer, CveIE As Integer, Tipo As String, Autorizado As Boolean) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentaAnticipoAutorizadoUpdate")
DataAdapter("PA_Vta_AnticipoAutorizadoUpdate")
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 UpdateIxCAnticipoAutorizado(CveIE As Integer, Autorizado As Boolean) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_IxCAnticipoAutorizadoUpdate")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveIE", SqlDbType.Int).Value = CveIE
.Add("@Tipo", SqlDbType.VarChar).Value = Tipo
.Add("@Autorizado", SqlDbType.Bit).Value = Autorizado
End With
Try

View File

@@ -1156,18 +1156,13 @@ Partial Class Ventas_PVCobranza
If CveVenta > 0 OrElse CveIE > 0 Then
Dim Actualizo As Boolean = False
If Tipo.Contiene("NC", "Ant") Then
If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then
Actualizo = True
End If
ElseIf Tipo.Contiene("IxC") Then
If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, False) Then
Actualizo = True
End If
If ObjVentas.UpdateAnticipoAutorizado(CveVenta, CveIE, Tipo.Trim(), False) Then
Actualizo = True
End If
If Actualizo Then
Retorno = ObjEventoBitacora.AddEventoBitacora($"El anticipo se desautorizó correctamente. Folio: <b>{Folio}</b>", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveIE, -1, CveCliente, -1, -1, -1, -1, -1, CveVenta:=CveVenta)
Retorno = ObjEventoBitacora.AddEventoBitacora($"El anticipo se aplicó correctamente. Folio: <b>{Folio}</b>", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveIE, -1, CveCliente, -1, -1, -1, -1, -1, CveVenta:=CveVenta)
End If
End If
@@ -2279,7 +2274,7 @@ Partial Class Ventas_PVCobranza
Dim CveIE As Integer = gvr.DataKey("CveIE").ToEntero()
Dim ObjVta As New ClsVentas
If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, Saldo, 0, UsuarioActual.CveUsuario, 1, TipoDocumento:="Ant", DiasVencidos:=1, CveVenta:=CveVenta, CveIE:=CveIE) Then
If ObjVta.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, Saldo, CveEstatus:=0, CveUsuario:=UsuarioActual.CveUsuario, TipoAutorizacion:=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"
@@ -2381,9 +2376,9 @@ Partial Class Ventas_PVCobranza
Dim AnticipoAutorizado = CBool(e.Row.DBCampo("AnticipoAutorizado"))
If Not EsProduccion AndAlso UsuarioActual.CveRol = 1 Then
AnticipoAutorizado = True
End If
'If Not EsProduccion AndAlso UsuarioActual.CveRol = 1 Then
' AnticipoAutorizado = True
'End If
If UsuarioActual.Empresa.Funcionalidad(185) = "1" Then
If e.Row.DBCampo("Tipo").ToString().Contiene("NC", "Ant", "IxC") AndAlso Not AnticipoAutorizado Then