Autorizaciones por importe en NC, cargar metodos del pago al editar remision o refacturar

This commit is contained in:
2021-07-07 18:26:52 -07:00
parent 8e525c514f
commit d941a22fc9

View File

@@ -5307,13 +5307,7 @@ Partial Class Ventas
Private Sub CargaMetodosPago() Private Sub CargaMetodosPago()
'FACTURACION 3.3 'FACTURACION 3.3
DdlMetodoPago33.DataSource = GlobalDTVtaMetodoPago
'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.DataBind() DdlMetodoPago33.DataBind()
DdlMetodoPago33.SelectedValueExist("3") DdlMetodoPago33.SelectedValueExist("3")
@@ -5658,7 +5652,7 @@ Partial Class Ventas
Me.CveFormaPago33Cliente = ObjCliente.CveFormaPago33 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 'CveMetodoPagoCliente = ObjCliente.CveMetodoPago
@@ -5754,16 +5748,13 @@ Partial Class Ventas
ViewState("AplicaFord") = ObjCliente.AplicaFord ViewState("AplicaFord") = ObjCliente.AplicaFord
TxtFordGSDB.Text = ObjCliente.Ford_GSDB TxtFordGSDB.Text = ObjCliente.Ford_GSDB
'SELECIONAMOS VENDEDOR - SI ESTA EN MODO EDICIÓN SE QUEDA EL VENDEDOR ORIGINAL If ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero() > 0 Then
If Not ModalidadEdicion Then DdlVendedor.SelectedValueExist(ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero())
If ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero() > 0 Then End If
DdlVendedor.SelectedValueExist(ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero())
End If
'SI EL CLIENTE NO TIENE VENDEDOR SELECCIONAMOS EL DEL USUARIO 'SI EL CLIENTE NO TIENE VENDEDOR SELECCIONAMOS EL DEL USUARIO
If Not DdlVendedor.SelectedValue.ToEntero() > 0 Then If Not DdlVendedor.SelectedValue.ToEntero() > 0 Then
DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString())
End If
End If End If
If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then
@@ -6174,6 +6165,7 @@ Partial Class Ventas
ObjVentas.Dispose() ObjVentas.Dispose()
End If 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 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.SelectedValue = "2"
RBLPago.Items(0).Enabled = False RBLPago.Items(0).Enabled = False
@@ -6310,17 +6302,27 @@ Partial Class Ventas
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
End If End If
Else 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.Empresa.Funcionalidad(558) = "1" Then
If UsuarioActual.CveEmpresa = 140 Then RBLPago.SelectedValue = "2"
LnkSolicitarCredito.Visible = True RBLPago.Items(0).Enabled = False
DdlTipoAutorizacion.SelectedValueExist("1") 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
End If End If
End If End If
UPPCreditoDisponible.Update() 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 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()) Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
If CreditoDispo > 0 Then If CreditoDispo > 0 Then
@@ -7898,7 +7900,13 @@ Partial Class Ventas
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
Try Try
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, CveEstatus:=1) Then 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 If RowAutorizacion IsNot Nothing Then
TipoDocumentoAutorizacion = RowAutorizacion("CveTipoDocumento").ToString() TipoDocumentoAutorizacion = RowAutorizacion("CveTipoDocumento").ToString()
@@ -7938,12 +7946,22 @@ Partial Class Ventas
End If End If
End If End If
If DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then If TieneDiasVencidos AndAlso DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then
CveAutorizacion = -1 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 Exit Sub
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 End If
EmitirImprimirNew(TipoDoctoViejo) EmitirImprimirNew(TipoDoctoViejo)
@@ -31687,15 +31705,29 @@ Partial Class Ventas
DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1 DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1
UpModalSolicitud.Update() UpModalSolicitud.Update()
End Sub 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 Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged
Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString() Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString()
Select Case TipoDocto Select Case TipoDocto
Case "Ing" Case "Ing"
DivAutorizacion.Visible = True If DdlTipoAutorizacion.Items.FindByValue("2") Is Nothing Then
DivImporteSolicitud.Visible = True DdlTipoAutorizacion.Items.Insert(0, New ListItem("Vencimiento", "2"))
End If
Case "Egs" Case "Egs"
DivAutorizacion.Visible = False 'QUITAR LA DE VENCIMIENTO
DivImporteSolicitud.Visible = False DdlTipoAutorizacion.Items.Remove(DdlTipoAutorizacion.Items.FindByValue("2"))
End Select End Select
UpModalSolicitud.Update() UpModalSolicitud.Update()
End Sub End Sub