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

<DefaultClassOptions(), NonPersistent(), NavigationItem(False), CreatableItem(False)> _
Public Class AssetsHandlingCPB
    Inherits BaseObject
    Private _Customers As Customers


    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Protected Overrides Sub OnSaving()
        MyBase.OnSaving()
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
        Me.row_ConversationType = eConversationType.eNotset
        Me.row_DateDeadline = GetSQLTime(Session)
    End Sub
    Public Property Customers As Customers
        Get
            Return _Customers
        End Get
        Set(ByVal value As Customers)
            SetPropertyValue("Customers", _Customers, value)
        End Set
    End Property

    Private _row_NoteCustomers As String
    Private _row_NotePrivate As String
    Private _row_DateDeadline As Date 'Határidő
    Private _row_Amount As Double = 0 ' Összeget fizet határidőig 
    Private _row_AmountPercent As Double '%-ot fizet határidőig
    Private _row_ConversationType As eConversationType

    <NonPersistent(), Size(-1)> _
    Property row_NoteCustomers As String
        Get
            Return _row_NoteCustomers
        End Get
        Set(value As String)
            SetPropertyValue("row_NoteCustomers", _row_NoteCustomers, value)
        End Set
    End Property
    <NonPersistent(), Size(-1)>
    Property row_NotePrivate As String
        Get
            Return _row_NotePrivate
        End Get
        Set(value As String)
            SetPropertyValue("row_NotePrivate", _row_NotePrivate, value)
        End Set
    End Property
    Property row_DateDeadline As Date
        Get
            Return _row_DateDeadline
        End Get
        Set(value As Date)
            SetPropertyValue("row_DateDeadline", _row_DateDeadline, value)
        End Set
    End Property
    Property row_Amount As Double
        Get
            Return _row_Amount
        End Get
        Set(value As Double)
            SetPropertyValue("row_Amount", _row_Amount, value)
        End Set
    End Property
    Property row_AmountPercent As Double
        Get
            Return _row_AmountPercent
        End Get
        Set(value As Double)
            SetPropertyValue("row_AmountPercent", _row_AmountPercent, value)
        End Set
    End Property
    Property row_ConversationType As eConversationType
        Get
            Return _row_ConversationType
        End Get
        Set(value As eConversationType)
            SetPropertyValue("row_ConversationType", _row_ConversationType, value)
        End Set
    End Property

    <VisibleInListView(False), VisibleInLookupListView(False)> _
    ReadOnly Property AssetsHandlingCPBActivity As XPCollection(Of AssetsHandlingCPBActivity)
        Get
            Return New XPCollection(Of AssetsHandlingCPBActivity)(Session, CriteriaOperator.Parse("Customers=?", Me.Customers))
        End Get
    End Property
    <VisibleInListView(False), VisibleInLookupListView(False)> _
    ReadOnly Property PCIGroup As XPCollection(Of PCIGroup)
        Get
            Dim _Criteria As String = " IsNull(InvoiceHeader)=False And PartnerType = 0 And InvoiceHeader.PaymentOption.PayMode in ('InTransfer','InContinuous') And " +
                                    "GetDate(InvoiceHeader.DatePayment) < GetDate(?) and (GetDate(InvoiceHeader.DatePayment) < GetDate(DateLastConnected) OR " +
                                    "IsNull(DateLastConnected)=True) and AmountHUF_Account>1000  And InvoiceHeader.IsStorno=False and Customers=?"
            Return New XPCollection(Of PCIGroup)(Session, CriteriaOperator.Parse(_Criteria, Now, Me.Customers))
        End Get
    End Property
    ReadOnly Property AssetsHandling As XPCollection(Of AssetsHandling)
        Get
            Return New XPCollection(Of AssetsHandling)(Session, CriteriaOperator.Parse("Customers=?", Me.Customers))
        End Get
    End Property
End Class
