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 _ _ Public Class DeliveryNoteInRows 'Bejövő szállítólevél sorok Inherits BaseObject Private _DeliveryNoteInHeader As DeliveryNoteInHeader Private _RowIndex As Long = 0 'Sor index Private _Products As Products 'Termék vagy szolgáltatás Private _Installation As Installation 'Gyártmány Private _ListPriceHUF As Double = 0 ' Egységár HUF (nettó !) Private _ListPriceDEV As Double = 0 ' Egységár DEV (Nettó !) Private _DiscountPriceHUF As Double = 0 'Kedvezmény összege HUF Private _DiscountPriceDEV As Double = 0 'Kedvezmény összege DEV Private _QTT As Double = 0 'Mennyiség Private _QTT_Process As Double 'Mennyiségi szándék, kézzel beírható Private _QTT_Controlled As Double 'Erre a sorra vonatkozólag ? lett leigazolva szállítói számlán Private _QTT_Returned As Double ' Visszárúzott mennyiség Private _Units As Units ' Mennyiségi egység Private _VAT As VAT 'ÁFA Private _OrderOutRows As OrderOutRows 'Kimenő rendelési sor Private _OfferInRows As OfferInRows Private _NoteRows As String 'Sor megjegyzés Private _PacketNumber As String 'Kötegszám Private _Weight As Double 'Súly (összes mennyiség súlya) Private _WeightMode As eWeightMode 'Súly értelmezése, egységsúly vagy öszsúly Private _Area As Double 'Négyzetméter Private _ITransactionNumber As String 'INRASTAT tranzakciós azonosító Private _ShipingCode As String 'INTRASTAT szállítási azonosító Private _row_ListPrice As Double Private _row_DiscountPercent As Double Private _row_SumPrice As Double Public Sub New(ByVal session As Session) MyBase.New(session) End Sub Public Overrides Sub AfterConstruction() MyBase.AfterConstruction() QTT = 0 QTT_Controlled = 0 QTT_Process = 0 QTT_Returned = 0 End Sub Protected Overrides Sub OnSaving() MyBase.OnSaving() End Sub _ Property DeliveryNoteInHeader As DeliveryNoteInHeader Get Return _DeliveryNoteInHeader End Get Set(ByVal value As DeliveryNoteInHeader) SetPropertyValue("DeliveryNoteInHeader", _DeliveryNoteInHeader, value) End Set End Property Property RowIndex As Long Get Return _RowIndex End Get Set(value As Long) SetPropertyValue("RowIndex", _RowIndex, value) End Set End Property Property Products As Products Get Return _Products End Get Set(value As Products) SetPropertyValue("Products", _Products, value) End Set End Property Property Installation As Installation Get Return _Installation End Get Set(value As Installation) SetPropertyValue("Installation", _Installation, value) End Set End Property ReadOnly Property SumPriceHUF() As Double Get Return Math.Round(_QTT * (_ListPriceHUF - _DiscountPriceHUF), 0, MidpointRounding.AwayFromZero) End Get End Property ReadOnly Property SumPriceDEV() As Double Get Return Math.Round(_QTT * (_ListPriceDEV - _DiscountPriceDEV), 2, MidpointRounding.AwayFromZero) End Get End Property ReadOnly Property SumPriceVATHUF As Double Get If VAT Is Nothing Then Return 0 Else Return Math.Round(SumPriceHUF * VAT.KeyValue, 0, MidpointRounding.AwayFromZero) End If End Get End Property ReadOnly Property SumPriceVATDEV As Double Get If VAT Is Nothing Then Return 0 Else Return Math.Round(SumPriceDEV * VAT.KeyValue, 2, MidpointRounding.AwayFromZero) End If End Get End Property ReadOnly Property SumPriceBruttoHUF As Double Get Return SumPriceHUF + SumPriceVATHUF End Get End Property ReadOnly Property SumPriceBruttoDEV As Double Get Return SumPriceDEV + SumPriceVATDEV End Get End Property Property ListPriceHUF() As Double Get Return _ListPriceHUF End Get Set(ByVal value As Double) SetPropertyValue("ListPriceHUF", _ListPriceHUF, value) End Set End Property Property ListPriceDEV() As Double Get Return _ListPriceDEV End Get Set(ByVal value As Double) SetPropertyValue("ListPriceDEV", _ListPriceDEV, value) End Set End Property Property DiscountPriceHUF() As Double Get Return _DiscountPriceHUF End Get Set(ByVal value As Double) SetPropertyValue("DiscountPriceHUF", _DiscountPriceHUF, value) End Set End Property Property DiscountPriceDEV() As Double Get Return _DiscountPriceDEV End Get Set(ByVal value As Double) SetPropertyValue("DiscountPriceDEV", _DiscountPriceDEV, value) End Set End Property _ Property QTT() As Double Get Return _QTT End Get Set(ByVal value As Double) SetPropertyValue("QTT", _QTT, value) End Set End Property Property QTT_Process As Double Get Return _QTT_Process End Get Set(value As Double) SetPropertyValue("QTT_Process", _QTT_Process, value) If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then controlled_SumPrice = SetRowSumPrice(value, controlled_ListPrice, controlled_DiscountPercent) End If End Set End Property Property QTT_Controlled As Double Get Return _QTT_Controlled End Get Set(value As Double) SetPropertyValue("QTT_Controlled", _QTT_Controlled, value) End Set End Property Property QTT_Returned As Double Get Return _QTT_Returned End Get Set(value As Double) SetPropertyValue("QTT_Returned", _QTT_Returned, value) End Set End Property _ Property Units() As Units Get Return _Units End Get Set(ByVal value As Units) SetPropertyValue("Units", _Units, value) End Set End Property _ Property VAT() As VAT Get Return _VAT End Get Set(ByVal value As VAT) SetPropertyValue("VAT", _VAT, value) End Set End Property Property OrderOutRows As OrderOutRows Get Return _OrderOutRows End Get Set(value As OrderOutRows) SetPropertyValue("OrderOutRows", _OrderOutRows, value) End Set End Property Property OfferInRows As OfferInRows Get Return _OfferInRows End Get Set(value As OfferInRows) SetPropertyValue("OfferInRows", _OfferInRows, value) End Set End Property Property NoteRows As String Get Return _NoteRows End Get Set(value As String) SetPropertyValue("NoteRows", _NoteRows, value) End Set End Property Property PacketNumber As String Get Return _PacketNumber End Get Set(value As String) SetPropertyValue("PacketNumber", _PacketNumber, value) End Set End Property Property Weight As Double Get Return _Weight End Get Set(value As Double) SetPropertyValue("Weight", _Weight, value) End Set End Property Property WeightMode As eWeightMode Get Return _WeightMode End Get Set(value As eWeightMode) SetPropertyValue("WeightMode", _WeightMode, value) End Set End Property Property Area As Double Get Return _Area End Get Set(value As Double) SetPropertyValue("Area", _Area, value) End Set End Property Property ITransactionNumber As String Get Return _ITransactionNumber End Get Set(value As String) SetPropertyValue("ITransactionNumber", _ITransactionNumber, value) End Set End Property Property ShipingCode As String Get Return _ShipingCode End Get Set(value As String) SetPropertyValue("ShipingCode", _ShipingCode, value) End Set End Property '-----------Nonpersistent------------ Property controlled_ListPrice As Double Get Return _row_ListPrice End Get Set(value As Double) SetPropertyValue("controlled_ListPrice", _row_ListPrice, value) If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then controlled_SumPrice = SetRowSumPrice(QTT_Process, value, controlled_DiscountPercent) End If End Set End Property Property controlled_DiscountPercent As Double Get Return _row_DiscountPercent End Get Set(value As Double) SetPropertyValue("controlled_DiscountPercent", _row_DiscountPercent, value) If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then controlled_SumPrice = SetRowSumPrice(QTT_Process, controlled_ListPrice, value) End If End Set End Property Property controlled_SumPrice As Double Get Return _row_SumPrice End Get Set(value As Double) SetPropertyValue("controlled_SumPrice", _row_SumPrice, value) End Set End Property '----------Sub---------------- Public Sub AddRows(ByVal _p_DeliveryNoteInHeader As DeliveryNoteInHeader) ' Sor hozzáadása Me.DeliveryNoteInHeader = _p_DeliveryNoteInHeader Me.Products = _p_DeliveryNoteInHeader.row_Products Me.Units = _p_DeliveryNoteInHeader.row_Products.Units Me.VAT = _p_DeliveryNoteInHeader.row_Products.VAT Me.QTT = _p_DeliveryNoteInHeader.row_QTT Me.ListPriceHUF = _p_DeliveryNoteInHeader.row_ListPriceHUF Me.ListPriceDEV = _p_DeliveryNoteInHeader.row_ListPriceDEV Me.DiscountPriceDEV = _p_DeliveryNoteInHeader.row_ListPriceDEV * (_p_DeliveryNoteInHeader.row_DiscountPercent / 100) Me.DiscountPriceHUF = _p_DeliveryNoteInHeader.row_ListPriceHUF * (_p_DeliveryNoteInHeader.row_DiscountPercent / 100) Me.OrderOutRows = _p_DeliveryNoteInHeader.row_OrderOutRows Me.RowIndex = _p_DeliveryNoteInHeader.DeliveryNoteInrows.Count Me.PacketNumber = _p_DeliveryNoteInHeader.row_PacketNumber Me.Weight = _p_DeliveryNoteInHeader.row_Weight Me.WeightMode = _p_DeliveryNoteInHeader.row_WeightMode End Sub Private Function SetRowSumPrice(pQTT_Process As Double, prow_ListPrice As Double, prow_DiscountPercent As Double) As Double Return (pQTT_Process * prow_ListPrice) - (pQTT_Process * prow_ListPrice * (prow_DiscountPercent / 100)) End Function '//XPCollections _ ReadOnly Property DeliveryNoteInRRFC As XPCollection(Of DeliveryNoteInRRFC) Get Return New XPCollection(Of DeliveryNoteInRRFC)(PersistentCriteriaEvaluationBehavior.InTransaction, Session, CriteriaOperator.Parse("DeliveryNoteInRows=?", Me)) End Get End Property End Class