--Generar remision sin autorizaciones para publico general
This commit is contained in:
@@ -2307,6 +2307,15 @@ Partial Class Ventas
|
||||
ViewState("CveContratoTipo") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property HabilitaRemisionPublicoGeneral As Integer
|
||||
Get
|
||||
Return IfNull(ViewState("HabilitaRemisionPublicoGeneral"), "0", ViewState("HabilitaRemisionPublicoGeneral")).ToString().ToEntero()
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("HabilitaRemisionPublicoGeneral") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
'#Region "AuxiliarConta"
|
||||
@@ -6903,6 +6912,8 @@ Partial Class Ventas
|
||||
|
||||
If CveVenta <= 0 Then
|
||||
CalculaLineasAdicionales()
|
||||
HabilitaRemisionPublicoGeneral = 0
|
||||
HabilitarRemisionesPublicoGeneral()
|
||||
End If
|
||||
|
||||
|
||||
@@ -6917,6 +6928,71 @@ Partial Class Ventas
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Private Sub HabilitarRemisionesPublicoGeneral()
|
||||
If UsuarioActual.Empresa.Funcionalidad(381).Trim() <> "" Then
|
||||
'SI ESTA BLOQUEADO POR AUTORIZACION, HABILITAR LA OPCION DE REMISION PARA PUBLICO EN GENERAL
|
||||
If UsuarioActual.Empresa.Funcionalidad(381).Trim() = CveCliente.ToString() Then
|
||||
Dim DeshabilitarAutorizacion As Boolean = CBool(GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("DeshabilitaAutorizacion"))
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "PA" AndAlso DeshabilitarAutorizacion Then
|
||||
If DdlTipoComprobante.Items.FindByValue("Rem") Is Nothing Then
|
||||
DdlTipoComprobante.Items.Insert(0, New ListItem("Remisión", "Rem"))
|
||||
End If
|
||||
DdlTipoComprobante.SelectedValueExist("Rem")
|
||||
HabilitaRemisionPublicoGeneral = 1
|
||||
End If
|
||||
|
||||
'SI TIENE LA HABILITACION DE REMISION ACTIVA Y LA SUCURSAL NO LO PERMITE
|
||||
If Not DeshabilitarAutorizacion AndAlso HabilitaRemisionPublicoGeneral = 1 Then
|
||||
HabilitaRemisionPublicoGeneral = 0
|
||||
DdlTipoComprobante.SelectedValueExist("PA")
|
||||
If DdlTipoComprobante.Items.FindByValue("Rem") IsNot Nothing Then
|
||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
|
||||
End If
|
||||
End If
|
||||
|
||||
UpParametros.Update()
|
||||
|
||||
End If
|
||||
Else
|
||||
HabilitaRemisionPublicoGeneral = 0
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function ValidaImportePublicoGeneral() As Boolean
|
||||
Dim retorno As Boolean = False
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Rem" AndAlso HabilitaRemisionPublicoGeneral = 1 Then
|
||||
Dim Total As Decimal = TxtTotal.Text.ToDecimal()
|
||||
|
||||
If DdlMoneda.SelectedValue = "1" Then
|
||||
If Total <= 5000D Then
|
||||
retorno = True
|
||||
Else
|
||||
Alert("No puede generar una remisión con un valor mayor a 5,000 MXN. Debe cambiar el tipo de documento a 'Autorización'", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End If
|
||||
|
||||
If DdlMoneda.SelectedValue = "2" Then
|
||||
If TxtTipoCambio.Text.ToDecimal() > 0 Then
|
||||
Dim TotalPesos As Decimal = (Total * TxtTipoCambio.Text.ToDecimal())
|
||||
If TotalPesos <= 5000D Then
|
||||
retorno = True
|
||||
Else
|
||||
Alert($"No puede generar una remisión con un valor mayor a {(5000 / TxtTipoCambio.Text.ToDecimal()).RoundSQL(2)} USD. Debe cambiar el tipo de documento a 'Autorización'", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
Else
|
||||
Alert("No se ha especificado un tipo de cambio", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
retorno = True
|
||||
End If
|
||||
|
||||
Return retorno
|
||||
End Function
|
||||
|
||||
Private Sub CargaRelacionadasPendientes()
|
||||
|
||||
If CveVenta > 0 AndAlso UsuarioActual.TienePermisoProceso(321) Then
|
||||
@@ -8838,6 +8914,10 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
|
||||
If Not ValidaImportePublicoGeneral() Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If (Me.FacturarSucursal AndAlso DdlSucursalCliente.SelectedValue.ToEntero() > 0 AndAlso (Me.ClienteSucursal IsNot Nothing AndAlso String.IsNullOrEmpty(Me.ClienteSucursal.RFC))) Then
|
||||
Alert("La sucursal no tiene asignada un RFC.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
@@ -17985,6 +18065,7 @@ Partial Class Ventas
|
||||
ObjSubProyectos.Dispose()
|
||||
|
||||
CargaVendedores()
|
||||
HabilitarRemisionesPublicoGeneral()
|
||||
|
||||
UpDetalle.Update()
|
||||
UpEmitirTransitorio.Update()
|
||||
@@ -20027,6 +20108,8 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
|
||||
ValidaImportePublicoGeneral()
|
||||
|
||||
UPObservaciones.Update()
|
||||
UpContado.Update()
|
||||
UpPS.Update()
|
||||
|
||||
Reference in New Issue
Block a user