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.ConditionalAppearance

<NavigationItem(False), CreatableItem(False)> _
<NonPersistent()> _
<Appearance("DeliveryNoteView - StorageNeed Disable", AppearanceItemType.ViewItem, "1=1", TargetItems:="StorageNeed", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("DeliveryNoteView - Storage Hide", AppearanceItemType.ViewItem, "1=1", TargetItems:="Storage", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("DeliveryNoteView - Storage Disable", AppearanceItemType.ViewItem, "StorageNeed=False", TargetItems:="Storage", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("DeliveryNoteView - StorageMoveType Disable", AppearanceItemType.ViewItem, "StorageNeed=False", TargetItems:="StorageMoveType", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("DeliveryNoteView - DeliveryNoteOutType Disable", AppearanceItemType.ViewItem, "DeliveryNoteOutTypeNeed=False", TargetItems:="DeliveryNoteOutType", visibility:=Editors.ViewItemVisibility.Hide)> _
Public Class DeliveryNoteView ' -- szállítólevél készítéséhez a popup-hoz view
    Inherits BaseObject

    Private _TransportAddress As Address ' -- Szállítási cím
    Private _CustomersFrom As CustomersFrom ' Sajátcég
    Private _Customers As Customers ' Ügyfél
    Private _DateExecution As Date ' Végrehajtás dátuma
    Private _ShipmentOption As ShipmentOption ' Szállítási opció
    Private _QualityOption As QualityOption ' Minőségi opció
    Private _CurrencyName As CurrencyName ' Deviza
    Private _Note As String ' Megjegyzés
    Private _Storage As Storage 'Raktár a Kitárolás+szállítólevél action-hoz
    Private _StorageMoveType As StorageMoveType
    Private _DeliveryNoteOutType As DeliveryNoteOutType
    Private _StorageNeed As Boolean 'Raktár megjelenítése
    Private _DeliveryNoteOutTypeNeed As Boolean 'Deliveryhez

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
        StorageNeed = False
        DeliveryNoteOutTypeNeed = False
    End Sub
    <RuleRequiredField("DeliveryNoteView.TransportAddress", DefaultContexts.Save)> _
    Property TransportAddress As Address
        Get
            Return _TransportAddress
        End Get
        Set(value As Address)
            SetPropertyValue("TransportAddress", _TransportAddress, value)
        End Set
    End Property
    <RuleRequiredField("DeliveryNoteView.CustomersFrom", DefaultContexts.Save)> _
    Property CustomersFrom As CustomersFrom
        Get
            Return _CustomersFrom
        End Get
        Set(value As CustomersFrom)
            SetPropertyValue("CustomersFrom", _CustomersFrom, value)
        End Set
    End Property
    <RuleRequiredField("DeliveryNoteView.Customers", DefaultContexts.Save)> _
    Property Customers() As Customers
        Get
            Return _Customers
        End Get
        Set(ByVal value As Customers)
            SetPropertyValue("Customers", _Customers, value)
        End Set
    End Property
    <RuleRequiredField("DeliveryNoteView.DateExecution", DefaultContexts.Save)> _
    Property DateExecution() As Date
        Get
            Return _DateExecution
        End Get
        Set(ByVal value As Date)
            SetPropertyValue("DateExecution", _DateExecution, value)
        End Set
    End Property
    Property ShipmentOption() As ShipmentOption
        Get
            Return _ShipmentOption
        End Get
        Set(ByVal value As ShipmentOption)
            SetPropertyValue("ShipmentOption", _ShipmentOption, value)
        End Set
    End Property
    Property QualityOption() As QualityOption
        Get
            Return _QualityOption
        End Get
        Set(ByVal value As QualityOption)
            SetPropertyValue("QualityOption", _QualityOption, value)
        End Set
    End Property
    <RuleRequiredField("DeliveryNoteView.CurrencyName", DefaultContexts.Save)> _
    Property CurrencyName() As CurrencyName
        Get
            Return _CurrencyName
        End Get
        Set(ByVal value As CurrencyName)
            SetPropertyValue("CurrencyName", _CurrencyName, value)
        End Set
    End Property
    <Size(-1)> _
    Property Note() As String
        Get
            Return _Note
        End Get
        Set(ByVal value As String)
            SetPropertyValue("Note", _Note, value)
        End Set
    End Property
    Property Storage As Storage
        Get
            Return _Storage
        End Get
        Set(value As Storage)
            SetPropertyValue("Storage", _Storage, value)
        End Set
    End Property
    <ImmediatePostData(True), DataSourceCriteria("MoveType = 0 and MoveDirection=1")>
    Property StorageMoveType As StorageMoveType
        Get
            Return _StorageMoveType
        End Get
        Set(value As StorageMoveType)
            SetPropertyValue("StorageMoveType", _StorageMoveType, value)
            If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then
                If value IsNot Nothing Then
                    Storage = value.Storage 'MoveType
                End If
            End If
        End Set
    End Property
    Property StorageNeed As Boolean
        Get
            Return _StorageNeed
        End Get
        Set(value As Boolean)
            SetPropertyValue("StorageNeed", _StorageNeed, value)
        End Set
    End Property
    Property DeliveryNoteOutType As DeliveryNoteOutType
        Get
            Return _DeliveryNoteOutType
        End Get
        Set(value As DeliveryNoteOutType)
            SetPropertyValue("DeliveryNoteOutType", _DeliveryNoteOutType, value)
        End Set
    End Property
    Property DeliveryNoteOutTypeNeed As Boolean
        Get
            Return _DeliveryNoteOutTypeNeed
        End Get
        Set(value As Boolean)
            SetPropertyValue("DeliveryNoteOutTypeNeed", _DeliveryNoteOutTypeNeed, value)
        End Set
    End Property
End Class