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 DevExpress.ExpressApp.ConditionalAppearance Imports System.Linq Imports System.Linq.Expressions Imports DevExpress.ExpressApp.Editors ' _ ' _ ' _ ' _ ' _ '4", EditorState.Disabled)> _ _ _ _ _ _ _ _ _ _ 3", AppearanceItemType.Action, _ "(RegistryHeader.CurrentWorkflowSystemSteps.StepFinancialType in (2,5) = False) Or !IsNull(ContractRows) Or ! IsNull(Contracts)", _ TargetItems:="aCreateTechnicalContractFromRegistry", visibility:=Editors.ViewItemVisibility.Hide)> _ _ _ _ _ _ _ _ _ _ _ _ _ Public Class RegistryRowsFinancialControlling Inherits BaseObject Private _RegistryHeader As RegistryHeader 'Iktatás fejléce Private _ChoiceRowMode As eChoiceRowMode 'Szerződési sor vagy teljesítési igazolás sor kiválasztása Private _DateExecution As Date 'Teljesítés dátuma Private _ChartOfAccounts As ChartOfAccounts 'FK által beállított számlaszám _ Private _Contracts As Contracts 'Szerződés fejléce _ Private _ContractRows As ContractRows 'Szerződési sor _ Private _PaymentOption As PaymentOption 'Fizetési mód Private _Note As String 'Megjegyzés Private _Amount As Double 'Nettó összeg _ Private _Controlling As Controlling 'Kontroll szám Private _CostHolder As CostHolder 'Költségviselő Private _CostPlace As CostPlace 'Költséghely Private _UniqueObjects As UniqueObjects 'Egyedi azonosító Private _JobNumberObjects As JobNumberObjects 'Munkaszám, project Private _File As FileData 'A beszkennelt telj. igazolás file _ Private _IsReInvoice As Boolean '= False 'Tovább kell számlázni ? Private _ReInvoice_Customers As Customers 'Kinek kell továbbszámlázni ? Private _ReInvoice_ContractRows As ContractRows 'Milyen szerződési sor alapján _ Private _ReInvoice_ExtraCharge As Double 'Mennyiért Private _ReInvoice_Contracts As Contracts 'Melyik szerződésre hozza létre a sort amin ki lesz számlázva _ Private _ReInvoiceMode As eReinvoiceMode 'Továbbszámlázás módja Private _ReInvoiceReason As Controlling 'Továbbszámlázás jogcíme Private _IsGuaranteeBack As Boolean '= False 'Van-e visszatartási garancia Private _F_ReadyforBookEntryRows As Boolean '= False ' _ Private _WorkflowMessage As String 'Léptetéskori üzenet _ Private _ConnectInfoAdvanced As String = "" 'Analitikus kötési szám az előlegek pontozásához Public Sub New(ByVal session As Session) MyBase.New(session) End Sub Public Overrides Sub AfterConstruction() MyBase.AfterConstruction() Me.ChoiceRowMode = eChoiceRowMode.eFromContractRows If Me.RegistryHeader IsNot Nothing Then Me.DateExecution = Me.RegistryHeader.F_DateExecution End If IsGuaranteeBack = False F_ReadyforBookEntryRows = False IsReInvoice = False End Sub Protected Overrides Sub OnSaving() MyBase.OnSaving() If IsDeleted = False Then If Me.ContractRows IsNot Nothing Then Dim _CurrencyRate As Double = 1.0 If Math.Abs(Me.ContractRows.NettoPriceHUF) < Math.Abs(Me.Amount) Then If Math.Abs(Math.Abs(Me.ContractRows.NettoPriceHUF) - Math.Abs(Me.Amount)) > 5 Then Throw New Exception("*A leigazolni kívánt összeg meghaladja, az igazoláshoz felhasznált szerződési sor összegét, módosítsa a szerződési sort ! Iktatószám : " & Me.RegistryHeader.DocumentNumber) End If End If If Math.Abs(Me.ContractRows.NettoPriceHUF) > Math.Abs(Me.Amount) Then If Math.Abs(Math.Abs(Me.ContractRows.NettoPriceHUF) - Math.Abs(Me.Amount)) > 5 Then Throw New Exception("*A leigazoláshoz felhasználni kívánt szerződési sor összege meghaladja a számla sor összegét. Módosítsa a szerződési sort ! Iktatószám : " & Me.RegistryHeader.DocumentNumber) End If End If End If If Me.RegistryHeader IsNot Nothing Then If Me.DateExecution = Nothing Then Me.DateExecution = Me.RegistryHeader.F_DateExecution End If End If End If End Sub Protected Overrides Sub OnDeleting() MyBase.OnDeleting() If Me.ContractRows IsNot Nothing Then If Me.ContractRows.Contracts.ContractTemplate.IsTechnical Then Me.ContractRows.Delete() End If If Me.ContractRows IsNot Nothing Then Me.ContractRows.RegistryRowsFinancialControlling = Nothing End If End If Dim _DeliveryNoteInRRFC_Collection As New XPCollection(Of DeliveryNoteInRRFC)(PersistentCriteriaEvaluationBehavior.InTransaction, Session, CriteriaOperator.Parse("RegistryRowsFinancialControlling=?", Me)) Session.Delete(_DeliveryNoteInRRFC_Collection) End Sub _ Property RegistryHeader As RegistryHeader Get Return _RegistryHeader End Get Set(ByVal value As RegistryHeader) SetPropertyValue("RegistryHeader", _RegistryHeader, value) If Session.IsNewObject(Me) And Session.IsObjectsLoading = False And Session.IsObjectsSaving = False And Me.RegistryHeader IsNot Nothing Then Me.Note = RegistryHeader.ShortName End If End Set End Property _ Property ChoiceRowMode As eChoiceRowMode Get Return _ChoiceRowMode End Get Set(ByVal value As eChoiceRowMode) SetPropertyValue("ChoiceRowMode", _ChoiceRowMode, value) End Set End Property Property DateExecution As Date Get Return _DateExecution.Date End Get Set(value As Date) SetPropertyValue("DateExecution", _DateExecution, value.Date) End Set End Property Property ConnectInfoAdvanced As String Get Return _ConnectInfoAdvanced End Get Set(value As String) SetPropertyValue("ConnectInfoAdvanced", _ConnectInfoAdvanced, value) End Set End Property '-Rule5DMatrix ------------------------------- _ _ Property Controlling As Controlling Get Return _Controlling End Get Set(ByVal value As Controlling) SetPropertyValue("Controlling", _Controlling, value) If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving And Me.ContractRows IsNot Nothing Then If Me.ContractRows.Controlling IsNot value Then Me.ContractRows.Controlling = value Me.ContractRows.Save() End If End If End Set End Property _ Property CostHolder As CostHolder Get Return _CostHolder End Get Set(ByVal value As CostHolder) SetPropertyValue("CostHolder", _CostHolder, value) If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving And Me.ContractRows IsNot Nothing Then If Me.ContractRows.CostHolder IsNot value Then Me.ContractRows.CostHolder = value Me.ContractRows.Save() End If End If End Set End Property _ Property CostPlace As CostPlace Get Return _CostPlace End Get Set(ByVal value As CostPlace) SetPropertyValue("CostPlace", _CostPlace, value) End Set End Property _ Property UniqueObjects As UniqueObjects Get Return _UniqueObjects End Get Set(ByVal value As UniqueObjects) SetPropertyValue("UniqueObjects", _UniqueObjects, value) If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving And Me.ContractRows IsNot Nothing Then If Me.ContractRows.UniqueObjects IsNot value Then Me.ContractRows.UniqueObjects = value Me.ContractRows.Save() End If End If End Set End Property _ Property JobNumberObjects As JobNumberObjects Get Return _JobNumberObjects End Get Set(ByVal value As JobNumberObjects) SetPropertyValue("JobNumberObjects", _JobNumberObjects, value) If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving And Me.ContractRows IsNot Nothing Then If Me.ContractRows.JobNumberObjects IsNot value Then Me.ContractRows.JobNumberObjects = value Me.ContractRows.Save() End If End If End Set End Property Property ChartOfAccounts As ChartOfAccounts Get Return _ChartOfAccounts End Get Set(ByVal value As ChartOfAccounts) SetPropertyValue("ChartOfAccounts", _ChartOfAccounts, value) End Set End Property Property Contracts As Contracts Get Return (_Contracts) End Get Set(ByVal value As Contracts) SetPropertyValue("Contracts", _Contracts, value) End Set End Property Property ContractRows As ContractRows Get Return _ContractRows End Get Set(ByVal value As ContractRows) SetPropertyValue("ContractRows", _ContractRows, value) If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then If value IsNot Nothing Then PaymentOption = value.PaymentOption Controlling = value.Controlling UniqueObjects = value.UniqueObjects Note = value.Description CostHolder = value.CostHolder CostPlace = value.CostPlace JobNumberObjects = value.JobNumberObjects If Me.RegistryHeader.F_CurrencyName.ShortName <> "HUF" Then Me.Amount = Math.Round(value.NettoPriceDEV * Me.RegistryHeader.F_CurrencyRate, 0, MidpointRounding.AwayFromZero) value.NettoPriceHUF = Math.Round(value.NettoPriceDEV * Me.RegistryHeader.F_CurrencyRate, 0, MidpointRounding.AwayFromZero) '-- Itt van egy SAVE !!!!! De ez kell !!!!!! value.Save() Else Me.Amount = value.NettoPriceHUF End If End If End If End Set End Property Property PaymentOption As PaymentOption Get Return _PaymentOption End Get Set(ByVal value As PaymentOption) SetPropertyValue("PaymentOption", _PaymentOption, value) End Set End Property Property Note As String Get Return _Note End Get Set(ByVal value As String) SetPropertyValue("Note", _Note, value) If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving And Me.ContractRows IsNot Nothing Then 'If Not Me.ContractRows.ShortName = value Then ' Me.ContractRows.ShortName = value ' Me.ContractRows.Save() 'End If End If End Set End Property Property Amount As Double Get Return _Amount End Get Set(ByVal value As Double) SetPropertyValue("Amount", _Amount, value) If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving And Me.ContractRows IsNot Nothing Then If Me.ContractRows.NettoPriceHUF = value Then Me.ContractRows.NettoPriceHUF = value Me.ContractRows.NettoPriceHUF = Math.Round(Me.ContractRows.NettoPriceHUF, 2, MidpointRounding.AwayFromZero) End If value = Math.Round(value, 2, MidpointRounding.AwayFromZero) End If End Set End Property Property File As FileData Get Return _File End Get Set(ByVal value As FileData) SetPropertyValue("File", _File, value) End Set End Property Property IsReInvoice As Boolean Get Return _IsReInvoice End Get Set(ByVal value As Boolean) SetPropertyValue("IsReInvoice", _IsReInvoice, value) End Set End Property Property ReInvoiceMode As eReinvoiceMode Get Return _ReInvoiceMode End Get Set(ByVal value As eReinvoiceMode) SetPropertyValue("ReinvoiceMode", _ReInvoiceMode, value) If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then End If End Set End Property Property ReInvoiceReason As Controlling Get Return _ReInvoiceReason End Get Set(ByVal value As Controlling) SetPropertyValue("ReInvoiceReason", _ReInvoiceReason, value) End Set End Property Property ReInvoice_Customers As Customers Get Return _ReInvoice_Customers End Get Set(ByVal value As Customers) SetPropertyValue("ReInvoice_Customers", _ReInvoice_Customers, value) End Set End Property Property ReInvoice_ContractRows As ContractRows Get Return _ReInvoice_ContractRows End Get Set(ByVal value As ContractRows) SetPropertyValue("ReInvoice_ContractRows", _ReInvoice_ContractRows, value) End Set End Property Property ReInvoice_ExtraCharge As Double Get Return _ReInvoice_ExtraCharge End Get Set(ByVal value As Double) SetPropertyValue("ReInvoice_ExtraCharge", _ReInvoice_ExtraCharge, value) End Set End Property _ Property IsGuaranteeBack As Boolean Get Return _IsGuaranteeBack End Get Set(ByVal value As Boolean) SetPropertyValue("IsGuaranteeBack", _IsGuaranteeBack, value) End Set End Property _ Property F_ReadyforBookEntryRows As Boolean Get Return _F_ReadyforBookEntryRows End Get Set(ByVal value As Boolean) SetPropertyValue("F_ReadyforBookEntryRows", _F_ReadyforBookEntryRows, value) End Set End Property _ Property WorkflowMessage As String Get Return _WorkflowMessage End Get Set(ByVal value As String) SetPropertyValue("WorkflowMessage", _WorkflowMessage, value) End Set End Property '------ReadOnly---------- _ ReadOnly Property RegistryBankTransfer As XPCollection(Of RegistryBankTransfer) Get Return New XPCollection(Of RegistryBankTransfer)(Session, CriteriaOperator.Parse("RegistryHeader=?", Me.RegistryHeader)) End Get End Property ReadOnly Property DisplayName As String Get If Me.RegistryHeader IsNot Nothing Then Return Me.RegistryHeader.RegistryNumber & ", " & Me.RegistryHeader.DocumentNumber Else Return "" End If End Get End Property End Class