--FIX autorizaciones
This commit is contained in:
@@ -247,7 +247,7 @@ Partial Class Ventas_CatAutorizacionLimites
|
|||||||
Dim DiasVencidosAutorizacion As Integer = gvRow.DataKey("DiasVencidosAutorizacion").ToEntero()
|
Dim DiasVencidosAutorizacion As Integer = gvRow.DataKey("DiasVencidosAutorizacion").ToEntero()
|
||||||
|
|
||||||
If DiasVencidos > DiasVencidosAutorizacion Then
|
If DiasVencidos > DiasVencidosAutorizacion Then
|
||||||
Alert($"No se puede autorizar, los días vencidos del cliente son mayores a la autorización. Dias Vencidos: {DiasVencidos:N0}", TipoMensaje.MsgAdvertencia)
|
Alert($"No se puede autorizar, los días vencidos del cliente son mayores a la autorización. Dias Vencidos: {DiasVencidos:N0} . Dias autorizados. {DiasVencidosAutorizacion:N0}", TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
@@ -7635,23 +7635,7 @@ Partial Class Ventas
|
|||||||
Bloqueo = True
|
Bloqueo = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'SI ES AUTORIZACION DEBE PERMITIR GENERARLA
|
If Bloqueo AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
If Bloqueo Then
|
|
||||||
BtnEmitirImprimir.Visible = False
|
|
||||||
BtnsFacturar.Visible = False
|
|
||||||
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
|
|
||||||
BtnGenerarRemision.Visible = False
|
|
||||||
LnkPedido2SinFacturar.Visible = False
|
|
||||||
LnkCotizaciones.Visible = False
|
|
||||||
LnkOCs.Visible = False
|
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
|
||||||
TieneBloqueoPorCreditoVencimiento = 1
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
|
||||||
Dim Autorizacion As Integer = 0
|
Dim Autorizacion As Integer = 0
|
||||||
|
|
||||||
Dim ObjVentas As New ClsVentas
|
Dim ObjVentas As New ClsVentas
|
||||||
@@ -7672,11 +7656,28 @@ Partial Class Ventas
|
|||||||
|
|
||||||
'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
|
'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
|
||||||
If Autorizacion > 0 Then
|
If Autorizacion > 0 Then
|
||||||
BtnsFacturar.Visible = True
|
Bloqueo = False
|
||||||
TieneBloqueoPorCreditoVencimiento = 0
|
TieneBloqueoPorCreditoVencimiento = 0
|
||||||
|
Alert("El cliente tiene una autorización aprobada")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'SI ES AUTORIZACION DEBE PERMITIR GENERARLA
|
||||||
|
If Bloqueo Then
|
||||||
|
BtnEmitirImprimir.Visible = False
|
||||||
|
BtnsFacturar.Visible = False
|
||||||
|
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
|
||||||
|
BtnGenerarRemision.Visible = False
|
||||||
|
LnkPedido2SinFacturar.Visible = False
|
||||||
|
LnkCotizaciones.Visible = False
|
||||||
|
LnkOCs.Visible = False
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
|
TieneBloqueoPorCreditoVencimiento = 1
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
Else
|
Else
|
||||||
' el cliente tiene crédito disponible, no tiene bloqueo
|
' el cliente tiene crédito disponible, no tiene bloqueo
|
||||||
@@ -7912,35 +7913,53 @@ Partial Class Ventas
|
|||||||
Vta.Dispose()
|
Vta.Dispose()
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
Dim Autorizacion As Integer = 0
|
|
||||||
|
|
||||||
Dim ObjVentas As New ClsVentas
|
Dim BloquearCliente As Boolean = False
|
||||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then
|
|
||||||
Dim RowAutorizacion As DataRow = Nothing
|
'CREDITO NO SUFICIENTE
|
||||||
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
|
If Opcion = 3 Then
|
||||||
If TieneDiasVencidos Then
|
'Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
|
||||||
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
|
'If CreditoDispo < 0 AndAlso RBLPago.SelectedValue = "1" Then
|
||||||
Else
|
' BloquearCliente = True
|
||||||
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
|
'End If
|
||||||
|
BloquearCliente = True
|
||||||
|
'FACTURAS CON VENCIMIENTO
|
||||||
|
ElseIf Opcion = 2 Then
|
||||||
|
BloquearCliente = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
If BloquearCliente 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
|
End If
|
||||||
|
ObjVentas.Dispose()
|
||||||
|
|
||||||
If RowAutorizacion IsNot Nothing Then
|
'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
|
||||||
Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
|
If Opcion > 0 AndAlso Autorizacion <= 0 Then
|
||||||
|
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
||||||
|
BtnsFacturar.Visible = False
|
||||||
|
BtnGenerarRemision.Visible = False
|
||||||
|
BtnEmitirImprimir.Visible = False
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ClienteEsDistribuidor AndAlso Opcion.Contiene(2, 3) Then
|
||||||
|
TieneBloqueoPorCreditoVencimiento = 1
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
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
|
|
||||||
BtnEmitirImprimir.Visible = False
|
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ClienteEsDistribuidor AndAlso Opcion.Contiene(2, 3) Then
|
|
||||||
TieneBloqueoPorCreditoVencimiento = 1
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
Else
|
Else
|
||||||
If Opcion > 0 Then
|
If Opcion > 0 Then
|
||||||
|
|||||||
Reference in New Issue
Block a user