diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index c42c53288..648e92ba4 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -6602,6 +6602,30 @@ Partial Class Ventas
LnkOCs.Visible = False
End If
+ If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
+ Dim Autorizacion As Integer = 0
+
+ Dim ObjVentas As New ClsVentas
+ If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then
+ Dim RowAutorizacion As DataRow = Nothing
+ 'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
+ If TieneDiasVencidos Then
+ RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
+ Else
+ RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
+ End If
+
+ If RowAutorizacion IsNot Nothing Then
+ Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
+ End If
+ End If
+ ObjVentas.Dispose()
+
+ 'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
+ If Autorizacion > 0 Then
+ BtnsFacturar.Visible = True
+ End If
+ End If
Else
@@ -6620,6 +6644,32 @@ Partial Class Ventas
DdlTipoComprobante.SelectedValueExistInsert("Cot", "Cotización")
End If
TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza)).ToShortDateString
+
+ If EsCotizacion AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
+ Dim Autorizacion As Integer = 0
+
+ Dim ObjVentas As New ClsVentas
+ If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then
+ Dim RowAutorizacion As DataRow = Nothing
+ 'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
+ If TieneDiasVencidos Then
+ RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
+ Else
+ RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
+ End If
+
+ If RowAutorizacion IsNot Nothing Then
+ Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
+ End If
+ End If
+ ObjVentas.Dispose()
+
+ 'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
+ If Autorizacion > 0 Then
+ BtnsFacturar.Visible = True
+ End If
+ End If
+
End If
@@ -6753,10 +6803,39 @@ Partial Class Ventas
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:
{0}", Vta.SerieVenta)
Vta.Dispose()
- If Opcion > 0 Then
- Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
- BtnsFacturar.Visible = False
- BtnGenerarRemision.Visible = False
+
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
+ Dim Autorizacion As Integer = 0
+
+ Dim ObjVentas As New ClsVentas
+ If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then
+ Dim RowAutorizacion As DataRow = Nothing
+ 'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
+ If TieneDiasVencidos Then
+ RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
+ Else
+ RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
+ End If
+
+ If RowAutorizacion IsNot Nothing Then
+ Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
+ End If
+ End If
+ ObjVentas.Dispose()
+
+ 'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
+ If Opcion > 0 AndAlso Autorizacion <= 0 Then
+ Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
+ BtnsFacturar.Visible = False
+ BtnGenerarRemision.Visible = False
+ End If
+
+ Else
+ If Opcion > 0 Then
+ Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
+ BtnsFacturar.Visible = False
+ BtnGenerarRemision.Visible = False
+ End If
End If
End If
End If