Autorizaciones por importe en NC, cargar metodos del pago al editar remision o refacturar
This commit is contained in:
@@ -5307,13 +5307,7 @@ Partial Class Ventas
|
||||
Private Sub CargaMetodosPago()
|
||||
|
||||
'FACTURACION 3.3
|
||||
|
||||
'No puede asignar PUE como método de pago
|
||||
If UsuarioActual.TienePermisoProceso(326) Then
|
||||
DdlMetodoPago33.DataSource = GlobalDTVtaMetodoPago.FiltraParametros("CveMetodoPago <> 1")
|
||||
Else
|
||||
DdlMetodoPago33.DataSource = GlobalDTVtaMetodoPago
|
||||
End If
|
||||
DdlMetodoPago33.DataSource = GlobalDTVtaMetodoPago
|
||||
|
||||
DdlMetodoPago33.DataBind()
|
||||
DdlMetodoPago33.SelectedValueExist("3")
|
||||
@@ -5658,7 +5652,7 @@ Partial Class Ventas
|
||||
|
||||
Me.CveFormaPago33Cliente = ObjCliente.CveFormaPago33
|
||||
|
||||
If (CveVenta <= 0 AndAlso CveCotizacion <= 0) Or EsCreaApartirDe Or NuevaFactura = 1 Then
|
||||
If (CveVenta <= 0 AndAlso CveCotizacion <= 0) Or EsCreaApartirDe Or NuevaFactura = 1 OrElse ModalidadEdicion Then
|
||||
'CveMetodoPagoCliente = ObjCliente.CveMetodoPago
|
||||
|
||||
|
||||
@@ -5754,16 +5748,13 @@ Partial Class Ventas
|
||||
ViewState("AplicaFord") = ObjCliente.AplicaFord
|
||||
TxtFordGSDB.Text = ObjCliente.Ford_GSDB
|
||||
|
||||
'SELECIONAMOS VENDEDOR - SI ESTA EN MODO EDICIÓN SE QUEDA EL VENDEDOR ORIGINAL
|
||||
If Not ModalidadEdicion Then
|
||||
If ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero() > 0 Then
|
||||
DdlVendedor.SelectedValueExist(ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero())
|
||||
End If
|
||||
If ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero() > 0 Then
|
||||
DdlVendedor.SelectedValueExist(ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero())
|
||||
End If
|
||||
|
||||
'SI EL CLIENTE NO TIENE VENDEDOR SELECCIONAMOS EL DEL USUARIO
|
||||
If Not DdlVendedor.SelectedValue.ToEntero() > 0 Then
|
||||
DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString())
|
||||
End If
|
||||
'SI EL CLIENTE NO TIENE VENDEDOR SELECCIONAMOS EL DEL USUARIO
|
||||
If Not DdlVendedor.SelectedValue.ToEntero() > 0 Then
|
||||
DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString())
|
||||
End If
|
||||
|
||||
If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then
|
||||
@@ -6174,6 +6165,7 @@ Partial Class Ventas
|
||||
ObjVentas.Dispose()
|
||||
End If
|
||||
|
||||
'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO
|
||||
If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso Me.PermiteCredito = False AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1 Then
|
||||
RBLPago.SelectedValue = "2"
|
||||
RBLPago.Items(0).Enabled = False
|
||||
@@ -6310,17 +6302,27 @@ Partial Class Ventas
|
||||
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
Else
|
||||
'este codigo no es temporal
|
||||
If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
|
||||
If UsuarioActual.CveEmpresa = 140 Then
|
||||
LnkSolicitarCredito.Visible = True
|
||||
DdlTipoAutorizacion.SelectedValueExist("1")
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
|
||||
RBLPago.SelectedValue = "2"
|
||||
RBLPago.Items(0).Enabled = False
|
||||
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||
UPCondicionesPago.Update()
|
||||
Else
|
||||
'este codigo no es temporal
|
||||
If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
|
||||
If UsuarioActual.CveEmpresa = 140 Then
|
||||
LnkSolicitarCredito.Visible = True
|
||||
DdlTipoAutorizacion.SelectedValueExist("1")
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
UPPCreditoDisponible.Update()
|
||||
'Si tiene credito disponible, Verificar limites de (verificar candados de venta, remisiones sin facturar, facturas que no tengan vencidas)
|
||||
ElseIf UsuarioActual.Empresa.Funcionalidad(597) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso CveVenta > 0 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Pd2", "Cot") Or (DdlTipoComprobante.SelectedValue = "Rem" And ModalidadEdicion And ViewState("CveClienteAnterior").ToString().ToEntero() > 0 And LblRFC.Text.Trim <> "XAXX010101000")) Then
|
||||
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
|
||||
If CreditoDispo > 0 Then
|
||||
@@ -7898,7 +7900,13 @@ Partial Class Ventas
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Try
|
||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, CveEstatus:=1) Then
|
||||
Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='{DdlTipoComprobante.SelectedValue}'", Orderby:="TipoAutorizacion")
|
||||
Dim RowAutorizacion As DataRow = Nothing
|
||||
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
|
||||
If TieneDiasVencidos Then
|
||||
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 2 AND CveVenta IS NULL AND CveTipoDocumento='{DdlTipoComprobante.SelectedValue}'")
|
||||
Else
|
||||
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='{DdlTipoComprobante.SelectedValue}'", Orderby:="Importe DESC")
|
||||
End If
|
||||
|
||||
If RowAutorizacion IsNot Nothing Then
|
||||
TipoDocumentoAutorizacion = RowAutorizacion("CveTipoDocumento").ToString()
|
||||
@@ -7938,12 +7946,22 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then
|
||||
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.", TipoMensaje.MsgAdvertencia)
|
||||
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
|
||||
|
||||
End If
|
||||
|
||||
EmitirImprimirNew(TipoDoctoViejo)
|
||||
@@ -31687,15 +31705,29 @@ Partial Class Ventas
|
||||
DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1
|
||||
UpModalSolicitud.Update()
|
||||
End Sub
|
||||
'Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged
|
||||
' Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString()
|
||||
' Select Case TipoDocto
|
||||
' Case "Ing"
|
||||
' DivAutorizacion.Visible = True
|
||||
' DivImporteSolicitud.Visible = True
|
||||
' Case "Egs"
|
||||
' DivAutorizacion.Visible = False
|
||||
' DivImporteSolicitud.Visible = False
|
||||
' End Select
|
||||
' UpModalSolicitud.Update()
|
||||
'End Sub
|
||||
|
||||
Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged
|
||||
Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString()
|
||||
Select Case TipoDocto
|
||||
Case "Ing"
|
||||
DivAutorizacion.Visible = True
|
||||
DivImporteSolicitud.Visible = True
|
||||
If DdlTipoAutorizacion.Items.FindByValue("2") Is Nothing Then
|
||||
DdlTipoAutorizacion.Items.Insert(0, New ListItem("Vencimiento", "2"))
|
||||
End If
|
||||
Case "Egs"
|
||||
DivAutorizacion.Visible = False
|
||||
DivImporteSolicitud.Visible = False
|
||||
'QUITAR LA DE VENCIMIENTO
|
||||
DdlTipoAutorizacion.Items.Remove(DdlTipoAutorizacion.Items.FindByValue("2"))
|
||||
End Select
|
||||
UpModalSolicitud.Update()
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user