Files
Nuvolar/Nuvolar.Module/BusinessObjects/Business/BusinessTransactions/Invoice/InvoiceRows.vb
T
ivanszabo dd449f32d7 Jelölő adatok IsActive
Mezőgazdaság termeltetés IsActive
Számviteli készletnél szállítólevél DateExecution
2018-03-12 10:53:58 +01:00

863 lines
35 KiB
VB.net

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 eInvoiceRowType
FromOrder = 0 'Bejövő megrendelésből termék
FromManual = 1 'Kézzel beállítva
FromWorkSheet = 2 'Munkalap sorról
FromContract = 3 'Szerződési sorból
End Enum
Public Enum eInvoiceRowMainType
TurnOverMaterial = 0 'Árbevétel anyag
TurnOverServices = 1 'Árbevétel szolgáltatás
Advance = 2 'Előleg
End Enum
Public Enum eInvoiceRowCorrigendumType
eNormal = 0
eOriginalMinus = 1
eNew = 2
End Enum
'<EditorStateRuleAttribute("Disable all properties when InvoiceHeader.IsEditable = False", "InvoiceHeader;InvoiceRowtype;RowIndex;CustomsTariffs;ShortName;Description;ListPriceHUF;ListPriceDEV;DiscountPriceHUF;DiscountPriceDEV;QTT;Units;VAT;QualityOption;ContractRows", EditorState.Disabled, "InvoiceHeader.IsEditable=False", ViewType.DetailView)> _
<DefaultClassOptions()> _
<NavigationItem(False), CreatableItem(False)> _
<Appearance("Disable all properties when InvoiceHeader.IsEditable = False", TargetItems:="InvoiceHeader;InvoiceRowtype;RowIndex;CustomsTariffs;ShortName;Description;ListPriceHUF;ListPriceDEV;DiscountPriceHUF;DiscountPriceDEV;QTT;Units;VAT;QualityOption;ContractRows", Criteria:="InvoiceHeader.IsEditable=False", Enabled:=False, Context:="DetailView")> _
<Appearance("Hide DEV when InvoiceHeader.CurrencyName.ShortName = 'HUF'", AppearanceItemType.ViewItem, "InvoiceHeader.CurrencyName.ShortName = 'HUF'", TargetItems:="ListPriceDEV;DiscountPriceDEV", visibility:=Editors.ViewItemVisibility.Hide)> _
<RuleCriteria("RuleCriteria InvoiceRows-ChartOfAccounts", DefaultContexts.Save, "ChartOfAccounts.Children.Count=0", "Csak gyermek objektum választható ki!", SkipNullOrEmptyValues:=False)> _
Public Class InvoiceRows
Inherits BaseObject
Private _InvoiceHeader As InvoiceHeader 'Számla fejléce
Private _InvoiceRowtype As eInvoiceRowType 'Számla sor tipusa
Private _InvoicePeriod As String 'Számlázási időszak string
Private _DateExecution As Date 'Elszámolás dátuma
Private _RowIndex As Long = 0 'Számla sorindex
Private _CustomsTariffs As CustomsTariffs 'Vámtarifaszám
Private _ShortName As String 'Megnevezés
Private _Description As String 'Leírás
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 _Units As Units ' Mennyiségi egység
Private _VAT As VAT 'ÁFA
Private _QualityOption As QualityOption 'Minőségi kondíció
Private _ContractRows As ContractRows ' -- Szerződés sor
Private _Controlling As Controlling '-- Controlling szám
Private _ChartOfAccounts As ChartOfAccounts '-- Ezt a könyvelő állítja be, ha akarja.
Private _UniqueObjects As UniqueObjects ' -- Egyedi azonosító
Private _CostHolder As CostHolder ' -- Költség viselő
Private _CostPlace As CostPlace ' -- Költség viselő
Private _JobNumberObjects As JobNumberObjects ' -- Project
Private _InvoiceRowsAdvance As InvoiceRows ' Ez egy előleg vissza sor és mutat az előleg sorra
Private _ReadyforBookEntryRows As Boolean '= False 'Könyvelhető-e a sor. Ha nem, akkor feladás előtti ellenőrzés nem engedi át
Private _InvoiceRows As InvoiceRows 'Helyesbített sor
Private _OrderInRows As OrderInRows ' A számla melyik rendelési sorról készült
Private _OrderInRowsOther As OrderInRowsOther ' A számla melyik rendelési egyéb sorról készült
Private _WorkflowSystemSteps As WorkflowSystemSteps
Private _InvoiceRowCorrigendumType As eInvoiceRowCorrigendumType
Private _Worksheet_CostRows As Worksheet_CostRows 'A kapcsolódó munkalap elszámolási sora
Private _DeliveryNoteOutRows As DeliveryNoteOutRows 'A kapcsolódó kimenő szállítólevél sora
Private _Products As Products 'Terméktörzsből
Private _Services As Services 'Szolgáltatás törzsből
Private _SumPriceHUF As Double 'Netto sor összesen HUF
Private _SumPriceDEV As Double 'Netto sor összesen DEV
Private _SumPriceVATHUF As Double 'ÁFA sor összesen HUF
Private _SumPriceVATDEV As Double 'ÁFA sor összesen DEV
Private _SumPriceBruttoHUF As Double 'Brutto sor összesen HUF
Private _SumPriceBruttoDEV As Double 'Brutto sor összesen DEV
Private _SumAveragePriceHUF As Double 'Átlag beszerzési ár HUF
Private _SumAveragePriceDEV As Double 'Átlag beszerzési ár DEV
Private _SumGrossMarginHUF As Double 'Árréstömeg
Private _SumGrossMarginDEV As Double 'Árréstömeg
Private _SumBallanceHUF As Double 'Mai napig kiegyenlített rész
Private _SumBallanceDEV As Double 'Mai napig kiegyenlített rész (deviza)
Private _Weight_NAV As Double 'ÁFA bevallás miatt a súly
'NonPersistent
Private _QTT_Will As Double 'NonPersistent jóváírandó mennyiség
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
If Me.InvoiceHeader IsNot Nothing Then
If Me.InvoiceHeader.DateExecution = Nothing Then
Else
Me.DateExecution = Me.InvoiceHeader.DateExecution
End If
End If
ReadyforBookEntryRows = False
End Sub
Protected Overrides Sub OnSaving()
MyBase.OnSaving()
If Me.InvoiceHeader IsNot Nothing Then
If Me.InvoiceHeader.DateExecution = Nothing Then
Me.DateExecution = Me.InvoiceHeader.DateExecution
End If
End If
Me.CalculateSum()
'// FIFO sorok újragenerálása
If Me.OrderInRows IsNot Nothing Then
If Me.InvoiceHeader IsNot Nothing Then
If Me.InvoiceHeader.IsEditable = False And Me.InvoiceHeader.IsStorno = False Then
Dim _InvoiceRowsFIFO_Collection As New XPCollection(Of InvoiceRowsFIFO)(PersistentCriteriaEvaluationBehavior.InTransaction, Session, CriteriaOperator.Parse("InvoiceRows=?", Me))
Session.Delete(_InvoiceRowsFIFO_Collection)
Dim _InvoiceRowsFIFO As InvoiceRowsFIFO
Dim _StorageOutRowsInRows As StorageOutRowsInRows
For Each _StorageOutRowsInRows In OrderInRows.StorageOutRowsInRows_Collection
_InvoiceRowsFIFO = New InvoiceRowsFIFO(Session)
_InvoiceRowsFIFO.InvoiceRows = Me
_InvoiceRowsFIFO.StorageInRows = _StorageOutRowsInRows.StorageInRows
_InvoiceRowsFIFO.QTT = _StorageOutRowsInRows.QTT
_InvoiceRowsFIFO.Save()
Next
End If
End If
If Me.Controlling Is Nothing Then
'// Kontrollszám nélküli tételek ellenőrzése !!!
If UCase(Me.ShortName) Like "*ELŐLEG*" Then
If Me.OrderInRows.OrderInHeader.OrderInParameters.Controlling_InvoiceAdvance_Default IsNot Nothing Then
Me.Controlling = Me.OrderInRows.OrderInHeader.OrderInParameters.Controlling_InvoiceAdvance_Default
End If
Else
If Me.OrderInRows.OrderInHeader.OrderInParameters.Controlling_Rows_Default IsNot Nothing Then
Me.Controlling = Me.OrderInRows.OrderInHeader.OrderInParameters.Controlling_Rows_Default
End If
End If
End If
If Me.OrderInRowsOther IsNot Nothing Then
If Me.Controlling Is Nothing Then
If Me.OrderInRowsOther.OrderInHeader.OrderInParameters.Controlling_OtherRows_Default IsNot Nothing Then
Me.Controlling = Me.OrderInRowsOther.OrderInHeader.OrderInParameters.Controlling_OtherRows_Default
End If
End If
End If
End If
End Sub
Public Sub AddRows(ByVal _p_InvoiceHeader As InvoiceHeader, Optional _p_InvoiceRows As InvoiceRows = Nothing, Optional _p_ObjectSpace As Xpo.XPObjectSpace = Nothing)
' Sor hozzáadása a fejléchez, valamint árkalkuláció a sor termékére
If _p_InvoiceRows IsNot Nothing Then 'Számla sorainak módosítása
Dim _InvoiceRows_Corr_New As InvoiceRows = _p_ObjectSpace.CreateObject(Of InvoiceRows)()
Me.InvoiceHeader = _p_InvoiceHeader
Me.InvoiceRows = _p_InvoiceRows
Me.ShortName = _p_InvoiceRows.ShortName
Me.Description = _p_InvoiceRows.Description
Me.ListPriceHUF = _p_InvoiceRows.ListPriceHUF
Me.ListPriceDEV = _p_InvoiceRows.ListPriceDEV
'Me.DiscountPercent = _p_InvoiceHeader.row_DiscountPercent
Me.DiscountPriceHUF = Me.ListPriceHUF * (_p_InvoiceRows.DiscountPercent / 100)
Me.DiscountPriceDEV = Me.ListPriceDEV * (_p_InvoiceRows.DiscountPercent / 100)
Me.QTT = _p_InvoiceRows.QTT * (-1)
Me.Units = _p_InvoiceRows.Units
Me.VAT = _p_InvoiceRows.VAT
Me.QualityOption = _p_InvoiceRows.QualityOption
Me.Controlling = _p_InvoiceRows.Controlling
Me.UniqueObjects = _p_InvoiceRows.UniqueObjects
Me.CostHolder = _p_InvoiceRows.CostHolder
Me.CostPlace = _p_InvoiceRows.CostPlace
Me.JobNumberObjects = _p_InvoiceRows.JobNumberObjects
Me.InvoiceRowCorrigendumType = eInvoiceRowCorrigendumType.eOriginalMinus
Me.InvoicePeriod = _p_InvoiceRows.InvoicePeriod
Me.CustomsTariffs = _p_InvoiceRows.CustomsTariffs
Me.ContractRows = _p_InvoiceRows.ContractRows
Me.OrderInRows = _p_InvoiceRows.OrderInRows
Me.OrderInRowsOther = _p_InvoiceRows.OrderInRowsOther
If _p_InvoiceHeader.row_Products IsNot Nothing Then Me.Products = _p_InvoiceHeader.row_Products
If _p_InvoiceHeader.row_Services IsNot Nothing Then Me.Services = _p_InvoiceHeader.row_Services
If _p_InvoiceHeader.InvoiceRows.Count = 0 Then
Me.RowIndex = 0
Else
Me.RowIndex = _p_InvoiceHeader.InvoiceRows.Count - 1
End If
Me.Save()
_InvoiceRows_Corr_New.InvoiceHeader = _p_InvoiceHeader
_InvoiceRows_Corr_New.InvoiceRows = _p_InvoiceRows
_InvoiceRows_Corr_New.ShortName = _p_InvoiceRows.ShortName
_InvoiceRows_Corr_New.Description = _p_InvoiceRows.Description
_InvoiceRows_Corr_New.ListPriceHUF = _p_InvoiceHeader.row_ListPriceHUF
_InvoiceRows_Corr_New.ListPriceDEV = _p_InvoiceHeader.row_ListPriceDEV
_InvoiceRows_Corr_New.DiscountPriceHUF = _InvoiceRows_Corr_New.ListPriceHUF * (_p_InvoiceRows.DiscountPercent / 100)
_InvoiceRows_Corr_New.DiscountPriceDEV = _InvoiceRows_Corr_New.ListPriceDEV * (_p_InvoiceRows.DiscountPercent / 100)
_InvoiceRows_Corr_New.QTT = _p_InvoiceHeader.row_QTT
_InvoiceRows_Corr_New.Units = _p_InvoiceRows.Units
_InvoiceRows_Corr_New.VAT = _p_InvoiceHeader.row_VAT
_InvoiceRows_Corr_New.QualityOption = _p_InvoiceRows.QualityOption
_InvoiceRows_Corr_New.Controlling = _p_InvoiceRows.Controlling
_InvoiceRows_Corr_New.UniqueObjects = _p_InvoiceRows.UniqueObjects
_InvoiceRows_Corr_New.CostHolder = _p_InvoiceRows.CostHolder
_InvoiceRows_Corr_New.CostPlace = _p_InvoiceRows.CostPlace
_InvoiceRows_Corr_New.JobNumberObjects = _p_InvoiceRows.JobNumberObjects
_InvoiceRows_Corr_New.InvoiceRowCorrigendumType = eInvoiceRowCorrigendumType.eNew
_InvoiceRows_Corr_New.InvoicePeriod = _p_InvoiceRows.InvoicePeriod
_InvoiceRows_Corr_New.CustomsTariffs = _p_InvoiceRows.CustomsTariffs
_InvoiceRows_Corr_New.ContractRows = _p_InvoiceRows.ContractRows
_InvoiceRows_Corr_New.OrderInRows = _p_InvoiceRows.OrderInRows
_InvoiceRows_Corr_New.OrderInRowsOther = _p_InvoiceRows.OrderInRowsOther
If _p_InvoiceHeader.InvoiceRows.Count = 0 Then
_InvoiceRows_Corr_New.RowIndex = 0
Else
_InvoiceRows_Corr_New.RowIndex = _p_InvoiceHeader.InvoiceRows.Count - 1
End If
_InvoiceRows_Corr_New.Save()
Else 'Normál menetrend, gyalogos számla rögzítsé
Me.InvoiceHeader = _p_InvoiceHeader
Me.InvoiceRows = _p_InvoiceRows
Me.ShortName = _p_InvoiceHeader.row_ShortName
Me.Description = _p_InvoiceHeader.row_Description
Me.ListPriceHUF = _p_InvoiceHeader.row_ListPriceHUF
Me.ListPriceDEV = _p_InvoiceHeader.row_ListPriceDEV
'Me.DiscountPercent = _p_InvoiceHeader.row_DiscountPercent
Me.DiscountPriceHUF = Me.ListPriceHUF * (_p_InvoiceHeader.row_DiscountPercent / 100)
Me.DiscountPriceDEV = Me.ListPriceDEV * (_p_InvoiceHeader.row_DiscountPercent / 100)
Me.QTT = _p_InvoiceHeader.row_QTT
Me.Units = _p_InvoiceHeader.row_Units
Me.VAT = _p_InvoiceHeader.row_VAT
Me.QualityOption = _p_InvoiceHeader.row_QualityOption
If _p_InvoiceHeader.row_Controlling Is Nothing Then
Me.Controlling = _p_InvoiceHeader.InvoiceType.ControllingDefault
Else
Me.Controlling = _p_InvoiceHeader.row_Controlling
End If
Me.UniqueObjects = _p_InvoiceHeader.row_UniqueObjects
Me.CostHolder = _p_InvoiceHeader.row_CostHolder
Me.CostPlace = _p_InvoiceHeader.row_CostPlace
Me.JobNumberObjects = _p_InvoiceHeader.row_JobNumberObjects
Me.InvoiceRowCorrigendumType = eInvoiceRowCorrigendumType.eNormal
Me.InvoicePeriod = _p_InvoiceHeader.row_InvoicePeriod
Me.CustomsTariffs = _p_InvoiceHeader.row_CustomsTariffs
Me.Products = _p_InvoiceHeader.row_Products
Me.Services = _p_InvoiceHeader.row_Services
If _p_InvoiceHeader.InvoiceRows.Count = 0 Then
Me.RowIndex = 0
Else
Me.RowIndex = _p_InvoiceHeader.InvoiceRows.Count - 1
End If
Me.Save()
End If
End Sub
Public Sub RemoveRows(ByVal _p_InvoiceHeader As InvoiceHeader)
For Each _InvoiceRows As InvoiceRows In _p_InvoiceHeader.InvoiceRows
If _InvoiceRows.RowIndex > Me.RowIndex Then
_InvoiceRows.RowIndex -= 1
End If
Next
Me.Delete()
Me.Save()
Session.CommitTransaction()
End Sub
Property DateExecution As Date
Get
Return _DateExecution
End Get
Set(value As Date)
SetPropertyValue("DateExecution", _DateExecution, value)
End Set
End Property
Property InvoicePeriod As String
Get
Return _InvoicePeriod
End Get
Set(value As String)
SetPropertyValue("InvoicePeriod", _InvoicePeriod, value)
End Set
End Property
<Association("InvoiceHeader", GetType(InvoiceHeader))> _
Property InvoiceHeader() As InvoiceHeader
Get
Return _InvoiceHeader
End Get
Set(ByVal value As InvoiceHeader)
SetPropertyValue("InvoiceHeader", _InvoiceHeader, value)
If _InvoiceHeader IsNot Nothing Then
' Sor indexelés mikor hozzáad a fejléchez sorokat, az első sor rögtön 0 indexről indul
If Session.IsNewObject(Me) And Session.IsObjectsLoading = False And Session.IsObjectsSaving = False And Session.IsObjectMarkedDeleted(Me) = False Then
Dim i As Integer = 1
If i = _InvoiceHeader.InvoiceRows.Count Then
Me.RowIndex = 1 ' A második sor indexét 1 re állítja
End If
If _InvoiceHeader.InvoiceRows.Count > 1 Then
Me.RowIndex = _InvoiceHeader.InvoiceRows.Count ' a harmadik sortól növeli az indexeket
End If
End If
End If
End Set
End Property
Property InvoiceRowtype() As eInvoiceRowType
Get
Return _InvoiceRowtype
End Get
Set(ByVal value As eInvoiceRowType)
SetPropertyValue("InvoiceRowtype", _InvoiceRowtype, value)
End Set
End Property
Property RowIndex() As Long
Get
Return _RowIndex
End Get
Set(ByVal value As Long)
SetPropertyValue("RowIndex", _RowIndex, value)
End Set
End Property
Property CustomsTariffs() As CustomsTariffs
Get
Return _CustomsTariffs
End Get
Set(ByVal value As CustomsTariffs)
SetPropertyValue("CustomsTariffs", _CustomsTariffs, value)
End Set
End Property
<Size(255)> _
<RuleRequiredField("RuleRequiredField for InvoiceRows.ShortName", DefaultContexts.Save)> _
Property ShortName() As String
Get
Return _ShortName
End Get
Set(ByVal value As String)
SetPropertyValue("ShortName", _ShortName, value)
End Set
End Property
<Size(4000)> _
Property Description() As String
Get
Return _Description
End Get
Set(ByVal value As String)
SetPropertyValue("Description", _Description, value)
End Set
End Property
Property ListPriceHUF() As Double
Get
Return _ListPriceHUF
End Get
Set(ByVal value As Double)
SetPropertyValue("ListPriceHUF", _ListPriceHUF, value)
If Session.IsObjectsLoading = False AndAlso Session.IsObjectsSaving = False Then
CalculateSum()
End If
End Set
End Property
Property ListPriceDEV() As Double
Get
Return _ListPriceDEV
End Get
Set(ByVal value As Double)
SetPropertyValue("ListPriceDEV", _ListPriceDEV, value)
If Session.IsObjectsLoading = False AndAlso Session.IsObjectsSaving = False Then
CalculateSum()
End If
End Set
End Property
Property DiscountPriceHUF() As Double
Get
Return _DiscountPriceHUF
End Get
Set(ByVal value As Double)
SetPropertyValue("DiscountPriceHUF", _DiscountPriceHUF, value)
If Session.IsObjectsLoading = False AndAlso Session.IsObjectsSaving = False Then
CalculateSum()
End If
End Set
End Property
Property DiscountPriceDEV() As Double
Get
Return _DiscountPriceDEV
End Get
Set(ByVal value As Double)
SetPropertyValue("DiscountPriceDEV", _DiscountPriceDEV, value)
If Session.IsObjectsLoading = False AndAlso Session.IsObjectsSaving = False Then
CalculateSum()
End If
End Set
End Property
<RuleRequiredField("RuleRequiredField for InvoiceRows.QTT", DefaultContexts.Save)> _
Property QTT() As Double
Get
Return _QTT
End Get
Set(ByVal value As Double)
SetPropertyValue("QTT", _QTT, value)
If Session.IsObjectsLoading = False AndAlso Session.IsObjectsSaving = False Then
CalculateSum()
End If
End Set
End Property
Property DeliveryNoteOutRows As DeliveryNoteOutRows
Get
Return _DeliveryNoteOutRows
End Get
Set(value As DeliveryNoteOutRows)
SetPropertyValue("DeliveryNoteOutRows", _DeliveryNoteOutRows, value)
End Set
End Property
<VisibleInListView(False), VisibleInDetailView(False), VisibleInLookupListView(False)>
Property Products As Products
Get
Return _Products
End Get
Set(value As Products)
SetPropertyValue("Products", _Products, value)
End Set
End Property
<VisibleInListView(False), VisibleInDetailView(False), VisibleInLookupListView(False)>
Property Services As Services
Get
Return _Services
End Get
Set(value As Services)
SetPropertyValue("Services", _Services, value)
End Set
End Property
<VisibleInDetailView(False)> _
Property SumPriceHUF() As Double
Get
Return _SumPriceHUF
End Get
Set(value As Double)
SetPropertyValue("SumPriceHUF", _SumPriceHUF, value)
End Set
End Property
<VisibleInDetailView(False)> _
Property SumPriceDEV() As Double
Get
Return _SumPriceDEV
End Get
Set(value As Double)
SetPropertyValue("SumPriceDEV", _SumPriceDEV, value)
End Set
End Property
<VisibleInDetailView(False)> _
Property SumPriceVATHUF As Double
Get
Return _SumPriceVATHUF
End Get
Set(value As Double)
SetPropertyValue("SumPriceVATHUF", _SumPriceVATHUF, value)
End Set
End Property
<VisibleInDetailView(False)> _
Property SumPriceVATDEV As Double
Get
Return _SumPriceVATDEV
End Get
Set(value As Double)
SetPropertyValue("SumPriceVATDEV", _SumPriceVATDEV, value)
End Set
End Property
<VisibleInDetailView(False)> _
Property SumPriceBruttoHUF As Double
Get
Return _SumPriceBruttoHUF
End Get
Set(value As Double)
SetPropertyValue("SumPriceBruttoHUF", _SumPriceBruttoHUF, value)
End Set
End Property
<VisibleInDetailView(False)> _
Property SumPriceBruttoDEV As Double
Get
Return _SumPriceBruttoDEV
End Get
Set(value As Double)
SetPropertyValue("SumPriceBruttoDEV", _SumPriceBruttoDEV, value)
End Set
End Property
Property Weight_NAV As Double
Get
Return _Weight_NAV
End Get
Set(value As Double)
SetPropertyValue("Weight_NAV", _Weight_NAV, value)
End Set
End Property
<VisibleInDetailView(False), VisibleInListView(False), VisibleInLookupListView(False)> _
Property SumAveragePriceHUF As Double
Get
Return _SumAveragePriceHUF
End Get
Set(value As Double)
SetPropertyValue("SumAveragePriceHUF", _SumAveragePriceHUF, value)
End Set
End Property
<VisibleInDetailView(False), VisibleInListView(False), VisibleInLookupListView(False)> _
Property SumAveragePriceDEV As Double
Get
Return _SumAveragePriceDEV
End Get
Set(value As Double)
SetPropertyValue("SumAveragePriceDEV", _SumAveragePriceDEV, value)
End Set
End Property
<VisibleInDetailView(False), VisibleInListView(False), VisibleInLookupListView(False)> _
Property SumGrossMarginHUF As Double
Get
Return _SumGrossMarginHUF
End Get
Set(value As Double)
SetPropertyValue("SumGrossMarginHUF", _SumGrossMarginHUF, value)
End Set
End Property
<VisibleInDetailView(False), VisibleInListView(False), VisibleInLookupListView(False)> _
Property SumGrossMarginDEV As Double
Get
Return _SumGrossMarginDEV
End Get
Set(value As Double)
SetPropertyValue("SumGrossMarginDEV", _SumGrossMarginDEV, value)
End Set
End Property
Property SumBallanceHUF As Double
Get
Return _SumBallanceHUF
End Get
Set(value As Double)
SetPropertyValue("SumBallanceHUF", _SumBallanceHUF, value)
End Set
End Property
Property SumBallanceDEV As Double
Get
Return _SumBallanceDEV
End Get
Set(value As Double)
SetPropertyValue("SumBallanceDEV", _SumBallanceDEV, value)
End Set
End Property
<RuleRequiredField("RuleRequiredField for InvoiceRows.Units", DefaultContexts.Save)> _
Property Units() As Units
Get
Return _Units
End Get
Set(ByVal value As Units)
SetPropertyValue("Units", _Units, value)
End Set
End Property
<RuleRequiredField("RuleRequiredField for InvoiceRows.VAT", DefaultContexts.Save)> _
Property VAT() As VAT
Get
Return _VAT
End Get
Set(ByVal value As VAT)
SetPropertyValue("VAT", _VAT, value)
'If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
' If value.InversState = True Then
' If Me.InvoiceHeader IsNot Nothing Then
' If String.IsNullOrEmpty(Me.InvoiceHeader.Description) Then
' Me.InvoiceHeader.Description = value.Description
' Else
' If Not (Me.InvoiceHeader.Description.Contains(value.Description)) Then
' Me.InvoiceHeader.Description = Me.InvoiceHeader.Description + vbNewLine + value.Description
' End If
' End If
' End If
' End If
'End If
End Set
End Property
Property QualityOption() As QualityOption
Get
Return _QualityOption
End Get
Set(ByVal value As QualityOption)
SetPropertyValue("QualityOption", _QualityOption, value)
End Set
End Property
Property ContractRows As ContractRows
Get
Return _ContractRows
End Get
Set(ByVal value As ContractRows)
SetPropertyValue("ContractRows", _ContractRows, value)
End Set
End Property
'Rule5DMatrix ...
<ImmediatePostData(True), DataSourceCriteria("IsParent=False")>
Property Controlling As Controlling
Get
Return _Controlling
End Get
Set(ByVal value As Controlling)
SetPropertyValue("Controlling", _Controlling, value)
End Set
End Property
<ImmediatePostData(True), DataSourceCriteria("AccountYear=GetYear('@This.InvoiceHeader.DateExecution')")>
Property ChartOfAccounts As ChartOfAccounts
Get
Return _ChartOfAccounts
End Get
Set(value As ChartOfAccounts)
SetPropertyValue("ChartOfAccounts", _ChartOfAccounts, value)
End Set
End Property
<RuleRequiredField("InvoiceRows-UniqueObjects", DefaultContexts.Save, TargetCriteria:="InvoiceHeader.InvoiceType.Rule5DMatrix.RequireUniqueObjects=True")>
<DataSourceCriteria("IsActive != False")>
Property UniqueObjects As UniqueObjects
Get
Return _UniqueObjects
End Get
Set(ByVal value As UniqueObjects)
SetPropertyValue("UniqueObjects", _UniqueObjects, value)
End Set
End Property
<RuleRequiredField("InvoiceRows-CostHolder", DefaultContexts.Save, TargetCriteria:="InvoiceHeader.InvoiceType.Rule5DMatrix.RequireCostHolder=True")> _
Property CostHolder As CostHolder
Get
Return _CostHolder
End Get
Set(ByVal value As CostHolder)
SetPropertyValue("CostHolder", _CostHolder, value)
End Set
End Property
<DataSourceCriteria("IsActive != False")>
Property CostPlace As CostPlace
Get
Return _CostPlace
End Get
Set(ByVal value As CostPlace)
SetPropertyValue("CostPlace", _CostPlace, value)
End Set
End Property
Property JobNumberObjects As JobNumberObjects
Get
Return _JobNumberObjects
End Get
Set(ByVal value As JobNumberObjects)
SetPropertyValue("JobNumberObjects", _JobNumberObjects, value)
End Set
End Property
Property Worksheet_CostRows As Worksheet_CostRows
Get
Return _Worksheet_CostRows
End Get
Set(value As Worksheet_CostRows)
SetPropertyValue("Worksheet_CostRows", _Worksheet_CostRows, value)
End Set
End Property
Property InvoiceRowsAdvance As InvoiceRows
Get
Return _InvoiceRowsAdvance
End Get
Set(ByVal value As InvoiceRows)
SetPropertyValue("InvoiceRowsAdvance", _InvoiceRowsAdvance, value)
End Set
End Property
Property ReadyforBookEntryRows As Boolean
Get
Return _ReadyforBookEntryRows
End Get
Set(value As Boolean)
SetPropertyValue("ReadyforBookEntryRows", _ReadyforBookEntryRows, value)
End Set
End Property
Property InvoiceRows As InvoiceRows
Get
Return _InvoiceRows
End Get
Set(value As InvoiceRows)
SetPropertyValue("InvoiceRows", _InvoiceRows, value)
End Set
End Property
Property OrderInRows As OrderInRows
Get
Return _OrderInRows
End Get
Set(value As OrderInRows)
SetPropertyValue("OrderInRows", _OrderInRows, value)
End Set
End Property
Property OrderInRowsOther As OrderInRowsOther
Get
Return _OrderInRowsOther
End Get
Set(value As OrderInRowsOther)
SetPropertyValue("OrderInRowsOther", _OrderInRowsOther, value)
End Set
End Property
Property WorkflowSystemSteps As WorkflowSystemSteps
Get
Return _WorkflowSystemSteps
End Get
Set(value As WorkflowSystemSteps)
SetPropertyValue("WorkflowSystemSteps", _WorkflowSystemSteps, value)
End Set
End Property
Property InvoiceRowCorrigendumType As eInvoiceRowCorrigendumType
Get
Return _InvoiceRowCorrigendumType
End Get
Set(value As eInvoiceRowCorrigendumType)
SetPropertyValue("InvoiceRowCorrigendumType", _InvoiceRowCorrigendumType, value)
End Set
End Property
<NonPersistent()> _
Property QTT_Will As Double
Get
Return _QTT_Will
End Get
Set(value As Double)
SetPropertyValue("QTT_Will", _QTT_Will, value)
End Set
End Property
'// Readonly properties
ReadOnly Property SumPriceOriginalHUF As Double
Get
If OrderInRows IsNot Nothing Then
If OrderInRows.ListPriceOriginalHUF <> 0 Then
Return OrderInRows.ListPriceOriginalHUF * QTT
Else
Return SumPriceHUF
End If
Else
Return SumPriceHUF
End If
End Get
End Property
ReadOnly Property SumGrossMarginOriginalHUF As Double
Get
Return SumPriceOriginalHUF - SumAveragePriceHUF
End Get
End Property
ReadOnly Property InvoiceRowMainType As eInvoiceRowMainType
Get
If Me.OrderInRows IsNot Nothing Then
Return eInvoiceRowMainType.TurnOverMaterial
ElseIf UCase(ShortName) Like "*ELŐLEG*" Then
Return eInvoiceRowMainType.Advance
ElseIf Me.OrderInRowsOther IsNot Nothing Then
Return eInvoiceRowMainType.TurnOverServices
ElseIf Me.Worksheet_CostRows IsNot Nothing Then
Return eInvoiceRowMainType.TurnOverServices
Else
Return eInvoiceRowMainType.TurnOverServices
End If
End Get
End Property
ReadOnly Property DiscountPercent() As Double
Get
Return 0
End Get
End Property
ReadOnly Property PriceHUF As Double
Get
If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
Return ListPriceHUF - DiscountPriceHUF
Else
Return 0
End If
End Get
End Property
ReadOnly Property PriceDEV As Double
Get
If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
Return ListPriceDEV - DiscountPriceDEV
Else
Return 0
End If
End Get
End Property
'//XPCollections
<VisibleInListView(False), VisibleInLookupListView(False)> _
ReadOnly Property InvoiceRowsFIFO As XPCollection(Of InvoiceRowsFIFO)
Get
If Me IsNot Nothing Then
Return New XPCollection(Of InvoiceRowsFIFO)(Session, CriteriaOperator.Parse("InvoiceRows=? and isnull(InvoiceRows)=False", Me))
Else
Return New XPCollection(Of InvoiceRowsFIFO)(Session, CriteriaOperator.Parse("1=2"))
End If
End Get
End Property
<VisibleInListView(False), VisibleInDetailView(False), VisibleInLookupListView(False)> _
ReadOnly Property StorageOutRowsInRows As XPCollection(Of StorageOutRowsInRows)
Get
If DeliveryNoteOutRows IsNot Nothing Then
Return New XPCollection(Of StorageOutRowsInRows)(Session, CriteriaOperator.Parse("Oid=?", DeliveryNoteOutRows.StorageOutRowsInRows.Oid))
ElseIf OrderInRows IsNot Nothing Then
Return New XPCollection(Of StorageOutRowsInRows)(Session, CriteriaOperator.Parse("StorageOutRows.OrderInRows=?", OrderInRows))
Else
Return New XPCollection(Of StorageOutRowsInRows)(Session, CriteriaOperator.Parse("1=2"))
End If
End Get
End Property
<Browsable(False)> _
ReadOnly Property QTT_CreditNote As Double
Get
Dim _QTT_CreditNote As Double = 0
Dim _InvoiceCreditNoteRows_Collection As New XPCollection(Of InvoiceCreditNoteRows)(Session, CriteriaOperator.Parse("FromInvoiceRows=?", Me))
If _InvoiceCreditNoteRows_Collection.Count > 0 Then
For Each _InvoiceCreditNoteRows As InvoiceCreditNoteRows In _InvoiceCreditNoteRows_Collection
_QTT_CreditNote += _InvoiceCreditNoteRows.QTT
Next
End If
Return _QTT_CreditNote
End Get
End Property
'//Public functions
'-- Számolt értékek beállítása
Public Sub CalculateSum()
SumPriceHUF = Math.Round(_QTT * (ListPriceHUF - DiscountPriceHUF), 2, MidpointRounding.AwayFromZero)
SumPriceDEV = Math.Round(_QTT * (ListPriceDEV - DiscountPriceDEV), 2, MidpointRounding.AwayFromZero)
If VAT Is Nothing Then
SumPriceVATHUF = 0
Else
SumPriceVATHUF = Math.Round(SumPriceHUF * VAT.KeyValue, 2, MidpointRounding.AwayFromZero)
End If
If VAT Is Nothing Then
SumPriceVATDEV = 0
Else
SumPriceVATDEV = Math.Round(SumPriceDEV * VAT.KeyValue, 2, MidpointRounding.AwayFromZero)
End If
SumPriceBruttoHUF = SumPriceHUF + SumPriceVATHUF
SumPriceBruttoDEV = SumPriceDEV + SumPriceVATDEV
End Sub
End Class