Imports System Imports System.ComponentModel Imports DevExpress.Xpo Imports DevExpress.Data.Filtering Imports DevExpress.ExpressApp.ConditionalAppearance Imports DevExpress.ExpressApp Imports DevExpress.Persistent.Base Imports DevExpress.Persistent.BaseImpl Imports DevExpress.Persistent.Validation Imports System.Linq Imports System.Linq.Expressions Public Enum eOrderOutState InProgress = 0 Started = 1 Closed = 2 End Enum '-- Kimenő megrendelés --------------------------------------------------------------------------------------------------- Public Enum eOrderOutMainType eFromProducts = 0 'Terméket rendelünk meg eFromInstallation = 1 'Gyártmányt rendelünk meg eFromServices = 2 'Szolgáltatást rendelünk meg End Enum ' _ ' _ ' _ ' _ ' _ ' _ ' _ ' _ _ _ _ _ _ _ _ _ _ _ _ _ _ Public Class OrderOutHeader Inherits BaseObject Private _CustomersFrom As CustomersFrom 'Saját cég Private _CustomersOrder As CustomersOrder 'Beszállító Private _CustomersOrderDocuments As CustomersOrderDocuments Private _Contacts As Contacts 'Beszállító kapcsolata Private _DocumentNumber As String 'Rendelési szám Private _DateCreated As Date 'kiállítás dátuma Private _DateExecution As Date 'Teljesítés dátuma Private _ObjectCreated As Date 'Objektum keletkezésének dátuma Private _UserCreated As User Private _PaymentOption As PaymentOption 'Fizetési opció Private _ShipmentOption As ShipmentOption 'Szállítási opció Private _QualityOption As QualityOption 'Minőségi opció Private _CurrencyName As CurrencyName 'Deviza Private _IsEditable As Boolean = True 'Szerkeszthető vagy végleges Private _IsStorno As Boolean = False 'Stornózott Private _OrderOutHeader As OrderOutHeader 'Melyik rendelés helyesbítése Private _TotalNettoHUF As Double = 0 Private _TotalNettoDEV As Double = 0 Private _Note As String ' Megjegyzés '-- Non persistent objektumok Private _row_Products As Products 'Termék, ami a szállítólevelen van Private _row_QTT As Double 'Termék szállított mennyisége Private _row_ListPriceHUF As Double 'Termék listaára HUF Private _row_ListPriceDEV As Double 'Termék listaára DEV Private _row_DiscountPercent As Double 'Termék ár kedvezmény %-ban Public Sub New(ByVal session As Session) MyBase.New(session) End Sub Public Overrides Sub AfterConstruction() MyBase.AfterConstruction() DateCreated = GetSQLTime(Session) DateExecution = GetSQLTime(Session) End Sub Protected Overrides Sub OnSaving() MyBase.OnSaving() If String.IsNullOrEmpty(DocumentNumber) Then DocumentNumber = CustomersOrderDocuments.NumberGenerator.GetNewNumber(CustomersOrderDocuments.NumberGenerator) End If If Session.IsNewObject(Me) Then ObjectCreated = GetSQLTime(Session) UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser)) End If End Sub _ _ Public ReadOnly Property OrderOutRows() As XPCollection(Of OrderOutRows) Get Return GetCollection(Of OrderOutRows)("OrderOutRows") End Get End Property _ Property CustomersFrom() As CustomersFrom Get Return _CustomersFrom End Get Set(ByVal value As CustomersFrom) SetPropertyValue("CustomersFrom", _CustomersFrom, value) End Set End Property _ Property CustomersOrder() As CustomersOrder Get Return _CustomersOrder End Get Set(ByVal value As CustomersOrder) SetPropertyValue("CustomersOrder", _CustomersOrder, value) End Set End Property Property CustomersOrderDocuments As CustomersOrderDocuments Get Return _CustomersOrderDocuments End Get Set(ByVal value As CustomersOrderDocuments) SetPropertyValue("CustomersOrderDocuments", _CustomersOrderDocuments, value) If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then If value IsNot Nothing Then Me.CurrencyName = value.CurrencyName Else CurrencyName = Nothing End If End If End Set End Property Property DocumentNumber() As String Get Return _DocumentNumber End Get Set(ByVal value As String) SetPropertyValue("DocumentNumber", _DocumentNumber, value) End Set End Property Property Contacts() As Contacts Get Return _Contacts End Get Set(ByVal value As Contacts) SetPropertyValue("Contacts", _Contacts, value) 'If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then ' If value IsNot Nothing Then ' Me.CustomersOrder = value.Customers ' End If 'End If End Set End Property Property DateCreated() As Date Get Return _DateCreated End Get Set(ByVal value As Date) SetPropertyValue("DateCreated", _DateCreated, value) End Set End Property Property DateExecution() As Date Get Return _DateExecution End Get Set(ByVal value As Date) SetPropertyValue("DateExecution", _DateExecution, value) End Set End Property _ Property ObjectCreated() As Date Get Return _ObjectCreated End Get Set(ByVal value As Date) SetPropertyValue("ObjectCreated", _ObjectCreated, value) End Set End Property _ Property UserCreated As User Get Return _UserCreated End Get Set(value As User) SetPropertyValue("UserCreated", _UserCreated, value) End Set End Property Public Property PaymentOption() As PaymentOption Get Return _PaymentOption End Get Set(ByVal value As PaymentOption) SetPropertyValue("PaymentOption", _PaymentOption, value) End Set End Property Public Property ShipmentOption() As ShipmentOption Get Return _ShipmentOption End Get Set(ByVal value As ShipmentOption) SetPropertyValue("ShipmentOption", _ShipmentOption, value) End Set End Property Public Property QualityOption() As QualityOption Get Return _QualityOption End Get Set(ByVal value As QualityOption) SetPropertyValue("QualityOption", _QualityOption, value) End Set End Property _ Public Property CurrencyName() As CurrencyName Get Return _CurrencyName End Get Set(ByVal value As CurrencyName) SetPropertyValue("CurrencyName", _CurrencyName, value) End Set End Property Property IsEditable() As Boolean Get Return _IsEditable End Get Set(ByVal value As Boolean) SetPropertyValue("IsEditable", _IsEditable, value) End Set End Property Property IsStorno() As Boolean Get Return _IsStorno End Get Set(ByVal value As Boolean) SetPropertyValue("IsStorno", _IsStorno, value) End Set End Property Property OrderOutHeader As OrderOutHeader Get Return _OrderOutHeader End Get Set(value As OrderOutHeader) SetPropertyValue("OrderOutHeader", _OrderOutHeader, value) End Set End Property Public Property TotalNettoHUF() As Double Get Return _TotalNettoHUF End Get Set(ByVal value As Double) SetPropertyValue("TotalNettoHUF", _TotalNettoHUF, value) End Set End Property Public Property TotalNettoDEV() As Double Get Return _TotalNettoDEV End Get Set(ByVal value As Double) SetPropertyValue("TotalNettoDEV", _TotalNettoDEV, value) End Set End Property _ Property Note() As String Get Return _Note End Get Set(ByVal value As String) SetPropertyValue("Note", _Note, value) End Set End Property ' NonPersistent propertys ------------------------------- _ _ _ _ Property row_Products() As Products Get Return _row_Products End Get Set(ByVal value As Products) SetPropertyValue("row_Products", _row_Products, value) If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then If value IsNot Nothing Then Me.row_ListPriceHUF = value.ListPriceInHUF Me.row_ListPriceDEV = value.ListPriceInDEV End If End If End Set End Property _ _ _ Property row_QTT As Double Get Return _row_QTT End Get Set(value As Double) SetPropertyValue("row_QTT", _row_QTT, value) If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then If Me.CustomersOrder IsNot Nothing And Me.CustomersOrder.PricingIn IsNot Nothing Then Me.row_ListPriceHUF = Me.CustomersOrder.PricingIn.GetCurrentPriceNettoHUF(Me.row_Products, value) Me.row_ListPriceDEV = Me.CustomersOrder.PricingIn.GetCurrentPriceNettoDEV(Me.row_Products, value) End If End If End Set End Property _ _ _ Property row_ListPriceHUF As Double Get Return _row_ListPriceHUF End Get Set(value As Double) SetPropertyValue("row_ListPriceHUF", _row_ListPriceHUF, value) End Set End Property _ _ _ Property row_ListPriceDEV As Double Get Return _row_ListPriceDEV End Get Set(value As Double) SetPropertyValue("row_ListPriceDEV", _row_ListPriceDEV, value) End Set End Property _ _ _ Property row_DiscountPercent As Double Get Return _row_DiscountPercent End Get Set(value As Double) SetPropertyValue("row_DiscountPercent", _row_DiscountPercent, value) End Set End Property _ ReadOnly Property OrderInTo As XPCollection(Of OrderInTo) Get Return New XPCollection(Of OrderInTo)(Session, CriteriaOperator.Parse("OrderOutRows is NULL")) End Get End Property _ ReadOnly Property DeliveryNoteInRows As XPCollection(Of DeliveryNoteInRows) Get Return New XPCollection(Of DeliveryNoteInRows)(Session, CriteriaOperator.Parse("OrderOutRows.OrderOutHeader=?", Me)) End Get End Property End Class