Imports Microsoft.VisualBasic
Imports System
Imports System.Linq
Imports System.Text
Imports DevExpress.Xpo
Imports DevExpress.ExpressApp
Imports System.ComponentModel
Imports DevExpress.ExpressApp.DC
Imports DevExpress.Data.Filtering
Imports DevExpress.Persistent.Base
Imports System.Collections.Generic
Imports DevExpress.ExpressApp.Model
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation

'<ImageName("BO_Contact")> _
'<DefaultProperty("DisplayMemberNameForLookupEditorsOfThisType")> _
'<DefaultListViewOptions(MasterDetailMode.ListViewOnly, False, NewItemRowPosition.None)> _
'<Persistent("DatabaseTableName")> _
<DefaultClassOptions(), NavigationItem(False), CreatableItem(False), DeferredDeletion(False)> _
Public Class VATCompareDetail ' Specify more UI options using a declarative approach (http://documentation.devexpress.com/#Xaf/CustomDocument2701).
    Inherits BaseObject ' Inherit from a different class to provide a custom primary key, concurrency and deletion behavior, etc. (http://documentation.devexpress.com/#Xaf/CustomDocument3146).

    Private _VATCompare As VATCompare

    Private _VAT As VAT
    Private _PartnerType As ePartnerType
    Private _DateVAT As Date
    Private _DateExecution As Date
    Private _DocumentNumber As String
    Private _Customers As Customers
    Private _Note As String
    Private _PayMode As ePayMode

    Private _AmountVATOut_Source As Double 'Értékesítést terhelő ÁFA
    Private _AmountVATIn_Source As Double 'Beszerzést terhelő ÁFA
    Private _AmountVATOutBase_Source As Double 'Értékesítést terhelő ÁFA alap
    Private _AmountVATInBase_Source As Double 'Beszerzést terhelő ÁFA alap

    Private _AmountVATOut_Destination As Double 'Értékesítést terhelő ÁFA
    Private _AmountVATIn_Destination As Double 'Beszerzést terhelő ÁFA
    Private _AmountVATOutBase_Destination As Double 'Értékesítést terhelő ÁFA alap
    Private _AmountVATInBase_Destination As Double 'Beszerzést terhelő ÁFA alap

    

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
        ' Place your initialization code here (http://documentation.devexpress.com/#Xaf/CustomDocument2834).
    End Sub

    <Association("VATCompare-VATCompareDetail", GetType(VATCompare))> _
    Property VATCompare As VATCompare
        Get
            Return _VATCompare
        End Get
        Set(value As VATCompare)
            SetPropertyValue("VATCompare", _VATCompare, value)
        End Set
    End Property
    Property VAT As VAT
        Get
            Return _VAT
        End Get
        Set(ByVal value As VAT)
            SetPropertyValue("VAT", _VAT, value)
        End Set
    End Property
    Property PartnerType As ePartnerType
        Get
            Return _PartnerType
        End Get
        Set(ByVal value As ePartnerType)
            SetPropertyValue("PartnerType", _PartnerType, value)
        End Set
    End Property
    Property DateVAT As Date
        Get
            Return _DateVAT
        End Get
        Set(ByVal value As Date)
            SetPropertyValue("DateVAT", _DateVAT, value)
        End Set
    End Property
    Property DateExecution As Date
        Get
            Return _DateExecution
        End Get
        Set(ByVal value As Date)
            SetPropertyValue("DateExecution", _DateExecution, value)
        End Set
    End Property
    Property DocumentNumber As String
        Get
            Return _DocumentNumber
        End Get
        Set(ByVal value As String)
            SetPropertyValue("DocumentNumber", _DocumentNumber, value)
        End Set
    End Property
    Property Customers As Customers
        Get
            Return _Customers
        End Get
        Set(ByVal value As Customers)
            SetPropertyValue("Customers", _Customers, value)
        End Set
    End Property
    <Size(900)> _
    Property Note As String
        Get
            Return _Note
        End Get
        Set(ByVal value As String)
            SetPropertyValue("Note", _Note, value)
        End Set
    End Property
    Property PayMode As ePayMode
        Get
            Return _PayMode
        End Get
        Set(ByVal value As ePayMode)
            SetPropertyValue("PayMode", _PayMode, value)
        End Set
    End Property

    Property AmountVATOut_Source As Double
        Get
            Return _AmountVATOut_Source
        End Get
        Set(value As Double)
            SetPropertyValue("AmountVATOut_Source", _AmountVATOut_Source, value)
        End Set
    End Property
    Property AmountVATIn_Source As Double
        Get
            Return _AmountVATIn_Source
        End Get
        Set(value As Double)
            SetPropertyValue("AmountVATIn_Source", _AmountVATIn_Source, value)
        End Set
    End Property
    Property AmountVATOutBase_Source As Double
        Get
            Return _AmountVATOutBase_Source
        End Get
        Set(value As Double)
            SetPropertyValue("AmountVATOutBase_Source", _AmountVATOutBase_Source, value)
        End Set
    End Property
    Property AmountVATInBase_Source As Double
        Get
            Return _AmountVATInBase_Source
        End Get
        Set(value As Double)
            SetPropertyValue("AmountVATInBase_Source", _AmountVATInBase_Source, value)
        End Set
    End Property

    Property AmountVATOut_Destination As Double
        Get
            Return _AmountVATOut_Destination
        End Get
        Set(value As Double)
            SetPropertyValue("AmountVATOut_Destination", _AmountVATOut_Destination, value)
        End Set
    End Property
    Property AmountVATIn_Destination As Double
        Get
            Return _AmountVATIn_Destination
        End Get
        Set(value As Double)
            SetPropertyValue("AmountVATIn_Destination", _AmountVATIn_Destination, value)
        End Set
    End Property
    Property AmountVATOutBase_Destination As Double
        Get
            Return _AmountVATOutBase_Destination
        End Get
        Set(value As Double)
            SetPropertyValue("AmountVATOutBase_Destination", _AmountVATOutBase_Destination, value)
        End Set
    End Property
    Property AmountVATInBase_Destination As Double
        Get
            Return _AmountVATInBase_Destination
        End Get
        Set(value As Double)
            SetPropertyValue("AmountVATInBase_Destination", _AmountVATInBase_Destination, value)
        End Set
    End Property

    ReadOnly Property AmountVATOut_Difference As Double
        Get
            Return AmountVATOut_Destination - AmountVATOut_Source
        End Get
    End Property
    ReadOnly Property AmountVATIn_Difference As Double
        Get
            Return AmountVATIn_Source - AmountVATIn_Destination
        End Get
    End Property
    ReadOnly Property AmountVATOutBase_Difference As Double
        Get
            Return AmountVATOutBase_Destination - AmountVATOutBase_Source
        End Get
    End Property
    ReadOnly Property AmountVATInBase_Difference As Double
        Get
            Return AmountVATInBase_Source - AmountVATInBase_Destination
        End Get
    End Property

    ReadOnly Property SumTotal_Difference As Double
        Get
            Return Me.AmountVATOut_Difference - Me.AmountVATIn_Difference
        End Get
    End Property
    'Private _PersistentProperty As String
    '<XafDisplayName("My display name"), ToolTip("My hint message")> _
    '<ModelDefault("EditMask", "(000)-00"), Index(0), VisibleInListView(False)> _
    '<Persistent("DatabaseColumnName"), RuleRequiredField(DefaultContexts.Save)> _
    'Public Property PersistentProperty() As String
    '    Get
    '        Return _PersistentProperty
    '    End Get
    '    Set(ByVal value As String)
    '        SetPropertyValue("PersistentProperty", _PersistentProperty, value)
    '    End Set
    'End Property

    '<Action(Caption:="My UI Action", ConfirmationMessage:="Are you sure?", ImageName:="Attention", AutoCommit:=True)> _
    'Public Sub ActionMethod()
    '    ' Trigger a custom business logic for the current record in the UI (http://documentation.devexpress.com/#Xaf/CustomDocument2619).
    '    Me.PersistentProperty = "Paid"
    'End Sub
End Class
