171 lines
5.8 KiB
VB.net
171 lines
5.8 KiB
VB.net
Imports System.Data.Entity
|
|
Imports DevExpress.Xpf.Core.ServerMode
|
|
Imports bdGrupoSanchoToro.db
|
|
|
|
Imports bdGrupoSanchoToro.db.Utilidades
|
|
Imports DevExpress.Xpf.Grid
|
|
Imports DevExpress.Xpf.Core
|
|
Imports System.Linq.Dynamic
|
|
Imports tsUtilidades.Datos
|
|
Imports tsWPFCore
|
|
Imports DevExpress.Xpf.Bars
|
|
Imports System.Linq.Dynamic.Core
|
|
Public Class ucConciliacionesBancarias
|
|
|
|
Dim bd As tscGrupoSanchoToro
|
|
|
|
Public Overrides Sub EstableceTitulo()
|
|
Me.docpanel.Caption = "Conciliaciones Bancarias"
|
|
End Sub
|
|
|
|
|
|
|
|
Public Overrides ReadOnly Property idRegistroAplicacionActual As String
|
|
Get
|
|
Return "ConciliacionesBancarias"
|
|
End Get
|
|
End Property
|
|
|
|
Public Overrides ReadOnly Property DescripcionRegistro As String
|
|
Get
|
|
Return "Conciliación Bancaria"
|
|
End Get
|
|
End Property
|
|
|
|
Public Overrides ReadOnly Property NombreTablaBase As String
|
|
Get
|
|
Return "conciliacionesbancarias"
|
|
End Get
|
|
End Property
|
|
|
|
Public Overrides Sub EstableceDataContextSecundarios(Optional Background As Boolean = False)
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Public Overrides Sub Cargado()
|
|
Me.HabilitarRefresco = True
|
|
deFechaInicio.EditValue = Now.AddMonths(-4)
|
|
deFechaFin.EditValue = Now
|
|
GridBusqueda = Me.gc
|
|
End Sub
|
|
|
|
|
|
|
|
Public Overrides Function EstableceDCPrincipal(Optional Background As Boolean = False, Optional FuerzaNuevo As Boolean = False, Optional Refrescar As Boolean = False) As tsUtilidades.EstadosAplicacion
|
|
If Refrescar OrElse Background Then ObtieneConciliacionesAsync(bd, Background)
|
|
Return tsUtilidades.EstadosAplicacion.AplicacionSinIndice
|
|
End Function
|
|
|
|
Public Overrides Function ObtieneBD() As tsUtilidades.ItsContexto
|
|
bd = tscGrupoSanchoToro.NuevoContexto()
|
|
Return bd
|
|
End Function
|
|
|
|
'Public Overrides Function ObtieneConexionBD() As BBDD
|
|
' Return bdGrupoSanchoToro.db.tscGrupoSanchoToro.bdga
|
|
'End Function
|
|
|
|
Public Overrides Function ObtienePermisos() As tsUtilidades.Permisos
|
|
Return Comun.ObtienePermisos(Me.bd, "AP.ADMINISTRATIVOS", idUsuario)
|
|
End Function
|
|
|
|
|
|
|
|
Public Sub New()
|
|
|
|
' Esta llamada es exigida por el diseñador.
|
|
InitializeComponent()
|
|
|
|
|
|
|
|
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
|
|
|
|
End Sub
|
|
Public Function ObtieneConciliaciones(ByRef DataContext As Object, BackGround As Boolean, TextoBusqueda As String, FechaInicio As DateOnly?, FechaFin As DateOnly?) As List(Of conciliacionesbancarias)
|
|
Dim rs As IQueryable(Of conciliacionesbancarias)
|
|
Dim iNumExc As Integer = 0
|
|
|
|
Do
|
|
Try
|
|
rs = bd.conciliacionesbancarias.Include(Function(x) x.idCajaNavigation).AsQueryable
|
|
If TextoBusqueda <> "" Then
|
|
Dim parametros(0) As Object
|
|
Dim ExpresionBusqueda = tsWPFCore.Utilidades.Varias.GeneraExpresionBusqueda(TextoBusqueda, {"idConciliacion"}, {"idCajaNavigation.Descripcion", "idCajaNavigation.IBAN"}, Nothing)
|
|
rs = rs.Where(ExpresionBusqueda)
|
|
End If
|
|
If FechaInicio.HasValue Then
|
|
rs = rs.Where(Function(x) x.FechaFin >= FechaInicio.Value)
|
|
End If
|
|
If FechaFin.HasValue Then
|
|
Dim ff As DateOnly = FechaFin.Value.AddDays(1)
|
|
'Dim ff As DateTime = Now
|
|
rs = rs.Where(Function(x) x.FechaInicio < ff)
|
|
End If
|
|
Exit Do
|
|
Catch ex As Exception
|
|
iNumExc += 1
|
|
If iNumExc > 3 Then
|
|
rs = Nothing
|
|
Exit Do
|
|
End If
|
|
End Try
|
|
Loop
|
|
If rs IsNot Nothing Then
|
|
Return rs.ToList
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Function
|
|
|
|
Public Async Sub ObtieneConciliacionesAsync(bd As tscGrupoSanchoToro, Background As Boolean)
|
|
Try
|
|
|
|
|
|
Dim rs As New List(Of conciliacionesbancarias)
|
|
Dim fi, ff As DateOnly?
|
|
Dim Busqueda As String
|
|
|
|
Busqueda = Me.teBusqueda.Text.Trim
|
|
fi = If(deFechaInicio.EditValue Is Nothing, Nothing, DateOnly.FromDateTime(deFechaInicio.EditValue))
|
|
ff = If(deFechaFin.EditValue Is Nothing, Nothing, DateOnly.FromDateTime(deFechaFin.EditValue))
|
|
|
|
If Background Then
|
|
Me.ContenedorAplicacion.IsEnabled = False
|
|
Await Task.Run(Sub()
|
|
rs = ObtieneConciliaciones(bd, Background, Busqueda, fi, ff)
|
|
End Sub)
|
|
Else
|
|
If DXSplashScreen.IsActive = False Then DXSplashScreen.Show(Of tsWPFCore.SplashScreenTecnosis)()
|
|
DXSplashScreen.SetState("Buscando Extractos ...")
|
|
rs = ObtieneConciliaciones(bd, Background, Busqueda, fi, ff)
|
|
End If
|
|
|
|
gc.ItemsSource = rs
|
|
DataContext = rs
|
|
|
|
Catch ex As Exception
|
|
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
|
|
DXMessageBox.Show(ex.Message, "Error")
|
|
Finally
|
|
Me.ContenedorAplicacion.IsEnabled = True
|
|
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
|
|
End Try
|
|
End Sub
|
|
Private Sub Nuevo() Handles Me.BotonNuevoPulsado
|
|
FuncionesDinamicas.AbrirAP(New ucConciliacionBancaria, OtrosParametros)
|
|
End Sub
|
|
Private Sub ApLineas_Enlazar(Celda As EditGridCellData, Defecto As Boolean) Handles Me.Enlazar
|
|
Dim id As Integer = DirectCast(Me.gc.CurrentItem, conciliacionesbancarias).idConciliacion
|
|
FuncionesDinamicas.AbrirAP(New ucConciliacionBancaria(id), OtrosParametros)
|
|
End Sub
|
|
|
|
Private Sub BtBuscar_Click(sender As Object, e As RoutedEventArgs)
|
|
ObtieneConciliacionesAsync(bd, False)
|
|
End Sub
|
|
|
|
|
|
End Class
|
|
|