2026-01-30 03

This commit is contained in:
2026-01-30 12:07:23 +01:00
parent 6034845e65
commit 79ae74ee26
28 changed files with 319 additions and 89 deletions

View File

@@ -1,5 +1,5 @@

Imports tsl5.Extensiones
Imports tsUtilidades.Extensiones
Imports bdGrupoSanchoToro
Imports DevExpress.Xpf.Core
Imports System.Data.Entity

View File

@@ -7,7 +7,7 @@ Imports DevExpress.Xpf.Grid
Imports DevExpress.Xpf.Core
Imports System.Linq.Dynamic
Imports DevExpress.Xpf.Bars
Imports tsl5.Datos
Imports tsUtilidades.Datos
Imports tsWPF
Imports tsWPF.Comun
Imports tsWPFCore.Comun
@@ -220,7 +220,7 @@ Public Class ApunteExtracto
Property idAsiento As Integer
Property NumeroAsiento As String
Property Concepto As String
Property Fecha As Date?
Property Fecha As DateOnly?
Property Debe As Double
Property Haber As Double
Property Saldo As Double

View File

@@ -11,9 +11,9 @@ Imports tsWPF.modExtensiones
Imports System.Data.Common
Imports System.Data.Entity
Imports DevExpress.Xpf.Grid
Imports tsl5.Extensiones
Imports tsUtilidades.Extensiones
Imports DevExpress.Xpf.Bars
Imports tsl5.Datos
Imports tsUtilidades.Datos
Imports tsWPF.Comun
Imports bdGrupoSanchoToro.db

View File

@@ -4,7 +4,7 @@ Imports bdGrupoSanchoToro
Imports DevExpress.Xpf.Grid
Imports DevExpress.Xpf.Core
Imports System.Linq.Dynamic
Imports tsl5.Datos
Imports tsUtilidades.Datos
Imports tsWPFCore
Imports tsWPFCore.Comun
Imports bdGrupoSanchoToro.db

View File

@@ -7,7 +7,7 @@ Imports DevExpress.Xpf.Grid
Imports DevExpress.Xpf.Core
Imports System.Linq.Dynamic
Imports DevExpress.Xpf.Bars
Imports tsl5.Datos
Imports tsUtilidades.Datos
Imports tsWPF
Imports DevExpress.Data
Imports tsWPF.Comun

View File

@@ -7,7 +7,7 @@ Imports DevExpress.Xpf.Grid
Imports DevExpress.Xpf.Core
Imports System.Linq.Dynamic
Imports DevExpress.Xpf.Bars
Imports tsl5.Datos
Imports tsUtilidades.Datos
Imports tsWPF
Imports DevExpress.Data
Imports tsWPF.Comun
@@ -53,7 +53,7 @@ Public Class ucBalanceSumasYSaldos
End Sub
Private _Nivel As Integer
Public Overrides Sub Cargado()
_Nivel = CInt(Rutinas.Ttagi(Me.OtrosParametros, "OPAR"))
_Nivel = CInt(tsUtilidades.Utilidades.Ttagi(Me.OtrosParametros, "OPAR"))
Dim Ejercicios = bd.ejercicioscontables.OrderByDescending(Function(x) x.FechaInicio).ToList
Dim ejab = Ejercicios.Where(Function(x) x.FechaCierre Is Nothing)
deFechaInicio.EditValue = ejab.OrderBy(Function(x) x.FechaInicio).First.FechaInicio

View File

@@ -5,7 +5,7 @@ Imports DevExpress.Xpf.Core
Imports DevExpress.XtraReports.UserDesigner
Imports DevExpress.XtraReports.UI
Imports System.IO
Imports tsl5.Datos
Imports tsUtilidades.Datos
Imports tsWPF
Imports tsWPF.Comun
Imports tsWPFCore.Comun
@@ -107,7 +107,7 @@ Public Class ucBancos
' End Get
'End Property
'Public Function ObtieneContexto(dcn As tsl5.Datos.DatosConexionCliente) As System.Data.Objects.ObjectContext Implements tsWPF.IApCabLin.ObtieneContexto
'Public Function ObtieneContexto(dcn As tsUtilidades.Datos.DatosConexionCliente) As System.Data.Objects.ObjectContext Implements tsWPF.IApCabLin.ObtieneContexto
' bd = bdGrupoSanchoToro.gestionasegasaEntities.NuevoContexto
' Return bd
'End Function

View File

@@ -7,11 +7,11 @@ Imports DevExpress.Xpf.Editors.Helpers
Imports DevExpress.Xpf.Core
Imports System.Data.Common
Imports System.Data.Entity
Imports tsl5.Datos
Imports tsUtilidades.Datos
Imports DevExpress.Xpf.Bars
Imports DevExpress.Xpf.Grid
Imports System.Collections
Imports tsl5.Extensiones
Imports tsUtilidades.Extensiones
Imports System.Data.Objects.DataClasses
Imports tsWPFCore.Comun
Imports tsWPFCore

View File

