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.Xpo Imports DevExpress.Data.Filtering Imports DevExpress.ExpressApp.SystemModule Imports DevExpress.ExpressApp.CloneObject Imports System.Linq Imports System.Linq.Expressions Public Class ChartOfAccountsVC 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() If View.Id = "ChartOfAccountsYear_ListView" Then Frame.GetController(Of NewObjectViewController)?.Active.SetItemValue("", False) Frame.GetController(Of CloneObjectViewController)?.Active.SetItemValue("", False) Frame.GetController(Of DeleteObjectsViewController)?.Active.SetItemValue("", False) End If If View.Id = "ChartOfAccountsYear_DetailView" Then Frame.GetController(Of NewObjectViewController)?.Active.SetItemValue("", False) Frame.GetController(Of CloneObjectViewController)?.Active.SetItemValue("", False) Frame.GetController(Of DeleteObjectsViewController)?.Active.SetItemValue("", False) End If If View.Id = "ChartOfAccountsYear_ChartOfAccounts_ListView" Then Frame.GetController(Of LinkUnlinkController)?.Active.SetItemValue("", False) Frame.GetController(Of CloneObjectViewController)?.Active.SetItemValue("", False) AddHandler Frame.GetController(Of DeleteObjectsViewController).DeleteAction.Executing, AddressOf ChartOfAccountsYear_ChartOfAccounts_ListView_DeleteAction_Executing End If End Sub Protected Overrides Sub OnDeactivated() MyBase.OnDeactivated() If View.Id = "ChartOfAccountsYear_ChartOfAccounts_ListView" Then Frame.GetController(Of LinkUnlinkController)?.Active.SetItemValue("", True) Frame.GetController(Of CloneObjectViewController)?.Active.SetItemValue("", True) End If End Sub Private Sub aReCreateChartOfAccounts_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aReCreateChartOfAccounts.Execute Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _uow As New UnitOfWork(_ocur.Session.DataLayer) Dim _ChartOfAccounts_Collection As New XPCollection(Of ChartOfAccounts)(_uow) Dim _ChartOfAccounts As ChartOfAccounts Dim _AccountNumber As String = "" Dim _AccountNumber_Parent As String = "" RaiseEvent InitWork(1, 1, _ChartOfAccounts_Collection.Count) For Each _ChartOfAccounts In _ChartOfAccounts_Collection RaiseEvent DoWork() RecursiveSetParent(_uow, _ChartOfAccounts.AccountYear, _ChartOfAccounts.AccountNumber, _ChartOfAccounts) _ChartOfAccounts.ChartOfAccounts1 = _uow.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", Mid(_ChartOfAccounts.AccountNumber, 1, 1), _ChartOfAccounts.AccountYear)) _ChartOfAccounts.ChartOfAccounts2 = _uow.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", Mid(_ChartOfAccounts.AccountNumber, 1, 2), _ChartOfAccounts.AccountYear)) _ChartOfAccounts.ChartOfAccounts3 = _uow.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", Mid(_ChartOfAccounts.AccountNumber, 1, 3), _ChartOfAccounts.AccountYear)) _ChartOfAccounts.ChartOfAccounts4 = _uow.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", Mid(_ChartOfAccounts.AccountNumber, 1, 4), _ChartOfAccounts.AccountYear)) _ChartOfAccounts.ChartOfAccounts5 = _uow.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", Mid(_ChartOfAccounts.AccountNumber, 1, 5), _ChartOfAccounts.AccountYear)) _ChartOfAccounts.ChartOfAccounts6 = _uow.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", Mid(_ChartOfAccounts.AccountNumber, 1, 6), _ChartOfAccounts.AccountYear)) _ChartOfAccounts.ChartOfAccounts7 = _uow.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", Mid(_ChartOfAccounts.AccountNumber, 1, 7), _ChartOfAccounts.AccountYear)) _ChartOfAccounts.ChartOfAccounts8 = _uow.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", Mid(_ChartOfAccounts.AccountNumber, 1, 8), _ChartOfAccounts.AccountYear)) Next _uow.CommitChanges() RaiseEvent FinalWork End Sub Sub RecursiveSetParent(_uow As UnitOfWork, _Year As Long, _AccountNumber As String, _ChartOfAccount_Set As ChartOfAccounts) Dim _AccountNumber_Parent As String = LTrim(RTrim(Mid(_AccountNumber, 1, Len(_AccountNumber) - 1))) Dim _ChartOfAccounts_Parent As ChartOfAccounts If _AccountNumber_Parent = "" Then Else _ChartOfAccounts_Parent = _uow.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountYear=? and AccountNumber=?", _Year, _AccountNumber_Parent)) If _ChartOfAccounts_Parent Is Nothing Then RecursiveSetParent(_uow, _Year, _AccountNumber_Parent, _ChartOfAccount_Set) Else _ChartOfAccount_Set.Parent = _ChartOfAccounts_Parent _uow.CommitChanges() End If End If End Sub Private Sub aCreateChartOfAccountsYear_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCreateChartOfAccountsYear.Execute Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _ChartOfAccountsYear As ChartOfAccountsYear Dim _ChartOfAccounts_New As ChartOfAccounts Dim _CurrentYear As Long = GetSQLTime(_ocur.Session).Year Dim _PrevYear As Long = GetSQLTime(_ocur.Session).Year - 1 Dim _FirstDayOfYear = GeneralFunction.FirstDayOfYear(GetSQLTime(_ocur.Session)) Dim _LastDayOfYear = GeneralFunction.LastDayOfYear(GetSQLTime(_ocur.Session)) _ChartOfAccountsYear = _ocur.FindObject(Of ChartOfAccountsYear)(CriteriaOperator.Parse("AccountYear=?", GetSQLTime(_ocur.Session).Year)) If _ChartOfAccountsYear Is Nothing Then _ChartOfAccountsYear = _ocur.CreateObject(Of ChartOfAccountsYear)() _ChartOfAccountsYear.AccountYear = GetSQLTime(_ocur.Session).Year Dim _ChartOfAccounts_Collection As New XPCollection(Of ChartOfAccounts)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _ChartOfAccounts As ChartOfAccounts RaiseEvent InitWork(1, 1, _ChartOfAccounts_Collection.Count) For Each _ChartOfAccounts In _ChartOfAccounts_Collection RaiseEvent DoWork() _ChartOfAccounts_New = _ocur.CreateObject(Of ChartOfAccounts)() _ChartOfAccounts_New.Name = _ChartOfAccounts.Name _ChartOfAccounts_New.Parent = Nothing _ChartOfAccounts_New.AccountNumber = _ChartOfAccounts.AccountNumber _ChartOfAccounts_New.AccountYear = _ChartOfAccountsYear.AccountYear _ocur.CommitChanges() Next _ocur.CommitChanges() RaiseEvent FinalWork _ChartOfAccounts_Collection = New XPCollection(Of ChartOfAccounts)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) RaiseEvent InitWork(1, 1, _ChartOfAccounts_Collection.Count) For Each _ChartOfAccounts In _ChartOfAccounts_Collection RaiseEvent DoWork() Me.RecursiveSetParent(_ocur.Session, _CurrentYear, _ChartOfAccounts.AccountNumber, _ChartOfAccounts) _ocur.CommitChanges() Next _ocur.CommitChanges() RaiseEvent FinalWork End If '// VAT -> ÁFA megnyitása, paraméterek átmásolása Dim _VATYear_Collection_CurrentYear As New XPCollection(Of VATYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) Dim _VATYear_Collection_PrevYear As New XPCollection(Of VATYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _VATYear_PrevYear As VATYear Dim _VATYear_CurrentYear As VATYear If _VATYear_Collection_CurrentYear.Count <= 0 Then RaiseEvent InitWork(1, 1, _VATYear_Collection_PrevYear.Count) For Each _VATYear_PrevYear In _VATYear_Collection_PrevYear RaiseEvent DoWork() _VATYear_CurrentYear = _ocur.FindObject(Of VATYear)(CriteriaOperator.Parse("AccountYear=? and VAT=?", _CurrentYear, _VATYear_PrevYear.VAT)) If _VATYear_CurrentYear Is Nothing Then _VATYear_CurrentYear = _ocur.CreateObject(Of VATYear)() _VATYear_CurrentYear.VAT = _VATYear_PrevYear.VAT _VATYear_CurrentYear.AccountYear = _CurrentYear If _VATYear_PrevYear.ChartOfAccountsIn IsNot Nothing Then _VATYear_CurrentYear.ChartOfAccountsIn = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _VATYear_PrevYear.ChartOfAccountsIn.AccountNumber, _CurrentYear)) End If If _VATYear_PrevYear.ChartOfAccountsOut IsNot Nothing Then _VATYear_CurrentYear.ChartOfAccountsOut = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _VATYear_PrevYear.ChartOfAccountsOut.AccountNumber, _CurrentYear)) End If End If Next _ocur.CommitChanges() RaiseEvent FinalWork End If '// Controlling -> Kontrollszámok megnyitása, paraméterek átmásolása Dim _ControllingYear_Collection_CurrentYear As New XPCollection(Of ControllingYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) Dim _ControllingYear_Collection_PrevYear As New XPCollection(Of ControllingYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _ControllingYear_PrevYear As ControllingYear Dim _ControllingYear_CurrentYear As ControllingYear If _ControllingYear_Collection_CurrentYear.Count <= 0 Then RaiseEvent InitWork(1, 1, _ControllingYear_Collection_PrevYear.Count) For Each _ControllingYear_PrevYear In _ControllingYear_Collection_PrevYear RaiseEvent DoWork() _ControllingYear_CurrentYear = _ocur.FindObject(Of ControllingYear)(CriteriaOperator.Parse("AccountYear=? and Controlling=?", _CurrentYear, _ControllingYear_PrevYear.Controlling)) If _ControllingYear_CurrentYear Is Nothing Then _ControllingYear_CurrentYear = _ocur.CreateObject(Of ControllingYear)() _ControllingYear_CurrentYear.Controlling = _ControllingYear_PrevYear.Controlling _ControllingYear_CurrentYear.AccountYear = _CurrentYear If _ControllingYear_PrevYear.ChartOfAccounts IsNot Nothing Then _ControllingYear_CurrentYear.ChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts) _ (CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _ControllingYear_PrevYear.ChartOfAccounts.AccountNumber, _CurrentYear)) End If If _ControllingYear_PrevYear.ChartOfAccounts2 IsNot Nothing Then _ControllingYear_CurrentYear.ChartOfAccounts2 = _ocur.FindObject(Of ChartOfAccounts) _ (CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _ControllingYear_PrevYear.ChartOfAccounts2.AccountNumber, _CurrentYear)) End If End If Next _ocur.CommitChanges() RaiseEvent FinalWork End If '// CustomersGLParameters -> Ügyfél főkönyvi kategória megnyitása Dim _CustomersGLParametersYear_Collection_CurrentYear As New XPCollection(Of CustomersGLParametersYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) Dim _CustomersGLParametersYear_Collection_PrevYear As New XPCollection(Of CustomersGLParametersYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _CustomersGLParametersYear_PrevYear As CustomersGLParametersYear Dim _CustomersGLParametersYear_CurrentYear As CustomersGLParametersYear If _CustomersGLParametersYear_Collection_CurrentYear.Count <= 0 Then RaiseEvent InitWork(1, 1, _CustomersGLParametersYear_Collection_PrevYear.Count) For Each _CustomersGLParametersYear_PrevYear In _CustomersGLParametersYear_Collection_PrevYear RaiseEvent DoWork() _CustomersGLParametersYear_CurrentYear = _ocur.FindObject(Of CustomersGLParametersYear)(CriteriaOperator.Parse("AccountYear=? and CustomersGLParameters=?", _CurrentYear, _CustomersGLParametersYear_PrevYear.CustomersGLParameters)) If _CustomersGLParametersYear_CurrentYear Is Nothing Then _CustomersGLParametersYear_CurrentYear = _ocur.CreateObject(Of CustomersGLParametersYear)() _CustomersGLParametersYear_CurrentYear.CustomersGLParameters = _CustomersGLParametersYear_PrevYear.CustomersGLParameters _CustomersGLParametersYear_CurrentYear.AccountYear = _CurrentYear If _CustomersGLParametersYear_PrevYear.ChartOfAccountsIn IsNot Nothing Then _CustomersGLParametersYear_CurrentYear.ChartOfAccountsIn = _ocur.FindObject(Of ChartOfAccounts) _ (CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _ _CustomersGLParametersYear_PrevYear.ChartOfAccountsIn.AccountNumber, _CurrentYear)) End If If _CustomersGLParametersYear_PrevYear.ChartOfAccountsOut IsNot Nothing Then _CustomersGLParametersYear_CurrentYear.ChartOfAccountsOut = _ocur.FindObject(Of ChartOfAccounts) _ (CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _ _CustomersGLParametersYear_PrevYear.ChartOfAccountsOut.AccountNumber, _CurrentYear)) End If If _CustomersGLParametersYear_PrevYear.ChartOfAccountsNo IsNot Nothing Then _CustomersGLParametersYear_CurrentYear.ChartOfAccountsNo = _ocur.FindObject(Of ChartOfAccounts) _ (CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _ _CustomersGLParametersYear_PrevYear.ChartOfAccountsNo.AccountNumber, _CurrentYear)) End If End If Next _ocur.CommitChanges() RaiseEvent FinalWork End If '// GLHeader_RateDiffParameter -> Árfolyamelszámolás, kerekítés Dim _GLHeader_RateDiffParameterYear_Collection_CurrentYear As New XPCollection(Of GLHeader_RateDiffParameterYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) Dim _GLHeader_RateDiffParameterYear_Collection_PrevYear As New XPCollection(Of GLHeader_RateDiffParameterYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _GLHeader_RateDiffParameterYear_PrevYear As GLHeader_RateDiffParameterYear Dim _GLHeader_RateDiffParameterYear_CurrentYear As GLHeader_RateDiffParameterYear If _GLHeader_RateDiffParameterYear_Collection_CurrentYear.Count <= 0 Then RaiseEvent InitWork(1, 1, _GLHeader_RateDiffParameterYear_Collection_PrevYear.Count) For Each _GLHeader_RateDiffParameterYear_PrevYear In _GLHeader_RateDiffParameterYear_Collection_PrevYear RaiseEvent DoWork() _GLHeader_RateDiffParameterYear_CurrentYear = _ocur.FindObject(Of GLHeader_RateDiffParameterYear)(CriteriaOperator.Parse("AccountYear=? and GLHeader_RateDiffParameter=?", _CurrentYear, _GLHeader_RateDiffParameterYear_PrevYear.GLHeader_RateDiffParameter)) If _GLHeader_RateDiffParameterYear_CurrentYear Is Nothing Then _GLHeader_RateDiffParameterYear_CurrentYear = _ocur.CreateObject(Of GLHeader_RateDiffParameterYear)() _GLHeader_RateDiffParameterYear_CurrentYear.GLHeader_RateDiffParameter = _GLHeader_RateDiffParameterYear_PrevYear.GLHeader_RateDiffParameter _GLHeader_RateDiffParameterYear_CurrentYear.AccountYear = _CurrentYear _GLHeader_RateDiffParameterYear_CurrentYear.ChartOfAccounts_RateDiff_Loss = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _GLHeader_RateDiffParameterYear_PrevYear.ChartOfAccounts_RateDiff_Loss.AccountNumber, _CurrentYear)) _GLHeader_RateDiffParameterYear_CurrentYear.ChartOfAccounts_RateDiff_Win = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _GLHeader_RateDiffParameterYear_PrevYear.ChartOfAccounts_RateDiff_Win.AccountNumber, _CurrentYear)) If _GLHeader_RateDiffParameterYear_PrevYear.ChartOfAccounts_Rounding_Loss IsNot Nothing Then _GLHeader_RateDiffParameterYear_CurrentYear.ChartOfAccounts_Rounding_Loss = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _GLHeader_RateDiffParameterYear_PrevYear.ChartOfAccounts_Rounding_Loss.AccountNumber, _CurrentYear)) End If If _GLHeader_RateDiffParameterYear_PrevYear.ChartOfAccounts_Rounding_Win IsNot Nothing Then _GLHeader_RateDiffParameterYear_CurrentYear.ChartOfAccounts_Rounding_Win = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _GLHeader_RateDiffParameterYear_PrevYear.ChartOfAccounts_Rounding_Win.AccountNumber, _CurrentYear)) End If End If Next _ocur.CommitChanges() RaiseEvent FinalWork End If '// LiquidAssets -> Pénzeszközök megnyitása Dim _LiquidAssetsYear_Collection_CurrentYear As New XPCollection(Of LiquidAssetsYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) Dim _LiquidAssetsYear_Collection_PrevYear As New XPCollection(Of LiquidAssetsYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _LiquidAssetsYear_PrevYear As LiquidAssetsYear Dim _LiquidAssetsYear_CurrentYear As LiquidAssetsYear If _LiquidAssetsYear_Collection_CurrentYear.Count <= 0 Then RaiseEvent InitWork(1, 1, _LiquidAssetsYear_Collection_PrevYear.Count) For Each _LiquidAssetsYear_PrevYear In _LiquidAssetsYear_Collection_PrevYear RaiseEvent DoWork() _LiquidAssetsYear_CurrentYear = _ocur.FindObject(Of LiquidAssetsYear)(CriteriaOperator.Parse("AccountYear=? and LiquidAssets=?", _CurrentYear, _LiquidAssetsYear_PrevYear.LiquidAssets)) If _LiquidAssetsYear_CurrentYear Is Nothing Then _LiquidAssetsYear_CurrentYear = _ocur.CreateObject(Of LiquidAssetsYear)() _LiquidAssetsYear_CurrentYear.LiquidAssets = _LiquidAssetsYear_PrevYear.LiquidAssets _LiquidAssetsYear_CurrentYear.AccountYear = _CurrentYear If _LiquidAssetsYear_PrevYear.ChartOfAccounts IsNot Nothing Then _LiquidAssetsYear_CurrentYear.ChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _LiquidAssetsYear_PrevYear.ChartOfAccounts.AccountNumber, _CurrentYear)) End If If _LiquidAssetsYear_PrevYear.ChartOfAccountsPlus IsNot Nothing Then _LiquidAssetsYear_CurrentYear.ChartOfAccountsPlus = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _LiquidAssetsYear_PrevYear.ChartOfAccountsPlus.AccountNumber, _CurrentYear)) End If If _LiquidAssetsYear_PrevYear.ChartOfAccountsMinus IsNot Nothing Then _LiquidAssetsYear_CurrentYear.ChartOfAccountsMinus = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _LiquidAssetsYear_PrevYear.ChartOfAccountsMinus.AccountNumber, _CurrentYear)) End If End If Next _ocur.CommitChanges() RaiseEvent FinalWork End If '// Tárgyiesköz paraméterek beállítása '// LiquidAssets -> Pénzeszközök megnyitása Dim _FixedAssetsGLParametersYear_Collection_CurrentYear As New XPCollection(Of FixedAssetsGLParametersYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) Dim _FixedAssetsGLParametersYear_Collection_PrevYear As New XPCollection(Of FixedAssetsGLParametersYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _FixedAssetsGLParametersYear_PrevYear As FixedAssetsGLParametersYear Dim _FixedAssetsGLParametersYear_CurrentYear As FixedAssetsGLParametersYear If _FixedAssetsGLParametersYear_Collection_CurrentYear.Count <= 0 Then RaiseEvent InitWork(1, 1, _FixedAssetsGLParametersYear_Collection_PrevYear.Count) For Each _FixedAssetsGLParametersYear_PrevYear In _FixedAssetsGLParametersYear_Collection_PrevYear RaiseEvent DoWork() _FixedAssetsGLParametersYear_CurrentYear = _ocur.FindObject(Of FixedAssetsGLParametersYear)(CriteriaOperator.Parse("AccountYear=? and FixedAssetsGLParameters=?", _CurrentYear, _FixedAssetsGLParametersYear_PrevYear.FixedAssetsGLParameters)) If _FixedAssetsGLParametersYear_CurrentYear Is Nothing Then _FixedAssetsGLParametersYear_CurrentYear = _ocur.CreateObject(Of FixedAssetsGLParametersYear)() _FixedAssetsGLParametersYear_CurrentYear.FixedAssetsGLParameters = _FixedAssetsGLParametersYear_PrevYear.FixedAssetsGLParameters _FixedAssetsGLParametersYear_CurrentYear.AccountYear = _CurrentYear If _FixedAssetsGLParametersYear_PrevYear.CreditChartOfAccounts IsNot Nothing Then _FixedAssetsGLParametersYear_CurrentYear.CreditChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _FixedAssetsGLParametersYear_PrevYear.CreditChartOfAccounts.AccountNumber, _CurrentYear)) End If If _FixedAssetsGLParametersYear_PrevYear.DebitChartOfAccounts IsNot Nothing Then _FixedAssetsGLParametersYear_CurrentYear.DebitChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _FixedAssetsGLParametersYear_PrevYear.DebitChartOfAccounts.AccountNumber, _CurrentYear)) End If End If Next _ocur.CommitChanges() RaiseEvent FinalWork End If '//GLRows-ban átkönyvelni a tételeket az új év főkönyvi számláira Dim _GLRows_Collection As New XPCollection(Of GLRows)(_ocur.Session, CriteriaOperator.Parse("DebitChartOfAccounts.AccountYear<>? and GetDate(GLHeader.DateExecution) between (?,?)", _CurrentYear, _FirstDayOfYear.Date, _LastDayOfYear.Date)) Dim _GLRows As GLRows RaiseEvent InitWork(1, 1, _GLRows_Collection.Count) Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", False) For Each _GLRows In _GLRows_Collection RaiseEvent DoWork() If _GLRows.DebitChartOfAccounts IsNot Nothing Then Dim _ChartOfAccounts As ChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountYear=? and AccountNumber=?", _CurrentYear, _GLRows.DebitChartOfAccounts.AccountNumber)) If _ChartOfAccounts IsNot Nothing Then _GLRows.DebitChartOfAccounts = _ChartOfAccounts End If End If Next _ocur.CommitChanges() Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", True) RaiseEvent FinalWork _GLRows_Collection = New XPCollection(Of GLRows)(_ocur.Session, CriteriaOperator.Parse("CreditChartOfAccounts.AccountYear<>? and GetDate(GLHeader.DateExecution) between (?,?)", _CurrentYear, _FirstDayOfYear.Date, _LastDayOfYear.Date)) RaiseEvent InitWork(1, 1, _GLRows_Collection.Count) Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", False) For Each _GLRows In _GLRows_Collection RaiseEvent DoWork() If _GLRows.DebitChartOfAccounts IsNot Nothing Then Dim _ChartOfAccounts As ChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountYear=? and AccountNumber=?", _CurrentYear, _GLRows.CreditChartOfAccounts.AccountNumber)) If _ChartOfAccounts IsNot Nothing Then _GLRows.CreditChartOfAccounts = _ChartOfAccounts End If End If Next _ocur.CommitChanges() Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", True) RaiseEvent FinalWork End Sub Private Sub aReCreateChartOfAccountsParent_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aReCreateChartOfAccountsParent.Execute Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _uow As New UnitOfWork(_ocur.Session.DataLayer) Dim _ChartOfAccounts As ChartOfAccounts For Each _ChartOfAccounts In View.SelectedObjects Me.RecursiveSetParent(_uow, _ChartOfAccounts.AccountYear, _ChartOfAccounts.AccountNumber, _uow.GetObjectByKey(Of ChartOfAccounts)(_ChartOfAccounts.Oid)) Next _uow.CommitChanges() _ocur.CommitChanges() End Sub Private Sub ChartOfAccountsYear_ChartOfAccounts_ListView_DeleteAction_Executing(sender As Object, e As CancelEventArgs) '// Fk. számlaszám törlése ! '// Nem lehet paraméter, és nem lehet könyvelve rá ! '// Paraméterek: '// LiquidAssetsYear '// CustomersGLParametersYear '// GLHeader_ratediffparametersYear '// ControllingYear '// VATYear '// Nem lehet szülő End Sub Private Sub aReCreateChartOfAccountsCount_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aReCreateChartOfAccountsCount.Execute Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _uow As New UnitOfWork(_ocur.Session.DataLayer) Dim _ChartOfAccounts As ChartOfAccounts Dim _ListView As ListView = TryCast(View, ListView) If _ListView IsNot Nothing Then If _ListView.SelectedObjects.Count > 0 Then RaiseEvent InitWork(1, 1, _ListView.SelectedObjects.Count) For Each _ChartOfAccounts In _ListView.SelectedObjects Dim _GLRows_xpquery As New XPQuery(Of GLRows)(_uow) Dim _Count = Aggregate _GLRows In _GLRows_xpquery Where _GLRows.GLHeader.IsEditable = False And (_GLRows.DebitChartOfAccounts.Oid = _ChartOfAccounts.Oid Or _GLRows.CreditChartOfAccounts.Oid = _ChartOfAccounts.Oid) Into Count() _ChartOfAccounts.RecordCount = _Count RaiseEvent DoWork() Next Else RaiseEvent InitWork(1, 1, _ListView.CollectionSource.List.Count) For Each _ChartOfAccounts In _ListView.CollectionSource.List Dim _GLRows_xpquery As New XPQuery(Of GLRows)(_uow) Dim _Count = Aggregate _GLRows In _GLRows_xpquery Where _GLRows.GLHeader.IsEditable = False And (_GLRows.DebitChartOfAccounts.Oid = _ChartOfAccounts.Oid Or _GLRows.CreditChartOfAccounts.Oid = _ChartOfAccounts.Oid) Into Count() _ChartOfAccounts.RecordCount = _Count RaiseEvent DoWork() Next End If End If _ocur.CommitChanges() RaiseEvent FinalWork View.Refresh() End Sub Private Sub aViewGLRowsfromChartOfAccounts_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aViewGLRowsfromChartOfAccounts.Execute Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(GLRows)) Dim _ChartOfAccounts As ChartOfAccounts = TryCast(View.SelectedObjects(0), ChartOfAccounts) Dim _Criteria As String = "(DebitChartOfAccounts.Oid=? or CreditChartOfAccounts.Oid=?) and GLHeader.IsEditable=False" If _ChartOfAccounts Is Nothing Then Exit Sub If LTrim(RTrim(_Criteria <> "")) Then _CS.BeginUpdateCriteria() _CS.Criteria("DetailFilter") = CriteriaOperator.Parse(_Criteria, _ChartOfAccounts.Oid, _ChartOfAccounts.Oid) _CS.EndUpdateCriteria() e.ShowViewParameters.CreatedView = Application.CreateListView("GLRows_ListView_All", _CS, True) End If End Sub Private Sub aCloseChartOfAccountsYear_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCloseChartOfAccountsYear.Execute Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _ChartOfAccountsYear As ChartOfAccountsYear = TryCast(View.SelectedObjects(0), ChartOfAccountsYear) If _ChartOfAccountsYear IsNot Nothing Then _ChartOfAccountsYear.IsClosed = True _ocur.CommitChanges() End If End Sub Private Sub aCloseChartOfAccountsYearBack_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCloseChartOfAccountsYearBack.Execute Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace) Dim _ChartOfAccountsYear As ChartOfAccountsYear = TryCast(View.SelectedObjects(0), ChartOfAccountsYear) If _ChartOfAccountsYear IsNot Nothing Then _ChartOfAccountsYear.IsClosed = False _ocur.CommitChanges() End If End Sub Private Sub aCreateCartOfAccountsYearAny_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aCreateCartOfAccountsYearAny.CustomizePopupWindowParams Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace Dim _ChartOfAccountsYearPopup As ChartOfAccountsYearPopup = _onew.CreateObject(Of ChartOfAccountsYearPopup)() e.View = Application.CreateDetailView(_onew, "ChartOfAccountsYearPopup_DetailView", False, _ChartOfAccountsYearPopup) End Sub Private Sub aCreateCartOfAccountsYearAny_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aCreateCartOfAccountsYearAny.Execute Try GLOBAL_HAS_Audit = False Dim _ocur As Xpo.XPObjectSpace = Application.CreateObjectSpace 'TryCast(View.ObjectSpace, Xpo.XPObjectSpace) 'Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace Dim i As Long = 0 Dim _ChartOfAccountsYear As ChartOfAccountsYear Dim _ChartOfAccounts_New As ChartOfAccounts Dim _CurrentYear As Long = TryCast(e.PopupWindow.View.SelectedObjects(0), ChartOfAccountsYearPopup).AccountYear Dim _CurrentYearDate As Date = CDate(_CurrentYear.ToString & "/01/01") Dim _PrevYear As Long = TryCast(e.PopupWindow.View.SelectedObjects(0), ChartOfAccountsYearPopup).AccountYearPrev Dim _FirstDayOfYear = GeneralFunction.FirstDayOfYear(_CurrentYearDate) Dim _LastDayOfYear = GeneralFunction.LastDayOfYear(_CurrentYearDate) _ChartOfAccountsYear = _ocur.FindObject(Of ChartOfAccountsYear)(CriteriaOperator.Parse("AccountYear=?", _CurrentYearDate.Year)) If _ChartOfAccountsYear Is Nothing Then _ChartOfAccountsYear = _ocur.CreateObject(Of ChartOfAccountsYear)() _ChartOfAccountsYear.AccountYear = _CurrentYearDate.Year Dim _ChartOfAccounts_Collection As New XPCollection(Of ChartOfAccounts)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _ChartOfAccounts As ChartOfAccounts RaiseEvent InitWork(1, 1, _ChartOfAccounts_Collection.Count) For Each _ChartOfAccounts In _ChartOfAccounts_Collection RaiseEvent DoWork() _ChartOfAccounts_New = _ocur.CreateObject(Of ChartOfAccounts)() _ChartOfAccounts_New.Name = _ChartOfAccounts.Name _ChartOfAccounts_New.Parent = Nothing _ChartOfAccounts_New.AccountNumber = _ChartOfAccounts.AccountNumber _ChartOfAccounts_New.AccountYear = _ChartOfAccountsYear.AccountYear i += 1 If i Mod 50 = 0 Then _ocur.CommitChanges() '_ocur.CommitChanges() Next _ocur.CommitChanges() RaiseEvent FinalWork _ChartOfAccounts_Collection = New XPCollection(Of ChartOfAccounts)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) RaiseEvent InitWork(1, 1, _ChartOfAccounts_Collection.Count) i = 0 For Each _ChartOfAccounts In _ChartOfAccounts_Collection RaiseEvent DoWork() Me.RecursiveSetParent(_ocur.Session, _CurrentYear, _ChartOfAccounts.AccountNumber, _ChartOfAccounts) i += 1 If i Mod 50 = 0 Then _ocur.CommitChanges() Next _ocur.CommitChanges() RaiseEvent FinalWork End If '// VAT -> ÁFA megnyitása, paraméterek átmásolása Dim _VATYear_Collection_CurrentYear As New XPCollection(Of VATYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) Dim _VATYear_Collection_PrevYear As New XPCollection(Of VATYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _VATYear_PrevYear As VATYear Dim _VATYear_CurrentYear As VATYear If _VATYear_Collection_CurrentYear.Count <= 0 Then RaiseEvent InitWork(1, 1, _VATYear_Collection_PrevYear.Count) i = 0 For Each _VATYear_PrevYear In _VATYear_Collection_PrevYear RaiseEvent DoWork() _VATYear_CurrentYear = _ocur.FindObject(Of VATYear)(CriteriaOperator.Parse("AccountYear=? and VAT=?", _CurrentYear, _VATYear_PrevYear.VAT)) If _VATYear_CurrentYear Is Nothing Then _VATYear_CurrentYear = _ocur.CreateObject(Of VATYear)() _VATYear_CurrentYear.VAT = _VATYear_PrevYear.VAT _VATYear_CurrentYear.AccountYear = _CurrentYear If _VATYear_PrevYear.ChartOfAccountsIn IsNot Nothing Then _VATYear_CurrentYear.ChartOfAccountsIn = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _VATYear_PrevYear.ChartOfAccountsIn.AccountNumber, _CurrentYear)) End If If _VATYear_PrevYear.ChartOfAccountsOut IsNot Nothing Then _VATYear_CurrentYear.ChartOfAccountsOut = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _VATYear_PrevYear.ChartOfAccountsOut.AccountNumber, _CurrentYear)) End If End If Next _ocur.CommitChanges() RaiseEvent FinalWork End If '// Controlling -> Kontrollszámok megnyitása, paraméterek átmásolása Dim _ControllingYear_Collection_CurrentYear As New XPCollection(Of ControllingYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) Dim _ControllingYear_Collection_PrevYear As New XPCollection(Of ControllingYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _ControllingYear_PrevYear As ControllingYear Dim _ControllingYear_CurrentYear As ControllingYear If _ControllingYear_Collection_CurrentYear.Count <= 0 Then RaiseEvent InitWork(1, 1, _ControllingYear_Collection_PrevYear.Count) i = 0 For Each _ControllingYear_PrevYear In _ControllingYear_Collection_PrevYear RaiseEvent DoWork() _ControllingYear_CurrentYear = _ocur.FindObject(Of ControllingYear)(CriteriaOperator.Parse("AccountYear=? and Controlling=?", _CurrentYear, _ControllingYear_PrevYear.Controlling)) If _ControllingYear_CurrentYear Is Nothing Then _ControllingYear_CurrentYear = _ocur.CreateObject(Of ControllingYear)() _ControllingYear_CurrentYear.Controlling = _ControllingYear_PrevYear.Controlling _ControllingYear_CurrentYear.AccountYear = _CurrentYear If _ControllingYear_PrevYear.ChartOfAccounts IsNot Nothing Then _ControllingYear_CurrentYear.ChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts) _ (CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _ControllingYear_PrevYear.ChartOfAccounts.AccountNumber, _CurrentYear)) End If If _ControllingYear_PrevYear.ChartOfAccounts2 IsNot Nothing Then _ControllingYear_CurrentYear.ChartOfAccounts2 = _ocur.FindObject(Of ChartOfAccounts) _ (CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _ControllingYear_PrevYear.ChartOfAccounts2.AccountNumber, _CurrentYear)) End If End If i += 1 If i Mod 50 = 0 Then _ocur.CommitChanges() Next _ocur.CommitChanges() RaiseEvent FinalWork End If '// CustomersGLParameters -> Ügyfél főkönyvi kategória megnyitása Dim _CustomersGLParametersYear_Collection_CurrentYear As New XPCollection(Of CustomersGLParametersYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) Dim _CustomersGLParametersYear_Collection_PrevYear As New XPCollection(Of CustomersGLParametersYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _CustomersGLParametersYear_PrevYear As CustomersGLParametersYear Dim _CustomersGLParametersYear_CurrentYear As CustomersGLParametersYear If _CustomersGLParametersYear_Collection_CurrentYear.Count <= 0 Then RaiseEvent InitWork(1, 1, _CustomersGLParametersYear_Collection_PrevYear.Count) i = 0 For Each _CustomersGLParametersYear_PrevYear In _CustomersGLParametersYear_Collection_PrevYear RaiseEvent DoWork() _CustomersGLParametersYear_CurrentYear = _ocur.FindObject(Of CustomersGLParametersYear)(CriteriaOperator.Parse("AccountYear=? and CustomersGLParameters=?", _CurrentYear, _CustomersGLParametersYear_PrevYear.CustomersGLParameters)) If _CustomersGLParametersYear_CurrentYear Is Nothing Then _CustomersGLParametersYear_CurrentYear = _ocur.CreateObject(Of CustomersGLParametersYear)() _CustomersGLParametersYear_CurrentYear.CustomersGLParameters = _CustomersGLParametersYear_PrevYear.CustomersGLParameters _CustomersGLParametersYear_CurrentYear.AccountYear = _CurrentYear If _CustomersGLParametersYear_PrevYear.ChartOfAccountsIn IsNot Nothing Then _CustomersGLParametersYear_CurrentYear.ChartOfAccountsIn = _ocur.FindObject(Of ChartOfAccounts) _ (CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _ _CustomersGLParametersYear_PrevYear.ChartOfAccountsIn.AccountNumber, _CurrentYear)) End If If _CustomersGLParametersYear_PrevYear.ChartOfAccountsOut IsNot Nothing Then _CustomersGLParametersYear_CurrentYear.ChartOfAccountsOut = _ocur.FindObject(Of ChartOfAccounts) _ (CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _ _CustomersGLParametersYear_PrevYear.ChartOfAccountsOut.AccountNumber, _CurrentYear)) End If If _CustomersGLParametersYear_PrevYear.ChartOfAccountsNo IsNot Nothing Then _CustomersGLParametersYear_CurrentYear.ChartOfAccountsNo = _ocur.FindObject(Of ChartOfAccounts) _ (CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _ _CustomersGLParametersYear_PrevYear.ChartOfAccountsNo.AccountNumber, _CurrentYear)) End If End If i += 1 If i Mod 50 = 0 Then _ocur.CommitChanges() Next _ocur.CommitChanges() RaiseEvent FinalWork End If '// GLHeader_RateDiffParameter -> Árfolyamelszámolás, kerekítés Dim _GLHeader_RateDiffParameterYear_Collection_CurrentYear As New XPCollection(Of GLHeader_RateDiffParameterYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) Dim _GLHeader_RateDiffParameterYear_Collection_PrevYear As New XPCollection(Of GLHeader_RateDiffParameterYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _GLHeader_RateDiffParameterYear_PrevYear As GLHeader_RateDiffParameterYear Dim _GLHeader_RateDiffParameterYear_CurrentYear As GLHeader_RateDiffParameterYear If _GLHeader_RateDiffParameterYear_Collection_CurrentYear.Count <= 0 Then RaiseEvent InitWork(1, 1, _GLHeader_RateDiffParameterYear_Collection_PrevYear.Count) For Each _GLHeader_RateDiffParameterYear_PrevYear In _GLHeader_RateDiffParameterYear_Collection_PrevYear RaiseEvent DoWork() _GLHeader_RateDiffParameterYear_CurrentYear = _ocur.FindObject(Of GLHeader_RateDiffParameterYear)(CriteriaOperator.Parse("AccountYear=? and GLHeader_RateDiffParameter=?", _CurrentYear, _GLHeader_RateDiffParameterYear_PrevYear.GLHeader_RateDiffParameter)) If _GLHeader_RateDiffParameterYear_CurrentYear Is Nothing Then _GLHeader_RateDiffParameterYear_CurrentYear = _ocur.CreateObject(Of GLHeader_RateDiffParameterYear)() _GLHeader_RateDiffParameterYear_CurrentYear.GLHeader_RateDiffParameter = _GLHeader_RateDiffParameterYear_PrevYear.GLHeader_RateDiffParameter _GLHeader_RateDiffParameterYear_CurrentYear.AccountYear = _CurrentYear _GLHeader_RateDiffParameterYear_CurrentYear.ChartOfAccounts_RateDiff_Loss = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _GLHeader_RateDiffParameterYear_PrevYear.ChartOfAccounts_RateDiff_Loss.AccountNumber, _CurrentYear)) _GLHeader_RateDiffParameterYear_CurrentYear.ChartOfAccounts_RateDiff_Win = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _GLHeader_RateDiffParameterYear_PrevYear.ChartOfAccounts_RateDiff_Win.AccountNumber, _CurrentYear)) If _GLHeader_RateDiffParameterYear_PrevYear.ChartOfAccounts_Rounding_Loss IsNot Nothing Then _GLHeader_RateDiffParameterYear_CurrentYear.ChartOfAccounts_Rounding_Loss = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _GLHeader_RateDiffParameterYear_PrevYear.ChartOfAccounts_Rounding_Loss.AccountNumber, _CurrentYear)) End If If _GLHeader_RateDiffParameterYear_PrevYear.ChartOfAccounts_Rounding_Win IsNot Nothing Then _GLHeader_RateDiffParameterYear_CurrentYear.ChartOfAccounts_Rounding_Win = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _GLHeader_RateDiffParameterYear_PrevYear.ChartOfAccounts_Rounding_Win.AccountNumber, _CurrentYear)) End If End If Next _ocur.CommitChanges() RaiseEvent FinalWork End If '// LiquidAssets -> Pénzeszközök megnyitása Dim _LiquidAssetsYear_Collection_CurrentYear As New XPCollection(Of LiquidAssetsYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) Dim _LiquidAssetsYear_Collection_PrevYear As New XPCollection(Of LiquidAssetsYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _LiquidAssetsYear_PrevYear As LiquidAssetsYear Dim _LiquidAssetsYear_CurrentYear As LiquidAssetsYear If _LiquidAssetsYear_Collection_CurrentYear.Count <= 0 Then RaiseEvent InitWork(1, 1, _LiquidAssetsYear_Collection_PrevYear.Count) For Each _LiquidAssetsYear_PrevYear In _LiquidAssetsYear_Collection_PrevYear RaiseEvent DoWork() _LiquidAssetsYear_CurrentYear = _ocur.FindObject(Of LiquidAssetsYear)(CriteriaOperator.Parse("AccountYear=? and LiquidAssets=?", _CurrentYear, _LiquidAssetsYear_PrevYear.LiquidAssets)) If _LiquidAssetsYear_CurrentYear Is Nothing Then _LiquidAssetsYear_CurrentYear = _ocur.CreateObject(Of LiquidAssetsYear)() _LiquidAssetsYear_CurrentYear.LiquidAssets = _LiquidAssetsYear_PrevYear.LiquidAssets _LiquidAssetsYear_CurrentYear.AccountYear = _CurrentYear If _LiquidAssetsYear_PrevYear.ChartOfAccounts IsNot Nothing Then _LiquidAssetsYear_CurrentYear.ChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _LiquidAssetsYear_PrevYear.ChartOfAccounts.AccountNumber, _CurrentYear)) End If If _LiquidAssetsYear_PrevYear.ChartOfAccountsPlus IsNot Nothing Then _LiquidAssetsYear_CurrentYear.ChartOfAccountsPlus = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _LiquidAssetsYear_PrevYear.ChartOfAccountsPlus.AccountNumber, _CurrentYear)) End If If _LiquidAssetsYear_PrevYear.ChartOfAccountsMinus IsNot Nothing Then _LiquidAssetsYear_CurrentYear.ChartOfAccountsMinus = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _LiquidAssetsYear_PrevYear.ChartOfAccountsMinus.AccountNumber, _CurrentYear)) End If End If Next _ocur.CommitChanges() RaiseEvent FinalWork End If '// Tárgyiesköz paraméterek beállítása '// LiquidAssets -> Pénzeszközök megnyitása Dim _FixedAssetsGLParametersYear_Collection_CurrentYear As New XPCollection(Of FixedAssetsGLParametersYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _CurrentYear)) Dim _FixedAssetsGLParametersYear_Collection_PrevYear As New XPCollection(Of FixedAssetsGLParametersYear)(_ocur.Session, CriteriaOperator.Parse("AccountYear=?", _PrevYear)) Dim _FixedAssetsGLParametersYear_PrevYear As FixedAssetsGLParametersYear Dim _FixedAssetsGLParametersYear_CurrentYear As FixedAssetsGLParametersYear If _FixedAssetsGLParametersYear_Collection_CurrentYear.Count <= 0 Then RaiseEvent InitWork(1, 1, _FixedAssetsGLParametersYear_Collection_PrevYear.Count) For Each _FixedAssetsGLParametersYear_PrevYear In _FixedAssetsGLParametersYear_Collection_PrevYear RaiseEvent DoWork() _FixedAssetsGLParametersYear_CurrentYear = _ocur.FindObject(Of FixedAssetsGLParametersYear)(CriteriaOperator.Parse("AccountYear=? and FixedAssetsGLParameters=?", _CurrentYear, _FixedAssetsGLParametersYear_PrevYear.FixedAssetsGLParameters)) If _FixedAssetsGLParametersYear_CurrentYear Is Nothing Then _FixedAssetsGLParametersYear_CurrentYear = _ocur.CreateObject(Of FixedAssetsGLParametersYear)() _FixedAssetsGLParametersYear_CurrentYear.FixedAssetsGLParameters = _FixedAssetsGLParametersYear_PrevYear.FixedAssetsGLParameters _FixedAssetsGLParametersYear_CurrentYear.AccountYear = _CurrentYear If _FixedAssetsGLParametersYear_PrevYear.CreditChartOfAccounts IsNot Nothing Then _FixedAssetsGLParametersYear_CurrentYear.CreditChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _FixedAssetsGLParametersYear_PrevYear.CreditChartOfAccounts.AccountNumber, _CurrentYear)) End If If _FixedAssetsGLParametersYear_PrevYear.DebitChartOfAccounts IsNot Nothing Then _FixedAssetsGLParametersYear_CurrentYear.DebitChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountNumber=? and AccountYear=?", _FixedAssetsGLParametersYear_PrevYear.DebitChartOfAccounts.AccountNumber, _CurrentYear)) End If End If Next _ocur.CommitChanges() RaiseEvent FinalWork End If '//GLRows-ban átkönyvelni a tételeket az új év főkönyvi számláira Dim _GLRows_Collection As New XPCollection(Of GLRows)(_ocur.Session, CriteriaOperator.Parse("DebitChartOfAccounts.AccountYear<>? and GetDate(GLHeader.DateExecution) between (?,?)", _CurrentYear, _FirstDayOfYear.Date, _LastDayOfYear.Date)) Dim _GLRows As GLRows RaiseEvent InitWork(1, 1, _GLRows_Collection.Count) Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", False) i = 0 For Each _GLRows In _GLRows_Collection RaiseEvent DoWork() If _GLRows.DebitChartOfAccounts IsNot Nothing Then Dim _ChartOfAccounts As ChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountYear=? and AccountNumber=?", _CurrentYear, _GLRows.DebitChartOfAccounts.AccountNumber)) If _ChartOfAccounts IsNot Nothing Then _GLRows.DebitChartOfAccounts = _ChartOfAccounts End If End If i += 1 If i Mod 50 = 0 Then _ocur.CommitChanges() Next _ocur.CommitChanges() Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", True) RaiseEvent FinalWork _GLRows_Collection = New XPCollection(Of GLRows)(_ocur.Session, CriteriaOperator.Parse("CreditChartOfAccounts.AccountYear<>? and GetDate(GLHeader.DateExecution) between (?,?)", _CurrentYear, _FirstDayOfYear.Date, _LastDayOfYear.Date)) RaiseEvent InitWork(1, 1, _GLRows_Collection.Count) Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", False) i = 0 For Each _GLRows In _GLRows_Collection RaiseEvent DoWork() If _GLRows.DebitChartOfAccounts IsNot Nothing Then Dim _ChartOfAccounts As ChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountYear=? and AccountNumber=?", _CurrentYear, _GLRows.CreditChartOfAccounts.AccountNumber)) If _ChartOfAccounts IsNot Nothing Then _GLRows.CreditChartOfAccounts = _ChartOfAccounts End If End If i += 1 If i Mod 50 = 0 Then _ocur.CommitChanges() Next _ocur.CommitChanges() Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", True) RaiseEvent FinalWork Catch ex As Exception Finally RaiseEvent FinalWork GLOBAL_HAS_Audit = True End Try End Sub End Class