Files
Nuvolar/Nuvolar.Module/BusinessObjects/Financial/FinancialObjects/FinancialTransactions/Fixed Assets/FixedAssetsQueryVC.vb
T
2017-03-08 11:21:27 +01:00

71 lines
3.5 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
Public Class FixedAssetsQueryVC
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
Private Sub aGenerateFixedAssetsQuery_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aGenerateFixedAssetsQuery.Execute
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _FixedAssetsQueryHeader As FixedAssetsQueryHeader = _onew.GetObject(TryCast(View.SelectedObjects(0), FixedAssetsQueryHeader))
Dim _FixedAssetsCard_Collection As XPCollection(Of FixedAssetsCard)
Dim _FixedAssetsCard As FixedAssetsCard = Nothing
Dim _FixedAssetsQueryRows As FixedAssetsQueryRows = Nothing
_onew.Delete(_FixedAssetsQueryHeader.FixedAssetsQueryRows)
_FixedAssetsCard_Collection = New XPCollection(Of FixedAssetsCard)(_onew.Session, CriteriaOperator.Parse("IsEditable=False and IsActivated=True and CustomersFrom=?", _FixedAssetsQueryHeader.CustomersFrom))
For Each _FixedAssetsCard In _FixedAssetsCard_Collection
_FixedAssetsQueryRows = _onew.CreateObject(Of FixedAssetsQueryRows)()
_FixedAssetsQueryRows.FixedAssetsQueryHeader = _FixedAssetsQueryHeader
_FixedAssetsQueryRows.FixedAssetsCard = _FixedAssetsCard
'// ÉCS
Dim _FixedAssetsCardPlanRows_Collection As New XPCollection(Of FixedAssetsCardPlanRows)(_onew.Session, CriteriaOperator.Parse("FixedAssetsCard=? and FixedAssetsCardPlanRowsType in (1,3) and DateTo<?", _FixedAssetsCard, _FixedAssetsQueryHeader.DateClose.AddDays(1)))
Dim _FixedAssetsCardPlanRows As FixedAssetsCardPlanRows
_FixedAssetsCardPlanRows_Collection.Sorting.Add(New SortProperty("RowIndex", DB.SortingDirection.Descending))
For Each _FixedAssetsCardPlanRows In _FixedAssetsCardPlanRows_Collection
_FixedAssetsQueryRows.AmountHUFBrutto = _FixedAssetsCardPlanRows.BruttoHUFBallance
_FixedAssetsQueryRows.AmountHUFNettoA = _FixedAssetsCardPlanRows.NettoHUFBallanceACC
_FixedAssetsQueryRows.AmountHUFNettoT = _FixedAssetsCardPlanRows.NettoHUFBallanceTAX
_FixedAssetsQueryRows.AmountHUFDecrepationA = _FixedAssetsQueryRows.AmountHUFBrutto - _FixedAssetsQueryRows.AmountHUFDecrepationA
_FixedAssetsQueryRows.AmountHUFDecrepationT = _FixedAssetsQueryRows.AmountHUFBrutto - _FixedAssetsQueryRows.AmountHUFDecrepationT
Exit For
Next
'// Ha van kivezetési sor akkor módosul pár dolog
_FixedAssetsCardPlanRows = _onew.FindObject(Of FixedAssetsCardPlanRows)(CriteriaOperator.Parse("FixedAssetsCard=? and FixedAssetsCardPlanRowsType in (5) and DateTo<?", _FixedAssetsCard, _FixedAssetsQueryHeader.DateClose.AddDays(1)))
If _FixedAssetsCardPlanRows IsNot Nothing Then
End If
Next
_onew.CommitChanges()
View.Refresh()
End Sub
End Class