Imports System Imports System.ComponentModel Imports System.Collections.Generic Imports System.Diagnostics Imports System.Text Imports DevExpress.ExpressApp Imports DevExpress.ExpressApp.Actions Imports DevExpress.Persistent.Base Imports DevExpress.ExpressApp.SystemModule Imports DevExpress.ExpressApp.CloneObject Imports DevExpress.Persistent.BaseImpl Imports DevExpress.Data.Filtering Imports DevExpress.ExpressApp.Editors Imports DevExpress.ExpressApp.Utils Public Class RegistryTaskVC Inherits DevExpress.ExpressApp.ViewController Public Event InitWork(ByVal _Minimum As Long, ByVal _Step As Long, ByVal _Maximum As Long) Public Event DoWork() Public Event FinalWork Public Sub New() MyBase.New() 'This call is required by the Component Designer. InitializeComponent() RegisterActions(components) End Sub Protected Overrides Sub OnActivated() MyBase.OnActivated() Frame.GetController(Of RegistryTaskVC).aRegistryTaskStateReset.Active.SetItemValue("", False) Frame.GetController(Of RegistryTaskVC).aRegistryEmailToResponsible.Active.SetItemValue("", False) If View.Id Like "RegistryTasks_ListView*" Or View.Id Like "RegistryHeader_ListView*" Then Frame.GetController(Of RegistryTaskVC).aRegistryEmailToResponsible.Active.SetItemValue("", True) End If If View.Id = "RegistryTasks_DetailView" Then Frame.GetController(Of NewObjectViewController)?.Active.SetItemValue("", False) Frame.GetController(Of CloneObjectViewController)?.Active.SetItemValue("", False) Dim _RegistryTasks As RegistryTasks = TryCast(View.SelectedObjects(0), RegistryTasks) If _RegistryTasks IsNot Nothing Then If _RegistryTasks.Status = General.TaskStatus.Completed Then Frame.GetController(Of ModificationsController)?.Active.SetItemValue("", False) End If End If End If If View.Id = "RegistryHeader_RegistryTasks_ListView" Then If TryCast(SecuritySystem.CurrentUser, User).UserName = "SysAdmin" Then Frame.GetController(Of RegistryTaskVC).aRegistryTaskStateReset.Active.SetItemValue("", True) End If End If If View.Id = "DeliveryNoteInRows_ListView_Certificate_HUF" Or View.Id = "DeliveryNoteInRows_ListView_Certificate_DEV" Then Frame.GetController(Of CloneObjectViewController)?.Active.SetItemValue("", False) End If End Sub Protected Overrides Sub OnDeactivated() MyBase.OnDeactivated() If View.Id = "RegistryTasks_DetailView" Then Frame.GetController(Of ModificationsController)?.Active.SetItemValue("", True) Frame.GetController(Of NewObjectViewController)?.Active.SetItemValue("", True) Frame.GetController(Of CloneObjectViewController)?.Active.SetItemValue("", True) End If If View.Id = "DeliveryNoteInRows_ListView_Certificate_HUF" Or View.Id = "DeliveryNoteInRows_ListView_Certificate_DEV" Then Frame.GetController(Of CloneObjectViewController)?.Active.SetItemValue("", True) End If End Sub Private Sub aRegistryTaskStateReset_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aRegistryTaskStateReset.Execute Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _RegistryTasks As RegistryTasks = TryCast(View.SelectedObjects(0), RegistryTasks) If _RegistryTasks IsNot Nothing Then If _RegistryTasks.Status = 4 Then _RegistryTasks.Status = 0 Else _RegistryTasks.Status = 4 End If _ocur.CommitChanges() End If End Sub Private Sub aToTable_RRFC_RegistryTask_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aToTable_RRFC_RegistryTask.Execute Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _RegistryTasks As RegistryTasks = TryCast(View.SelectedObjects(0), RegistryTasks) Dim _RegistryRowsFinancialControlling As RegistryRowsFinancialControlling If _RegistryTasks IsNot Nothing Then If _RegistryTasks.RegistryHeader IsNot Nothing Then _RegistryRowsFinancialControlling.ConnectInfoAdvanced = _RegistryTasks.row_ConnectInfoAdvanced _RegistryRowsFinancialControlling = _ocur.CreateObject(Of RegistryRowsFinancialControlling)() _RegistryRowsFinancialControlling.RegistryHeader = _RegistryTasks.RegistryHeader _RegistryRowsFinancialControlling.ContractRows = _ocur.GetObject(_RegistryTasks.row_RRFC_ContractRows) _RegistryRowsFinancialControlling.ContractRows.RegistryRowsFinancialControlling = _RegistryRowsFinancialControlling _RegistryRowsFinancialControlling.Amount = _RegistryTasks.row_RRFC_Amount _RegistryRowsFinancialControlling.Controlling = _RegistryTasks.row_RRFC_Controlling _RegistryRowsFinancialControlling.CostHolder = _RegistryTasks.row_RRFC_CostHolder _RegistryRowsFinancialControlling.CostPlace = _RegistryTasks.row_RRFC_CostPlace _RegistryRowsFinancialControlling.Note = _RegistryTasks.row_RRFC_Note _RegistryRowsFinancialControlling.JobNumberObjects = _RegistryTasks.row_RRFC_JobNumberObjects _RegistryRowsFinancialControlling.UniqueObjects = _RegistryTasks.row_RRFC_UniqueObjects _RegistryRowsFinancialControlling.File = _RegistryTasks.row_RRFC_File If _RegistryTasks.row_RRFC_IsReInvoice = True Then _RegistryRowsFinancialControlling.IsReInvoice = _RegistryTasks.row_RRFC_IsReInvoice _RegistryRowsFinancialControlling.ReInvoice_Customers = _RegistryTasks.row_RRFC_ReInvoice_Customers _RegistryRowsFinancialControlling.ReInvoiceMode = _RegistryTasks.row_RRFC_ReInvoiceMode _RegistryRowsFinancialControlling.ReInvoiceReason = _RegistryTasks.row_RRFC_ReInvoiceReason End If _ocur.CommitChanges() View.Refresh() _RegistryTasks.row_RRFC_Amount = _RegistryTasks.RegistryHeader.NettoAmountRemaining End If End If End Sub Private Sub aToTable_RRFC_With_TContract_RegistryTask_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aToTable_RRFC_With_TContract_RegistryTask.Execute '// Technikai szerződés sor + Táblázatba beadás !!! Frame.GetController(Of DevExpress.ExpressApp.Validation.PersistenceValidationController)()?.Active.SetItemValue("", False) ' A validáció ideiglenes letiltása az akció végrehajtásának idejére. Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _RegistryTasks As RegistryTasks = TryCast(View.SelectedObjects(0), RegistryTasks) Dim _TechnicalContractTemplate As ContractTemplate = _ocur.FindObject(Of ContractTemplate)(CriteriaOperator.Parse("CustomersFrom=? And IsTechnical=True", _RegistryTasks.RegistryHeader.CustomersFrom)) Dim _Contracts As Contracts = _ocur.FindObject(Of Contracts)(CriteriaOperator.Parse("CustomersFrom=? AND Customers=? AND ContractTemplate=?", _RegistryTasks.RegistryHeader.CustomersFrom, _RegistryTasks.RegistryHeader.Customers, _TechnicalContractTemplate)) Dim _ContractRows As ContractRows Dim _RegistryRowsFinancial As RegistryRowsFinancial Dim _RegistryRowsFinancialControlling As RegistryRowsFinancialControlling Dim _TechnicalLimitAmount As Double = _RegistryTasks.row_RRFC_Controlling.TechnicalContractLimit If _TechnicalLimitAmount = 0 Then _TechnicalLimitAmount = 200000 If _RegistryTasks.row_RRFC_Amount <= _TechnicalLimitAmount Then If _Contracts Is Nothing Then _Contracts = _ocur.CreateObject(Of Contracts)() _Contracts.CustomersFrom = _RegistryTasks.RegistryHeader.CustomersFrom _Contracts.Customers = _RegistryTasks.RegistryHeader.Customers _Contracts.ContractTemplate = _TechnicalContractTemplate _Contracts.DateCreated = _RegistryTasks.RegistryHeader.F_DateCreated _Contracts.DateExecution = _RegistryTasks.RegistryHeader.F_DateExecution _Contracts.DocumentNumber = _Contracts.ContractTemplate.NumberGenerator.GetNewNumber(_Contracts.ContractTemplate.NumberGenerator) _Contracts.State = State.Signed End If _ContractRows = _ocur.CreateObject(Of ContractRows)() _ContractRows.Contracts = _Contracts _ContractRows.CurrencyName = _RegistryTasks.RegistryHeader.F_CurrencyName _ContractRows.ContractRowsType = eContractRowsType.eFix _ContractRows.DateExecution = _RegistryTasks.RegistryHeader.F_DateExecution _ContractRows.Controlling = _RegistryTasks.row_RRFC_Controlling If _RegistryTasks.RegistryHeader.F_CurrencyName.ShortName = "HUF" Then _ContractRows.NettoPriceHUF = _RegistryTasks.row_RRFC_Amount Else If _RegistryTasks.RegistryHeader.F_CurrencyRate <> 0 Then _ContractRows.NettoPriceDEV = _RegistryTasks.row_RRFC_Amount / _RegistryTasks.RegistryHeader.F_CurrencyRate Else _ContractRows.NettoPriceDEV = 0 End If _ContractRows.NettoPriceHUF = _RegistryTasks.row_RRFC_Amount End If _ContractRows.ShortName = _RegistryTasks.row_RRFC_Note 'IDE KELL VALAMI ÁFA ! For Each _RegistryRowsFinancial In _RegistryTasks.RegistryHeader.RegistryRowsFinancial _ContractRows.VAT = _RegistryRowsFinancial.VAT Exit For Next _ContractRows.UniqueObjects = _RegistryTasks.row_RRFC_UniqueObjects _ContractRows.CostHolder = _RegistryTasks.row_RRFC_CostHolder _ContractRows.CostPlace = _RegistryTasks.row_RRFC_CostPlace _ContractRows.Controlling = _RegistryTasks.row_RRFC_Controlling _ContractRows.JobNumberObjects = _RegistryTasks.row_RRFC_JobNumberObjects _RegistryRowsFinancialControlling = _ocur.CreateObject(Of RegistryRowsFinancialControlling)() _RegistryRowsFinancialControlling.RegistryHeader = _RegistryTasks.RegistryHeader _RegistryRowsFinancialControlling.ContractRows = _ContractRows _RegistryRowsFinancialControlling.Amount = _RegistryTasks.row_RRFC_Amount _RegistryRowsFinancialControlling.Controlling = _RegistryTasks.row_RRFC_Controlling _RegistryRowsFinancialControlling.CostHolder = _RegistryTasks.row_RRFC_CostHolder _RegistryRowsFinancialControlling.CostPlace = _RegistryTasks.row_RRFC_CostPlace _RegistryRowsFinancialControlling.Note = _RegistryTasks.row_RRFC_Note _RegistryRowsFinancialControlling.JobNumberObjects = _RegistryTasks.row_RRFC_JobNumberObjects _RegistryRowsFinancialControlling.UniqueObjects = _RegistryTasks.row_RRFC_UniqueObjects _RegistryRowsFinancialControlling.ConnectInfoAdvanced = _RegistryTasks.row_ConnectInfoAdvanced If _RegistryTasks.row_RRFC_IsReInvoice = True Then _RegistryRowsFinancialControlling.IsReInvoice = _RegistryTasks.row_RRFC_IsReInvoice _RegistryRowsFinancialControlling.ReInvoice_Customers = _RegistryTasks.row_RRFC_ReInvoice_Customers _RegistryRowsFinancialControlling.ReInvoiceMode = _RegistryTasks.row_RRFC_ReInvoiceMode _RegistryRowsFinancialControlling.ReInvoiceReason = _RegistryTasks.row_RRFC_ReInvoiceReason End If _ContractRows.RegistryRowsFinancialControlling = _RegistryRowsFinancialControlling _ocur.CommitChanges() View.Refresh() _RegistryTasks.row_RRFC_Amount = _RegistryTasks.RegistryHeader.NettoAmountRemaining Else '-------!!!!!!!TESZT MIATT!!!!!------------------------------------------ Dim _Message As String = String.Format("Technikai limit van beállítva ! {0}", _TechnicalLimitAmount) Throw New Exception(_Message) End If End Sub Private Sub aToTableD_RRFC_RegistryTask_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aToTableD_RRFC_RegistryTask.Execute Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _RegistryTasks As RegistryTasks = TryCast(View.SelectedObjects(0), RegistryTasks) Dim _ListView_RRF As ListPropertyEditor Dim _RegistryRowsFinancialControlling As RegistryRowsFinancialControlling Dim _ContractRows_ArrayList As New ArrayList If _RegistryTasks IsNot Nothing Then _ListView_RRF = TryCast(View, DetailView).FindItem("RegistryRowsFinancialControlling") If _ListView_RRF IsNot Nothing Then For Each _RegistryRowsFinancialControlling In _ListView_RRF.ListView.SelectedObjects If _RegistryRowsFinancialControlling.ContractRows IsNot Nothing Then If _RegistryRowsFinancialControlling.ContractRows.Contracts IsNot Nothing Then If _RegistryRowsFinancialControlling.ContractRows.Contracts.ContractTemplate.IsTechnical Then _ContractRows_ArrayList.Add(_RegistryRowsFinancialControlling.ContractRows) End If End If End If Next _ocur.Delete(_ListView_RRF.ListView.SelectedObjects) _ocur.Delete(_ContractRows_ArrayList) _ocur.CommitChanges() View.Refresh() End If End If End Sub Private Sub aToTable_RRFC_With_RContract_RegistryTask_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aToTable_RRFC_With_RContract_RegistryTask.CustomizePopupWindowParams Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _RegistryTasks As RegistryTasks = TryCast(View.SelectedObjects(0), RegistryTasks) Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(Contracts)) _CS.BeginUpdateCriteria() _CS.Criteria.Add("Filter1", CriteriaOperator.Parse("CustomersFrom.Oid=? and Customers.Oid=? and ContractTemplate.PartnerType=1 and ContractTemplate.IsTechnical=False and (State = 1 OR State = 2)", _RegistryTasks.RegistryHeader.CustomersFrom.Oid, _RegistryTasks.RegistryHeader.Customers.Oid)) _CS.EndUpdateCriteria() e.View = Application.CreateListView("Contracts_Finder_Payables", _CS, False) End Sub Private Sub aToTable_RRFC_With_RContract_RegistryTask_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aToTable_RRFC_With_RContract_RegistryTask.Execute Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _RegistryTasks As RegistryTasks = TryCast(View.SelectedObjects(0), RegistryTasks) Dim _RegistryRowsFinancialControlling As RegistryRowsFinancialControlling Dim _Contracts As Contracts = _ocur.GetObject(TryCast(e.PopupWindow.View.SelectedObjects(0), Contracts)) Dim _ContractRows As ContractRows If _Contracts Is Nothing Then Exit Sub If _RegistryTasks IsNot Nothing And _Contracts IsNot Nothing Then _ContractRows = _ocur.CreateObject(Of ContractRows)() _ContractRows.Contracts = _Contracts _ContractRows.ContractRowsType = eContractRowsType.eFix _ContractRows.DateExecution = _RegistryTasks.RegistryHeader.F_DateExecution _ContractRows.Controlling = _RegistryTasks.row_RRFC_Controlling _ContractRows.CurrencyName = _RegistryTasks.RegistryHeader.F_CurrencyName _ContractRows.NettoPriceHUF = _RegistryTasks.row_RRFC_Amount If Not _ContractRows.CurrencyName.ShortName = "HUF" Then If _RegistryTasks.RegistryHeader.F_CurrencyRate <> 0 Then _ContractRows.NettoPriceDEV = Math.Round(_RegistryTasks.row_RRFC_Amount / _RegistryTasks.RegistryHeader.F_CurrencyRate, 2, MidpointRounding.AwayFromZero) End If End If _ContractRows.ShortName = _RegistryTasks.row_RRFC_Note If _RegistryTasks.RegistryHeader.RegistryRowsFinancial.Count > 0 Then _ContractRows.VAT = TryCast(_RegistryTasks.RegistryHeader.RegistryRowsFinancial(0), RegistryRowsFinancial).VAT End If _ContractRows.CostHolder = _RegistryTasks.row_RRFC_CostHolder _ContractRows.CostPlace = _RegistryTasks.row_RRFC_CostPlace _ContractRows.Controlling = _RegistryTasks.row_RRFC_Controlling _ContractRows.JobNumberObjects = _RegistryTasks.row_RRFC_JobNumberObjects _ContractRows.UniqueObjects = _RegistryTasks.row_RRFC_UniqueObjects _ContractRows.QTT = 1 _ContractRows.Units = _ocur.FindObject(Of Units)(CriteriaOperator.Parse("DefaultForBusinnes=True")) _RegistryRowsFinancialControlling = _ocur.CreateObject(Of RegistryRowsFinancialControlling)() _RegistryRowsFinancialControlling.RegistryHeader = _RegistryTasks.RegistryHeader _RegistryRowsFinancialControlling.ContractRows = _ContractRows _RegistryRowsFinancialControlling.Amount = _RegistryTasks.row_RRFC_Amount _RegistryRowsFinancialControlling.Controlling = _RegistryTasks.row_RRFC_Controlling _RegistryRowsFinancialControlling.CostHolder = _RegistryTasks.row_RRFC_CostHolder _RegistryRowsFinancialControlling.CostPlace = _RegistryTasks.row_RRFC_CostPlace _RegistryRowsFinancialControlling.Note = _RegistryTasks.row_RRFC_Note _RegistryRowsFinancialControlling.JobNumberObjects = _RegistryTasks.row_RRFC_JobNumberObjects _RegistryRowsFinancialControlling.UniqueObjects = _RegistryTasks.row_RRFC_UniqueObjects _RegistryRowsFinancialControlling.ConnectInfoAdvanced = _RegistryTasks.row_ConnectInfoAdvanced If _RegistryTasks.row_RRFC_IsReInvoice = True Then _RegistryRowsFinancialControlling.IsReInvoice = _RegistryTasks.row_RRFC_IsReInvoice _RegistryRowsFinancialControlling.ReInvoice_Customers = _RegistryTasks.row_RRFC_ReInvoice_Customers _RegistryRowsFinancialControlling.ReInvoiceMode = _RegistryTasks.row_RRFC_ReInvoiceMode _RegistryRowsFinancialControlling.ReInvoiceReason = _RegistryTasks.row_RRFC_ReInvoiceReason End If _ContractRows.RegistryRowsFinancialControlling = _RegistryRowsFinancialControlling _ocur.CommitChanges() End If If Frame.GetController(Of RefreshController).RefreshAction.Enabled Then Frame.GetController(Of RefreshController).RefreshAction.DoExecute() End If End Sub Private Sub aImport_RRFC_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aImport_RRFC.CustomizePopupWindowParams Try Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace Dim _RegistryTasks As RegistryTasks = TryCast(View.SelectedObjects(0), RegistryTasks) If _RegistryTasks Is Nothing Then Throw New Exception("*Váratlan hiba történt, a folyamat megszakadt!") Dim _RegistryRowsFinancialControllingTemplatePopup As RegistryRowsFinancialControllingTemplatePopup = _onew.CreateObject(Of RegistryRowsFinancialControllingTemplatePopup)() _RegistryRowsFinancialControllingTemplatePopup.MasterKey = Guid.NewGuid _RegistryRowsFinancialControllingTemplatePopup.CustomersFrom = _onew.GetObject(_RegistryTasks.CustomersFrom) _RegistryRowsFinancialControllingTemplatePopup.Customers = _onew.GetObject(_RegistryTasks.Customers) e.View = Application.CreateDetailView(_onew, "RegistryRowsFinancialControllingTemplatePopup_DetailView", False, _RegistryRowsFinancialControllingTemplatePopup) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain"))) End Try End Sub Private Sub aImport_RRFC_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aImport_RRFC.Execute Try Dim _ocur As Xpo.XPObjectSpace = View.ObjectSpace Dim _RegistryTasks As RegistryTasks = TryCast(View.SelectedObjects(0), RegistryTasks) Dim _RegistryRowsFinancialControllingTemplatePopup As RegistryRowsFinancialControllingTemplatePopup = TryCast(e.PopupWindow.View.SelectedObjects(0), RegistryRowsFinancialControllingTemplatePopup) Dim _ListView_RegistryRowsFinancialControlling As ListPropertyEditor = TryCast(e.PopupWindow.View, DetailView).FindItem("RegistryRowsFinancialControlling") If _ListView_RegistryRowsFinancialControlling Is Nothing Then Throw New Exception("*Váratlan hiba történt, a folyamat megszakadt!") Dim _RegistryRowsFinancialControlling_Template As RegistryRowsFinancialControlling = TryCast(_ListView_RegistryRowsFinancialControlling.ListView.SelectedObjects(0), RegistryRowsFinancialControlling) If _RegistryRowsFinancialControlling_Template Is Nothing Then Throw New Exception("*Nem lett kijelölve egy igazolási sablon sem!") If _ListView_RegistryRowsFinancialControlling.ListView.SelectedObjects.Count > 1 Then Throw New Exception("*Egynél több igazolási sablon lett kijelölve, nem lehet egyértelműen meghatározni az igazolási sablont!") _RegistryTasks.row_RRFC_Amount = _RegistryRowsFinancialControlling_Template.Amount _RegistryTasks.row_RRFC_Contracts = _ocur.GetObject(_RegistryRowsFinancialControlling_Template.ContractRows.Contracts) If _RegistryRowsFinancialControlling_Template.ContractRows.RegistryRowsFinancialControlling Is Nothing Then _RegistryTasks.row_RRFC_ContractRows = _ocur.GetObject(_RegistryRowsFinancialControlling_Template.ContractRows) Else _RegistryTasks.row_RRFC_ContractRows = Nothing End If _RegistryTasks.row_RRFC_Controlling = _ocur.GetObject(_RegistryRowsFinancialControlling_Template.Controlling) _RegistryTasks.row_RRFC_CostHolder = _ocur.GetObject(_RegistryRowsFinancialControlling_Template.CostHolder) _RegistryTasks.row_RRFC_CostPlace = _ocur.GetObject(_RegistryRowsFinancialControlling_Template.CostPlace) _RegistryTasks.row_RRFC_JobNumberObjects = _ocur.GetObject(_RegistryRowsFinancialControlling_Template.JobNumberObjects) _RegistryTasks.row_RRFC_UniqueObjects = _ocur.GetObject(_RegistryRowsFinancialControlling_Template.UniqueObjects) _RegistryTasks.row_RRFC_Note = _RegistryRowsFinancialControlling_Template.Note Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain"))) End Try 'Try ' Dim _ocur As Xpo.XPObjectSpace = View.ObjectSpace ' Dim _RegistryTasks As RegistryTasks = TryCast(View.SelectedObjects(0), RegistryTasks) ' Dim _RegistryRowsFinancialControlling_Template As RegistryRowsFinancialControlling = Nothing ' Dim _RegistryRowsFinancialControllingTemplatePopup As RegistryRowsFinancialControllingTemplatePopup = TryCast(e.PopupWindow.View.SelectedObjects(0), RegistryRowsFinancialControllingTemplatePopup) ' Dim _ListView_RegistryHeader As ListPropertyEditor = TryCast(e.PopupWindow.View, DetailView).FindItem("RegistryHeader") ' If _ListView_RegistryHeader Is Nothing Then Exit Sub ' Dim _RegistryHeader_Template As RegistryHeader = TryCast(_ListView_RegistryHeader.ListView.SelectedObjects(0), RegistryHeader) ' If _RegistryHeader_Template Is Nothing Then Exit Sub ' _RegistryHeader_Template = _ocur.GetObjectByKey(Of RegistryHeader)(_RegistryHeader_Template.Oid) ' Select Case _RegistryRowsFinancialControllingTemplatePopup.RRFCT_Type ' Case eRRFCT_Type.eTechnical ' 'Frame.GetController(Of DevExpress.ExpressApp.Validation.PersistenceValidationController)()?.Active.SetItemValue("", False) ' A validáció ideiglenes letiltása az akció végrehajtásának idejére. ' Dim _TechnicalContractTemplate As ContractTemplate = _ocur.FindObject(Of ContractTemplate)(CriteriaOperator.Parse("CustomersFrom=? And IsTechnical=True", _ ' _RegistryRowsFinancialControllingTemplatePopup.CustomersFrom)) ' Dim _Contracts As Contracts = _ocur.FindObject(Of Contracts)(CriteriaOperator.Parse("CustomersFrom=? AND Customers=? AND ContractTemplate=?", _RegistryHeader_Template.CustomersFrom, _ ' _RegistryHeader_Template.Customers, _TechnicalContractTemplate)) ' Dim _ContractRows As ContractRows ' If _TechnicalContractTemplate IsNot Nothing Then ' If _Contracts Is Nothing Then ' _Contracts = _ocur.CreateObject(Of Contracts)() ' _Contracts.CustomersFrom = _RegistryTasks.RegistryHeader.CustomersFrom ' _Contracts.Customers = _RegistryTasks.RegistryHeader.Customers ' _Contracts.ContractTemplate = _TechnicalContractTemplate ' _Contracts.DateCreated = _RegistryTasks.RegistryHeader.F_DateCreated ' _Contracts.DateExecution = _RegistryTasks.RegistryHeader.F_DateExecution ' _Contracts.DocumentNumber = _Contracts.ContractTemplate.NumberGenerator.GetNewNumber(_Contracts.ContractTemplate.NumberGenerator) ' _Contracts.State = State.Signed ' End If ' For Each _RegistryRowsFinancialControlling_Template In _RegistryHeader_Template.RegistryRowsFinancialControlling ' _ContractRows = _ocur.CreateObject(Of ContractRows)() ' _ContractRows.Contracts = _Contracts ' _ContractRows.CurrencyName = _RegistryTasks.RegistryHeader.F_CurrencyName ' _ContractRows.ContractRowsType = eContractRowsType.eFix ' _ContractRows.DateExecution = _RegistryTasks.RegistryHeader.F_DateExecution ' _ContractRows.Controlling = _RegistryRowsFinancialControlling_Template.Controlling ' _ContractRows.NettoPriceDEV = 0 ' _ContractRows.NettoPriceHUF = 0 ' _ContractRows.ShortName = _RegistryRowsFinancialControlling_Template.Note ' 'IDE KELL VALAMI ÁFA ! ' For Each _RegistryRowsFinancial In _RegistryTasks.RegistryHeader.RegistryRowsFinancial ' _ContractRows.VAT = _RegistryRowsFinancial.VAT ' Exit For ' Next ' _ContractRows.UniqueObjects = _RegistryRowsFinancialControlling_Template.UniqueObjects ' _ContractRows.CostHolder = _RegistryRowsFinancialControlling_Template.CostHolder ' _ContractRows.CostPlace = _RegistryRowsFinancialControlling_Template.CostPlace ' _ContractRows.Controlling = _RegistryRowsFinancialControlling_Template.Controlling ' _ContractRows.JobNumberObjects = _RegistryRowsFinancialControlling_Template.JobNumberObjects ' _RegistryRowsFinancialControlling_Template = _ocur.CreateObject(Of RegistryRowsFinancialControlling)() ' _RegistryRowsFinancialControlling_Template.RegistryHeader = _RegistryTasks.RegistryHeader ' _RegistryRowsFinancialControlling_Template.ContractRows = _ContractRows ' _RegistryRowsFinancialControlling_Template.Amount = 0 ' _RegistryRowsFinancialControlling_Template.Controlling = _RegistryRowsFinancialControlling_Template.Controlling ' _RegistryRowsFinancialControlling_Template.CostHolder = _RegistryRowsFinancialControlling_Template.CostHolder ' _RegistryRowsFinancialControlling_Template.CostPlace = _RegistryRowsFinancialControlling_Template.CostPlace ' _RegistryRowsFinancialControlling_Template.Note = _RegistryRowsFinancialControlling_Template.Note ' _RegistryRowsFinancialControlling_Template.JobNumberObjects = _RegistryRowsFinancialControlling_Template.JobNumberObjects ' _RegistryRowsFinancialControlling_Template.UniqueObjects = _RegistryRowsFinancialControlling_Template.UniqueObjects ' If _RegistryTasks.row_RRFC_IsReInvoice = True Then ' _RegistryRowsFinancialControlling_Template.IsReInvoice = _RegistryRowsFinancialControlling_Template.IsReInvoice ' _RegistryRowsFinancialControlling_Template.ReInvoice_Customers = _RegistryRowsFinancialControlling_Template.ReInvoice_Customers ' _RegistryRowsFinancialControlling_Template.ReInvoiceMode = _RegistryRowsFinancialControlling_Template.ReInvoiceMode ' _RegistryRowsFinancialControlling_Template.ReInvoiceReason = _RegistryRowsFinancialControlling_Template.ReInvoiceReason ' End If ' _ocur.CommitChanges() ' Next ' End If ' Case eRRFCT_Type.eReal ' End Select '_ocur.CommitChanges() End Sub Private Sub aRegistryEmailToResponsible_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aRegistryEmailToResponsible.Execute Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _User As User = TryCast(SecuritySystem.CurrentUser, User) Dim _HRPerson As HRPerson = _ocur.FindObject(Of HRPerson)(CriteriaOperator.Parse("User.Oid=?", _User.Oid)) Dim _HRResponsible As HRPerson Dim _Body As String Dim _Subject As String If View.SelectedObjects.Count <= 0 Then Exit Sub If TryCast(View.SelectedObjects(0), RegistryHeader) IsNot Nothing Then '// Ha RegistryHeader az objektum Dim _RegistryHeader As RegistryHeader For Each _RegistryHeader In View.SelectedObjects _HRResponsible = _RegistryHeader.HRResponsible _Subject = "Nuvolar tájékoztatás" _Body = "Cég : " & _RegistryHeader.CustomersFrom.FullName _Body += vbNewLine & "Partner : " & _RegistryHeader.Customers.FullName _Body += vbNewLine & "Iktatás tipusa : " & _RegistryHeader.RegistryType.ShortName _Body += vbNewLine & "Iktatószám : " & _RegistryHeader.RegistryNumber _Body += vbNewLine & vbNewLine & "Téma : " & _RegistryHeader.ShortName SendSMTPMail(_ocur, _HRPerson, _HRResponsible.Email, _Subject, _Body) Next End If If TryCast(View.SelectedObjects(0), RegistryTasks) IsNot Nothing Then '// Ha RegistryTask az objektum Dim _RegistryTasks As RegistryTasks For Each _RegistryTasks In View.SelectedObjects _HRResponsible = _RegistryTasks.RegistryHeader.HRResponsible _Subject = "Nuvolar tájékoztatás" _Body = "Cég : " & _RegistryTasks.RegistryHeader.CustomersFrom.FullName _Body += vbNewLine & "Partner : " & _RegistryTasks.RegistryHeader.Customers.FullName _Body += vbNewLine & "Iktatás tipusa : " & _RegistryTasks.RegistryHeader.RegistryType.ShortName _Body += vbNewLine & "Iktatószám : " & _RegistryTasks.RegistryHeader.RegistryNumber _Body += vbNewLine & vbNewLine & "Téma : " & _RegistryTasks.RegistryHeader.ShortName SendSMTPMail(_ocur, _HRPerson, _HRResponsible.Email, _Subject, _Body) Next End If End Sub Private Sub aPaymentCertificates_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aPaymentCertificates.CustomizePopupWindowParams Try Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace Dim _RegistryTasks As RegistryTasks = _onew.GetObjectByKey(Of RegistryTasks)(TryCast(View.SelectedObjects(0), RegistryTasks).Oid) Dim _DeliveryNoteInRows_CollectionSource As CollectionSource = New CollectionSource(_onew, GetType(DeliveryNoteInRows)) _DeliveryNoteInRows_CollectionSource.BeginUpdateCriteria() _DeliveryNoteInRows_CollectionSource.Criteria.Add("1", CriteriaOperator.Parse("DeliveryNoteInHeader.Customers.Oid=? AND DeliveryNoteInHeader.CurrencyName.Oid=?", _RegistryTasks.Customers.Oid, _RegistryTasks.RegistryHeader.F_CurrencyName.Oid)) _DeliveryNoteInRows_CollectionSource.EndUpdateCriteria() For Each _DeliveryNoteInRows As DeliveryNoteInRows In _DeliveryNoteInRows_CollectionSource.Collection _DeliveryNoteInRows.QTT_Process = 0 '_DeliveryNoteInRows.QTT - _DeliveryNoteInRows.QTT_Controlled If _RegistryTasks.RegistryHeader.F_CurrencyName.ShortName = "HUF" Then _DeliveryNoteInRows.controlled_ListPrice = _DeliveryNoteInRows.ListPriceHUF If _DeliveryNoteInRows.ListPriceHUF <> 0 Then _DeliveryNoteInRows.controlled_DiscountPercent = (_DeliveryNoteInRows.DiscountPriceHUF / _DeliveryNoteInRows.ListPriceHUF) * 100 Else _DeliveryNoteInRows.controlled_ListPrice = _DeliveryNoteInRows.ListPriceDEV If _DeliveryNoteInRows.ListPriceDEV <> 0 Then _DeliveryNoteInRows.controlled_DiscountPercent = (_DeliveryNoteInRows.DiscountPriceDEV / _DeliveryNoteInRows.ListPriceDEV) * 100 End If Next If _RegistryTasks.RegistryHeader.F_CurrencyName.ShortName = "HUF" Then e.View = Application.CreateListView("DeliveryNoteInRows_ListView_Certificate_HUF", _DeliveryNoteInRows_CollectionSource, False) Else e.View = Application.CreateListView("DeliveryNoteInRows_ListView_Certificate_DEV", _DeliveryNoteInRows_CollectionSource, False) End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain"))) End Try End Sub Private Sub aPaymentCertificates_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aPaymentCertificates.Execute '// Szállítólevél pontozása számlaigazoláshoz ! Try Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace Dim _RegistryTasks As RegistryTasks = TryCast(View.SelectedObjects(0), RegistryTasks) If _RegistryTasks.row_RRFC_Controlling Is Nothing Then Throw New Exception("*Nincs beállítva kontrolszám!") Frame.GetController(Of DevExpress.ExpressApp.Validation.PersistenceValidationController)()?.Active.SetItemValue("", False) Dim _TechnicalContractTemplate As ContractTemplate = _onew.FindObject(Of ContractTemplate)(CriteriaOperator.Parse("CustomersFrom=? And IsTechnical=True", _onew.GetObject(_RegistryTasks.RegistryHeader.CustomersFrom))) Dim _TechnicalLimitAmount As Double = _RegistryTasks.row_RRFC_Controlling.TechnicalContractLimit If _TechnicalLimitAmount = 0 Then _TechnicalLimitAmount = 200000 Dim _Contracts As Contracts = _onew.FindObject(Of Contracts)(CriteriaOperator.Parse("CustomersFrom=? AND Customers=? AND ContractTemplate=?", _onew.GetObject(_RegistryTasks.RegistryHeader.CustomersFrom), _ _onew.GetObject(_RegistryTasks.RegistryHeader.Customers), _TechnicalContractTemplate)) If _Contracts Is Nothing Then _Contracts = _onew.CreateObject(Of Contracts)() With _Contracts .CustomersFrom = _onew.GetObject(_RegistryTasks.RegistryHeader.CustomersFrom) .Customers = _onew.GetObject(_RegistryTasks.RegistryHeader.Customers) .ContractTemplate = _TechnicalContractTemplate .DateCreated = _onew.GetObject(_RegistryTasks.RegistryHeader.F_DateCreated) .DateExecution = _onew.GetObject(_RegistryTasks.RegistryHeader.F_DateExecution) .DocumentNumber = _Contracts.ContractTemplate.NumberGenerator.GetNewNumber(_Contracts.ContractTemplate.NumberGenerator) .State = State.Signed End With End If RaiseEvent InitWork(1, 1, e.PopupWindow.View.SelectedObjects.Count) For Each _DeliveryNoteInRows As DeliveryNoteInRows In TryCast(e.PopupWindow.View, ListView).CollectionSource.Collection RaiseEvent DoWork() If _DeliveryNoteInRows.QTT_Process > 0 And _DeliveryNoteInRows.QTT_Process <= _DeliveryNoteInRows.QTT Then Dim _ContractRows As New ContractRows(_onew.Session) With _ContractRows .Contracts = _Contracts .CurrencyName = _onew.GetObject(_RegistryTasks.RegistryHeader.F_CurrencyName) .ContractRowsType = eContractRowsType.eFix .DateExecution = _RegistryTasks.RegistryHeader.F_DateExecution .Controlling = _onew.GetObject(_RegistryTasks.row_RRFC_Controlling) If _RegistryTasks.RegistryHeader.F_CurrencyName.ShortName = "HUF" Then .NettoPriceHUF = _DeliveryNoteInRows.controlled_SumPrice Else If _RegistryTasks.RegistryHeader.F_CurrencyRate <> 0 Then .NettoPriceDEV = _DeliveryNoteInRows.controlled_SumPrice Else .NettoPriceDEV = 0 End If .NettoPriceHUF = _DeliveryNoteInRows.controlled_SumPrice * _RegistryTasks.RegistryHeader.F_CurrencyRate End If .ShortName = _DeliveryNoteInRows.Products.ShortName .VAT = _onew.GetObject(_DeliveryNoteInRows.VAT) .UniqueObjects = _onew.GetObject(_RegistryTasks.row_RRFC_UniqueObjects) .CostHolder = _onew.GetObject(_RegistryTasks.row_RRFC_CostHolder) .CostPlace = _onew.GetObject(_RegistryTasks.row_RRFC_CostPlace) .Controlling = _onew.GetObject(_RegistryTasks.row_RRFC_Controlling) .JobNumberObjects = _onew.GetObject(_RegistryTasks.row_RRFC_JobNumberObjects) End With Dim _RegistryRowsFinancialControlling As New RegistryRowsFinancialControlling(_onew.Session) With _RegistryRowsFinancialControlling .RegistryHeader = _onew.GetObject(_RegistryTasks.RegistryHeader) .ContractRows = _ContractRows .Amount = .ContractRows.NettoPriceHUF .Controlling = _onew.GetObject(_RegistryTasks.row_RRFC_Controlling) .CostHolder = _onew.GetObject(_RegistryTasks.row_RRFC_CostHolder) .CostPlace = _onew.GetObject(_RegistryTasks.row_RRFC_CostPlace) .Note = _RegistryTasks.row_RRFC_Note .JobNumberObjects = _onew.GetObject(_RegistryTasks.row_RRFC_JobNumberObjects) .UniqueObjects = _onew.GetObject(_RegistryTasks.row_RRFC_UniqueObjects) If _RegistryTasks.row_RRFC_IsReInvoice = True Then .IsReInvoice = _RegistryTasks.row_RRFC_IsReInvoice .ReInvoice_Customers = _onew.GetObject(_RegistryTasks.row_RRFC_ReInvoice_Customers) .ReInvoiceMode = _RegistryTasks.row_RRFC_ReInvoiceMode .ReInvoiceReason = _RegistryTasks.row_RRFC_ReInvoiceReason End If End With _ContractRows.RegistryRowsFinancialControlling = _RegistryRowsFinancialControlling Dim _DeliveryNoteInRRFC As New DeliveryNoteInRRFC(_onew.Session) With (_DeliveryNoteInRRFC) .DeliveryNoteInRows = _onew.GetObjectByKey(Of DeliveryNoteInRows)(_DeliveryNoteInRows.Oid) .RegistryRowsFinancialControlling = _RegistryRowsFinancialControlling .QTT_Controlled = _DeliveryNoteInRows.QTT_Process End With End If Next _onew.CommitChanges() RaiseEvent FinalWork Frame.GetController(Of DevExpress.ExpressApp.Validation.PersistenceValidationController)()?.Active.SetItemValue("", True) '// ObjectSpace frissítése ... If Frame.GetController(Of RefreshController)() IsNot Nothing Then If Frame.GetController(Of RefreshController).RefreshAction IsNot Nothing Then If Frame.GetController(Of RefreshController).RefreshAction.Enabled Then Frame.GetController(Of RefreshController).RefreshAction.DoExecute() End If End If End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain"))) End Try End Sub End Class