Files
SanchoToro/GestionGrupoSanchoToro/ucConciliacionBancariaant.xaml.vb
2026-01-23 12:45:41 +01:00

649 lines
28 KiB
VB.net

Imports bdGrupoSanchoToro.db
Imports DevExpress.Xpf.Core
Imports tsWPFCore
Imports System.Collections
Imports DevExpress.Xpf.Bars
Imports bdGrupoSanchoToro.db.Utilidades
Imports tsEFCore8.Extensiones
Imports Microsoft.EntityFrameworkCore
Public Class ucConciliacionBancariaant
Private bd As tscGrupoSanchoToro
Public Overrides Sub Cargado()
ContenedorAplicacion.btGuardar.IsVisible = True
ContenedorAplicacion.btGuardar.Hint = "Conciliar movimientos seleccionados"
End Sub
Public Overrides Function EstablecedcPrincipal(Optional Background As Boolean = False, Optional FuerzaNuevo As Boolean = False, Optional Refrescar As Boolean = False) As tsUtilidades.EstadosAplicacion
Dim cjs = bd.cajas.Where(Function(x) x.idEmpresa = EmpresaActual.idEmpresa AndAlso x.FechaBaja.HasValue = False AndAlso (x.Tipo = cajas.TipoCajaEnum.BANCO)).OrderBy(Function(x) x.Descripcion).ToList
Me.cbCajas.ItemsSource = cjs
Return tsUtilidades.EstadosAplicacion.AplicacionSinIndice
End Function
Public Overrides Sub EstableceDataContextSecundarios(Optional Background As Boolean = False)
End Sub
Public Overrides Sub EstableceTitulo()
Me.docpanel.Caption = "Conciliación Bancaria"
End Sub
Public Overrides ReadOnly Property idRegistroAplicacionActual As String
Get
Return "ConciliacionBancaria"
End Get
End Property
Public Overrides ReadOnly Property NombreTablaBase As String
Get
Return "movimientoscaja"
End Get
End Property
Public Overrides ReadOnly Property DescripcionRegistro As String
Get
Return "Conciliación Bancaria"
End Get
End Property
Public Overrides Function ObtieneBD() As tsUtilidades.ItsContexto
bd = tscGrupoSanchoToro.NuevoContexto()
Return bd
End Function
Public Overrides Function ObtienePermisos() As tsUtilidades.Permisos
Return Comun.ObtienePermisos(Me.bd, "AP.ADMINISTRATIVOS", idUsuario)
End Function
Private Sub ap_Enlazar(Celda As DevExpress.Xpf.Grid.EditGridCellData, Defecto As Boolean) Handles Me.Enlazar
Dim ra = DirectCast(Me.gc.CurrentItem, movimientoscaja)
Select Case Celda.Column.FieldName.ToLower
Case "referenciadocumento"
Dim id As Integer
If ra.idFactura.HasValue Then
'id = ra.idFactura
'FuncionesDinamicas.AbrirAP(New ucFacturaEmitida(id), OtrosParametros)
Else
id = ra.idFacturaRecibida
FuncionesDinamicas.AbrirAP(New ucFacturaRecibida(id), OtrosParametros)
End If
Case "razonsocial"
Dim id As Integer
If ra.idFactura.HasValue Then
id = ra.idFacturaNavigation.idCliente
ElseIf ra.idFacturaRecibida.HasValue Then
id = ra.idFacturaRecibidaNavigation.idProveedor
End If
FuncionesDinamicas.AbrirAP(New ucEntidad(id), OtrosParametros)
Case "idmovimiento"
Dim id As Integer
id = ra.idMovimiento
FuncionesDinamicas.AbrirAP(New ucMovimientoCaja(id), OtrosParametros)
End Select
End Sub
Private Sub ap_AntesGuardar(sender As Object, e As ItemClickEventArgs, ByRef Cancelar As Boolean, ByRef MensajesError As Hashtable, OpcionGuardado As Integer) Handles Me.AntesGuardar
tv.CommitEditing()
' Dim aps As List(Of Apuntes) = Me.gc.ItemsSource
Dim ahora As DateTime = bd.AhoraMySql
gc.FilterCriteria = Nothing
For i = 0 To Me.gc.VisibleRowCount - 1
Dim rw = gc.GetRowHandleByVisibleIndex(i)
If Not gc.IsGroupRowHandle(rw) Then
EstableceConciliacion(rw, ahora)
Else
For j = 0 To gc.GetChildRowCount(rw) - 1
EstableceConciliacion(gc.GetChildRowHandle(rw, j), ahora)
Next
End If
Next
'bd.GuardarCambios()
'Cancelar = True
End Sub
Private Sub EstableceConciliacion(rw As Integer, ahora As DateTime)
Dim m As movimientoscaja
If Not gc.IsGroupRowHandle(rw) Then
m = gc.GetRow(rw)
If Me.tv.IsRowSelected(rw) Then
If m.FechaSupervision.HasValue = False Then
m.FechaSupervision = Now
End If
Else
If m.FechaSupervision.HasValue Then
m.FechaSupervision = Nothing
End If
End If
End If
End Sub
Private Sub ObtieneMovimientosCaja()
Try
Dim cjs As New List(Of Integer)
If cbCajas.EditValue IsNot Nothing Then
If cbCajas.EditValue.GetType Is GetType(List(Of Object)) Then
Dim locj As List(Of Object) = cbCajas.EditValue
For Each cj In locj
cjs.Add(CType(cj, Integer))
Next
Else
cjs = TryCast(cbCajas.EditValue, List(Of Integer))
End If
End If
Dim iqmv = bd.movimientoscaja.Include(Function(x) x.idUsuarioNavigation).Include(Function(x) x.idCajaNavigation).Include(Function(x) x.idFacturaNavigation.idClienteNavigation).Include(Function(x) x.idFacturaRecibidaNavigation.idProveedorNavigation).AsQueryable
If Not Me.cbIncluirSupervisados.IsChecked Then
iqmv = iqmv.Where(Function(x) x.FechaSupervision.HasValue = False)
End If
If Me.teFechaInicial.EditValue IsNot Nothing Then
Dim dFi As Date = Me.teFechaInicial.EditValue
Dim fi As New DateTime(dFi.Year, dFi.Month, dFi.Day, 0, 0, 0)
iqmv = iqmv.Where(Function(x) x.Fecha >= dFi)
End If
If Me.teFechaInicial.EditValue IsNot Nothing Then
Dim dFf As Date = Me.teFechaFinal.EditValue
Dim fi As New DateTime(dFf.Year, dFf.Month, dFf.Day, 0, 0, 0)
iqmv = iqmv.Where(Function(x) x.Fecha >= dFf)
End If
Me.gc.ItemsSource = iqmv.Where(Function(x) cjs.Contains(x.idCaja)).ToList
Me.DataContext = Me.gc.ItemsSource
If Me.cbIncluirSupervisados.IsChecked Then
For i = 0 To Me.gc.VisibleRowCount - 1
Dim rw = gc.GetRowHandleByVisibleIndex(i)
MarcaSeleccionados(rw)
Next
End If
Catch ex As Exception
FuncionesDinamicas.ErrorNoControladoAp(Me, ex)
DXMessageBox.Show(ex.Message, "Error")
End Try
End Sub
Private Sub MarcaSeleccionados(rw As Integer)
If Not gc.IsGroupRowHandle(rw) Then
Dim ap As movimientoscaja = gc.GetRow(rw)
If ap.FechaSupervision.HasValue Then
gc.SelectItem(rw)
End If
Else
For i = 0 To gc.GetChildRowCount(rw) - 1
MarcaSeleccionados(gc.GetChildRowHandle(rw, i))
Next
End If
End Sub
Private Sub btBuscar_Click(sender As Object, e As RoutedEventArgs)
ObtieneMovimientosCaja()
End Sub
End Class
'Public Class ucConciliacionBancaria
'
' Dim bd As tscGrupoSanchoToro
' Private WithEvents ApLineas As tsWPFCore.ApLineas
' ' Private ListadoCajas As List(Of Integer)
' Private DatosCargados As Boolean
' Private TotalPagado As Double
' Private TotalDevuelto As Double
' Private TotalPagadoAgrupado As Double
' Private TotalDevueltoAgrupado As Double
' Private ApuntesAGuardar As List(Of Integer)
' Private idCajs() As Integer
' Private cajs As List(Of cajas)
' Private Sub ApLineas_Cargado() Handles ApLineas.Cargado
' Me.tv.AllowEditing = True
' ' Me.gcSupervisado.AllowEditing = DevExpress.Utils.DefaultBoolean.True
' Me.ApLineas.ContenedorL.btEliminar.IsVisible = False
' Me.ApLineas.ContenedorL.btNuevo.IsVisible = False
' Me.ApLineas.ContenedorL.btInvertir.IsVisible = False
' Me.ApLineas.ContenedorL.btSeleccionar.IsVisible = False
' Dim biguardar As DevExpress.Xpf.Bars.BarButtonItem
' biguardar = New DevExpress.Xpf.Bars.BarButtonItem
' biguardar.Name = "btGuardarConciliacion"
' biguardar.Glyph = New BitmapImage(New Uri("pack://application:,,,/DevExpress.Images.v16.2;component/GrayScaleImages/Save/Save_16x16.png"))
' biguardar.Hint = "Guardar"
' biguardar.IsEnabled = True
' Me.ApLineas.ContenedorL.BarraBotones.Items.Add(biguardar)
' Dim ilGuardar As New DevExpress.Xpf.Bars.BarButtonItemLink()
' ilGuardar.Name = "ilGuardar"
' ilGuardar.BarItemName = biguardar.Name
' Me.ApLineas.ContenedorL.BarraBotones.Bars(0).ItemLinks.Insert(0, ilGuardar)
' AddHandler biguardar.ItemClick, AddressOf Guardar_ItemClick
' End Sub
' Private Sub ApLineas_Enlazar(Celda As EditGridCellData, Defecto As Boolean) Handles ApLineas.Enlazar
' 'Select Case Celda.Column.FieldName.ToLower
' ' Case "numerorecibo"
' Dim rec As Apuntes = Celda.RowData.Row
' Dim ucf As New ucFactura
' Dim dwi As dxwInicio = Window.GetWindow(Me)
' If rec.NumeroRecibo IsNot Nothing Then
' Comun.AbrirUcCL(ucf, dwi.grupodoc, Nothing, Me.ApLineas.dcfg, Me.ApLineas.dcn, 0, Me.ApLineas.dsc, Me.ApLineas.OtrosParametros, bd.recibos.First(Function(x) x.idrecibo = rec.NumeroRecibo).idFactura)
' End If
' ' End Select
' End Sub
' Public Sub EstableceDataContext(ByRef DataContext As Object, Optional BackGround As Boolean = False) Implements tsWPFCore.IApLineas.EstableceDataContext
' Try
' If Not DatosCargados Then
' cajs = (From c In bd.cajas Where c.FechaBaja Is Nothing AndAlso c.enumeraciones.Codigo <> "TIPCAJ.METALICO" Order By c.Descripcion).ToList
' For i = cajs.Count - 1 To 0 Step -1
' If Comun.ObtienePermisos(bd, cajs(i).idPermiso, ApLineas.dsc.idUsuario).Otros = False Then
' cajs.Remove(cajs(i))
' End If
' Next
' If cajs.Count > 0 Then
' If Comun.idCajaPredeterminada Is Nothing Then
' If cajs.Count = 1 Then Comun.idCajaPredeterminada = cajs.First.idCaja
' Else
' If cajs.Where(Function(c) c.idCaja = Comun.idCajaPredeterminada).Count = 0 Then
' Comun.idCajaPredeterminada = cajs.First.idCaja
' End If
' End If
' Dim cj As cajas = (From c In bd.cajas Select c Where c.idCaja = Comun.idCajaPredeterminada).First
' End If
' idCajs = cajs.Select(Function(x) x.idCaja).ToArray
' ' Me.cbCaja.ItemsSource = cajs
' ' ListadoCajas = (From c In cajs Select c.idCaja).ToList
' 'If Comun.idCajaPredeterminada IsNot Nothing Then
' ' Me.cbCaja.EditValue = Comun.idCajaPredeterminada
' 'Else
' ' Me.cbCaja.EditValue = cajs.First
' 'End If
' End If
' ' Me.teFechaFinal.EditValue = Now
' ' Me.teFechaInicial.EditValue = Now
' DatosCargados = True
' ObtieneApuntes()
' DataContext = Me.gc.DataContext
' Catch ex As Exception
' DXMessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error)
' End Try
' End Sub
' Public ReadOnly Property NombreTablaBase As String Implements tsWPFCore.IApLineas.NombreTablaBase
' Get
' Return ""
' End Get
' End Property
' Public ReadOnly Property CampoIndice As String Implements IAplicacion.CampoIndice
' Get
' Throw New NotImplementedException()
' End Get
' End Property
' Public Overrides ReadOnly Property idRegistroAplicacionActual As String
' Get
' Throw New NotImplementedException()
' End Get
' End Property
' Public Overrides ReadOnly Property DescripcionRegistro As String
' Get
' Throw New NotImplementedException()
' End Get
' End Property
' Private ReadOnly Property IAplicacion_NombreTablaBase As String Implements IAplicacion.NombreTablaBase
' Get
' Throw New NotImplementedException()
' End Get
' End Property
' Public Sub Nuevo() Implements tsWPFCore.IApLineas.Nuevo
' End Sub
' Public Function ObtieneRejilla() As tsWPFCore.tsGridControl Implements tsWPFCore.IApLineas.ObtieneRejilla
' Return Me.gc
' End Function
' Public Sub EstableceApLin(ApLin As tsWPFCore.ApLineas) Implements tsWPFCore.IApLineas.EstableceApLin
' Me.ApLineas = ApLin
' End Sub
' Public Function ObtieneContexto(dcn As tsUtilidades.Datos.DatosConexionCliente) As System.Data.Objects.ObjectContext Implements tsWPFCore.IApLineas.ObtieneContexto
' bd = bdM3Academy.Utilidades.NuevaConexion(dcn.BasesDatos(0))
' Return bd
' End Function
' Public Function ObtienePermisos() As tsUtilidades.Permisos Implements tsWPFCore.IApLineas.ObtienePermisos
' Return Comun.ObtienePermisos(Me.bd, "AP.CONCILIACIONBANCARIA", Me.ApLineas.dsc.idUsuario)
' End Function
' Public Function ObtieneCampoIndice() As String Implements tsWPFCore.IApLineas.ObtieneCampoIndice
' Return ""
' End Function
' 'Private Sub ApLineas_ImprimirPlantilla(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs, idPlantilla As Integer) Handles ApLineas.ImprimirPlantilla
' ' Try
' ' Dim ds As Object = ObtieneDataSource()
' ' Informes.MuestraImpresos(bd, idPlantilla, ds, Me.ApLineas.GrupoDocumentos, tsWPFCore.ApCabLin.dm.DockController)
' ' Catch EX As Exception
' ' DXMessageBox.Show(EX.Message, "Atención", MessageBoxButton.OK)
' ' End Try
' 'End Sub
' Private Sub ObtieneApuntes()
' Try
' If DatosCargados Then
' ApuntesAGuardar = New List(Of Integer)
' Dim iNumeroApuntes As Integer
' Dim ierecs As IEnumerable(Of recibos)
' Dim recs As List(Of recibos)
' Dim lm As New List(Of Apuntes)
' Dim m As Apuntes
' ' Dim idCaja As Integer? = DirectCast(Me.cbCaja.EditValue, Integer)
' Dim dIngresosp, dGastosp As Double
' If idCajs.Count > 0 Then
' ierecs = (From r In bd.recibos Where idCajs.Contains(r.idCaja))
' If Me.teFechaInicial.EditValue IsNot Nothing Then
' Dim dFi As Date = Me.teFechaInicial.EditValue
' Dim fi As New DateTime(dFi.Year, dFi.Month, dFi.Day, 0, 0, 0)
' ierecs = (From r In ierecs Where r.FechaPago >= dFi)
' End If
' If Me.teFechaFinal.EditValue IsNot Nothing Then
' Dim dFf As Date = Me.teFechaFinal.EditValue
' Dim ff As New DateTime(dFf.Year, dFf.Month, dFf.Day, 23, 59, 59)
' ierecs = (From r In ierecs Where r.FechaPago <= dFf)
' End If
' If Not Me.cbIncluirSupervisados.IsChecked Then
' ierecs = (From r In ierecs Where r.Supervisado = False)
' End If
' recs = ierecs.ToList
' For Each r In recs
' iNumeroApuntes += 1
' m = New Apuntes
' m.Caja = cajs.First(Function(x) x.idCaja = r.idCaja).Descripcion
' If r.facturas.Mes IsNot Nothing Then
' m.Descripcion = "Recibo de " & r.facturas.RazonSocial & " Mensualidad: " & tsUtilidades.Utilidades.MesCastellano(r.facturas.Mes Mod 100) & " " & (r.facturas.Mes \ 100).ToString
' Else
' m.Descripcion = "Recibo de " & r.facturas.RazonSocial
' End If
' m.Fecha = r.FechaPago.Date
' m.ImporteEntrada = r.Importe
' m.ImporteSalida = 0
' m.NumeroRecibo = r.idrecibo
' m.Tipo = TipoMovimiento.RECIBO
' m.Usuario = If(r.usuarios Is Nothing, "", r.usuarios.Nombre)
' m.idApunte = iNumeroApuntes
' ' m.Supervisado = r.Supervisado
' m.FechaSupervision = r.FechaSupervision
' m.idMovimientoORecibo = r.idrecibo
' lm.Add(m)
' Next
' dIngresosp = recs.Sum(Function(x) x.Importe)
' ierecs = (From r In bd.recibos Where idCajs.Contains(r.idCaja) AndAlso r.FechaDevolucion IsNot Nothing)
' If Me.teFechaInicial.EditValue IsNot Nothing Then
' Dim dFi As Date = Me.teFechaInicial.EditValue
' Dim fi As New DateTime(dFi.Year, dFi.Month, dFi.Day, 0, 0, 0)
' ierecs = (From r In ierecs Where r.FechaDevolucion >= dFi)
' End If
' If Me.teFechaFinal.EditValue IsNot Nothing Then
' Dim dFf As Date = Me.teFechaFinal.EditValue
' Dim ff As New DateTime(dFf.Year, dFf.Month, dFf.Day, 23, 59, 59)
' ierecs = (From r In ierecs Where r.FechaDevolucion <= dFf)
' End If
' If Not Me.cbIncluirSupervisados.IsChecked Then
' ierecs = (From r In ierecs Where r.DevolucionSupervisada = False)
' End If
' recs = ierecs.ToList
' For Each r In recs
' iNumeroApuntes += 1
' m = New Apuntes
' m.Caja = cajs.First(Function(x) x.idCaja = r.idCaja).Descripcion
' If r.facturas.Mes IsNot Nothing Then
' m.Descripcion = "Devolución Recibo de " & r.facturas.RazonSocial & " Mensualidad: " & tsUtilidades.Utilidades.MesCastellano(r.facturas.Mes Mod 100) & " " & (r.facturas.Mes \ 100).ToString
' Else
' m.Descripcion = "Devolución Recibo de " & r.facturas.RazonSocial
' End If
' m.Fecha = r.FechaDevolucion.Value.Date
' m.ImporteEntrada = 0
' m.ImporteSalida = r.Importe
' m.NumeroRecibo = r.idrecibo
' m.Tipo = TipoMovimiento.DEVOLUCION_RECIBO
' m.Usuario = If(r.usuarios1 Is Nothing, "", r.usuarios1.Nombre)
' m.idApunte = iNumeroApuntes
' ' m.Supervisado = r.DevolucionSupervisada
' m.FechaSupervision = r.FechaSupervisionDevolucion
' m.idMovimientoORecibo = r.idrecibo
' lm.Add(m)
' Next
' dGastosp = recs.Sum(Function(x) x.Importe)
' Dim iemovs As IEnumerable(Of movimientoscaja)
' Dim movs As List(Of movimientoscaja)
' iemovs = (From mv In bd.movimientoscaja Where idCajs.Contains(mv.idCaja) AndAlso mv.Tipo <> TipoMovimiento.APERTURA AndAlso mv.Tipo <> TipoMovimiento.CIERRE)
' ' ierecs = (From r In bd.recibos Where r.idCaja = idCaja AndAlso r.FechaDevolucion IsNot Nothing)
' If Me.teFechaInicial.EditValue IsNot Nothing Then
' Dim dFi As Date = Me.teFechaInicial.EditValue
' Dim fi As New DateTime(dFi.Year, dFi.Month, dFi.Day, 0, 0, 0)
' iemovs = (From mv In iemovs Where mv.Fecha >= dFi)
' End If
' If Me.teFechaFinal.EditValue IsNot Nothing Then
' Dim dFf As Date = Me.teFechaFinal.EditValue
' Dim ff As New DateTime(dFf.Year, dFf.Month, dFf.Day, 23, 59, 59)
' iemovs = (From mv In iemovs Where mv.Fecha <= dFf)
' End If
' If Not Me.cbIncluirSupervisados.IsChecked Then
' iemovs = (From mv In iemovs Where mv.Supervisado = False)
' End If
' movs = iemovs.ToList
' For Each mc In movs
' iNumeroApuntes += 1
' m = New Apuntes
' m.Caja = cajs.First(Function(x) x.idCaja = mc.idCaja).Descripcion
' m.Descripcion = mc.Descripcion
' m.Fecha = mc.Fecha.Value.Date
' m.ImporteSalida = mc.ImporteSalida
' m.ImporteEntrada = mc.ImporteEntrada
' m.Tipo = mc.Tipo
' 'Select Case mc.Tipo
' ' Case "INGRESO"
' ' m.Tipo = TipoMovimiento.INGRESO
' ' Case "GASTO"
' ' m.Tipo = TipoMovimiento.GASTO
' ' Case "APERTURA"
' ' m.Tipo = TipoMovimiento.APERTURA
' ' Case "CIERRE"
' ' m.Tipo = TipoMovimiento.CIERRE
' ' Case "DEVOLUCION RECIBO"
' ' m.Tipo = TipoMovimiento.DEVOLUCION_RECIBO
' ' Case "TRASPASO"
' ' m.Tipo = TipoMovimiento.TRASPASO
' 'End Select
' m.Usuario = mc.usuarios.Nombre
' m.idApunte = iNumeroApuntes
' ' m.Supervisado = mc.Supervisado
' m.FechaSupervision = mc.FechaSupervision
' m.idMovimientoORecibo = mc.idMovimiento
' lm.Add(m)
' Next
' dIngresosp += movs.Sum(Function(x) x.ImporteEntrada)
' dGastosp += movs.Sum(Function(x) x.ImporteSalida)
' If idCajs.Count > 0 Then
' recs = (From r In bd.recibos Where idCajs.Contains(r.idCaja) AndAlso r.idMovimientoCierre Is Nothing).ToList
' Dim imprecs As Double? = recs.Sum(Function(r) r.Importe)
' Dim recdevs = (From r In bd.recibos Where idCajs.Contains(r.idCaja) AndAlso r.idMovimientoCierreDevolucion Is Nothing AndAlso r.FechaDevolucion IsNot Nothing).ToList
' Dim imprecdevs As Double? = recdevs.Sum(Function(r) r.Importe)
' Dim mvs = (From mv In bd.movimientoscaja Where idCajs.Contains(mv.idCaja) AndAlso mv.idMovimientoCierre Is Nothing AndAlso mv.Tipo <> TipoMovimiento.CIERRE)
' Dim dImporteMovEnt As Double? = mvs.Sum(Function(mv) mv.ImporteEntrada)
' Dim dImporteMovSal As Double? = mvs.Sum(Function(mv) mv.ImporteSalida)
' Dim dIngresos As Double = If(dImporteMovEnt, 0) + If(imprecs, 0)
' Dim dGastos As Double = If(dImporteMovSal, 0) + If(imprecdevs, 0)
' 'Me.teSaldoActual.EditValue = dIngresos - dGastos
' 'Me.teIngresos.EditValue = dIngresosp
' 'Me.teGastos.EditValue = dGastosp
' Else
' 'Me.teSaldoActual.EditValue = 0
' 'Me.teIngresos.EditValue = 0
' 'Me.teGastos.EditValue = 0
' End If
' lm = lm.OrderBy(Function(x) x.Fecha).ThenBy(Function(x) x.idApunte).ToList
' Else
' Throw New Exception("Seleccione primero la caja")
' End If
' Me.gc.ItemsSource = lm
' For i = 0 To Me.gc.VisibleRowCount - 1
' Dim rw = gc.GetRowHandleByVisibleIndex(i)
' MarcaSeleccionados(rw)
' Next
' End If
' Catch ex As Exception
' Throw New Exception(ex.Message, ex)
' End Try
' End Sub
' Private Sub MarcaSeleccionados(rw As Integer)
' If Not gc.IsGroupRowHandle(rw) Then
' Dim ap As Apuntes = gc.GetRow(rw)
' If ap.FechaSupervision.HasValue Then
' gc.SelectItem(rw)
' End If
' Else
' For i = 0 To gc.GetChildRowCount(rw) - 1
' MarcaSeleccionados(gc.GetChildRowHandle(rw, i))
' Next
' End If
' End Sub
' Private Sub teFechaInicial_EditValueChanged(sender As Object, e As DevExpress.Xpf.Editors.EditValueChangedEventArgs) Handles teFechaInicial.EditValueChanged
' ObtieneApuntes()
' Me.DataContext = Me.gc.ItemsSource
' End Sub
' Private Sub teFechaFinal_EditValueChanged(sender As Object, e As DevExpress.Xpf.Editors.EditValueChangedEventArgs) Handles teFechaFinal.EditValueChanged
' ObtieneApuntes()
' Me.DataContext = Me.gc.ItemsSource
' End Sub
' Private Sub cbIncluirSupervisados_Checked(sender As Object, e As RoutedEventArgs)
' ObtieneApuntes()
' Me.DataContext = Me.gc.ItemsSource
' End Sub
' Private Sub cbIncluirSupervisados_Unchecked(sender As Object, e As RoutedEventArgs)
' ObtieneApuntes()
' Me.DataContext = Me.gc.ItemsSource
' End Sub
' Private Sub Guardar_ItemClick(sender As Object, e As DevExpress.Xpf.Bars.ItemClickEventArgs)
' tv.CommitEditing()
' ' Dim aps As List(Of Apuntes) = Me.gc.ItemsSource
' Dim ahora As DateTime = Comun.AhoraMysql(bd)
' gc.FilterCriteria = Nothing
' For i = 0 To Me.gc.VisibleRowCount - 1
' Dim rw = gc.GetRowHandleByVisibleIndex(i)
' If Not gc.IsGroupRowHandle(rw) Then
' EstableceConciliacion(rw, ahora)
' Else
' For j = 0 To gc.GetChildRowCount(rw) - 1
' EstableceConciliacion(gc.GetChildRowHandle(rw, j), ahora)
' Next
' End If
' Next
' bd.GuardarCambios()
' EstableceDataContext(Me.DataContext)
' End Sub
' Private Sub EstableceConciliacion(rw As Integer, ahora As DateTime)
' Dim ap As Apuntes
' Dim r As recibos
' Dim m As movimientoscaja
' If Not gc.IsGroupRowHandle(rw) Then
' ap = gc.GetRow(rw)
' Select Case ap.Tipo
' Case TipoMovimiento.RECIBO
' r = bd.recibos.First(Function(x) x.idrecibo = ap.idMovimientoORecibo)
' If Me.tv.IsRowSelected(rw) Then
' If Not r.Supervisado Then
' r.Supervisado = True
' r.FechaSupervision = ahora
' End If
' Else
' If r.Supervisado Then
' r.Supervisado = False
' r.FechaSupervision = Nothing
' End If
' End If
' Case TipoMovimiento.DEVOLUCION_RECIBO
' r = bd.recibos.First(Function(x) x.idrecibo = ap.idMovimientoORecibo)
' If Me.tv.IsRowSelected(rw) Then
' If Not r.DevolucionSupervisada Then
' r.DevolucionSupervisada = True
' r.FechaSupervisionDevolucion = ahora
' End If
' Else
' If r.DevolucionSupervisada Then
' r.DevolucionSupervisada = False
' r.FechaSupervisionDevolucion = Nothing
' End If
' End If
' Case Else
' m = bd.movimientoscaja.First(Function(x) x.idMovimiento = ap.idMovimientoORecibo)
' If Me.tv.IsRowSelected(rw) Then
' If Not m.Supervisado Then
' m.Supervisado = True
' m.FechaSupervision = ahora
' End If
' Else
' If m.Supervisado Then
' m.Supervisado = False
' m.FechaSupervision = Nothing
' End If
' End If
' End Select
' End If
' End Sub
'End Class