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
'-- Vegyes könyvelés
'<Appearance("Disable GLheader when IsEditable=false", AppearanceItemType:="LayoutItem", criteria:="IsEditable=False", targetitems:="GLHeader", visibility:=Editors.ViewItemVisibility.Hide)> _
<DefaultClassOptions()> _
<NavigationItem("FinancialTransactions")> _
<Appearance("Hide GLMixedVC Actions when IsEditable=False",
                      AppearanceItemType:="Action",
                      criteria:="IsEditable=False",
                      TargetItems:="aToTable_GLMixed; aToTableD_GLMixed; aBackToRowEdit_GLMixed; aFinal_GLMixed; aFinalAndNew_GLMixed",
                      visibility:=Editors.ViewItemVisibility.Hide,
                      context:="DetailView")> _
<Appearance("Hide GLMixedVC Actions when IsEditable=True",
                      AppearanceItemType:="Action",
                      criteria:="IsEditable=True",
                      TargetItems:="aMakeEditable_GLMixed",
                      visibility:=Editors.ViewItemVisibility.Hide,
                      context:="DetailView")> _
<Appearance("Hide GLMixed property when IsEditable=False",
                      AppearanceItemType:="ViewItem",
                      criteria:="IsEditable=False",
                      targetitems:="row_PartnerType;row_PCIGroup;row_TransactionType",
                      visibility:=Editors.ViewItemVisibility.Hide,
                      context:="DetailView")> _
<Appearance("Hide GLMixed property when row_PartnerType='eNotSet'",
                      AppearanceItemType:="ViewItem",
                      criteria:="row_PartnerType='eNotSet'",
                      targetitems:="row_PCIGroup;row_TransactionType",
                      visibility:=Editors.ViewItemVisibility.Hide,
                      context:="DetailView")> _
Public Class GLMixed
    Inherits GLHeader
    Private _DocumentFile As FileData
    Private _row_PartnerType As ePartnerType = ePartnerType.eNotSet
    Private _row_PCIGroup As PCIGroup
    Private _row_TransactionType As eTransactionType = eTransactionType.eNotSet
    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
        If Session.IsNewObject(Me) Then
            Me.GLDocumentType = eGLDocumentType.eGLMixed
            Me.DateExecution = GetSQLTime(Session)
        End If
    End Sub
    Protected Overrides Sub OnDeleting()
        MyBase.OnDeleting()
        Session.Delete(Me.GLRows)
    End Sub
    Property DocumentFile As FileData
        Get
            Return _DocumentFile
        End Get
        Set(value As FileData)
            SetPropertyValue("DocumentFile", _DocumentFile, value)
        End Set
    End Property

    '//Nonpersistent property
    <NonPersistent()> _
    <VisibleInListView(False)> _
    <ImmediatePostData()> _
    Property row_PartnerType As ePartnerType
        Get
            Return _row_PartnerType
        End Get
        Set(value As ePartnerType)
            SetPropertyValue("row_PartnerType", _row_PartnerType, value)
            If Session.IsObjectsSaving = False And Session.IsObjectsLoading = False Then
                Select Case value
                    Case ePartnerType.eNotSet
                        Me.row_TransactionType = eTransactionType.eNotSet
                End Select
            End If
        End Set
    End Property
    <NonPersistent()> _
    <DataSourceCriteria("CustomersFrom='@This.CustomersFrom' and PartnerType='@This.row_PartnerType'  and BallanceState=0 and isnull(CurrencyName_Account)=False ")> _
    <ImmediatePostData(True)> _
    <VisibleInListView(False)> _
    Property row_PCIGroup() As PCIGroup
        Get
            Return _row_PCIGroup
        End Get
        Set(ByVal value As PCIGroup)
            SetPropertyValue("row_PCIGroup", _row_PCIGroup, value)
            If Session.IsObjectsSaving = False And Session.IsObjectsLoading = False Then
                If value IsNot Nothing Then
                    row_ConnectInfo = value.ConnectInfo
                    row_Customer = value.Customers
                    row_PartnerType = value.PartnerType
                End If
            End If
        End Set
    End Property
    <NonPersistent()> _
    <VisibleInListView(False)> _
    Property row_TransactionType As eTransactionType
        Get
            Return _row_TransactionType
        End Get
        Set(value As eTransactionType)
            SetPropertyValue("row_TransactionType", _row_TransactionType, value)
        End Set
    End Property
End Class
