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 System.Data.SqlClient
Imports DevExpress.ExpressApp.ConditionalAppearance

Imports System.Linq
Imports System.Linq.Expressions

Public Enum eInvoiceTypeBase
    eEarnestofTender = 0 'Foglaló számla
    eAdvancePayment = 1 'Előleg számla
    eNormalInvoice = 2 'Normál számla
    eFinalInvoice = 3 'Végszámla, ami tartalmaz vagy előleg, vagy foglaló sorokat
    eCustomRate = 4 'Egyéb számla szerű de nem számviteli számla (dijbekérők, illeték bekérők stb.)
End Enum
<DefaultClassOptions()> _
<NavigationItem("BusinessStocks")> _
Public Class InvoiceType
    Inherits BaseObject
    Private _InvoiceTypeBase As eInvoiceTypeBase 'Számla bázis tipus
    Private _CustomersFrom As CustomersFrom '-- Saját cég
    Private _CustomerBankAccounts As CustomerBankAccounts '--Számlán szereplő alapértelmezett bankszámlaszám
    Private _ShortName As String '-- Megnevezés
    Private _Description As String '-- Rövid leírás
    Private _NumberGenerator As NumberGenerator '-- Számla sorszám formátuma
    Private _NumberGeneratorProforma As NumberGenerator '-- Számla sorszám formátuma proforma esetén
    Private _ReportData As ReportData '-- Számla nyomtatványa belföldi HUF
    Private _ReportData_DEV As ReportData '-- Belföldi EU
    Private _ReportData_DEV_EU As ReportData '-- Számla nyomtatványa EU devizás
    Private _ReportData_HUF_DEV As ReportData '-- Számla nyomtatványa DEv és HUF devizás
    Private _WorkflowSystem As WorkflowSystem
    Private _Rule5DMatrix As Rule5DMatrix

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Property InvoiceTypeBase As eInvoiceTypeBase
        Get
            Return _InvoiceTypeBase
        End Get
        Set(ByVal value As eInvoiceTypeBase)
            SetPropertyValue("InvoiceTypeBase", _InvoiceTypeBase, value)
        End Set
    End Property
    <RuleRequiredField("InvoiceType-CustomersFrom", DefaultContexts.Save)> _
    Property CustomersFrom As CustomersFrom
        Get
            Return _CustomersFrom
        End Get
        Set(ByVal value As CustomersFrom)
            SetPropertyValue("CustomersFrom", _CustomersFrom, value)
        End Set
    End Property
    <DataSourceCriteria("Customers='@This.CustomersFrom'")> _
    Property CustomerBankAccounts As CustomerBankAccounts
        Get
            Return _CustomerBankAccounts
        End Get
        Set(ByVal value As CustomerBankAccounts)
            SetPropertyValue("CustomerBankAccount", _CustomerBankAccounts, value)
        End Set
    End Property
    Property ShortName() As String
        Get
            Return _ShortName
        End Get
        Set(ByVal value As String)
            SetPropertyValue("ShortName", _ShortName, 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
    <RuleRequiredField("InvoiceType-NumberGenerator", DefaultContexts.Save)> _
    Property NumberGenerator() As NumberGenerator
        Get
            Return _NumberGenerator
        End Get
        Set(ByVal value As NumberGenerator)
            SetPropertyValue("NumberGenerator", _NumberGenerator, value)
        End Set
    End Property
    Property NumberGeneratorProforma As NumberGenerator
        Get
            Return _NumberGeneratorProforma
        End Get
        Set(value As NumberGenerator)
            SetPropertyValue("NumberGeneratorProforma", _NumberGeneratorProforma, value)
        End Set
    End Property
    <RuleRequiredField("InvoiceType-ReportData", DefaultContexts.Save)> _
    Property ReportData As ReportData
        Get
            Return _ReportData
        End Get
        Set(ByVal value As ReportData)
            SetPropertyValue("ReportData", _ReportData, value)
        End Set
    End Property
    <RuleRequiredField("InvoiceType-ReportData_DEV", DefaultContexts.Save)> _
    Property ReportData_DEV As ReportData
        Get
            Return _ReportData_DEV
        End Get
        Set(ByVal value As ReportData)
            SetPropertyValue("ReportData_DEV", _ReportData_DEV, value)
        End Set
    End Property
    <RuleRequiredField("InvoiceType-ReportData_DEV_EU", DefaultContexts.Save)> _
    Property ReportData_DEV_EU As ReportData
        Get
            Return _ReportData_DEV_EU
        End Get
        Set(ByVal value As ReportData)
            SetPropertyValue("ReportData_DEV_EU", _ReportData_DEV_EU, value)
        End Set
    End Property
    Property ReportData_HUF_DEV As ReportData
        Get
            Return _ReportData_HUF_DEV
        End Get
        Set(value As ReportData)
            SetPropertyValue("ReportData_HUF_DEV", _ReportData_HUF_DEV, value)
        End Set
    End Property
    <DataSourceCriteria("PartnerType = 0")> _
    <RuleRequiredField("InvoiceType-WorkflowSystem", DefaultContexts.Save)> _
    Property WorkflowSystem As WorkflowSystem
        Get
            Return _WorkflowSystem
        End Get
        Set(value As WorkflowSystem)
            SetPropertyValue("WorkflowSystem", _WorkflowSystem, value)
        End Set
    End Property
    Property Rule5DMatrix As Rule5DMatrix
        Get
            Return _Rule5DMatrix
        End Get
        Set(value As Rule5DMatrix)
            SetPropertyValue("Rule5DMatrix", _Rule5DMatrix, value)
        End Set
    End Property
End Class
