diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 984edaf7c..583e7247d 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -7647,36 +7647,40 @@ Partial Class Ventas '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 (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 - Dim ObjVentas As New ClsVentas - If ObjVentas.ObtenerCreditoRestante(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Then - If ObjVentas.DtResultados.Rows.Count > 0 Then + If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then + Dim ObjVentas As New ClsVentas - 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 + 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 - 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 + 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 - Else ObjVentas.Dispose() - Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError) - Exit Sub End If - ObjVentas.Dispose() + 'End If End If