--FIX autorizaciones de NC

This commit is contained in:
2025-04-01 11:21:25 -07:00
parent 929f160a3d
commit 1d902f26b4

View File

@@ -10505,7 +10505,7 @@ Partial Class Ventas
End Sub
Private Sub VerificaAutorizacionEgs(Optional VerificarImportes As Boolean = True)
Private Sub VerificaAutorizacionEgs(Optional VerificarImportes As Boolean = True, Optional MostrarAlertas As Boolean = True)
Dim ImporteAutorizacion As Decimal = 0
Dim TipoAutorizacion As Integer = 0
@@ -10535,7 +10535,10 @@ Partial Class Ventas
CveAutorizacion = -1
If BloquearCredito Then
Alert($"El importe autorizado es insuficiente. Importe autorizado:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
If MostrarAlertas Then
Alert($"El importe autorizado es insuficiente. Importe autorizado:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
End If
Exit Sub
End If
End If
@@ -10543,7 +10546,10 @@ Partial Class Ventas
Else
CveAutorizacion = -1
Alert($"No se encontro una autorización de crédito.", TipoMensaje.MsgAdvertencia)
If MostrarAlertas Then
Alert($"No se encontro una autorización de crédito.", TipoMensaje.MsgAdvertencia)
End If
Exit Sub
End If
End Sub
@@ -31508,6 +31514,23 @@ Partial Class Ventas
Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False, Optional AplicoNCFacturaActual As Boolean = False, Optional TipoDoctoNC As String = "Egs")
Try
'VALIDACION DE AUTORIZACION PARA NC, POR AHORA SOLO BDH
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso AplicoNCFacturaActual AndAlso TipoDoctoNC = "Egs" Then
Dim PermiteAutorizacion = False
'SI NO ES GENERADA CON REMISIONES DE NC, UTILIZAR LA AUTORIZACION
If (ListaRemisionesNC Is Nothing OrElse ListaRemisionesNC.Count = 0) Then
PermiteAutorizacion = True
End If
If PermiteAutorizacion Then
VerificaAutorizacionEgs(VerificarImportes:=True, MostrarAlertas:=True)
If Me.CveAutorizacion <= 0 Then
Exit Sub
End If
End If
End If
Me.AplicaDocumentoNuevoNC = AplicaNuevoDocumento
Dim DrPS As DataRow = Nothing
@@ -40582,10 +40605,13 @@ Partial Class Ventas
RblRNCTipo_SelectedIndexChanged(RblRNCTipo, EventArgs.Empty)
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
VerificaAutorizacionEgs(VerificarImportes:=True)
If Me.CveAutorizacion <= 0 Then
Exit Sub
Else
TxtImportesRemisionesNC.Text = "0.00"
TxtNCImporte.Text = "0.00"
VerificaAutorizacionEgs(VerificarImportes:=True, MostrarAlertas:=False)
If Me.CveAutorizacion > 0 Then
Using ObjVentas As New ClsVentas
If ObjVentas.GetAutorizacion(Me.CveAutorizacion, UsuarioActual.CveEmpresa) Then
If ObjVentas.DtResultados.FiltroPrimeroValor("CveTipoVenta").ToEntero() > 0 Then
@@ -40595,7 +40621,12 @@ Partial Class Ventas
End If
End If
End Using
Else
DivTipoVentaAsingado.Visible = True
LblTipoVentaAsignado.Text = "Sin definir"
DdlNCPS.Enabled = True
End If
End If
RegistraScript("$('#ModalAplicarNC').modal('show');", "ModalNC")