Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -524,6 +524,29 @@ Public Class ClsCompProveedores
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateProveedorLimiteCredito(CveProveedor As Integer, LimiteCredito As Decimal, PlazoPago As Integer, UsaLimiteCredito As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Comp_ProveedorLimiteCreditoUpdate")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
|
||||
.Add("@LimiteCredito", SqlDbType.Money).Value = LimiteCredito
|
||||
.Add("@PlazoPago", SqlDbType.Int).Value = PlazoPago
|
||||
.Add("@UsaLimiteCredito", SqlDbType.Bit).Value = UsaLimiteCredito
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al Actualizar el limite de crédito del Proveedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateProveedorPagoElectronico(EstatusPagoElectronico As Boolean, CveUsuario As Integer, CveProveedor As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Comp_ProveedorUpdatePagoElectronico")
|
||||
|
||||
@@ -4139,8 +4139,10 @@ Partial Class Compras_Proveedores
|
||||
End Sub
|
||||
|
||||
Private Sub LnkAddParametros_Click(sender As Object, e As EventArgs) Handles LnkAddParametros.Click
|
||||
|
||||
LblLimiteCredito.Text = TxtLimiteCredito.Text.FormatoNumero
|
||||
LblPlazoCobranza.Text = TxtPlazoCobranza.Text
|
||||
|
||||
If LblLimiteCredito.Text.ToDouble > 0 Then
|
||||
TdSaldo.Visible = True
|
||||
TdSaldo2.Visible = True
|
||||
@@ -4149,9 +4151,24 @@ Partial Class Compras_Proveedores
|
||||
TdSaldo.Visible = False
|
||||
TdSaldo2.Visible = False
|
||||
End If
|
||||
|
||||
If CveProveedor > 0 Then
|
||||
Dim ObjPro As New ClsCompProveedores
|
||||
If ObjPro.UpdateProveedorLimiteCredito(CveProveedor, TxtLimiteCredito.Text.ToDecimal, TxtPlazoCobranza.Text.ToEntero, ChkUsaLimiteCredito.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Limite de crédito modificado correctamente.")
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddParametros"))
|
||||
End If
|
||||
ObjPro.Dispose()
|
||||
Else
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddParametros"))
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
UPPCxP.Update()
|
||||
UpParametros.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddParametros"))
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub LnkCuentasBancarias_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancarias.Click
|
||||
|
||||
@@ -247,7 +247,7 @@ Partial Class Ventas_CatAutorizacionLimites
|
||||
Dim DiasVencidosAutorizacion As Integer = gvRow.DataKey("DiasVencidosAutorizacion").ToEntero()
|
||||
|
||||
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
|
||||
End If
|
||||
|
||||
|
||||
@@ -7635,23 +7635,7 @@ Partial Class Ventas
|
||||
Bloqueo = True
|
||||
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
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
If Bloqueo AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
Dim Autorizacion As Integer = 0
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
@@ -7672,11 +7656,28 @@ Partial Class Ventas
|
||||
|
||||
'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
|
||||
If Autorizacion > 0 Then
|
||||
BtnsFacturar.Visible = True
|
||||
Bloqueo = False
|
||||
TieneBloqueoPorCreditoVencimiento = 0
|
||||
Alert("El cliente tiene una autorización aprobada")
|
||||
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
|
||||
' el cliente tiene crédito disponible, no tiene bloqueo
|
||||
@@ -7890,6 +7891,13 @@ Partial Class Ventas
|
||||
If (ValidaRemision AndAlso DdlTipoComprobante.SelectedValue = "Rem") AndAlso RBLPago.SelectedValue = "1" Then
|
||||
ValidaCondicionesCredito = True
|
||||
End If
|
||||
Else
|
||||
'SI ES VENTA NUEVA VALIDA AUNQUE NO PERMITA CREDITO
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") Then
|
||||
ValidaCondicionesCredito = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If ValidaCondicionesCredito Then
|
||||
@@ -7905,34 +7913,53 @@ Partial Class Ventas
|
||||
Vta.Dispose()
|
||||
|
||||
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")
|
||||
Dim BloquearCliente As Boolean = False
|
||||
|
||||
'CREDITO NO SUFICIENTE
|
||||
If Opcion = 3 Then
|
||||
'Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
|
||||
'If CreditoDispo < 0 AndAlso RBLPago.SelectedValue = "1" Then
|
||||
' BloquearCliente = True
|
||||
'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
|
||||
ObjVentas.Dispose()
|
||||
|
||||
If RowAutorizacion IsNot Nothing Then
|
||||
Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
|
||||
'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
|
||||
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
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ClienteEsDistribuidor AndAlso Opcion.Contiene(2, 3) Then
|
||||
TieneBloqueoPorCreditoVencimiento = 1
|
||||
End If
|
||||
End If
|
||||
|
||||
Else
|
||||
If Opcion > 0 Then
|
||||
@@ -18161,18 +18188,18 @@ 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 = True
|
||||
TrVistaPrevia.Visible = True
|
||||
BtnEmitirImprimir.Visible = TieneBloqueoPorCreditoVencimiento = 0
|
||||
TrVistaPrevia.Visible = TieneBloqueoPorCreditoVencimiento = 0
|
||||
Else
|
||||
If LblCliente.Text <> "Cliente" And Not EstatusCliente Then
|
||||
Alert("El Cliente seleccionado no esta activo", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
If Not CveEmpresaCRM > 0 Then
|
||||
BtnEmitirImprimir.Visible = EstatusCliente
|
||||
TrVistaPrevia.Visible = EstatusCliente
|
||||
BtnEmitirImprimir.Visible = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0
|
||||
TrVistaPrevia.Visible = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0
|
||||
Else
|
||||
BtnEmitirImprimir.Visible = True
|
||||
TrVistaPrevia.Visible = True
|
||||
BtnEmitirImprimir.Visible = TieneBloqueoPorCreditoVencimiento = 0
|
||||
TrVistaPrevia.Visible = TieneBloqueoPorCreditoVencimiento = 0
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -29563,6 +29590,11 @@ Partial Class Ventas
|
||||
UpCliente.Update()
|
||||
End If
|
||||
|
||||
'SI NO ESTA VISIBLE, HABILITAR PARA GENERAR LA NC
|
||||
If Not BtnEmitirImprimir.Visible Then
|
||||
BtnEmitirImprimir.Visible = True
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al aplicar NC", ex)
|
||||
End Try
|
||||
|
||||
Reference in New Issue
Block a user