diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index f7f66754d..004986c96 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -7664,7 +7664,9 @@ Partial Class Ventas
'SI ES AUTORIZACION DEBE PERMITIR GENERARLA
If Bloqueo Then
- BtnEmitirImprimir.Visible = False
+ If DdlTipoComprobante.SelectedValue <> "Cot" Then
+ BtnEmitirImprimir.Visible = False
+ End If
BtnsFacturar.Visible = False
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
BtnGenerarRemision.Visible = False
@@ -7952,7 +7954,9 @@ Partial Class Ventas
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
BtnsFacturar.Visible = False
BtnGenerarRemision.Visible = False
- BtnEmitirImprimir.Visible = False
+ If DdlTipoComprobante.SelectedValue <> "Cot" Then
+ BtnEmitirImprimir.Visible = False
+ End If
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ClienteEsDistribuidor AndAlso Opcion.Contiene(2, 3) Then
TieneBloqueoPorCreditoVencimiento = 1
@@ -9626,7 +9630,7 @@ Partial Class Ventas
Me.CveAutorizacion = -1
'SI ES A CREDITO DEBE VERIFICAR SI TIENE AUTORIZACIONES
- If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveCliente > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs") AndAlso RBLPago.SelectedValue = "1" Then
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveCliente > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing") AndAlso RBLPago.SelectedValue = "1" Then
Dim TipoDocumentoAutorizacion As String = ""
Dim ImporteAutorizacion As Decimal = 0
Dim TipoAutorizacion As Integer = 0
@@ -9634,13 +9638,13 @@ Partial Class Ventas
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
Dim ObjVentas As New ClsVentas
Try
- If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, DdlTipoDocto.SelectedValue, CveEstatus:=1) Then
+ If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, "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='{DdlTipoComprobante.SelectedValue}'", Orderby:="Importe DESC")
+ 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='{DdlTipoComprobante.SelectedValue}'", Orderby:="Importe DESC")
+ RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
End If
If RowAutorizacion IsNot Nothing Then
@@ -9660,11 +9664,11 @@ Partial Class Ventas
If TipoDocumentoAutorizacion = "Ing" Then
If TipoAutorizacion = 1 Then
- If TieneDiasVencidos Then
- CveAutorizacion = -1
- Alert($"El crédito no esta autorizado. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
+ 'If TieneDiasVencidos Then
+ ' CveAutorizacion = -1
+ ' Alert($"El crédito no esta autorizado. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
+ ' Exit Sub
+ 'End If
If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
Dim BloquearCredito As Boolean = True
@@ -9714,79 +9718,23 @@ Partial Class Ventas
End If
End If
- If TieneDiasVencidos AndAlso DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then
- CveAutorizacion = -1
- Alert($"El crédito no esta autorizado. No tiene autorización para generar notas de crédito. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
+ 'If TieneDiasVencidos AndAlso DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then
+ ' CveAutorizacion = -1
+ ' Alert($"El crédito no esta autorizado. No tiene autorización para generar notas de crédito. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
+ ' Exit Sub
+ 'End If
- If TipoDocumentoAutorizacion = "Egs" Then
- If TipoAutorizacion = 1 Then
- If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
- CveAutorizacion = -1
- Alert($"El crédito autorizado es insuficiente. Crédito Disponible:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
- End If
- End If
+ 'If TipoDocumentoAutorizacion = "Egs" Then
+ ' If TipoAutorizacion = 1 Then
+ ' If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
+ ' CveAutorizacion = -1
+ ' Alert($"El crédito autorizado es insuficiente. Crédito Disponible:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
+ ' Exit Sub
+ ' End If
+ ' End If
+ 'End If
End If
- 'SI TIENE LINEA ADICIONAL NO VERIFICAR LIMITE DE CREDITO
- 'SI NO TIENE AUTORIZACION VERIFICAR LIMITE DE CREDITO Y CANDADOS DE VENTA
- 'No exceder el limite de credito, Si no tiene contrato limita el credito, si tiene no hace nada. Si no tiene remisiones tampoco hace nada.
- 'If DdlLineaAdicional.SelectedValue.ToEntero() <= 0 AndAlso Me.CveAutorizacion <= 0 AndAlso (Not CveContrato > 0 Or CveContratoTipo.Contiene(28)) AndAlso (Not NuevaFactura = 1) AndAlso RBLPago.SelectedValue = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso RemisionesLista.Count <= 0 AndAlso TxtTotal.Text.ToDecimal > 0 AndAlso Not CvePedidoA > 0 Then
- ' 'If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then
-
- ' If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then
- ' Dim ObjVentas As New ClsVentas
-
- ' If ObjVentas.ObtenerCreditoRestante(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Then
- ' If ObjVentas.DtResultados.Rows.Count > 0 Then
-
- ' If DdlSucursalCliente.SelectedValue.ToEntero() > 0 Then
- ' If ObjVentas.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then
- ' ObjVentas.Dispose()
- ' Alert("Se está excediendo el límite de credito permitido de la Sucursal del Cliente.", TipoMensaje.MsgInformacion)
- ' Exit Sub
- ' End If
- ' Else
- ' If ObjVentas.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then
- ' ObjVentas.Dispose()
- ' Alert("Se está excediendo el límite de credito permitido del Cliente.", TipoMensaje.MsgInformacion)
- ' Exit Sub
- ' End If
- ' End If
-
- ' Else
- ' ObjVentas.Dispose()
- ' Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError)
- ' Exit Sub
- ' End If
- ' Else
- ' ObjVentas.Dispose()
- ' Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError)
- ' Exit Sub
- ' End If
- ' ObjVentas.Dispose()
-
- ' 'VERIFICA SI TIENE BLOQUEO POR DIAS VENCIDOS
- ' If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
- ' Dim Vta As New ClsVentas
- ' Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa, TipoVerificacion:=2)
- ' Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:
{0}", Vta.SerieVenta)
- ' Vta.Dispose()
-
- ' If Opcion = 2 Then
- ' Alert(OpcionMsg, TipoMensaje.MsgError)
- ' Exit Sub
- ' End If
- ' End If
-
- ' End If
-
- ' 'End If
- 'End If
-
'VALIDAR LINEAS ADICIONALES
If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then
'VERIFICA QUE LA CATEGORIA DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL
@@ -18188,8 +18136,8 @@ Partial Class Ventas
'VALIDA ESTATUS CLIENTE - SOLO SE PUEDE USAR EL CLIENTE PARA COTIZAR EN CASO DE ESTAR INACTIVO
If EsCreaApartirDe OrElse ModalidadEdicion OrElse CveVenta <= 0 Then
If DdlTipoComprobante.SelectedValue.Contiene("Cot", "DPe") Or TipoContrato >= 0 Then 'SI VIENE DE PEDIDO DE AF DESDE CONTRATO NO BLOQUEA CUANDO EL CLIENTE ESTA INACTIVO
- BtnEmitirImprimir.Visible = TieneBloqueoPorCreditoVencimiento = 0
- TrVistaPrevia.Visible = TieneBloqueoPorCreditoVencimiento = 0
+ BtnEmitirImprimir.Visible = True
+ TrVistaPrevia.Visible = True
Else
If LblCliente.Text <> "Cliente" And Not EstatusCliente Then
Alert("El Cliente seleccionado no esta activo", TipoMensaje.MsgAdvertencia)