Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering

Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
Imports DevExpress.Persistent.Base.General
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Linq
Imports System.Linq.Expressions
Imports DevExpress.ExpressApp.ConditionalAppearance

<DefaultClassOptions()> _
<NavigationItem(False), CreatableItem(False)> _
<DeferredDeletion(False)> _
<Appearance("Hide DEV when HUF in ReturnHeade", AppearanceItemType.ViewItem, "LiquidAssets.CurrencyName.ShortName='HUF'", TargetItems:="BallanceFromDEV;BallanceToDEV", visibility:=DevExpress.ExpressApp.Editors.ViewItemVisibility.Hide)> _
Public Class LiquidAssetsReturnHeader 'Pénzeszközök egyenlege
    Inherits BaseObject
    Private _CustomersFrom As CustomersFrom 'Saját cég
    Private _LiquidAssets As LiquidAssets 'Pénzeszköz
    Private _DateFrom As Date 'Dátumtól
    Private _DateTo As Date 'Dátumig
    Private _BallanceFromHUF As Double = 0
    Private _BallanceFromDEV As Double = 0
    Private _BallanceToHUF As Double = 0
    Private _BallanceToDEV As Double = 0
    Private _ObjectCreated As Date
    Private _UserCreated As User
    Private _GLClosingTime As GLClosingTime
    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Protected Overrides Sub OnSaving()
        MyBase.OnSaving()
        If Session.IsNewObject(Me) Then
            ObjectCreated = GetSQLTime(Session)
            UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
        End If
    End Sub
    <VisibleInListView(False)> _
    <Association("LiquidAssetsReturnHeader-LiquidAssetsReturnRows", GetType(LiquidAssetsReturnRows)), Aggregated()> _
    ReadOnly Property LiquidAssetsReturnRows As XPCollection(Of LiquidAssetsReturnRows)
        Get
            Return GetCollection(Of LiquidAssetsReturnRows)("LiquidAssetsReturnRows")
        End Get
    End Property
    <VisibleInListView(False)> _
    ReadOnly Property LiquidAssetsReturnRowsGLRows As XPCollection(Of GLRows)
        Get
            Dim _GLRows As GLRows
            Dim _LiquidAssetsReturnRowsGLRows As New XPCollection(Of GLRows)(Session, CriteriaOperator.Parse("1=2"))
            Dim _LiquidAssetsReturnRows As LiquidAssetsReturnRows
            For Each _LiquidAssetsReturnRows In Me.LiquidAssetsReturnRows
                For Each _GLRows In _LiquidAssetsReturnRows.GLCassa.GLRows
                    _LiquidAssetsReturnRowsGLRows.Add(_GLRows)
                Next
            Next
            Return _LiquidAssetsReturnRowsGLRows
        End Get
    End Property
    <VisibleInListView(False)> _
    <Association("LiquidAssetsReturnHeader-LiquidAssetsReturnDenomination", GetType(LiquidAssetsReturnDenomination)), Aggregated()> _
    ReadOnly Property LiquidAssetsReturnDenomination As XPCollection(Of LiquidAssetsReturnDenomination)
        Get
            Return GetCollection(Of LiquidAssetsReturnDenomination)("LiquidAssetsReturnDenomination")
        End Get
    End Property

    <ImmediatePostData(True)> _
    Property CustomersFrom As CustomersFrom
        Get
            Return _CustomersFrom
        End Get
        Set(ByVal value As CustomersFrom)
            SetPropertyValue("CustomersFrom", _CustomersFrom, value)
        End Set
    End Property
    <ImmediatePostData(True)> _
    <DataSourceCriteria("LiquidAssetsType in (0,2,4) AND CustomerFrom='@This.CustomersFrom'")> _
    Property LiquidAssets As LiquidAssets
        Get
            Return _LiquidAssets
        End Get
        Set(ByVal value As LiquidAssets)
            SetPropertyValue("LiquidAssets", _LiquidAssets, value)
            If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
                Session.Delete(Me.LiquidAssetsReturnDenomination)
                '--- Forint címlet jegyzék
                If value.CurrencyName.ShortName = "HUF" Then
                    If LiquidAssetsReturnDenomination.Count = 0 Then
                        Dim _LiquidAssetsReturnDenomination As LiquidAssetsReturnDenomination
                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 0
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "20 000"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 1
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "10 000"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 2
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "5 000"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 3
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "2 000"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 4
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "1 000"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 5
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "500"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 6
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "200"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 7
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "100"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 8
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "50"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 9
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "20"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 10
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "10"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 11
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "5"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0
                    End If
                End If
                If value.CurrencyName.ShortName = "EUR" Then
                    If LiquidAssetsReturnDenomination.Count = 0 Then
                        Dim _LiquidAssetsReturnDenomination As LiquidAssetsReturnDenomination
                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 1
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "500"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 2
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "200"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 3
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "100"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 4
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "50"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 5
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "20"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 6
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "10"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 7
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "5"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 8
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "2"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 9
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "1"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 10
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "50 cent"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 11
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "20 cent"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 12
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "10 cent"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 13
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "5 cent"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 14
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "2 cent"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 15
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "1 cent"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0
                    End If
                End If
                If value.CurrencyName.ShortName = "CHF" Then
                    If LiquidAssetsReturnDenomination.Count = 0 Then
                        Dim _LiquidAssetsReturnDenomination As LiquidAssetsReturnDenomination
                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 0
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "1000"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 2
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "200"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 3
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "100"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 4
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "50"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 5
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "20"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 6
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "10"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 7
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "5"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 8
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "2"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 9
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "1"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 10
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "50 cent"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 11
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "20 cent"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 12
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "10 cent"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                        _LiquidAssetsReturnDenomination = New LiquidAssetsReturnDenomination(Session)
                        _LiquidAssetsReturnDenomination.Idx = 13
                        _LiquidAssetsReturnDenomination.LiquidAssetsReturnHeader = Me
                        _LiquidAssetsReturnDenomination.Denomination = "5 cent"
                        _LiquidAssetsReturnDenomination.DenominationValue = 0

                    End If
                End If
            End If
        End Set
    End Property
    Property DateFrom As Date
        Get
            Return _DateFrom
        End Get
        Set(ByVal value As Date)
            SetPropertyValue("DateFrom", _DateFrom, value)
        End Set
    End Property
    Property DateTo As Date
        Get
            Return _DateTo
        End Get
        Set(ByVal value As Date)
            SetPropertyValue("DateTo", _DateTo, value)
        End Set
    End Property
    Property BallanceFromHUF As Double
        Get
            Return _BallanceFromHUF
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("BallanceFromHUF", _BallanceFromHUF, value)
        End Set
    End Property
    Property BallanceToHUF As Double
        Get
            Return _BallanceToHUF
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("BallanceToHUF", _BallanceToHUF, value)
        End Set
    End Property
    Property BallanceFromDEV As Double
        Get
            Return _BallanceFromDEV
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("BallanceFromDEV", _BallanceFromDEV, value)
        End Set
    End Property
    Property BallanceToDEV As Double
        Get
            Return _BallanceToDEV
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("BallanceToDEV", _BallanceToDEV, value)
        End Set
    End Property
    <NonCloneable> _
    Property ObjectCreated As Date
        Get
            Return _ObjectCreated
        End Get
        Set(value As Date)
            SetPropertyValue("ObjectCreated", _ObjectCreated, value)
        End Set
    End Property
    <NonCloneable> _
    Property UserCreated As User
        Get
            Return _UserCreated
        End Get
        Set(value As User)
            SetPropertyValue("UserCreated", _UserCreated, value)
        End Set
    End Property
    <Browsable(False)> _
    Property GLClosingTime As GLClosingTime
        Get
            Return _GLClosingTime
        End Get
        Set(value As GLClosingTime)
            SetPropertyValue("GLClosingTime", _GLClosingTime, value)
        End Set
    End Property

    Sub RecalculateBallance()
        If LiquidAssets Is Nothing Then Exit Sub
        If DateFrom < #1/1/2000# Then Exit Sub
        BallanceFromHUF = 0
        BallanceFromDEV = 0
        BallanceToHUF = 0
        BallanceToDEV = 0
        Dim _GLRows_Collection As New XPCollection(Of GLRows)(Session, CriteriaOperator.Parse("GetDate(GLHeader.DateExecution)<? and GLHeader.DocumentNumber<>'' and GLHeader.IsStorno=False", DateFrom.Date))
        Dim query = From _GLRows In _GLRows_Collection _
                    Where _GLRows.GLHeader.DateExecution.Date < DateFrom.Date And _GLRows.LiquidAssets Is Me.LiquidAssets And
                          _GLRows.GLHeader.IsEditable = False And
                          String.IsNullOrEmpty(_GLRows.GLHeader.DocumentNumber) = False And
                          _GLRows.GLHeader IsNot Nothing
            Group _GLRows By _GLRows.GLHeader.CustomersFrom, _
                             _GLRows.LiquidAssets Into g = Group _
            Select New With {Key .CustomersFrom = CustomersFrom, _
                             Key .LiquidAssets = LiquidAssets, _
                             Key .InAmountHUF = g.Sum(Function(inv) inv.InAmountHUF), _
                             Key .OutAmountHUF = g.Sum(Function(inv) inv.OutAmountHUF), _
                             Key .InAmountDEV = g.Sum(Function(inv) inv.InAmountDEV), _
                             Key .OutAmountDEV = g.Sum(Function(inv) inv.OutAmountDEV)}

        For Each item In query
            BallanceFromHUF += item.InAmountHUF - item.OutAmountHUF
            BallanceFromDEV += item.InAmountDEV - item.OutAmountDEV
        Next
        Dim _LiquidAssetsReturnRows As LiquidAssetsReturnRows
        Dim _ReturnAmountHUF As Double = 0
        Dim _ReturnAmountDEV As Double = 0
        For Each _LiquidAssetsReturnRows In LiquidAssetsReturnRows
            _ReturnAmountHUF += (_LiquidAssetsReturnRows.GLCassa.TotalInAmountHUF - _LiquidAssetsReturnRows.GLCassa.TotalOutAmountHUF)
            _ReturnAmountDEV += (_LiquidAssetsReturnRows.GLCassa.TotalInAmountDEV - _LiquidAssetsReturnRows.GLCassa.TotalOutAmountDEV)
        Next
        Me.BallanceToHUF = Me.BallanceFromHUF + _ReturnAmountHUF
        Me.BallanceToDEV = Me.BallanceFromDEV + _ReturnAmountDEV
    End Sub

End Class

