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 RegistryTelephone Inherits BaseObject Private _GLAccounts As GLAccounts Private _RegistryHeader As RegistryHeader Private _RegistryTelephoneParameters As RegistryTelephoneParameters Private _UniqueObjects As UniqueObjects Private _Amount_Brutto_INTERNET As Double Private _Amount_Netto_INTERNET As Double Private _Amount_VAT_INTERNET As Double Private _Amount_Brutto_PARKING As Double Private _Amount_Brutto_TELEPHON As Double Private _AmountNetto_TELEPHON_80 As Double Private _AmountNetto_TELEPHON_20 As Double Private _Amount_VAT_TELEPHON_70 As Double Private _Amount_Brutto_OTHER_DEFAULTVAT As Double Private _Amount_Netto_OTHER_DEFAULTVAT As Double Private _Amount_VAT_OTHER_DEFAULTVAT As Double Private _Amount_Brutto_OTHER_NOVAT As Double Public Sub New(ByVal session As Session) MyBase.New(session) ' This constructor is used when an object is loaded from a persistent storage. ' Do not place any code here or place it only when the IsLoading property is false: ' if (!IsLoading){ ' It is now OK to place your initialization code here. ' } ' or as an alternative, move your initialization code into the AfterConstruction method. End Sub Public Overrides Sub AfterConstruction() MyBase.AfterConstruction() ' Place here your initialization code. End Sub _ Property GLAccounts As GLAccounts Get Return _GLAccounts End Get Set(value As GLAccounts) SetPropertyValue("GLAccounts", _GLAccounts, value) End Set End Property Property RegistryHeader As RegistryHeader Get Return _RegistryHeader End Get Set(value As RegistryHeader) SetPropertyValue("RegistryHeader", _RegistryHeader, value) End Set End Property Property RegistryTelephoneParameters As RegistryTelephoneParameters Get Return _RegistryTelephoneParameters End Get Set(value As RegistryTelephoneParameters) SetPropertyValue("RegistryTelephoneParameters", _RegistryTelephoneParameters, value) End Set End Property Property UniqueObjects As UniqueObjects Get Return _UniqueObjects End Get Set(value As UniqueObjects) SetPropertyValue("UniqueObjects", _UniqueObjects, value) End Set End Property Property Amount_Brutto_INTERNET As Double Get Return _Amount_Brutto_INTERNET End Get Set(value As Double) SetPropertyValue("Amount_Brutto_INTERNET", _Amount_Brutto_INTERNET, value) If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then If Me.RegistryTelephoneParameters.VAT_DEFAULTVAT_INTERNET IsNot Nothing Then Amount_Netto_INTERNET = Math.Round(value / (1 + RegistryTelephoneParameters.VAT_DEFAULTVAT_INTERNET.KeyValue), 0, MidpointRounding.AwayFromZero) Amount_VAT_INTERNET = Math.Round(value - Amount_Netto_INTERNET, 0, MidpointRounding.AwayFromZero) Else Amount_Netto_INTERNET = value Amount_VAT_INTERNET = 0 End If End If End Set End Property Property Amount_Netto_INTERNET As Double Get Return _Amount_Netto_INTERNET End Get Set(value As Double) SetPropertyValue("Amount_Netto_INTERNET", _Amount_Netto_INTERNET, value) End Set End Property Property Amount_VAT_INTERNET As Double Get Return _Amount_VAT_INTERNET End Get Set(value As Double) SetPropertyValue("Amount_VAT_INTERNET", _Amount_VAT_INTERNET, value) End Set End Property Property Amount_Brutto_PARKING As Double Get Return _Amount_Brutto_PARKING End Get Set(value As Double) SetPropertyValue("Amount_Brutto_PARKING", _Amount_Brutto_PARKING, value) End Set End Property Property Amount_Brutto_TELEPHON As Double Get Return _Amount_Brutto_TELEPHON End Get Set(value As Double) SetPropertyValue("Amount_Brutto_TELEPHON", _Amount_Brutto_TELEPHON, value) If Session.IsObjectsSaving = False And Session.IsObjectsLoading = False Then If Me.RegistryTelephoneParameters.VAT_DEFAULTVAT IsNot Nothing Then Dim _Amount_Netto_TELEPHONE = Math.Round(Math.Round(value * 0.7, 2, MidpointRounding.AwayFromZero) / _ (1 + RegistryTelephoneParameters.VAT_DEFAULTVAT.KeyValue), 2, MidpointRounding.AwayFromZero) Me.Amount_VAT_TELEPHON_70 = Math.Round(_Amount_Netto_TELEPHONE * RegistryTelephoneParameters.VAT_DEFAULTVAT.KeyValue, 2, MidpointRounding.AwayFromZero) _Amount_Netto_TELEPHONE = value - Amount_VAT_TELEPHON_70 Me.AmountNetto_TELEPHON_80 = Math.Round(_Amount_Netto_TELEPHONE * 0.8, 2, MidpointRounding.AwayFromZero) Me.AmountNetto_TELEPHON_20 = _Amount_Netto_TELEPHONE - Me.AmountNetto_TELEPHON_80 Else Dim _Amount_Netto_TELEPHONE = Math.Round(Math.Round(value * 0.7, 2, MidpointRounding.AwayFromZero) / _ (1), 0, MidpointRounding.AwayFromZero) Me.Amount_VAT_TELEPHON_70 = 0 _Amount_Netto_TELEPHONE = value - Amount_VAT_TELEPHON_70 Me.AmountNetto_TELEPHON_80 = Math.Round(_Amount_Netto_TELEPHONE * 0.8, 2, MidpointRounding.AwayFromZero) Me.AmountNetto_TELEPHON_20 = _Amount_Netto_TELEPHONE - Me.AmountNetto_TELEPHON_80 End If End If End Set End Property Property AmountNetto_TELEPHON_80 As Double Get Return _AmountNetto_TELEPHON_80 End Get Set(value As Double) SetPropertyValue("AmountNetto_TELEPHON_80", _AmountNetto_TELEPHON_80, value) End Set End Property Property AmountNetto_TELEPHON_20 As Double Get Return _AmountNetto_TELEPHON_20 End Get Set(value As Double) SetPropertyValue("AmountNetto_TELEPHON_20", _AmountNetto_TELEPHON_20, value) End Set End Property Property Amount_VAT_TELEPHON_70 As Double Get Return _Amount_VAT_TELEPHON_70 End Get Set(value As Double) SetPropertyValue("Amount_VAT_TELEPHON_70", _Amount_VAT_TELEPHON_70, value) End Set End Property Property Amount_Brutto_OTHER_DEFAULTVAT As Double Get Return _Amount_Brutto_OTHER_DEFAULTVAT End Get Set(value As Double) SetPropertyValue("Amount_Brutto_OTHER_DEFAULTVAT", _Amount_Brutto_OTHER_DEFAULTVAT, value) If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then If Me.RegistryTelephoneParameters.VAT_DEFAULTVAT IsNot Nothing Then Amount_Netto_OTHER_DEFAULTVAT = Math.Round(value / (1 + RegistryTelephoneParameters.VAT_DEFAULTVAT.KeyValue), 0, MidpointRounding.AwayFromZero) Amount_VAT_OTHER_DEFAULTVAT = Math.Round(value - Amount_Netto_OTHER_DEFAULTVAT, 0, MidpointRounding.AwayFromZero) Else Amount_Netto_OTHER_DEFAULTVAT = value Amount_VAT_OTHER_DEFAULTVAT = 0 End If End If End Set End Property Property Amount_Netto_OTHER_DEFAULTVAT As Double Get Return _Amount_Netto_OTHER_DEFAULTVAT End Get Set(value As Double) SetPropertyValue("Amount_Netto_OTHER_DEFAULTVAT", _Amount_Netto_OTHER_DEFAULTVAT, value) End Set End Property Property Amount_VAT_OTHER_DEFAULTVAT As Double Get Return _Amount_VAT_OTHER_DEFAULTVAT End Get Set(value As Double) SetPropertyValue("Amount_VAT_OTHER_DEFAULTVAT", _Amount_VAT_OTHER_DEFAULTVAT, value) End Set End Property Property Amount_Brutto_OTHER_NOVAT As Double Get Return _Amount_Brutto_OTHER_NOVAT End Get Set(value As Double) SetPropertyValue("Amount_Brutto_OTHER_NOVAT", _Amount_Brutto_OTHER_NOVAT, value) End Set End Property ReadOnly Property RowTotalBrutto As Double Get Return Amount_Brutto_INTERNET + Amount_Brutto_OTHER_DEFAULTVAT + Amount_Brutto_OTHER_NOVAT + Amount_Brutto_PARKING + Amount_Brutto_TELEPHON End Get End Property End Class