@@ -128,7 +128,7 @@ Public Class ucConceptosApuntes
Public Async Sub ObtieneConceptosApuntesAsync(Background As Boolean)
Try
Dim rs As New List(Of conceptosapuntes)
Dim Busqueda = tsl5.Extensiones.ObjetoNothingAVacio(Me.teBusqueda.EditValue)
Dim Busqueda As String = Me.teBusqueda.EditValue.ToString
If Background Then
Me.ContenedorAplicacion.IsEnabled = False
Await Task.Run(Sub()

View File

@@ -11,8 +11,8 @@ Imports System.Data.Entity
Imports bdGrupoSanchoToro
Imports DevExpress.Xpf.Bars
Imports DevExpress.Xpf.Grid
Imports tsl5.Datos
Imports tsl5.Extensiones.StringExtensions
Imports tsUtilidades.Datos
Imports tsUtilidades.Extensiones.StringExtensions
Imports tsWPFCore.Comun
Imports tsUtilidades

View File

@@ -7,7 +7,7 @@ Imports DevExpress.Xpf.Grid
Imports DevExpress.Xpf.Core
Imports System.Linq.Dynamic
Imports DevExpress.Xpf.Bars
Imports tsl5.Datos
Imports tsUtilidades.Datos
Imports tsWPF
Imports tsWPF.Comun
Imports tsWPFCore.Comun

View File

@@ -12,7 +12,7 @@
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/tsWPF;component/Plantillas.xaml" />
<ResourceDictionary Source="pack://application:,,,/tsWPFCore;component/Plantillas.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="RejillaAnidadaStyle" TargetType="{x:Type dxg:RowControl}">
<Setter Property="Background" Value="#B0E0E6" />

View File

@@ -1,25 +1,19 @@
Option Strict Off
Imports DevExpress.Xpf.Editors
Imports DevExpress.Xpf.LayoutControl
Imports tsWPF
Imports tsWPFCore
Imports System.ComponentModel
Imports System.Data
Imports DevExpress.Xpf.Editors.Validation
Imports DevExpress.Xpf.Editors.Helpers
Imports DevExpress.Xpf.Core
Imports tsWPF.modExtensiones
Imports tsWPFCore.modExtensiones
Imports System.Data.Common
Imports System.Data.Entity
Imports bdGrupoSanchoToro
Imports DevExpress.Xpf.Grid
Imports tsl5.Extensiones
Imports bdGrupoSanchoToro.apuntes
Imports tsUtilidades.Extensiones
Imports bdGrupoSanchoToro.db.apuntes
Imports DevExpress.Xpf.Bars
Imports tsl5.Datos
Imports System.Windows.Media.Animation
Imports tsWPF.Comun
Imports tsWPFCore.Comun
Imports tsWPFCore
Imports tsUtilidades
Imports bdGrupoSanchoToro.db
@@ -105,8 +99,8 @@ Public Class ucDiario
If FuerzaNuevo OrElse _idAsiento Is Nothing Then
ra = New asientos
ra.Fecha = Today ' If(uEc.FechaFin > Now.Date, Now.Date, uEc.FechaFin)
ra.FechaIntroduccion = Now
ra.Fecha = DateOnly.FromDateTime(Today) ' If(uEc.FechaFin > Now.Date, Now.Date, uEc.FechaFin)
ra.FechaIntroduccion = DateOnly.FromDateTime(Now)
Dim uEc = bd.ejercicioscontables.FirstOrDefault(Function(x) x.FechaInicio <= ra.Fecha And x.FechaFin >= ra.Fecha And x.FechaCierre Is Nothing)
If uEc Is Nothing Then
uEc = bd.ejercicioscontables.Where(Function(x) x.FechaCierre Is Nothing).OrderByDescending(Function(x) x.FechaInicio).First
@@ -117,7 +111,7 @@ Public Class ucDiario
ra.Tipo = bdGrupoSanchoToro.db.asientos.TipoAsiento.NORMAL
ra.Punteado = False
NuevoEstado = EstadosAplicacion.Nuevo
ra.usuarios = bd.usuarios.First(Function(x) x.idUsuario = bdGrupoSanchoToro.Utilidades.dsc.idUsuario)
ra.idUsuarioNavigation = bd.usuarios.First(Function(x) x.idUsuario = bdGrupoSanchoToro.db.Utilidades.idUsuario)
Else
ra = bd.asientos.First(Function(x) x.idAsiento = _idAsiento)
NuevoEstado = EstadosAplicacion.ModificandoRegistro
@@ -156,13 +150,12 @@ Public Class ucDiario
If ra.apuntes.Any(Function(x) x.TipoDocumento.HasValue AndAlso (x.TipoDocumento = TiposDocumentos.FACTURA And x.NumeroDocumento.NothingAVacio = "")) Then
hte.Add("Almacenar-FaltaNumeroDocumento", "Es obligatorio meter el nº de documento en los apuntes de tipo factura")
End If
ra.Fecha = ra.Fecha.Date
Dim ej = bd.ejercicioscontables.FirstOrDefault(Function(x) x.FechaInicio <= ra.Fecha And x.FechaFin >= ra.Fecha And x.FechaCierre.HasValue = False)
If ej Is Nothing Then
hte.Add("Almacenar-EjercicioNoAbiertooCerrado", "El ejercicio según la fecha del asiento no se ha abierto o ya se cerró")
End If
If Estado = EstadosAplicacion.Nuevo Then
ra.FechaIntroduccion = tsl5.bbdd.AhoraSqlServer(bd)
ra.FechaIntroduccion = DateOnly.FromDateTime(Now)
ra.idUsuario = idUsuario
End If
If hte.Count > 0 Then
@@ -190,8 +183,7 @@ Public Class ucDiario
Select Case pts.NombreCampo.ToLower
Case "fecha"
Dim NuevaFecha As DateOnly = e.Value
NuevaFecha = NuevaFecha.Date
Dim NuevaFecha As DateOnly = DateOnly.FromDateTime(e.Value)
If NuevaFecha <> ra.Fecha Then
Dim Ejercicios = bd.ejercicioscontables.ToList
Dim EjercicioNuevo = Ejercicios.FirstOrDefault(Function(x) x.FechaInicio <= NuevaFecha And x.FechaFin >= NuevaFecha And x.FechaCierre Is Nothing)
@@ -426,13 +418,13 @@ Public Class ucDiario
Case TiposDocumentos.RECIBO
Dim rec = bd.movimientoscaja.FirstOrDefault(Function(x) x.idMovimiento = ap.idAplicacion)
If rec IsNot Nothing Then
Dim uc As New ucMovimientoCaja(rec.idRecibo)
FuncionesDinamicas.AbrirAP(uc)
Dim uc As New ucMovimientoCaja(rec.idMovimiento)
FuncionesDinamicas.AbrirAP(uc, "")
Else
DXMessageBox.Show("El recibo no se encuentra", "Atención")
DXMessageBox.Show("El Movimiento no se encuentra", "Atención")
End If
Case Else
DXMessageBox.Show("Tipo de documento no disponible", "Atención")
DXMessageBox.Show("Tipo Movimiento no disponible", "Atención")
End Select
End If
End Sub
@@ -560,9 +552,21 @@ Public Class ucDiario
Private Sub ucDiario_ErrorGuardando(sender As Object, ex As Exception, OpcionGuardado As Integer) Handles Me.ErrorGuardando
Try
Dim ea = bd.ObjectStateManager.GetObjectStateEntries(System.Data.EntityState.Added)
Dim ee = bd.ObjectStateManager.GetObjectStateEntries(System.Data.EntityState.Deleted)
Dim em = bd.ObjectStateManager.GetObjectStateEntries(System.Data.EntityState.Modified)
' //IEnumerable<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry> res = from e in this.ChangeTracker.Entries()
'// where e.State.HasFlag(Microsoft.EntityFrameworkCore.EntityState.Added) ||
'// e.State.HasFlag(Microsoft.EntityFrameworkCore.EntityState.Modified) ||
'// e.State.HasFlag(Microsoft.EntityFrameworkCore.EntityState.Deleted)
'// select e;
'//if (res.Any())
'// return true;
'//return false;
Dim ea = bd.ChangeTracker.Entries.Where(Function(x) x.State.HasFlag(EntityState.Added))
Dim ee = bd.ChangeTracker.Entries.Where(Function(x) x.State.HasFlag(EntityState.Deleted))
Dim em = bd.ChangeTracker.Entries.Where(Function(x) x.State.HasFlag(EntityState.Modified))
Dim sMensaje As String = "Entidades Añadidas: " & ea.Count.ToString
For Each ent In ea
Select Case ent.Entity.GetType

View File

@@ -6,13 +6,13 @@ Imports bdGrupoSanchoToro
Imports DevExpress.Xpf.Grid
Imports DevExpress.Xpf.Core
Imports System.Linq.Dynamic
Imports tsl5.Datos
Imports tsUtilidades.Datos
Imports tsWPF
Imports tsWPF.Comun
Imports tsWPFCore.Comun
Imports tsWPFCore
Imports tsUtilidades
Imports bdGrupoSanchoToro
Imports bdGrupoSanchoToro.db
Imports bdGrupoSanchoToro.db.Utilidades
@@ -105,7 +105,7 @@ Public Class ucDiarios
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
End Sub
Public Function ObtieneAsientos(BackGround As Boolean, TextoBusqueda As String, FechaInicio As Date, FechaFin As Date) As List(Of asientos)
Public Function ObtieneAsientos(BackGround As Boolean, TextoBusqueda As String, FechaInicio As DateOnly, FechaFin As DateOnly) As List(Of asientos)
Dim rs As New List(Of asientos)
Dim parametros(0) As Object
Dim iNumExc As Integer = 0
@@ -120,10 +120,10 @@ Public Class ucDiarios
'End If
Dim Calfap() As String = {"NumeroDocumento", "Concepto"}
Dim Cnumap() As String = {"idAsiento", "Debe", "Haber"}
Dim ExpBusAsi As String = tsWPF.Utilidades.Varias.GeneraExpresionBusqueda(TextoBusqueda, Cnumap, Calfap, Nothing)
Dim lap = bd.apuntes.Where(ExpBusAsi, parametros).Select(Function(x) x.asientos).Where(Function(x) x.Fecha >= FechaInicio And x.Fecha <= FechaFin).ToList
Dim ExpBusAsi As String = tsWPFCore.Utilidades.Varias.GeneraExpresionBusqueda(TextoBusqueda, Cnumap, Calfap, Nothing)
Dim lap = bd.apuntes.Where(ExpBusAsi, parametros).Select(Function(x) x.idAsientoNavigation).Where(Function(x) x.Fecha >= FechaInicio And x.Fecha <= FechaFin).ToList
Dim ctas = TextoBusqueda.Split(" ").Where(Function(x) x.Length = bdGrupoSanchoToro.db.cuentas.LongitudCuentaFinal).ToArray
Dim lap2 = bd.apuntes.Where(Function(x) ctas.Contains(x.cuentas.NumeroCuenta)).Select(Function(x) x.asientos).Where(Function(x) x.Fecha >= FechaInicio And x.Fecha <= FechaFin).ToList
Dim lap2 = bd.apuntes.Where(Function(x) ctas.Contains(x.idCuentaNavigation.NumeroCuenta)).Select(Function(x) x.idAsientoNavigation).Where(Function(x) x.Fecha >= FechaInicio And x.Fecha <= FechaFin).ToList
rs = lap.Union(lap2).OrderBy(Function(x) x.Fecha).ThenBy(Function(x) x.Fecha).ToList
Else
rs = bd.asientos.Where(Function(x) x.Fecha >= FechaInicio And x.Fecha <= FechaFin).ToList
@@ -145,7 +145,7 @@ Public Class ucDiarios
Dim rs As New List(Of asientos)
Dim fi, ff As Date?
Dim fi, ff As DateOnly?
Dim Busqueda As String
Busqueda = Me.teBusqueda.Text.Trim

View File

@@ -39,12 +39,12 @@ Public Class ucEjercicioContable
If FuerzaNuevo OrElse _idEjercicio Is Nothing Then
ra = New bdGrupoSanchoToro.db.ejercicioscontables
ra.FechaApertura = Now.Date
ra.FechaApertura = DateOnly.FromDateTime(Now)
Dim Anno As Integer = Now.Year
If Now.Month > 1 Then Anno += 1
ra.Descripcion = Anno.ToString
ra.FechaInicio = New Date(Anno, 1, 1)
ra.FechaFin = New Date(Anno, 12, 31)
ra.FechaInicio = New DateOnly(Anno, 1, 1)
ra.FechaFin = New DateOnly(Anno, 12, 31)
ra.idEmpresa = bd.empresas.First(Function(x) x.FechaBaja.HasValue = False).idEmpresa
Me.DataContext = ra
_idEjercicio = Nothing
@@ -157,7 +157,7 @@ Public Class ucEjercicioContable
If Not DXSplashScreen.IsActive Then DXSplashScreen.Show(Of tsWPFCore.SplashScreenTecnosis)()
DXSplashScreen.SetState("Obteniendo cuentas ...")
Dim Nivel As Integer = cbNivel.EditValue
Dim ctas = bdGrupoSanchoToro.db.vf_cuentas.Obtiene_vf_cuentas(bd, ra.ideje, Nivel)
Dim ctas = bdGrupoSanchoToro.db.vf_cuentas.Obtiene_vf_cuentas(bd, ra.idEjercicio, Nivel)
gcCuentas.ItemsSource = ctas
If DXSplashScreen.IsActive Then DXSplashScreen.Close()
Catch ex As Exception
@@ -435,7 +435,7 @@ Public Class ucEjercicioContable
Dim ctaea = bd.cuentas.First(Function(x) x.idCuenta = cta.idCuenta)
CopiaCuenta(bd, ejnue, ctaea, ctne)
End If
.cuentas = ctne
.idCuentaNavigation = ctne
'.idCuenta = ejnue.cuentas.First(Function(x) x.NumeroCuenta = cta.NumeroCuenta).idCuenta
'.Fecha = ejnue.FechaInicio
.Concepto = "ASIENTO APERTURA"

View File

@@ -21,7 +21,7 @@
</tsWPFCore:tsGridControl.PropiedadesTS>
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="Descripcion" Header="Ejercicio" Width="150" IsSmart="True" CellTemplate="{DynamicResource VerDetalleTemplate}" />
<dxg:GridColumn FieldName="empresascontables.RazonSocial" Width="350" IsSmart="True" Header="Empresa" />
<dxg:GridColumn FieldName="empresas.RazonSocial" Width="350" IsSmart="True" Header="Empresa" />
<dxg:GridColumn FieldName="FechaInicio" Width="90" IsSmart="True">
<dxg:GridColumn.EditSettings>
<dxe:DateEditSettings DisplayFormat="dd/MM/yyyy"/>

View File

@@ -65,7 +65,7 @@ Public Class ucEjerciciosContables
Return bd
End Function
'Public Overrides Function ObtieneConexionBD() As tsl5.Datos.BBDD
'Public Overrides Function ObtieneConexionBD() As tsUtilidades.Datos.BBDD
' Return bdGrupoSanchoToro.gestionasegasaEntities.bdga
'End Function

View File

@@ -10,7 +10,7 @@ Imports tsWPF.modExtensiones
Imports System.Data.Common
Imports System.Data.Entity
Imports bdGrupoSanchoToro
Imports tsl5.Datos
Imports tsUtilidades.Datos
Imports DevExpress.Xpf.Bars
Imports DevExpress.Xpf.Grid
Imports System.IO
@@ -47,7 +47,7 @@ Public Class ucInformeContables
'ra.Descripcion = Now.Year.ToString
'ra.FechaInicio = New Date(Now.Year, 1, 1)
'ra.FechaFin = New Date(Now.Year, 12, 31)
'ra.idEmpresa = bd.empresascontables.First(Function(x) x.FechaBaja.HasValue = False).idEmpresaContable
'ra.idEmpresa = bd.empresas.First(Function(x) x.FechaBaja.HasValue = False).idEmpresaContable
Me.DataContext = ra
_idInforme = Nothing
' ra.idEjercicio = Nothing

View File

@@ -12,7 +12,6 @@ Imports tsWPF.Comun
Imports tsWPFCore.Comun
Imports tsWPFCore
Imports tsUtilidades
Imports bdGrupoSanchoToro
Imports bdGrupoSanchoToro.db
Imports bdGrupoSanchoToro.db.Utilidades
@@ -75,7 +74,7 @@ Public Class ucInformesContables
Return bd
End Function
'Public Overrides Function ObtieneConexionBD() As tsl5.Datos.BBDD
'Public Overrides Function ObtieneConexionBD() As tsUtilidades.Datos.BBDD
' Return bdGrupoSanchoToro.gestionasegasaEntities.bdga
'End Function
@@ -123,20 +122,20 @@ Public Class ucInformesContables
End If
i += 1
Loop Until bd.informescontables.Any(Function(x) x.Descripcion = sDesc Or x.Codigo = sCod) = False
Dim fi As New ficheros
Dim fi As New bdGrupoSanchoToro.db.ficheros
With fi
.Descripcion = ra.ficheros.Descripcion
.Fecha = ra.ficheros.Fecha
.idAplicacion = ra.ficheros.idAplicacion
.idTipo = ra.ficheros.idTipo
.Observaciones = ra.ficheros.Observaciones
.Fichero = ra.ficheros.Fichero
.NombreFichero = ra.ficheros.NombreFichero
.Descripcion = ra.idFicheroNavigation.Descripcion
.Fecha = ra.idFicheroNavigation.Fecha
.idAplicacion = ra.idFicheroNavigation.idAplicacion
.idTipo = ra.idFicheroNavigation.idTipo
.Observaciones = ra.idFicheroNavigation.Observaciones
.Fichero = ra.idFicheroNavigation.Fichero
.NombreFichero = ra.idFicheroNavigation.NombreFichero
End With
With ni
.Codigo = sCod
.Descripcion = sDesc
.ficheros = fi
.idFicheroNavigation = fi
End With
For Each c In ra.celdasinformescontables
Dim nc As New celdasinformescontables
@@ -149,7 +148,7 @@ Public Class ucInformesContables
End With
ni.celdasinformescontables.Add(nc)
Next
bd.informescontables.AddObject(ni)
bd.informescontables.Add(ni)
bd.SaveChanges()
Me.RefrescaUC()
Else

View File

@@ -7,13 +7,12 @@ Imports DevExpress.Xpf.Grid
Imports DevExpress.Xpf.Core
Imports System.Linq.Dynamic
Imports DevExpress.Xpf.Bars
Imports tsl5.Datos
Imports tsUtilidades.Datos
Imports tsWPF
Imports tsWPF.Comun
Imports tsWPFCore.Comun
Imports tsWPFCore
Imports tsUtilidades
Imports bdGrupoSanchoToro
Imports bdGrupoSanchoToro.db
Imports bdGrupoSanchoToro.db.Utilidades
@@ -88,7 +87,7 @@ Public Class ucListadoDiario
End Sub
Public Function ObtieneApuntes(TextoBusqueda As String, FechaInicio As Date, FechaFin As Date) As List(Of apuntes)
Public Function ObtieneApuntes(TextoBusqueda As String, FechaInicio As DateOnly, FechaFin As DateOnly) As List(Of apuntes)
Dim rs As List(Of apuntes)
Dim parametros(0) As Object
Dim iNumExc As Integer = 0
@@ -99,12 +98,12 @@ Public Class ucListadoDiario
Dim Calfc() As String = {"cuentas.NumeroCuenta"}
Dim ExpBus As String = tsWPFCore.Utilidades.Varias.GeneraExpresionBusqueda(TextoBusqueda, Nothing, Calf, Nothing, Calfc)
If ExpBus = "" Then
rs = bd.apuntes.Include(Function(x) x.asientos).Include(Function(x) x.cuentas).Where(Function(x) x.asientos.Fecha >= FechaInicio And x.asientos.Fecha <= FechaFin).OrderBy(Function(x) x.asientos.Fecha).ThenBy(Function(x) x.idAsiento).ThenBy(Function(x) x.idApunte).ToList
rs = bd.apuntes.Include(Function(x) x.idAsientoNavigation).Include(Function(x) x.idCuentaNavigation).Where(Function(x) x.idAsientoNavigation.Fecha >= FechaInicio And x.idAsientoNavigation.Fecha <= FechaFin).OrderBy(Function(x) x.idAsientoNavigation.Fecha).ThenBy(Function(x) x.idAsientoNavigation).ThenBy(Function(x) x.idApunte).ToList
Else
rs = bd.apuntes.Include(Function(x) x.asientos).Include(Function(x) x.cuentas).Where(ExpBus, parametros).Where(Function(x) x.asientos.Fecha >= FechaInicio And x.asientos.Fecha <= FechaFin).OrderBy(Function(x) x.asientos.Fecha).ThenBy(Function(x) x.idAsiento).ThenBy(Function(x) x.idApunte).ToList
rs = bd.apuntes.Include(Function(x) x.idAsientoNavigation).Include(Function(x) x.idCuentaNavigation).Where(ExpBus, parametros).Where(Function(x) x.idAsientoNavigation.Fecha >= FechaInicio And x.idAsientoNavigation.Fecha <= FechaFin).OrderBy(Function(x) x.idAsientoNavigation.Fecha).ThenBy(Function(x) x.idAsiento).ThenBy(Function(x) x.idApunte).ToList
End If
Else
rs = bd.apuntes.Include(Function(x) x.asientos).Include(Function(x) x.cuentas).Where(Function(x) x.asientos.Fecha >= FechaInicio And x.asientos.Fecha <= FechaFin).OrderBy(Function(x) x.asientos.Fecha).ThenBy(Function(x) x.idAsiento).ThenBy(Function(x) x.idApunte).ToList
rs = bd.apuntes.Include(Function(x) x.idAsientoNavigation).Include(Function(x) x.idCuentaNavigation).Where(Function(x) x.idAsientoNavigation.Fecha >= FechaInicio And x.idAsientoNavigation.Fecha <= FechaFin).OrderBy(Function(x) x.idAsientoNavigation.Fecha).ThenBy(Function(x) x.idAsiento).ThenBy(Function(x) x.idApunte).ToList
End If
Exit Do
Catch ex As Exception
@@ -121,7 +120,7 @@ Public Class ucListadoDiario
Try
Dim rs As New List(Of apuntes)
Dim fi, ff As Date?
Dim fi, ff As DateOnly?
Dim Busqueda As String
Busqueda = Me.teBusqueda.Text.Trim

View File

@@ -1,15 +1,16 @@

Imports System.ComponentModel
Imports System.Drawing.Printing
Imports System.IO
Imports bdGrupoSanchoToro
Imports bdGrupoSanchoToro.db
Imports DevExpress.Xpf.Core
Imports DevExpress.Xpf.Docking
Imports DevExpress.Xpf.Printing
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraReports.UI
Imports tsEFCore8.Extensiones
Imports Microsoft.EntityFrameworkCore
Imports System.Drawing.Printing
Imports System.ComponentModel
Imports DevExpress.Xpf.Printing
Imports tsEFCore8.Extensiones
Public Class Informes
Private Shared NumeroCopias As Integer
@@ -132,5 +133,41 @@ Public Class Informes
xr.ExportToPdf(st)
Return st.ToArray
End Function
Friend Shared Sub MuestraImpresos(bd As tscGrupoSanchoToro, idPlantilla As Integer, Datasource As Object, GrupoDocumentos As DocumentGroup, dc As DockController)
Try
If idPlantilla = 0 Then Throw New Exception("Seleccione primero la plantilla a imprimir")
Dim xr As New XtraReport
Dim pl = bd.plantillas.AsNoTracking.Where(Function(x) x.idPlantilla = idPlantilla).First
Dim s As String = System.Text.Encoding.UTF8.GetString(pl.idFicheroNavigation.Fichero)
Using sw As New StreamWriter(New MemoryStream())
sw.Write(s)
sw.Flush()
xr = XtraReport.FromStream(sw.BaseStream, True)
End Using
Try
Dim pr As DevExpress.XtraReports.Parameters.Parameter = (From p As DevExpress.XtraReports.Parameters.Parameter In xr.Parameters Where p.Name = "Fecha").First
pr.Value = Now
pr.Visible = False
Catch ex As Exception
End Try
xr.DataSource = Datasource
Dim docpanel As New DevExpress.Xpf.Docking.DocumentPanel
docpanel.Caption = pl.Descripcion
Dim vi As New tsWPFCore.ucVisualizadorInformes()
vi.Visualizador.DocumentSource = xr
xr.CreateDocument(True)
docpanel.Content = vi
docpanel.ClosingBehavior = DevExpress.Xpf.Docking.ClosingBehavior.ImmediatelyRemove
GrupoDocumentos.Items.Add(docpanel)
dc.Activate(docpanel)
Catch ex As Exception
DXMessageBox.Show(ex.Message, "Atención", MessageBoxButton.OK, MessageBoxImage.Error)
End Try
End Sub
End Class

View File

@@ -84,7 +84,7 @@ namespace ServicioGrupoSanchoToro
List<AlternateView> avs = new List<AlternateView>();
avs.Add(avHtml);
tsCorreos.Funciones.EnviaCorreo(email.idcuentaNavigation.ServidorSMTP, email.Remitente, email.Destinatario, email.Asunto, sCuerpoHtml, ats, avs, email.Copia, email.CopiaOculta, email.idcuentaNavigation.CuentaCorreo, email.idcuentaNavigation.Password, (int)email.idcuentaNavigation.Puerto, email.idcuentaNavigation.SSL, true, email.idcuentaNavigation.ResponderA);
// tsl5.Correo.Funciones.EnviaCorreo(email.cuentascorreo.ServidorSMTP, email.Remitente, email.Destinatario, email.Asunto, email.Cuerpo, attachments, avs, , , email.cuentascorreo.CuentaCorreo, sPasswd, email.cuentascorreo.Puerto, email.cuentascorreo.SSL, True)
// tsUtilidades.Correo.Funciones.EnviaCorreo(email.cuentascorreo.ServidorSMTP, email.Remitente, email.Destinatario, email.Asunto, email.Cuerpo, attachments, avs, , , email.cuentascorreo.CuentaCorreo, sPasswd, email.cuentascorreo.Puerto, email.cuentascorreo.SSL, True)
email.FechaEnvio = DateTime.UtcNow;
}
catch (Exception ex)

