Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -566,7 +566,13 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
}
|
||||
else
|
||||
{
|
||||
//SI REGISTRA SALIDA DE ALMACÉN EN AUTOMÁTICO Y ES DEVOLUCION QUE REALIZE EL MOVMIENTO DE SALIDA DE ALMACEN
|
||||
if (UsuarioActual.Empresa.Funcionalidad(567) == "1" && factura.TipoDocto == "Dev" && factura.SaldoAlmacen != 0)
|
||||
{
|
||||
factura.RealizarDevolucionAlmacen = true;
|
||||
}
|
||||
retorno = factura.EjecutarCancelacionPendiente(CveEstatus, CancelacionFecha, CancelacionAcuse);
|
||||
|
||||
}
|
||||
|
||||
return retorno;
|
||||
|
||||
@@ -7529,7 +7529,7 @@ Partial Class Ventas
|
||||
Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595)
|
||||
|
||||
'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO
|
||||
If (Not UsuarioActual.Empresa.Funcionalidad(702).Contiene("1", "2")) AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then
|
||||
If (Not UsuarioActual.Empresa.Funcionalidad(702).Contiene("1")) AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then
|
||||
RBLPago.SelectedValue = "2"
|
||||
RBLPago.Items(0).Enabled = False
|
||||
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||
@@ -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
|
||||
@@ -7977,11 +7981,40 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
UPPCreditoDisponible.Update()
|
||||
|
||||
'SOLO VERIFICA VENCIMIENTOS
|
||||
If UsuarioActual.Empresa.Funcionalidad(702).Contiene("2") Then
|
||||
|
||||
Dim ValidaCliente As Boolean = False
|
||||
|
||||
If (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") AndAlso (Me.CveVenta <= 0 OrElse EsCreaApartirDe)) OrElse ((DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso (Me.CveVenta > 0 AndAlso Not EsCreaApartirDe))) Then
|
||||
ValidaCliente = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso (Me.CveCliente = UsuarioActual.Empresa.Funcionalidad(714).ToEntero()) Then
|
||||
ValidaCliente = False
|
||||
End If
|
||||
|
||||
'SI ES FACTURA, REMISION o FACTURACION DE COTIZACIONES
|
||||
If ValidaCliente 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: <br> <br> {0}", Vta.SerieVenta)
|
||||
Vta.Dispose()
|
||||
|
||||
If Opcion = 2 Then
|
||||
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
||||
BtnEmitirImprimir.Visible = False
|
||||
BtnsFacturar.Visible = False
|
||||
BtnGenerarRemision.Visible = False
|
||||
TieneBloqueoPorCreditoVencimiento = 1
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
'Puede hacer pedido
|
||||
If CveVenta <= 0 Then
|
||||
If Not UsuarioActual.TienePermisoProceso(177) And Not EsVentaMedica Then
|
||||
@@ -9626,7 +9659,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 +9667,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 +9693,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 +9747,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: <br> <br> {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 +18165,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)
|
||||
|
||||
Reference in New Issue
Block a user