agregado procesos y bd clases

This commit is contained in:
2026-04-28 11:52:16 +02:00
parent 59a774c397
commit cd2e8b8530
251 changed files with 56881 additions and 49 deletions

109
guia/Extensiones/apuntes.vb Normal file
View File

@@ -0,0 +1,109 @@
Partial Public Class apuntes
Private _NumeroCuentaTmp As String
Public Property NumeroCuentaTmp As String
Get
Return _NumeroCuentaTmp
End Get
Set(value As String)
_NumeroCuentaTmp = value
OnPropertyChanged("NumeroCuentaTmp")
End Set
End Property
Public Property SaldoCuentaTmp As Double
Public Property DescripcionCuentaTmp As String
Public Shared Sub EstableceSaldoTmp(lap As List(Of apuntes))
Dim SaldoAnterior As Double = 0
For Each ap In lap
SaldoAnterior = SaldoAnterior + ap.Debe - ap.Haber
ap.SaldoCuentaTmp = SaldoAnterior
Next
End Sub
Public Enum TiposDocumentos
RECIBO = 1
FACTURA = 2
OTRO = 99
End Enum
Public Shared Function ListaTiposDocumentos() As List(Of Tipo)
Dim lEstados As New List(Of Tipo)
For Each Enumeracion As TiposDocumentos In System.Enum.GetValues(GetType(TiposDocumentos))
lEstados.Add(New Tipo With {.id = CInt(Enumeracion), .Descripcion = Enumeracion.ToString.Replace("_", " ")})
Next
Return lEstados
End Function
Public Function DebeAnterior(bd As bdGestionAsegasa.gestionasegasaEntities, Fecha As Date) As Double
Try
Dim aps = bd.apuntes.Where(Function(X) X.idCuenta = Me.idCuenta And X.asientos.Fecha < Fecha).ToList
Return aps.Sum(Function(x) x.Debe)
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
Public Function HaberAnterior(bd As bdGestionAsegasa.gestionasegasaEntities, Fecha As Date) As Double
Try
Dim aps = bd.apuntes.Where(Function(X) X.idCuenta = Me.idCuenta And X.asientos.Fecha < Fecha).ToList
Return aps.Sum(Function(x) x.Haber)
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
Public ReadOnly Property Saldo As Double
Get
Return Math.Round(Debe - Haber, 2)
End Get
End Property
Private _Conciliado As Boolean?
Public Property Conciliado As Boolean
Get
If _Conciliado.HasValue Then
Return _Conciliado
Else
If ConciliacionActual_TMP IsNot Nothing Then
If ConciliacionActual_TMP.idconciliacion <> Me.idConciliacion Then
Return False
Else
Return Me.idConciliacion.HasValue
End If
Else
Return Me.idConciliacion.HasValue
End If
End If
End Get
Set(value As Boolean)
_Conciliado = value
If value Then
Me.conciliacionesbancarias = Me.ConciliacionActual_TMP
Else
Me.idConciliacion = Nothing
End If
End Set
End Property
Public Property ConciliacionActual_TMP As conciliacionesbancarias
Public ReadOnly Property ConciliadoEn As String
Get
If ConciliacionActual_TMP IsNot Nothing AndAlso Me.idConciliacion.HasValue AndAlso Me.idConciliacion <> ConciliacionActual_TMP.idconciliacion Then
Return "Nº Conc.: " & Me.idConciliacion & " (" & Me.conciliacionesbancarias.Año.ToString & "-" & Me.conciliacionesbancarias.Mes.ToString & ")"
Else
Return ""
End If
End Get
End Property
Public ReadOnly Property Diferencia As Double
Get
Return Debe - Haber
End Get
End Property
End Class
Public Class Tipo
Property id As Integer
Property Descripcion As String
End Class