View File

@@ -211,7 +211,7 @@ namespace bdGrupoSanchoToro
// las.Add("System.Data.Entity.dll");
// las.Add("dll");
// las.Add("tsWPF.dll");
// las.Add("tsl5.dll");
// las.Add("tsUtilidades.dll");
// var lp = new List<string>();
// lp.Add("bd As tscGrupoSanchoToro");
// // For Each p In parametros

View File

@@ -1078,14 +1078,14 @@ public partial class GrupoSanchoToroContext : DbContext
entity.HasIndex(e => e.Descripcion, "Descripcion_UNIQUE").IsUnique();
entity.HasIndex(e => e.idEmpresa, "ejercicioscontables_empresascontables_idx");
entity.HasIndex(e => e.idEmpresa, "ejercicioscontables_empresas_idx");
entity.Property(e => e.Descripcion).HasMaxLength(40);
entity.Property(e => e.NivelesCuentas).HasMaxLength(20);
entity.HasOne(d => d.idEmpresaNavigation).WithMany(p => p.ejercicioscontables)
.HasForeignKey(d => d.idEmpresa)
.HasConstraintName("ejercicioscontables_empresascontables");
.HasConstraintName("ejercicioscontables_empresas");
});
modelBuilder.Entity<empresas>(entity =>

View File

@@ -1,7 +1,8 @@
using System;
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.CompilerServices;
using Microsoft.VisualBasic.CompilerServices;
namespace bdGrupoSanchoToro.db
{
@@ -100,6 +101,7 @@ namespace bdGrupoSanchoToro.db
return "";
}
}
[NotMapped]
public conciliacionesbancarias ConciliacionActual_TMP { get; set; }
public double Saldo
{

View File

@@ -87,6 +87,26 @@ namespace bdGrupoSanchoToro.db
}
return cuenta;
}
public bool Punteado
{
get
{
return FechaPunteo.HasValue;
}
set
{
if (value)
{
FechaPunteo = DateTime.Now;
}
else
{
FechaPunteo=null;
}
OnPropertyChanged("Punteado");
}
}
private string _Ejercicio;
public string EjercicioTmp
{

View File

@@ -1,7 +1,8 @@
using System;
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.CompilerServices;
using Microsoft.VisualBasic.CompilerServices;
using tsUtilidades.Extensiones;
namespace bdGrupoSanchoToro.db
@@ -17,6 +18,7 @@ namespace bdGrupoSanchoToro.db
}
public const string CUENTA_PERDIDAS_Y_GANANCIAS = "12900000";
[NotMapped]
public List<apuntes> ApuntesTemporales { get; set; }
public string Descripcion
{

View File

@@ -0,0 +1,167 @@
using bdGrupoSanchoToro;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using tsUtilidades.Extensiones;
namespace bdGrupoSanchoToro.db
{
public partial class ejercicioscontables
{
public static int ObtieneidEjercicioAbierto(DateOnly Fecha)
{
var bd = tscGrupoSanchoToro.NuevoContexto();
var ej = bd.ejercicioscontables.FirstOrDefault(x => x.FechaInicio <= Fecha & x.FechaFin >= Fecha & x.FechaCierre.HasValue == false);
if (ej is null)
{
ej = bd.ejercicioscontables.FirstOrDefault(x => x.FechaInicio <= Fecha & x.FechaFin >= Fecha & x.FechaCierre.HasValue);
if (ej is null)
{
if (DateOnly.FromDateTime(DateTime.Today).DayNumber - Fecha.DayNumber > 365d || Fecha.DayNumber - DateOnly.FromDateTime(DateTime.Today).DayNumber > 60d)
{
throw new Exception("La fecha del ejercicio " + Fecha.ToShortDateString() + " parece incorrecta");
}
else
{
ej = ejercicioscontables.AbreEjercicio(bd, Fecha);
return ej.idEjercicio;
}
}
else
{
throw new Exception("El ejercicio está cerrado");
}
}
else
{
return ej.idEjercicio;
}
}
public string DescripcionExtendida
{
get
{
if (this.FechaInicio.Month == 1 & this.FechaInicio.Day == 1 & this.FechaFin.Month == 12 & this.FechaFin.Day == 31)
{
return this.idEmpresaNavigation.RazonSocial + " " + this.FechaInicio.Year.ToString();
}
else
{
return this.idEmpresaNavigation.RazonSocial + " " + this.FechaInicio.ToString() + " " + this.FechaFin.ToString();
}
}
}
public bdGrupoSanchoToro.db.asientos AsientoApertura
{
get
{
return this.asientos.FirstOrDefault(x => x.Tipo == (int)bdGrupoSanchoToro.db.asientos.TipoAsiento.APERTURA);
}
}
public bdGrupoSanchoToro.db.asientos AsientoRegularizacion
{
get
{
return this.asientos.FirstOrDefault(x => x.Tipo == (int)bdGrupoSanchoToro.db.asientos.TipoAsiento.REGULARIZACION);
}
}
// Private _CuentasPlanContable As List(Of cuentasplancontable)
// Public ReadOnly Property CuentasPlanContable As List(Of cuentasplancontable)
// Get
// If _CuentasPlanContable Is Nothing Then
// _CuentasPlanContable = Me.plancontable.gruposplancontable.SelectMany(Function(x) x.cuentasplancontable).ToList
// End If
// Return _CuentasPlanContable
// End Get
// End Property
public void CopiaCuentas()
{
try
{
tscGrupoSanchoToro bd = tscGrupoSanchoToro.NuevoContexto();
var ea = bd.ejercicioscontables.OrderByDescending(x => x.FechaInicio).FirstOrDefault(x => x.FechaInicio < this.FechaInicio);
if (ea is not null)
{
var ctas1 = ea.cuentas.Where(x => x.NumeroCuenta.Length == 1).ToList();
var ctas2 = ea.cuentas.Where(x => x.NumeroCuenta.Length == 2).ToList();
var ctas3 = ea.cuentas.Where(x => x.NumeroCuenta.Length == 3).ToList();
var ctas4 = ea.cuentas.Where(x => x.NumeroCuenta.Length == 4).ToList();
var ctas8 = ea.cuentas.Where(x => x.NumeroCuenta.Length == 8).ToList();
int Nc = 0;
foreach (var cta in ctas1)
Nc += this.CopiaCuenta(bd, this, cta);
foreach (var cta in ctas2)
Nc += this.CopiaCuenta(bd, this, cta);
foreach (var cta in ctas3)
Nc += this.CopiaCuenta(bd, this, cta);
foreach (var cta in ctas4)
Nc += this.CopiaCuenta(bd, this, cta);
foreach (var cta in ctas8)
Nc += this.CopiaCuenta(bd, this, cta);
bd.SaveChanges();
}
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
private int CopiaCuenta(tscGrupoSanchoToro bd, ejercicioscontables Ejercicio, bdGrupoSanchoToro.db.cuentas CtaAnterior)
{
if (!Ejercicio.cuentas.Any(X => (X.NumeroCuenta ?? "") == (CtaAnterior.NumeroCuenta ?? "")))
{
var nc = new bdGrupoSanchoToro.db.cuentas();
nc.Denominacion = CtaAnterior.Denominacion;
nc.EsCuentaFinal = CtaAnterior.EsCuentaFinal;
nc.Mote = CtaAnterior.Mote;
nc.Observaciones = CtaAnterior.Observaciones;
nc.NumeroCuenta = CtaAnterior.NumeroCuenta;
nc.idEjercicio = Ejercicio.idEjercicio;
nc.idEmpresaAmortizacion = CtaAnterior.idEmpresaAmortizacion;
nc.PresupuestoEnero = CtaAnterior.PresupuestoEnero;
nc.PresupuestoFebrero = CtaAnterior.PresupuestoFebrero;
nc.PresupuestoMarzo = CtaAnterior.PresupuestoMarzo;
nc.PresupuestoAbril = CtaAnterior.PresupuestoAbril;
nc.PresupuestoMayo = CtaAnterior.PresupuestoMayo;
nc.PresupuestoJunio = CtaAnterior.PresupuestoJunio;
nc.PresupuestoJulio = CtaAnterior.PresupuestoJulio;
nc.PresupuestoAgosto = CtaAnterior.PresupuestoAgosto;
nc.PresupuestoSeptiembre = CtaAnterior.PresupuestoSeptiembre;
nc.PresupuestoOctubre = CtaAnterior.PresupuestoOctubre;
nc.PresupuestoNoviembre = CtaAnterior.PresupuestoNoviembre;
nc.PresupuestoDiciembre = CtaAnterior.PresupuestoDiciembre;
bd.cuentas.Add(nc);
return 1;
}
else
{
return 0;
}
}
public static ejercicioscontables AbreEjercicio(tscGrupoSanchoToro bd, DateOnly Fecha)
{
var ej = new ejercicioscontables();
ej.FechaApertura = DateOnly.FromDateTime(DateTime.Now);
ej.FechaInicio = DateOnly.FromDateTime(new DateTime(Fecha.Year, 1, 1));
ej.FechaFin = DateOnly.FromDateTime( new DateTime(Fecha.Year, 12, 31));
ej.Descripcion = Fecha.Year.ToString();
bd.ejercicioscontables.Add(ej);
bd.SaveChanges();
ej.CopiaCuentas();
return ej;
}
public static bool CompruebaEjereciciosAbiertos(tscGrupoSanchoToro bd, List<DateOnly> Fechas)
{
var ejeabiertos = bd.ejercicioscontables.Where(x => x.FechaCierre.HasValue == false).ToList();
return Fechas.All(x => ejeabiertos.Any(y => y.FechaInicio <= x & y.FechaFin >= x));
}
}
}