2026-01-30 03
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user