Files
Nuvolar/Nuvolar.Module/BusinessObjects/Financial/FinancialObjects/FinancialTransactions/Reports/DTR/GLRowsVC.vb
T
2017-03-08 11:21:27 +01:00

1441 lines
89 KiB
VB.net

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.Persistent.BaseImpl
Imports DevExpress.ExpressApp.CloneObject
Imports DevExpress.ExpressApp.Model
Public Class GLRowsVC
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()
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _User As User = _ocur.GetObjectByKey(Of User)(_ocur.GetKeyValue(SecuritySystem.CurrentUser))
Frame.GetController(Of GLRowsVC).aGenerateGLReport.Active.SetItemValue("", False)
MyBase.OnActivated()
If View.Id Like "GLReport_GLReportRows_ListView*" Then
Frame.GetController(Of NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of ListViewProcessCurrentObjectController)().Active.SetItemValue("", False)
Frame.GetController(Of DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of ExportController).Active.SetItemValue("", True)
Frame.GetController(Of GLRowsVC).aGenerateGLReport.Active.SetItemValue("", True)
If TryCast(View, ListView) IsNot Nothing Then
If TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource) IsNot Nothing Then
If TryCast(TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject, GLReport) IsNot Nothing Then
If TryCast(TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject, GLReport).InPublic Then
Frame.GetController(Of ViewVariantsModule.ChangeVariantController).Active.SetItemValue("", False)
End If
End If
End If
End If
End If
If View.Id Like "GLReport_GLReportRowsCostHolder_ListView*" Then
Frame.GetController(Of GLRowsVC).aGenerateGLReport.Active.SetItemValue("", True)
If TryCast(View, ListView) IsNot Nothing Then
If TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource) IsNot Nothing Then
If TryCast(TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject, GLReport) IsNot Nothing Then
If TryCast(TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject, GLReport).InPublic Then
Frame.GetController(Of ViewVariantsModule.ChangeVariantController).Active.SetItemValue("", False)
End If
End If
End If
End If
End If
If View.Id Like "GLReport_DetailView*" Then
Dim _GLReport As GLReport = TryCast(View.SelectedObjects(0), GLReport)
Frame.GetController(Of GLRowsVC).aGenerateGLReport.Active.SetItemValue("", True)
If _GLReport.UserCreated IsNot Nothing Then
If Not _GLReport.UserCreated.Equals(_User) Then
'Frame.GetController(Of ModificationsController).SaveAction.Active.SetItemValue("", False)
Frame.GetController(Of ModificationsController).SaveAndCloseAction.Active.SetItemValue("", False)
Frame.GetController(Of ModificationsController).SaveAndNewAction.Active.SetItemValue("", False)
Frame.GetController(Of DeleteObjectsViewController).Active.SetItemValue("", False)
Frame.GetController(Of CloneObjectViewController).Active.SetItemValue("", False)
Frame.GetController(Of GLRowsVC).aGenerateGLReport.Active.SetItemValue("", False)
End If
End If
End If
If View.Id Like "GLReport_ListView*" Then
Frame.GetController(Of DeleteObjectsViewController).DeleteAction.TargetObjectsCriteria = "UserCreated.Oid='" & _User.Oid.ToString & "' or 'SysAdmin'='" & SecuritySystem.CurrentUserName & "'"
Frame.GetController(Of DeleteObjectsViewController).DeleteAction.TargetObjectsCriteriaMode = TargetObjectsCriteriaMode.TrueForAll
End If
If View.Id = "GLReport_ListView_Public" Then
Frame.GetController(Of CloneObjectViewController).Active.SetItemValue("", True)
Frame.GetController(Of NewObjectViewController).Active.SetItemValue("", True)
End If
If View.Id = "GLReport_ListView_Private" Then
If SecuritySystem.CurrentUserName = "SysAdmin" Then
Else
CType(View, ListView).CollectionSource.Criteria("ByUser") = CriteriaOperator.Parse("UserCreated=? ", _User)
End If
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
'Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", True)
If View.Id Like "GLReport_DetailView*" Then
Frame.GetController(Of ModificationsController).SaveAction.Active.SetItemValue("", True)
Frame.GetController(Of ModificationsController).SaveAndCloseAction.Active.SetItemValue("", True)
Frame.GetController(Of ModificationsController).SaveAndNewAction.Active.SetItemValue("", True)
Frame.GetController(Of DeleteObjectsViewController).Active.SetItemValue("", True)
Frame.GetController(Of CloneObjectViewController).Active.SetItemValue("", True)
Frame.GetController(Of GLRowsVC).aGenerateGLReport.Active.SetItemValue("", True)
End If
End Sub
Private Sub aGenerateGLReport_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aGenerateGLReport.Execute
'-- Főkönyvi kimutatást készíti
'Try
GLOBAL_HAS_Audit = False
Dim _GLReport As GLReport = Nothing
Dim _ocur As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _uow As UnitOfWork = New UnitOfWork(_ocur.Session.DataLayer)
Dim _uow_stat As UnitOfWork = New UnitOfWork(_ocur.Session.DataLayer)
Dim _GLReportRows As GLReportRows
Dim _GLReportRowsCostHolder As GLReportRowsCostHolder
Dim _DateExecution As Date = Nothing
If TryCast(View, ListView) IsNot Nothing Then
Dim _ListView As ListView = TryCast(View, ListView)
Dim _PropertyCollectionSource As PropertyCollectionSource = TryCast(_ListView.CollectionSource, PropertyCollectionSource)
If _PropertyCollectionSource IsNot Nothing Then
_GLReport = _uow.GetObjectByKey(Of GLReport)(TryCast(_PropertyCollectionSource.MasterObject, GLReport).Oid)
Else
_GLReportRows = TryCast(_ListView.CollectionSource.List(0), GLReportRows)
If _GLReportRows IsNot Nothing Then
_GLReport = _uow.GetObjectByKey(Of GLReport)(_GLReportRows.GLReport.Oid)
Else
_GLReportRowsCostHolder = TryCast(_ListView.CollectionSource.List(0), GLReportRowsCostHolder)
If _GLReportRowsCostHolder IsNot Nothing Then
_GLReport = _uow.GetObjectByKey(Of GLReport)(_GLReportRowsCostHolder.GLReport.Oid)
End If
End If
End If
ElseIf TryCast(View, DetailView) IsNot Nothing Then
_GLReport = _uow.GetObjectByKey(Of GLReport)(TryCast(View.SelectedObjects(0), GLReport).Oid)
End If
If _GLReport Is Nothing Then Exit Sub
Dim _GLRows As GLRows
Dim I As Long = 0
Dim _cs As String
Dim _QueryStatistics As QueryStatistics = New QueryStatistics(_uow_stat)
_QueryStatistics.TimeStart = GetSQLTime(_uow_stat)
_QueryStatistics.ObjectKey = _GLReport.Oid
_QueryStatistics.ObjectName = "GLReport"
_QueryStatistics.RecordNumber = 0
Dim _GLRows_Collection As XPCollection(Of GLRows)
'Dim _GLReportRows_Collection As New XPCollection(Of GLReportRows)(_uow, CriteriaOperator.Parse("GLReport=?", _GLReport))
'_uow.Delete(_GLReportRows_Collection)
'Dim _GLReportRowsCostHolder_Collection As New XPCollection(Of GLReportRowsCostHolder)(_uow, CriteriaOperator.Parse("GLReport=?", _GLReport))
'_uow.Delete(_GLReportRowsCostHolder_Collection)
Select Case GLOBAL_SQLType
Case eSQLType.PostgreSQL
_uow.ExecuteNonQuery("delete from ""GLReportRowsCostHolder"" where ""GLReport""='" & _GLReport.Oid.ToString & "'")
_uow.ExecuteNonQuery("delete from ""GLReportRows"" where ""GLReport""='" & _GLReport.Oid.ToString & "'")
Case Else
_uow.ExecuteNonQuery("delete from GLReportRowsCostHolder where GLReport='" & _GLReport.Oid.ToString & "'")
_uow.ExecuteNonQuery("delete from GLReportRows where GLReport='" & _GLReport.Oid.ToString & "'")
End Select
'-- Először a főkönyvi sorok ! ------------------------------------------
If _GLReport.ReportType = eGLReportType.GeneralLedger Then
If _GLReport.IsCustomersFrom = True Then
If _GLReport.GLReportDateExecutionMode = eDateExecutionMode.eHeader Then
_cs = " GLHeader.DateExecution>=? and GLHeader.DateExecution<=? and GLHeader.IsEditable=False"
Else
_cs = " DateExecution>=? and DateExecution<=? and GLHeader.IsEditable=False"
End If
If _GLReport.GLReportCustomersFrom.Count > 0 Then
Dim _cs_1 As String = ""
Dim _cs_1_i As Long = 0
Dim _GLReportCustomersFrom As GLReportCustomersFrom
For Each _GLReportCustomersFrom In _GLReport.GLReportCustomersFrom
If _cs_1_i = 0 Then
_cs_1 = " GLHeader.CustomersFrom.Oid='" & _GLReportCustomersFrom.CustomersFrom.Oid.ToString & "'"
_cs_1_i += 1
Else
_cs_1 &= " OR GLHeader.CustomersFrom.Oid='" & _GLReportCustomersFrom.CustomersFrom.Oid.ToString & "'"
End If
Next
If _cs_1 <> "" Then _cs &= " and (" & _cs_1 & ") "
End If
If _GLReport.GLReportChartOfAccounts.Count > 0 Then
Dim _cs_1 As String = ""
Dim _cs_1_i As Long = 0
Dim _GLReportChartOfAccounts As GLReportChartOfAccounts
For Each _GLReportChartOfAccounts In _GLReport.GLReportChartOfAccounts
If _cs_1_i = 0 Then
_cs_1 = " DebitChartOfAccounts.AccountNumber like '" & _GLReportChartOfAccounts.AccountNumber & "%' or CreditChartOfAccounts.AccountNumber like '" & _GLReportChartOfAccounts.AccountNumber & "%'"
_cs_1_i += 1
Else
_cs_1 &= " OR DebitChartOfAccounts.AccountNumber like '" & _GLReportChartOfAccounts.AccountNumber & "%' or CreditChartOfAccounts.AccountNumber like '" & _GLReportChartOfAccounts.AccountNumber & "%'"
End If
Next
If _cs_1 <> "" Then _cs &= " and (" & _cs_1 & ") "
End If
If _GLReport IsNot Nothing Then
If _GLReport.Criteria <> "" Then
If _cs <> "" Then
_cs = "(" & _cs & ") and " & CriteriaOperator.Parse(_GLReport.Criteria).ToString
Else
_cs = CriteriaOperator.Parse(_GLReport.Criteria).ToString
End If
End If
End If
_GLRows_Collection = New XPCollection(Of GLRows)(_uow, CriteriaOperator.Parse(_cs, _GLReport.FromDate, DateAdd(DateInterval.Minute, 1439, _GLReport.ToDate.Date)))
Else
If _GLReport.GLReportDateExecutionMode = eDateExecutionMode.eHeader Then
_cs = " GLHeader.DateExecution>=? and GLHeader.DateExecution<=? and GLHeader.IsEditable=False and GLHeader.CustomersFrom=?"
Else
_cs = " DateExecution>=? and DateExecution<=? and GLHeader.IsEditable=False and GLHeader.CustomersFrom=?"
End If
If _GLReport.GLReportChartOfAccounts.Count > 0 Then
Dim _cs_1 As String = ""
Dim _cs_1_i As Long = 0
Dim _GLReportChartOfAccounts As GLReportChartOfAccounts
For Each _GLReportChartOfAccounts In _GLReport.GLReportChartOfAccounts
If _cs_1_i = 0 Then
_cs_1 = " DebitChartOfAccounts.AccountNumber like '" & _GLReportChartOfAccounts.AccountNumber & "%' or CreditChartOfAccounts.AccountNumber like '" & _GLReportChartOfAccounts.AccountNumber & "%'"
_cs_1_i += 1
Else
_cs_1 &= " OR DebitChartOfAccounts.AccountNumber like '" & _GLReportChartOfAccounts.AccountNumber & "%' or CreditChartOfAccounts.AccountNumber like '" & _GLReportChartOfAccounts.AccountNumber & "%'"
End If
Next
If _cs_1 <> "" Then _cs &= " and (" & _cs_1 & ") "
End If
If _GLReport IsNot Nothing Then
If _GLReport.Criteria <> "" Then
If _cs <> "" Then
_cs = "(" & _cs & ") and " & CriteriaOperator.Parse(_GLReport.Criteria).ToString
Else
_cs = CriteriaOperator.Parse(_GLReport.Criteria).ToString
End If
End If
End If
_GLRows_Collection = New XPCollection(Of GLRows)(_uow, CriteriaOperator.Parse(_cs, _GLReport.FromDate, DateAdd(DateInterval.Minute, 1439, _GLReport.ToDate.Date), _GLReport.CustomersFrom))
End If
Else
If _GLReport.IsCustomersFrom = True Then
If _GLReport.GLReportDateExecutionMode = eDateExecutionMode.eHeader Then
_cs = " GLRowsTypeVAT <> 1 and GLHeader.DateExecution>=? and GLHeader.DateExecution<=? and GLHeader.IsEditable=False"
_cs += " and isnull(Controlling)=False "
Else
_cs = " GLRowsTypeVAT <> 1 and DateExecution>=? and DateExecution<=? and GLHeader.IsEditable=False"
_cs += " and isnull(Controlling)=False "
End If
If _GLReport.GLReportCustomersFrom.Count > 0 Then
Dim _cs_1 As String = ""
Dim _cs_1_i As Long = 0
Dim _GLReportCustomersFrom As GLReportCustomersFrom
For Each _GLReportCustomersFrom In _GLReport.GLReportCustomersFrom
If _cs_1_i = 0 Then
_cs_1 = " GLHeader.CustomersFrom.Oid='" & _GLReportCustomersFrom.CustomersFrom.Oid.ToString & "'"
_cs_1_i += 1
Else
_cs_1 &= " OR GLHeader.CustomersFrom.Oid='" & _GLReportCustomersFrom.CustomersFrom.Oid.ToString & "'"
End If
Next
If _cs_1 <> "" Then _cs &= " and (" & _cs_1 & ") "
End If
If _GLReport IsNot Nothing Then
If _GLReport.Criteria <> "" Then
If _cs <> "" Then
_cs = "(" & _cs & ") and " & CriteriaOperator.Parse(_GLReport.Criteria).ToString
Else
_cs = CriteriaOperator.Parse(_GLReport.Criteria).ToString
End If
End If
End If
_GLRows_Collection = New XPCollection(Of GLRows)(_uow, CriteriaOperator.Parse(_cs, _GLReport.FromDate, DateAdd(DateInterval.Minute, 1439, _GLReport.ToDate.Date)))
Else
If _GLReport.GLReportDateExecutionMode = eDateExecutionMode.eHeader Then
_cs = " GLRowsTypeVAT <> 1 and GLHeader.DateExecution>=? and GLHeader.DateExecution<=? and GLHeader.IsEditable=False and GLHeader.CustomersFrom=?"
_cs += " and isnull(Controlling)=False "
Else
_cs = " GLRowsTypeVAT <> 1 and DateExecution>=? and DateExecution<=? and GLHeader.IsEditable=False and GLHeader.CustomersFrom=?"
_cs += " and isnull(Controlling)=False "
End If
If _GLReport IsNot Nothing Then
If _GLReport.Criteria <> "" Then
If _cs <> "" Then
_cs = "(" & _cs & ") and " & CriteriaOperator.Parse(_GLReport.Criteria).ToString
Else
_cs = CriteriaOperator.Parse(_GLReport.Criteria).ToString
End If
End If
End If
_GLRows_Collection = New XPCollection(Of GLRows)(_uow, CriteriaOperator.Parse(_cs, _GLReport.FromDate, DateAdd(DateInterval.Minute, 1439, _GLReport.ToDate.Date), _GLReport.CustomersFrom))
End If
End If
RaiseEvent InitWork(1, 1, _GLRows_Collection.Count)
_QueryStatistics.RecordNumber += _GLRows_Collection.Count
For Each _GLRows In _GLRows_Collection
I += 1
RaiseEvent DoWork()
_GLReportRows = New GLReportRows(_uow)
_GLReportRows.GLRows = _GLRows
_GLReportRows.CurrencyName = _GLRows.GLHeader.CurrencyName
Select Case Mid(_GLRows.DebitChartOfAccounts.AccountNumber, 1, 1)
Case "5", "8", "9"
_GLReportRows.GLReportRowsType = eGLReportRowsType.eIncoming
Case Else
_GLReportRows.GLReportRowsType = eGLReportRowsType.eBallance
End Select
_GLReportRows.GLReportRowsState = eGLReportRowsState.eGLFinal
_GLReportRows.GLReport = _GLReport
_GLReportRows.ChartOfAccounts = _GLRows.DebitChartOfAccounts
_GLReportRows.DebitAmount = _GLRows.AmountHUF
_GLReportRows.DebitAmountDEV = _GLRows.AmountDEV
_GLReportRows.CreditAmount = 0
_GLReportRows.CustomersFrom = _GLRows.GLHeader.CustomersFrom
_GLReportRows.Customers = _GLRows.Customer
_GLReportRows.ConnectInfo = _GLRows.ConnectInfo
_GLReportRows.Controlling = _GLRows.Controlling
_GLReportRows.CostHolder = _GLRows.CostHolder
_GLReportRows.CostPlace = _GLRows.CostPlace
_GLReportRows.JobNumberObjects = _GLRows.JobNumberObjects
_GLReportRows.UniqueObjects = _GLRows.UniqueObjects
If _GLReport.ReportType = eGLReportType.Controlling Then
If _GLRows.Controlling Is Nothing Then
Select Case _GLRows.GLHeader.GLDocumentType
Case eGLDocumentType.eGLBank, eGLDocumentType.eGLCassa, eGLDocumentType.eGLCompensation, eGLDocumentType.eGLRateDiff
Select Case _GLRows.PartnerType
Case ePartnerType.ePayabels
Case ePartnerType.eReceivables
Case ePartnerType.eNotSet
If _GLRows.InAmountHUF <> 0 Then
_GLReportRows.BallanceAmount = _GLRows.AmountHUF
_GLReportRows.BallanceAmountDEV = _GLRows.AmountDEV
ElseIf _GLRows.OutAmountHUF <> 0 Then
_GLReportRows.BallanceAmount = _GLRows.AmountHUF * -1
_GLReportRows.BallanceAmountDEV = _GLRows.AmountDEV * -1
Else
_GLReportRows.BallanceAmount = _GLRows.AmountHUF
_GLReportRows.BallanceAmountDEV = _GLRows.AmountDEV
End If
End Select
Case Else
_GLReportRows.BallanceAmount = _GLRows.AmountHUF
_GLReportRows.BallanceAmountDEV = _GLRows.AmountDEV
End Select
Else
If _GLRows.Controlling.Controllingdirection = eControllingDirection.eIn Then
_GLReportRows.BallanceAmount = _GLRows.AmountHUF
_GLReportRows.BallanceAmountDEV = _GLRows.AmountDEV
ElseIf _GLRows.Controlling.Controllingdirection = eControllingDirection.eOut Then
_GLReportRows.BallanceAmount = _GLRows.AmountHUF * -1
_GLReportRows.BallanceAmountDEV = _GLRows.AmountDEV * -1
End If
End If
Else
_GLReportRows.BallanceAmount = _GLRows.AmountHUF
_GLReportRows.BallanceAmountDEV = _GLRows.AmountDEV
End If
If _GLReport.GLReportDateExecutionMode = eDateExecutionMode.eHeader Then
_DateExecution = _GLRows.GLHeader.DateExecution
Else
_DateExecution = _GLRows.DateExecution
End If
_GLReportRows.DateExecution = _DateExecution
_GLReportRows.DateExecution_Y = AlignStr(DatePart(DateInterval.Year, _GLReportRows.DateExecution).ToString, eDirection.Left, "0", 4)
_GLReportRows.DateExecution_Q = AlignStr(DatePart(DateInterval.Quarter, _GLReportRows.DateExecution).ToString, eDirection.Left, "0", 2)
_GLReportRows.DateExecution_M = AlignStr(DatePart(DateInterval.Month, _GLReportRows.DateExecution).ToString, eDirection.Left, "0", 2)
_GLReportRows.DateExecution_W = AlignStr(DatePart(DateInterval.WeekOfYear, _GLReportRows.DateExecution).ToString, eDirection.Left, "0", 2)
_GLReportRows.RegistryHeader = _GLRows.GLHeader.ImportedRegistryHeader
_GLReportRows.InvoiceHeader = _GLRows.GLHeader.ImportedInvoice
'_GLReportRows.Save()
If _GLReport.ReportType = eGLReportType.GeneralLedger Then
_GLReportRows = New GLReportRows(_uow)
_GLReportRows.GLRows = _GLRows
Select Case Mid(_GLRows.CreditChartOfAccounts.AccountNumber, 1, 1)
Case "5", "8", "9"
_GLReportRows.GLReportRowsType = eGLReportRowsType.eIncoming
Case Else
_GLReportRows.GLReportRowsType = eGLReportRowsType.eBallance
End Select
_GLReportRows.GLReportRowsState = eGLReportRowsState.eGLFinal
_GLReportRows.GLReport = _GLReport
_GLReportRows.ChartOfAccounts = _GLRows.CreditChartOfAccounts
_GLReportRows.DebitAmount = 0
_GLReportRows.CreditAmount = _GLRows.AmountHUF
_GLReportRows.CreditAmountDEV = _GLRows.AmountDEV
_GLReportRows.BallanceAmount = _GLRows.AmountHUF * -1
_GLReportRows.BallanceAmountDEV = _GLRows.AmountDEV * -1
_GLReportRows.CustomersFrom = _GLRows.GLHeader.CustomersFrom
_GLReportRows.Customers = _GLRows.Customer
_GLReportRows.ConnectInfo = _GLRows.ConnectInfo
_GLReportRows.Controlling = _GLRows.Controlling
_GLReportRows.CostHolder = _GLRows.CostHolder
_GLReportRows.CostPlace = _GLRows.CostPlace
_GLReportRows.JobNumberObjects = _GLRows.JobNumberObjects
_GLReportRows.UniqueObjects = _GLRows.UniqueObjects
If _GLReport.GLReportDateExecutionMode = eDateExecutionMode.eHeader Then
_DateExecution = _GLRows.GLHeader.DateExecution
Else
_DateExecution = _GLRows.DateExecution
End If
_GLReportRows.DateExecution = _DateExecution
_GLReportRows.DateExecution_Y = AlignStr(DatePart(DateInterval.Year, _GLReportRows.DateExecution).ToString, eDirection.Left, "0", 4)
_GLReportRows.DateExecution_Q = AlignStr(DatePart(DateInterval.Quarter, _GLReportRows.DateExecution).ToString, eDirection.Left, "0", 2)
_GLReportRows.DateExecution_M = AlignStr(DatePart(DateInterval.Month, _GLReportRows.DateExecution).ToString, eDirection.Left, "0", 2)
_GLReportRows.DateExecution_W = AlignStr(DatePart(DateInterval.WeekOfYear, _GLReportRows.DateExecution).ToString, eDirection.Left, "0", 2)
_GLReportRows.RegistryHeader = _GLRows.GLHeader.ImportedRegistryHeader
_GLReportRows.InvoiceHeader = _GLRows.GLHeader.ImportedInvoice
'_GLReportRows.Save()
End If
_uow.CommitChanges()
Next
RaiseEvent FinalWork
'// Most ki kéne venni azokat, amelyek nem passzolnak főkönyvileg !
_uow.CommitChanges()
'-- Be kéne tenni azokat az iktatásokat, amelyek még nincsenek lekönyvelve
If _GLReport.ReportType = eGLReportType.Controlling Then
If _GLReport.IsRegistry = True Then
Dim _RegistryHeader_Collection As XPCollection(Of RegistryHeader)
If _GLReport.IsCustomersFrom = True Then
_RegistryHeader_Collection = New XPCollection(Of RegistryHeader) _
(_uow, CriteriaOperator.Parse("RegistryType.RegistryMainType=0 and RegistryAcceptState=0 and IsEditable=False and isnull(F_GLAccounts)=True and GetDate(F_DateExecution)>=? and GetDate(F_DateExecution) <=?", _
_GLReport.FromDate.Date, _GLReport.ToDate.Date))
Else
_RegistryHeader_Collection = New XPCollection(Of RegistryHeader) _
(_uow, CriteriaOperator.Parse("RegistryType.RegistryMainType=0 and RegistryAcceptState=0 and IsEditable=False and isnull(F_GLAccounts)=True and CustomersFrom=? and GetDate(F_DateExecution)>=? and GetDate(F_DateExecution) <=?", _
_GLReport.CustomersFrom, _GLReport.FromDate.Date, _GLReport.ToDate.Date))
End If
Dim _RegistryHeader As RegistryHeader
Dim _RegistryRowsFinancialControlling As RegistryRowsFinancialControlling
RaiseEvent InitWork(1, 1, _RegistryHeader_Collection.Count)
_QueryStatistics.RecordNumber += _RegistryHeader_Collection.Count
For Each _RegistryHeader In _RegistryHeader_Collection
RaiseEvent DoWork()
I += 1
For Each _RegistryRowsFinancialControlling In _RegistryHeader.RegistryRowsFinancialControlling
_GLReportRows = New GLReportRows(_uow)
_GLReportRows.GLReport = _GLReport
_GLReportRows.GLReportRowsType = eGLReportRowsType.eIncoming
_GLReportRows.GLReportRowsState = eGLReportRowsState.eRegistry
If _RegistryRowsFinancialControlling.Controlling.Controllingdirection = eControllingDirection.eIn Then
_GLReportRows.BallanceAmount = _RegistryRowsFinancialControlling.Amount
Else
_GLReportRows.BallanceAmount = _RegistryRowsFinancialControlling.Amount * -1
End If
_GLReportRows.CustomersFrom = _RegistryHeader.CustomersFrom
_GLReportRows.Customers = _RegistryHeader.Customers
_GLReportRows.ConnectInfo = _RegistryHeader.DocumentNumber
_GLReportRows.Controlling = _RegistryRowsFinancialControlling.Controlling
_GLReportRows.CostHolder = _RegistryRowsFinancialControlling.CostHolder
_GLReportRows.CostPlace = _RegistryRowsFinancialControlling.CostPlace
_GLReportRows.JobNumberObjects = _RegistryRowsFinancialControlling.JobNumberObjects
_GLReportRows.UniqueObjects = _RegistryRowsFinancialControlling.UniqueObjects
_GLReportRows.DateExecution = _RegistryHeader.F_DateExecution
_GLReportRows.DateExecution_Y = AlignStr(DatePart(DateInterval.Year, _RegistryHeader.F_DateExecution).ToString, eDirection.Left, "0", 4)
_GLReportRows.DateExecution_Q = AlignStr(DatePart(DateInterval.Quarter, _RegistryHeader.F_DateExecution).ToString, eDirection.Left, "0", 2)
_GLReportRows.DateExecution_M = AlignStr(DatePart(DateInterval.Month, _RegistryHeader.F_DateExecution).ToString, eDirection.Left, "0", 2)
_GLReportRows.DateExecution_W = AlignStr(DatePart(DateInterval.WeekOfYear, _RegistryHeader.F_DateExecution).ToString, eDirection.Left, "0", 2)
_GLReportRows.RegistryHeader = _RegistryHeader
_GLReportRows.RegistryRowsFinancialControlling = _RegistryRowsFinancialControlling
_GLReportRows.Save()
Next
If I Mod 5000 = 0 Then _uow.CommitChanges()
Next
RaiseEvent FinalWork
_uow.CommitChanges()
End If
'-- Be kéne tenni azokat a vevői számlákat, amelyek nincsenek lekönyvelve
If _GLReport.IsInvoice = True Then
Dim _InvoiceHeader_Collection As XPCollection(Of InvoiceHeader)
If _GLReport.IsCustomersFrom = True Then
_InvoiceHeader_Collection = New XPCollection(Of InvoiceHeader) _
(_uow, CriteriaOperator.Parse("InvoiceType.InvoiceTypeBase in (0,1,2,3) and IsEditable=False and isnull(GLAccounts)=True and GetDate(DateExecution)>=? and GetDate(DateExecution) <=?", _
_GLReport.FromDate.Date, _GLReport.ToDate.Date))
Else
_InvoiceHeader_Collection = New XPCollection(Of InvoiceHeader) _
(_uow, CriteriaOperator.Parse("InvoiceType.InvoiceTypeBase in (0,1,2,3) and IsEditable=False and isnull(GLAccounts)=True and CustomersFrom=? and GetDate(DateExecution)>=? and GetDate(DateExecution) <=?", _
_GLReport.CustomersFrom, _GLReport.FromDate.Date, _GLReport.ToDate.Date))
End If
Dim _InvoiceHeader As InvoiceHeader
Dim _InvoiceRows As InvoiceRows
RaiseEvent InitWork(1, 1, _InvoiceHeader_Collection.Count)
_QueryStatistics.RecordNumber += _InvoiceHeader_Collection.Count
For Each _InvoiceHeader In _InvoiceHeader_Collection
RaiseEvent DoWork()
I += 1
For Each _InvoiceRows In _InvoiceHeader.InvoiceRows
_GLReportRows = New GLReportRows(_uow)
_GLReportRows.GLReport = _GLReport
_GLReportRows.GLReportRowsType = eGLReportRowsType.eIncoming
_GLReportRows.GLReportRowsState = eGLReportRowsState.eInvoice
If _InvoiceRows.Controlling.Controllingdirection = eControllingDirection.eIn Then
_GLReportRows.BallanceAmount = _InvoiceRows.SumPriceHUF
Else
_GLReportRows.BallanceAmount = _InvoiceRows.SumPriceHUF * -1
End If
_GLReportRows.CustomersFrom = _InvoiceHeader.CustomersFrom
_GLReportRows.Customers = _InvoiceHeader.Customers
_GLReportRows.ConnectInfo = _InvoiceHeader.DocumentNumber
_GLReportRows.Controlling = _InvoiceRows.Controlling
_GLReportRows.CostHolder = _InvoiceRows.CostHolder
_GLReportRows.CostPlace = _InvoiceRows.CostPlace
_GLReportRows.JobNumberObjects = _InvoiceRows.JobNumberObjects
_GLReportRows.UniqueObjects = _InvoiceRows.UniqueObjects
_GLReportRows.DateExecution = _InvoiceHeader.DateExecution
_GLReportRows.DateExecution_Y = AlignStr(DatePart(DateInterval.Year, _InvoiceHeader.DateExecution).ToString, eDirection.Left, "0", 4)
_GLReportRows.DateExecution_Q = AlignStr(DatePart(DateInterval.Quarter, _InvoiceHeader.DateExecution).ToString, eDirection.Left, "0", 2)
_GLReportRows.DateExecution_M = AlignStr(DatePart(DateInterval.Month, _InvoiceHeader.DateExecution).ToString, eDirection.Left, "0", 2)
_GLReportRows.DateExecution_W = AlignStr(DatePart(DateInterval.WeekOfYear, _InvoiceHeader.DateExecution).ToString, eDirection.Left, "0", 2)
_GLReportRows.InvoiceHeader = _InvoiceHeader
_GLReportRows.InvoiceRows = _InvoiceRows
_GLReportRows.Save()
Next
If I Mod 5000 = 0 Then _uow.CommitChanges()
Next
RaiseEvent FinalWork
_uow.CommitChanges()
End If
End If
If _GLReport.ReportType = eGLReportType.Controlling Then
I = 0
RaiseEvent InitWork(1, 1, _GLReport.GLReportRows.Count)
For Each _GLReportRows In _GLReport.GLReportRows
RaiseEvent DoWork()
CreateCostHolderInfoRows(_uow, _GLReportRows)
I += 1
If I Mod 5000 = 0 Then _uow.CommitChanges()
Next
_uow.CommitChanges()
RaiseEvent FinalWork
End If
_QueryStatistics.TimeStop = GetSQLTime(_uow_stat)
_QueryStatistics.TimeEllapsed = _QueryStatistics.TimeStop - _QueryStatistics.TimeStart
_uow_stat.CommitChanges()
If TryCast(View, DetailView) IsNot Nothing Then
If Frame.GetController(Of RefreshController).RefreshAction.Enabled Then
Frame.GetController(Of RefreshController).RefreshAction.DoExecute()
End If
ElseIf TryCast(View, ListView) IsNot Nothing Then
TryCast(View, ListView).CollectionSource.Reload()
End If
'Catch ex As Exception
'MsgBox(ex.Message)
'Finally
GLOBAL_HAS_Audit = True
RaiseEvent FinalWork
'End Try
End Sub
Private Sub CreateCostHolderInfoRows(_uow As UnitOfWork, _GLReportRows As GLReportRows)
Dim _GLReportRowsCostHolder As GLReportRowsCostHolder
If _GLReportRows.RegistryHeader IsNot Nothing Then
'//------------------------------------------------
Dim _HRPersonCustomers_Collection As New XPCollection(Of HRPersonCustomers)(_uow, CriteriaOperator.Parse("Customers=?", _GLReportRows.Customers))
If _HRPersonCustomers_Collection.Count > 0 Then
For Each _HRPersonCustomers As HRPersonCustomers In _HRPersonCustomers_Collection
If _HRPersonCustomers.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCustomers.DateTo.Date >= _GLReportRows.DateExecution.Date Then
If _HRPersonCustomers.HRPerson.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _HRPersonCustomers.HRPerson.HRPersonCostHolder
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _HRPersonCustomers.HRPerson
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
Next
End If
End If
Next
ElseIf _GLReportRows.UniqueObjects IsNot Nothing Then
Dim _FixedAssets As FixedAssets = _uow.FindObject(Of FixedAssets)(CriteriaOperator.Parse("UniqueObjects.Oid=?", _GLReportRows.UniqueObjects.Oid))
If _FixedAssets IsNot Nothing Then
If _FixedAssets.HRPerson_Using IsNot Nothing Then
If _FixedAssets.HRPerson_Using.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _FixedAssets.HRPerson_Using.HRPersonCostHolder
If _HRPersonCostHolder.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCostHolder.DateTo.Date >= _GLReportRows.DateExecution.Date Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _FixedAssets.HRPerson_Using
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
End If
Next
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
ElseIf _FixedAssets.CostHolder_Using IsNot Nothing Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _FixedAssets.CostHolder_Using
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
Else
Dim _HRPerson As HRPerson = _uow.FindObject(Of HRPerson)(CriteriaOperator.Parse("UniqueObjects.Oid=?", _GLReportRows.UniqueObjects.Oid))
If _HRPerson IsNot Nothing Then
If _HRPerson.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _HRPerson.HRPersonCostHolder
If _HRPersonCostHolder.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCostHolder.DateTo.Date >= _GLReportRows.DateExecution.Date Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _HRPerson
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
End If
Next
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
End If
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
'//------------------------------------------------
ElseIf _GLReportRows.InvoiceHeader IsNot Nothing Then
'// --------------------------------------------------
Dim _HRPersonCustomers_Collection As New XPCollection(Of HRPersonCustomers)(_uow, CriteriaOperator.Parse("Customers=?", _GLReportRows.Customers))
If _HRPersonCustomers_Collection.Count > 0 Then
For Each _HRPersonCustomers As HRPersonCustomers In _HRPersonCustomers_Collection
If _HRPersonCustomers.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCustomers.DateTo.Date >= _GLReportRows.DateExecution.Date Then
If _HRPersonCustomers.HRPerson.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _HRPersonCustomers.HRPerson.HRPersonCostHolder
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _HRPersonCustomers.HRPerson
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
Next
End If
End If
Next
ElseIf _GLReportRows.UniqueObjects IsNot Nothing Then
Dim _FixedAssets As FixedAssets = _uow.FindObject(Of FixedAssets)(CriteriaOperator.Parse("UniqueObjects.Oid=?", _GLReportRows.UniqueObjects.Oid))
If _FixedAssets IsNot Nothing Then
If _FixedAssets.HRPerson_Using IsNot Nothing Then
If _FixedAssets.HRPerson_Using.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _FixedAssets.HRPerson_Using.HRPersonCostHolder
If _HRPersonCostHolder.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCostHolder.DateTo.Date >= _GLReportRows.DateExecution.Date Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _FixedAssets.HRPerson_Using
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
End If
Next
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
ElseIf _FixedAssets.CostHolder_Using IsNot Nothing Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _FixedAssets.CostHolder_Using
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
Else
Dim _HRPerson As HRPerson = _uow.FindObject(Of HRPerson)(CriteriaOperator.Parse("UniqueObjects.Oid=?", _GLReportRows.UniqueObjects.Oid))
If _HRPerson IsNot Nothing Then
If _HRPerson.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _HRPerson.HRPersonCostHolder
If _HRPersonCostHolder.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCostHolder.DateTo.Date >= _GLReportRows.DateExecution.Date Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _HRPerson
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
End If
Next
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
End If
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
'-----------------------------------------------------
ElseIf _GLReportRows.GLRows IsNot Nothing Then
If _GLReportRows.GLRows.PartnerType = ePartnerType.eReceivables Then
Dim _HRPersonCustomers_Collection As New XPCollection(Of HRPersonCustomers)(_uow, CriteriaOperator.Parse("Customers=?", _GLReportRows.Customers))
If _HRPersonCustomers_Collection.Count > 0 Then
For Each _HRPersonCustomers As HRPersonCustomers In _HRPersonCustomers_Collection
If _HRPersonCustomers.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCustomers.DateTo.Date >= _GLReportRows.DateExecution.Date Then
If _HRPersonCustomers.HRPerson.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _HRPersonCustomers.HRPerson.HRPersonCostHolder
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _HRPersonCustomers.HRPerson
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
Next
End If
End If
Next
ElseIf _GLReportRows.UniqueObjects IsNot Nothing Then
Dim _FixedAssets As FixedAssets = _uow.FindObject(Of FixedAssets)(CriteriaOperator.Parse("UniqueObjects.Oid=?", _GLReportRows.UniqueObjects.Oid))
If _FixedAssets IsNot Nothing Then
If _FixedAssets.HRPerson_Using IsNot Nothing Then
If _FixedAssets.HRPerson_Using.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _FixedAssets.HRPerson_Using.HRPersonCostHolder
If _HRPersonCostHolder.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCostHolder.DateTo.Date >= _GLReportRows.DateExecution.Date Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _FixedAssets.HRPerson_Using
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
End If
Next
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
ElseIf _FixedAssets.CostHolder_Using IsNot Nothing Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _FixedAssets.CostHolder_Using
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
Else
Dim _HRPerson As HRPerson = _uow.FindObject(Of HRPerson)(CriteriaOperator.Parse("UniqueObjects.Oid=?", _GLReportRows.UniqueObjects.Oid))
If _HRPerson IsNot Nothing Then
If _HRPerson.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _HRPerson.HRPersonCostHolder
If _HRPersonCostHolder.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCostHolder.DateTo.Date >= _GLReportRows.DateExecution.Date Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _HRPerson
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
End If
Next
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
End If
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
ElseIf _GLReportRows.GLRows.PartnerType = ePartnerType.ePayabels Then
Dim _HRPersonCustomers_Collection As New XPCollection(Of HRPersonCustomers)(_uow, CriteriaOperator.Parse("Customers=?", _GLReportRows.Customers))
If _HRPersonCustomers_Collection.Count > 0 Then
For Each _HRPersonCustomers As HRPersonCustomers In _HRPersonCustomers_Collection
If _HRPersonCustomers.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCustomers.DateTo.Date >= _GLReportRows.DateExecution.Date Then
If _HRPersonCustomers.HRPerson.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _HRPersonCustomers.HRPerson.HRPersonCostHolder
If _HRPersonCostHolder.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCostHolder.DateTo.Date >= _GLReportRows.DateExecution.Date Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _HRPersonCustomers.HRPerson
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
End If
Next
End If
End If
Next
ElseIf _GLReportRows.UniqueObjects IsNot Nothing Then
Dim _FixedAssets As FixedAssets = _uow.FindObject(Of FixedAssets)(CriteriaOperator.Parse("UniqueObjects.Oid=?", _GLReportRows.UniqueObjects.Oid))
If _FixedAssets IsNot Nothing Then
If _FixedAssets.HRPerson_Using IsNot Nothing Then
If _FixedAssets.HRPerson_Using.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _FixedAssets.HRPerson_Using.HRPersonCostHolder
If _HRPersonCostHolder.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCostHolder.DateTo.Date >= _GLReportRows.DateExecution.Date Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _FixedAssets.HRPerson_Using
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
End If
Next
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
ElseIf _FixedAssets.CostHolder_Using IsNot Nothing Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _FixedAssets.CostHolder_Using
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
Else
Dim _HRPerson As HRPerson = _uow.FindObject(Of HRPerson)(CriteriaOperator.Parse("UniqueObjects.Oid=?", _GLReportRows.UniqueObjects.Oid))
If _HRPerson IsNot Nothing Then
If _HRPerson.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _HRPerson.HRPersonCostHolder
If _HRPersonCostHolder.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCostHolder.DateTo.Date >= _GLReportRows.DateExecution.Date Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _HRPerson
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
End If
Next
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
End If
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
ElseIf _GLReportRows.GLRows.PartnerType = ePartnerType.eNotSet Then
Dim _HRPersonCustomers_Collection As New XPCollection(Of HRPersonCustomers)(_uow, CriteriaOperator.Parse("Customers=?", _GLReportRows.Customers))
If _HRPersonCustomers_Collection.Count > 0 Then
For Each _HRPersonCustomers As HRPersonCustomers In _HRPersonCustomers_Collection
If _HRPersonCustomers.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCustomers.DateTo.Date >= _GLReportRows.DateExecution.Date Then
If _HRPersonCustomers.HRPerson.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _HRPersonCustomers.HRPerson.HRPersonCostHolder
If _HRPersonCostHolder.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCostHolder.DateTo.Date >= _GLReportRows.DateExecution.Date Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _HRPersonCustomers.HRPerson
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
End If
Next
End If
End If
Next
ElseIf _GLReportRows.UniqueObjects IsNot Nothing Then
Dim _FixedAssets As FixedAssets = _uow.FindObject(Of FixedAssets)(CriteriaOperator.Parse("UniqueObjects.Oid=?", _GLReportRows.UniqueObjects.Oid))
If _FixedAssets IsNot Nothing Then
If _FixedAssets.HRPerson_Using IsNot Nothing Then
If _FixedAssets.HRPerson_Using.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _FixedAssets.HRPerson_Using.HRPersonCostHolder
If _HRPersonCostHolder.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCostHolder.DateTo.Date >= _GLReportRows.DateExecution.Date Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _FixedAssets.HRPerson_Using
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
End If
Next
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
ElseIf _FixedAssets.CostHolder_Using IsNot Nothing Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _FixedAssets.CostHolder_Using
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
Else
Dim _HRPerson As HRPerson = _uow.FindObject(Of HRPerson)(CriteriaOperator.Parse("UniqueObjects.Oid=?", _GLReportRows.UniqueObjects.Oid))
If _HRPerson IsNot Nothing Then
If _HRPerson.HRPersonCostHolder.Count > 0 Then
For Each _HRPersonCostHolder As HRPersonCostHolder In _HRPerson.HRPersonCostHolder
If _HRPersonCostHolder.DateFrom.Date <= _GLReportRows.DateExecution.Date And _
_HRPersonCostHolder.DateTo.Date >= _GLReportRows.DateExecution.Date Then
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _HRPersonCostHolder.CostHolder
_GLReportRowsCostHolder.HRPerson = _HRPerson
_GLReportRowsCostHolder.FixedAssets = _FixedAssets
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount * (_HRPersonCostHolder.WorkPercent / 100)
End If
Next
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
End If
Else
_GLReportRowsCostHolder = New GLReportRowsCostHolder(_uow)
_GLReportRowsCostHolder.GLReport = _GLReportRows.GLReport
_GLReportRowsCostHolder.GLReportRows = _GLReportRows
_GLReportRowsCostHolder.CostHolder = _GLReportRows.CostHolder
_GLReportRowsCostHolder.BallanceAmount = _GLReportRows.BallanceAmount
End If
End If
End If
End Sub
Private Sub aViewAttachments_DTR_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aViewAttachments_DTR.Execute
Dim _GLReportRows As GLReportRows = TryCast(View.SelectedObjects(0), GLReportRows)
Dim _CustomersFrom As CustomersFrom = _GLReportRows.CustomersFrom
Dim _Customers As Customers = _GLReportRows.Customers
Dim _DocumentNumber As String = _GLReportRows.ConnectInfo
ViewAttachments.ViewAttachments(View.ObjectSpace, Frame, _CustomersFrom, _Customers, _DocumentNumber, "")
End Sub
Private Sub aViewRegistry_DTR_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aViewRegistry_DTR.Execute
Dim _GLReportRows As GLReportRows = TryCast(View.SelectedObjects(0), GLReportRows)
Dim _CustomersFrom As CustomersFrom = _GLReportRows.CustomersFrom
Dim _Customers As Customers = _GLReportRows.Customers
Dim _DocumentNumber As String = _GLReportRows.ConnectInfo
ViewRegistry.ViewRegistry(View.ObjectSpace, Application, e, _CustomersFrom, _Customers, _DocumentNumber)
End Sub
Private Sub aGLDTRChangeParam_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aGLDTRChangeParam.CustomizePopupWindowParams
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _GLRowsCheck As GLRowsCheck = _onew.CreateObject(Of GLRowsCheck)()
Dim _GLReportRows As GLReportRows = TryCast(View.SelectedObjects(0), GLReportRows)
If _GLReportRows IsNot Nothing Then
If _GLReportRows.GLRows IsNot Nothing Then
_GLRowsCheck.ChartOfAccountsYear = _onew.FindObject(Of ChartOfAccountsYear)(CriteriaOperator.Parse("AccountYear=?", _GLReportRows.GLRows.GLHeader.DateExecution.Year))
Else
_GLRowsCheck.ChartOfAccountsYear = _onew.FindObject(Of ChartOfAccountsYear)(CriteriaOperator.Parse("AccountYear=?", GetSQLTime(_onew.Session).Year))
End If
Else
_GLRowsCheck.ChartOfAccountsYear = _onew.FindObject(Of ChartOfAccountsYear)(CriteriaOperator.Parse("AccountYear=?", GetSQLTime(_onew.Session).Year))
End If
e.View = Application.CreateDetailView(_onew, "GLRowsCheck_DetailView", False, _GLRowsCheck)
End Sub
Private Sub aGLDTRChangeParam_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aGLDTRChangeParam.Execute
Frame.GetController(Of DevExpress.ExpressApp.Validation.PersistenceValidationController)().Active.SetItemValue("", False)
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _GLRowsCheck As GLRowsCheck = TryCast(e.PopupWindow.View.SelectedObjects(0), GLRowsCheck)
Dim _GLRows As GLRows
Dim _GLReportRows As GLReportRows
Dim I As Long = 0
Dim _Controlling As Controlling
Dim _JobNumberObjects As JobNumberObjects
Dim _CostHolder As CostHolder
Dim _CostPlace As CostPlace
Dim _UniqueObjects As UniqueObjects
Dim _DebitChartOfAccounts As ChartOfAccounts
Dim _CreditChartOfAccounts As ChartOfAccounts
If _GLRowsCheck.Controlling IsNot Nothing Then
_Controlling = _ocur.FindObject(Of Controlling)(CriteriaOperator.Parse("Oid=?", _GLRowsCheck.Controlling.Oid), True)
If _Controlling.Children.Count > 0 Then
Throw New Exception(String.Format("Nem gyermekobjektum. <<{0}>> Csak gyermekobjektum választható ki !", _Controlling.Name))
Exit Sub
End If
Else
_Controlling = Nothing
End If
If _GLRowsCheck.JobNumberObjects IsNot Nothing Then
_JobNumberObjects = _ocur.FindObject(Of JobNumberObjects)(CriteriaOperator.Parse("Oid=?", _GLRowsCheck.JobNumberObjects.Oid), True)
Else
_JobNumberObjects = Nothing
End If
If _GLRowsCheck.CostHolder IsNot Nothing Then
_CostHolder = _ocur.FindObject(Of CostHolder)(CriteriaOperator.Parse("Oid=?", _GLRowsCheck.CostHolder.Oid), True)
Else
_CostHolder = Nothing
End If
If _GLRowsCheck.CostPlace IsNot Nothing Then
_CostPlace = _ocur.FindObject(Of CostPlace)(CriteriaOperator.Parse("Oid=?", _GLRowsCheck.CostPlace.Oid), True)
Else
_CostPlace = Nothing
End If
If _GLRowsCheck.UniqueObjects IsNot Nothing Then
_UniqueObjects = _ocur.FindObject(Of UniqueObjects)(CriteriaOperator.Parse("Oid=?", _GLRowsCheck.UniqueObjects.Oid), True)
Else
_UniqueObjects = Nothing
End If
If _GLRowsCheck.DebitChartOfAccounts IsNot Nothing Then
_DebitChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("Oid=?", _GLRowsCheck.DebitChartOfAccounts.Oid), True)
Else
_DebitChartOfAccounts = Nothing
End If
If _GLRowsCheck.CreditChartOfAccounts IsNot Nothing Then
_CreditChartOfAccounts = _ocur.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("Oid=?", _GLRowsCheck.CreditChartOfAccounts.Oid), True)
Else
_CreditChartOfAccounts = Nothing
End If
If _DebitChartOfAccounts IsNot Nothing And _CreditChartOfAccounts IsNot Nothing Then
If _DebitChartOfAccounts.Oid = _CreditChartOfAccounts.Oid Then
Throw New Exception("*A tartozik és a követel számlaszám NEM lehet azonos !")
Exit Sub
End If
End If
RaiseEvent InitWork(1, 1, View.SelectedObjects.Count)
For Each _GLReportRows In View.SelectedObjects
I += 1
RaiseEvent DoWork()
_GLRows = _GLReportRows.GLRows
If _GLRows IsNot Nothing Then
If _Controlling IsNot Nothing Then
_GLRows.Controlling = _Controlling
_GLReportRows.Controlling = _Controlling
If _GLRows.RegistryRowsFinancialControlling IsNot Nothing Then
_GLRows.RegistryRowsFinancialControlling.Controlling = _Controlling
_GLRows.RegistryRowsFinancialControlling.Save()
End If
If _GLRows.InvoiceRows IsNot Nothing Then
_GLRows.InvoiceRows.Controlling = _Controlling
_GLRows.InvoiceRows.Save()
End If
End If
If _JobNumberObjects IsNot Nothing Then
_GLRows.JobNumberObjects = _JobNumberObjects
_GLReportRows.JobNumberObjects = _JobNumberObjects
If _GLRows.RegistryRowsFinancialControlling IsNot Nothing Then
_GLRows.RegistryRowsFinancialControlling.JobNumberObjects = _JobNumberObjects
_GLRows.RegistryRowsFinancialControlling.Save()
End If
If _GLRows.InvoiceRows IsNot Nothing Then
_GLRows.InvoiceRows.JobNumberObjects = _JobNumberObjects
_GLRows.InvoiceRows.Save()
End If
End If
If _CostHolder IsNot Nothing Then
_GLRows.CostHolder = _CostHolder
_GLReportRows.CostHolder = _CostHolder
If _GLRows.RegistryRowsFinancialControlling IsNot Nothing Then
_GLRows.RegistryRowsFinancialControlling.CostHolder = _CostHolder
_GLRows.RegistryRowsFinancialControlling.Save()
End If
If _GLRows.InvoiceRows IsNot Nothing Then
_GLRows.InvoiceRows.CostHolder = _CostHolder
_GLRows.InvoiceRows.Save()
End If
End If
If _CostPlace IsNot Nothing Then
_GLRows.CostPlace = _CostPlace
_GLReportRows.CostPlace = _CostPlace
If _GLRows.RegistryRowsFinancialControlling IsNot Nothing Then
_GLRows.RegistryRowsFinancialControlling.CostPlace = _CostPlace
_GLRows.RegistryRowsFinancialControlling.Save()
End If
If _GLRows.InvoiceRows IsNot Nothing Then
_GLRows.InvoiceRows.CostPlace = _CostPlace
_GLRows.InvoiceRows.Save()
End If
End If
If _UniqueObjects IsNot Nothing Then _GLRows.UniqueObjects = _UniqueObjects
_GLRows.Save()
End If
If I Mod 100 = 0 Then _ocur.CommitChanges()
Next
_ocur.CommitChanges()
RaiseEvent FinalWork
Dim nestedFrame As NestedFrame = TryCast(Frame, NestedFrame)
If nestedFrame IsNot Nothing Then
Dim parentView As View = nestedFrame.View
parentView.ObjectSpace.Refresh()
End If
Frame.GetController(Of DevExpress.ExpressApp.Validation.PersistenceValidationController)().Active.SetItemValue("", True)
End Sub
Private Sub aSelectCustomersFrom_DTR_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aSelectCustomersFrom_DTR.CustomizePopupWindowParams
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CS As New CollectionSource(_onew, GetType(CustomersFrom))
'_CS.BeginUpdateCriteria()
'_CS.Criteria.Clear()
'_CS.Criteria("First") = ""
'_CS.EndUpdateCriteria()
e.View = Application.CreateListView("CustomersFrom_ListView_Select", _CS, False)
End Sub
Private Sub aSelectCustomersFrom_DTR_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aSelectCustomersFrom_DTR.Execute
Dim _GLReport As GLReport = TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
Dim _CustomersFrom As CustomersFrom
Dim _GLReportCustomersFrom As GLReportCustomersFrom
If _GLReport Is Nothing Then Exit Sub
If e.PopupWindow.View.SelectedObjects.Count > 0 Then
For Each _CustomersFrom In e.PopupWindow.View.SelectedObjects
_GLReportCustomersFrom = New GLReportCustomersFrom(_uow)
_GLReportCustomersFrom.GLReport = _uow.GetObjectByKey(Of GLReport)(_GLReport.Oid)
_GLReportCustomersFrom.CustomersFrom = _uow.GetObjectByKey(Of CustomersFrom)(_CustomersFrom.Oid)
Next
_uow.CommitChanges()
End If
Dim nestedFrame As NestedFrame = TryCast(Frame, NestedFrame)
If nestedFrame IsNot Nothing Then
Dim parentView As View = nestedFrame.View
parentView.ObjectSpace.Refresh()
End If
End Sub
Private Sub aSelectChartOfAccounts_DTR_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aSelectChartOfAccounts_DTR.CustomizePopupWindowParams
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CS As New CollectionSource(_onew, GetType(ChartOfAccounts))
_CS.BeginUpdateCriteria()
_CS.Criteria.Clear()
_CS.Criteria("First") = CriteriaOperator.Parse("AccountYear=?", Year(Now))
_CS.EndUpdateCriteria()
e.View = Application.CreateListView("ChartOfAccounts_ListView_Select", _CS, False)
End Sub
Private Sub aSelectChartOfAccounts_DTR_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aSelectChartOfAccounts_DTR.Execute
Dim _GLReport As GLReport = TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
Dim _ChartOfAccounts As ChartOfAccounts
Dim _GLReportChartOfAccounts As GLReportChartOfAccounts
If _GLReport Is Nothing Then Exit Sub
If e.PopupWindow.View.SelectedObjects.Count > 0 Then
For Each _ChartOfAccounts In e.PopupWindow.View.SelectedObjects
_GLReportChartOfAccounts = New GLReportChartOfAccounts(_uow)
_GLReportChartOfAccounts.GLReport = _uow.GetObjectByKey(Of GLReport)(_GLReport.Oid)
_GLReportChartOfAccounts.AccountNumber = _ChartOfAccounts.AccountNumber
_GLReportChartOfAccounts.ShortName = _ChartOfAccounts.Name
Next
_uow.CommitChanges()
End If
Dim nestedFrame As NestedFrame = TryCast(Frame, NestedFrame)
If nestedFrame IsNot Nothing Then
Dim parentView As View = nestedFrame.View
parentView.ObjectSpace.Refresh()
End If
End Sub
' Private Function GetListViewModel(obj As Object) As IModelListView
' '// Futás közben ListView készítése
' Dim viewId As String = obj.[GetType]().Name & "_ListView_Custom"
' Dim modelListView As IModelListView = TryCast(Application.FindModelView(viewId), IModelListView)
' If modelListView Is Nothing Then
' modelListView = Application.Model.Views.AddNode(Of IModelListView)(viewId)
' modelListView.ModelClass = Application.Model.BOModel.GetClass(obj.[GetType]())
' End If
' Return modelListView
' End Function
' Private Function GetListViewModel(viewId As String) As IModelView
' Dim modelListView As IModelListView = TryCast(Application.FindModelView(viewId), IModelListView)
' If modelListView Is Nothing Then
' modelListView = Application.Model.Views.AddNode(Of IModelListView)(viewId)
' modelListView.ModelClass = Application.Model.BOModel.GetClass(myAnalisys.TargetObjectType)
'New DevExpress.ExpressApp.Model.NodeGenerators.ModelListViewColumnsNodesGenerator().GenerateNodes(DirectCast(modelListView.Columns, ModelNode))
' End If
' Return modelListView
' End Function
End Class