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
<DefaultClassOptions()> _
<NavigationItem(False), CreatableItem(False)> _
<DeferredDeletion(False)> _
Public Class GLBankDivide 'Popup a Banki csomag sorbontáshoz
    Inherits BaseObject
    Private _AmountPercent As Double = 0
    Private _AmountDEV As Double
    Private _AmountHUF As Double
    Private _DatePayment As Date
    Private _RegistryBankTransfer_AmountHUF As Double
    Private _RegistryBankTransfer_AmountDEV As Double
    Private _RegistryBankTransfer_RegistryHeader_CurrencyName As String
    Private _Note As String ' -- Az utalási tétel közlemény rovata

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    <NonPersistent()> _
    Public Property AmountPercent As Double
        Get
            Return _AmountPercent
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("AmountPercent", _AmountPercent, value)
            'If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then
            '    If Not Me.AmountHUF = Math.Round(((value / 100) * Me.RegistryBankTransfer.AmountHUF), 2, MidpointRounding.AwayFromZero) Then
            '        Me.AmountHUF = Math.Round(((value / 100) * Me.RegistryBankTransfer.AmountHUF), 2, MidpointRounding.AwayFromZero)
            '    End If
            'End If
        End Set
    End Property
    <NonPersistent()> _
    Public Property AmountDEV As Double
        Get
            Return _AmountDEV
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("AmountDEV", _AmountDEV, value)
            'If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then
            '    If Not Me.AmountHUF = Math.Round((value * Me.RegistryBankTransfer.RegistryHeader.F_CurrencyRate), 2, MidpointRounding.AwayFromZero) Then
            '        Me.AmountHUF = Math.Round((value * Me.RegistryBankTransfer.RegistryHeader.F_CurrencyRate), 2, MidpointRounding.AwayFromZero)
            '    End If
            'End If
        End Set
    End Property
    <NonPersistent()> _
    Public Property AmountHUF As Double
        Get
            Return _AmountHUF
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("AmountHUF", _AmountHUF, value)
            'If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then
            '    If Not Me.AmountDEV = Math.Round((value / Me.RegistryBankTransfer.RegistryHeader.F_CurrencyRate), 2, MidpointRounding.AwayFromZero) Then
            '        Me.AmountDEV = Math.Round((value / Me.RegistryBankTransfer.RegistryHeader.F_CurrencyRate), 2, MidpointRounding.AwayFromZero)
            '    End If
            '    If Not Math.Round(Me.AmountPercent, 2, MidpointRounding.AwayFromZero) = (Me.AmountHUF / Me.RegistryBankTransfer.AmountHUF) * 100 Then
            '        Me.AmountPercent = Math.Round(((Me.AmountHUF / Me.RegistryBankTransfer.AmountHUF) * 100), 2, MidpointRounding.AwayFromZero)
            '    End If
            'End If
        End Set
    End Property
    <NonPersistent()> _
    <RuleRequiredField("GLBankDivide.DatePayment", DefaultContexts.Save)> _
    Public Property DatePayment As Date
        Get
            Return _DatePayment
        End Get
        Set(ByVal value As Date)
            SetPropertyValue("DatePayment", _DatePayment, value)
        End Set
    End Property
    <NonPersistent()> _
    Property RegistryBankTransfer_AmountHUF As Double
        Get
            Return _RegistryBankTransfer_AmountHUF
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("RegistryBankTransfer_AmountHUF", _RegistryBankTransfer_AmountHUF, value)
        End Set
    End Property
    <NonPersistent()> _
    Property RegistryBankTransfer_AmountDEV As Double
        Get
            Return _RegistryBankTransfer_AmountDEV
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("RegistryBankTransfer_AmountDEV", _RegistryBankTransfer_AmountDEV, value)
        End Set
    End Property
    <NonPersistent()> _
    Property RegistryBankTransfer_RegistryHeader_CurrencyName As String
        Get
            Return _RegistryBankTransfer_RegistryHeader_CurrencyName
        End Get
        Set(ByVal value As String)
            SetPropertyValue("RegistryBankTransfer_RegistryHeader_CurrencyName", _RegistryBankTransfer_RegistryHeader_CurrencyName, value)
        End Set
    End Property
    <NonPersistent()> _
    Property Note As String
        Get
            Return _Note
        End Get
        Set(ByVal value As String)
            SetPropertyValue("Note", _Note, value)
        End Set
    End Property
End Class

