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.ExpressApp.SystemModule
Imports DevExpress.Persistent.Base.Security

Imports DevExpress.ExpressApp.ConditionalAppearance
Imports DevExpress.ExpressApp.Filtering

'<EditorStateRuleAttribute("Show CurrencyRate when CurrencyName != HUF", "CurrencyRate", EditorState.Hidden, "ContractRows.CurrencyName.ShortName = 'HUF'", ViewType.DetailView)> _
'<EditorStateRuleAttribute("Hide DateExecution when ContractRowsType != 1", "DateExecution", EditorState.Hidden, "ContractRows.ContractRowsType In(0,2)", ViewType.DetailView)> _
'<EditorStateRule("Hide DateCreated when ContractRowsType = 3", "DateCreated", EditorState.Hidden, "ContractRows.ContractRowsType = 3", ViewType.DetailView)> _

<Appearance("Show CurrencyRate when CurrencyName != HUF", TargetItems:="CurrencyRate", Criteria:="ContractRows.CurrencyName.ShortName = 'HUF'", Visibility:=Editors.ViewItemVisibility.Hide, Context:="DetailView")> _
<Appearance("Hide DateExecution when ContractRowsType != 1", TargetItems:="DateExecution", Criteria:="ContractRows.ContractRowsType In(0,2)", Visibility:=Editors.ViewItemVisibility.Hide, Context:="DetailView")> _
<Appearance("Hide DateCreated when ContractRowsType = 3", TargetItems:="DateCreated", Criteria:="ContractRows.ContractRowsType = 3", Visibility:=Editors.ViewItemVisibility.Hide, Context:="DetailView")> _
<NavigationItem(False), CreatableItem(False)> _
Public Class ContractsRowsToInvoice
    Inherits BaseObject
    Private _DateCreated As Date = Now ' A számla kiállításának dátuma
    Private _DateExecution As Date 'Teljesítés dátuma
    Private _Description As String ' Megjegyzés
    Private _CurrencyRate As Double = 1 ' Árfolyam
    Private _ContractRows As ContractRows ' A Deviza típusához kell
    Private _BankInformation As BankInformation
    Private _IsProforma As Boolean = False
    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    ReadOnly Property DateCreated As Date
        Get
            Return _DateCreated
        End Get
    End Property
    <RuleRequiredField("ContractsRowsToInvoice.DateExecution", DefaultContexts.Save, TargetCriteria:="ContractRows.ContractRowsType = 1")> _
    Property DateExecution As Date
        Get
            Return _DateExecution
        End Get
        Set(ByVal value As Date)
            SetPropertyValue("DateExecution", _DateExecution, value)
        End Set
    End Property
    <Size(-1)> _
    Property Description As String
        Get
            Return _Description
        End Get
        Set(ByVal value As String)
            SetPropertyValue("Description", _Description, value)
        End Set
    End Property
    Property CurrencyRate As Double
        Get
            Return _CurrencyRate
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("CurrencyRate", _CurrencyRate, value)
        End Set
    End Property
    Property ContractRows As ContractRows
        Get
            Return _ContractRows
        End Get
        Set(ByVal value As ContractRows)
            SetPropertyValue("ContractRows", _ContractRows, value)
        End Set
    End Property
    <DataSourceCriteria("LiquidAssests.CustomerFrom = '@This.ContractRows.Contracts.CustomersFrom' AND LiquidAssests.LiquidAssetsType = 1")> _
    Property BankInformation As BankInformation
        Get
            Return (_BankInformation)
        End Get
        Set(ByVal value As BankInformation)
            SetPropertyValue("CustomerBankAccounts", _BankInformation, value)
        End Set
    End Property
    Property IsProforma As Boolean
        Get
            Return _IsProforma
        End Get
        Set(value As Boolean)
            SetPropertyValue("IsProforma", _IsProforma, value)
        End Set
    End Property
End Class


