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

912 lines
49 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.Data.Filtering
Imports DevExpress.Xpo
Imports DevExpress.ExpressApp.SystemModule
Imports System.IO
Imports DevExpress.ExpressApp.Editors
Imports DevExpress.Persistent.Validation
Imports DevExpress.ExpressApp.Model
Public Class GLBankVC
Inherits DevExpress.ExpressApp.ViewController
Protected selection As ArrayList
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()
selection = New ArrayList()
'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)
MyBase.OnActivated()
Frame.GetController(Of GLBankVC).aMakeEditable_GLBank.Active.SetItemValue("", False)
Frame.GetController(Of GLBankVC).aRecalculateBallance.Active.SetItemValue("", False)
If View.Id Like "GLHeader_GLRows_ListView_Bank" Then
Frame.GetController(Of LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of ListViewProcessCurrentObjectController).Active.SetItemValue("", False)
Dim nv As ListView = CType(View, ListView)
Dim cs As PropertyCollectionSource = CType(nv.CollectionSource, PropertyCollectionSource)
AddHandler cs.MasterObjectChanged, AddressOf cs_MasterObjectChanged
End If
If View.Id = "GLBank_DetailView" Then
Frame.GetController(Of DeleteObjectsViewController).Active.SetItemValue("", False)
Frame.GetController(Of CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
Dim _GLBank As GLBank = TryCast(View.CurrentObject, GLBank)
If _GLBank Is Nothing Then
Else
If _GLBank.IsEditable = False Then
Frame.GetController(Of ModificationsController).Active.SetItemValue("", False)
Frame.GetController(Of GLBankVC).aFinal_GLBank.Active.SetItemValue("", False)
Frame.GetController(Of GLBankVC).aFinalAndNew_GLBank.Active.SetItemValue("", False)
Frame.GetController(Of GLBankVC).aToTable_GLBank.Active.SetItemValue("", False)
Frame.GetController(Of GLBankVC).aToTableD_GLBank.Active.SetItemValue("", False)
Frame.GetController(Of GLBankVC).aBackToRowEdit_GLBank.Active.SetItemValue("", False)
Frame.GetController(Of GLBankVC).aImportSavedBank.Active.SetItemValue("", False)
Frame.GetController(Of GLBankVC).aImportPCIGroupBank.Active.SetItemValue("", False)
Else
If _ocur.Session.IsNewObject(_GLBank) = False Then
_GLBank.BallanceHUF = _GLBank.GetBallanceOpenHUF(_GLBank.LiquidAssets_Main, _GLBank.DateExecution)
_GLBank.BallanceDEV = _GLBank.GetBallanceOpenDEV(_GLBank.LiquidAssets_Main, _GLBank.DateExecution)
_GLBank.RecalculateTotal()
End If
End If
If _GLBank.IsStorno = True Then
Frame.GetController(Of ModificationsController).Active.SetItemValue("", False)
Frame.GetController(Of DeleteObjectsViewController).Active.SetItemValue("", False)
End If
End If
End If
If View.Id = "GLBank_ListView" Then
Frame.GetController(Of DeleteObjectsViewController).Active.SetItemValue("", False)
Frame.GetController(Of CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of GLBankVC).aMakeEditable_GLBank.Active.SetItemValue("", True)
Frame.GetController(Of GLBankVC).aRecalculateBallance.Active.SetItemValue("", True)
End If
If View.Id = "GLBank_ListView_Editable" Then
AddHandler Frame.GetController(Of DeleteObjectsViewController).DeleteAction.Executed, AddressOf GLBank_DeleteAction_Executed
Frame.GetController(Of CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
End If
If View.Id = "PCIGroup_ListView_HUF" Then
Frame.GetController(Of LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DeleteObjectsViewController)().Active.SetItemValue("", False)
End If
If View.Id = "GLBankPrepareName_GLBankPrepareNameGroup_ListView" Then
Frame.GetController(Of NewObjectViewController).Active.SetItemValue("", False)
Frame.GetController(Of LinkUnlinkController).Active.SetItemValue("", False)
Frame.GetController(Of DeleteObjectsViewController).Active.SetItemValue("", False)
AddHandler View.SelectionChanged, AddressOf view_SelectionChanged
End If
'If View.Id = "PCIGroup_ListView_Find" Then
' Dim ListView As ListView = TryCast(View, ListView)
' ListView.CollectionSource.Criteria.Clear()
'End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
If View.Id = "GLBank_ListView" Then
Frame.GetController(Of DeleteObjectsViewController).Active.SetItemValue("", True)
End If
If View.Id Like "GLHeader_GLRows_ListView_Bank" Then
Frame.GetController(Of LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of NewObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of CloneObject.CloneObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of ListViewProcessCurrentObjectController).Active.SetItemValue("", True)
Dim nv As ListView = CType(View, ListView)
Dim cs As PropertyCollectionSource = CType(nv.CollectionSource, PropertyCollectionSource)
RemoveHandler cs.MasterObjectChanged, AddressOf cs_MasterObjectChanged
End If
If View.Id = "PCIGroup_ListView_HUF" Then
Frame.GetController(Of LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of NewObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DeleteObjectsViewController)().Active.SetItemValue("", True)
End If
End Sub
Private Sub view_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs)
If View Is Nothing Then Exit Sub
If View.Id = "GLBankPrepareName_GLBankPrepareNameGroup_ListView" Then
Dim nv As ListView = CType(View, ListView)
Dim cs As PropertyCollectionSource = CType(nv.CollectionSource, PropertyCollectionSource)
Dim _GLBankPrepareName As GLBankPrepareName
Dim _GLBankPrepareNameGroup As GLBankPrepareNameGroup
_GLBankPrepareName = TryCast(cs.MasterObject, GLBankPrepareName)
If _GLBankPrepareName IsNot Nothing Then
If View.SelectedObjects.Count > 0 Then
_GLBankPrepareNameGroup = TryCast(View.SelectedObjects(0), GLBankPrepareNameGroup)
If _GLBankPrepareNameGroup IsNot Nothing Then
_GLBankPrepareName.BankPrepareName = _GLBankPrepareNameGroup.BankPrepareName
End If
End If
End If
End If
End Sub
Private Sub cs_MasterObjectChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim _GLBank As GLBank = TryCast((CType(sender, PropertyCollectionSource)).MasterObject, GLBank)
If _GLBank.IsEditable = False Then
Frame.GetController(Of GLBankVC).aToTable_GLBank.Active.SetItemValue("", False)
End If
End Sub
Private Sub aMakeEditable_GLBank_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aMakeEditable_GLBank.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _GLBank As GLBank = TryCast(View.SelectedObjects(0), GLBank)
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
If _GLBank IsNot Nothing Then
_GLBank.IsEditable = True
_ocur.CommitChanges()
e.ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, "GLBank_DetailView", True, _onew.GetObject(_GLBank))
End If
End Sub
Private Sub aFinalAndNew_GLBank_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aFinalAndNew_GLBank.Execute
GLBank_Final(e)
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _GLBank_Finalized = _onew.GetObject(TryCast(e.SelectedObjects(0), GLBank))
Dim _GLBank As GLBank = _onew.CreateObject(Of GLBank)()
_GLBank.CustomersFrom = _GLBank_Finalized.CustomersFrom
_GLBank.LiquidAssets_Main = _GLBank_Finalized.LiquidAssets_Main
_GLBank.DateExecution = _GLBank_Finalized.DateExecution
e.ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, TryCast(View.Model, Model.IModelDetailView).Id, True, _GLBank)
e.ShowViewParameters.TargetWindow = TargetWindow.Current
End Sub
Private Sub aToTable_GLBank_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aToTable_GLBank.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _GLBank As GLBank = TryCast(View.SelectedObjects(0), GLBank)
Dim _GLHeader As GLHeader = TryCast(_GLBank, GLHeader)
Dim _GLRows As GLRows
Dim _GUID As Guid = Guid.NewGuid()
Dim _CashType As eCashType
If _GLBank Is Nothing Then Exit Sub
_GLRows = _ocur.CreateObject(Of GLRows)()
If _GLBank.row_TransactionType = eTransactionType.ePartnerCredit Or _GLBank.row_TransactionType = eTransactionType.ePartnerDebit Then
_CashType = eCashType.ePartner
If _GLBank.row_PartnerType = ePartnerType.eReceivables Then
If _GLBank.row_TransactionType = eTransactionType.ePartnerCredit Then
_GLHeader.row_DebitChartOfAccounts = _GLBank.LiquidAssets_Main.GetChartOfAccounts(_GLBank.DateExecution.Year, 0)
_GLHeader.row_CreditChartOfAccounts = _GLBank.row_Customer.CustomersGLParameters.GetChartOfAccounts(_GLBank.DateExecution.Year, eVATMode.eOut)
ElseIf _GLBank.row_TransactionType = eTransactionType.ePartnerDebit Then
_GLHeader.row_DebitChartOfAccounts = _GLBank.row_Customer.CustomersGLParameters.GetChartOfAccounts(_GLBank.DateExecution.Year, eVATMode.eOut)
_GLHeader.row_CreditChartOfAccounts = _GLBank.LiquidAssets_Main.GetChartOfAccounts(_GLBank.DateExecution.Year, 0)
End If
Else
If _GLBank.row_TransactionType = eTransactionType.ePartnerCredit Then
_GLHeader.row_DebitChartOfAccounts = _GLBank.LiquidAssets_Main.GetChartOfAccounts(_GLBank.DateExecution.Year, 0)
_GLHeader.row_CreditChartOfAccounts = _GLBank.row_Customer.CustomersGLParameters.GetChartOfAccounts(_GLBank.DateExecution.Year, eVATMode.eIn)
ElseIf _GLBank.row_TransactionType = eTransactionType.ePartnerDebit Then
_GLHeader.row_DebitChartOfAccounts = _GLBank.row_Customer.CustomersGLParameters.GetChartOfAccounts(_GLBank.DateExecution.Year, eVATMode.eIn)
_GLHeader.row_CreditChartOfAccounts = _GLBank.LiquidAssets_Main.GetChartOfAccounts(_GLBank.DateExecution.Year, 0)
End If
End If
Else
_CashType = eCashType.eNormal
If _GLBank.row_TransactionType = eTransactionType.eNormalCredit Or _GLBank.row_TransactionType = eTransactionType.eCorrectionCreditHUF Then
_GLHeader.row_DebitChartOfAccounts = _GLBank.LiquidAssets_Main.GetChartOfAccounts(_GLBank.DateExecution.Year, 0)
_GLHeader.row_CreditChartOfAccounts = _GLBank.row_ChartOfAccounts
Else
_GLHeader.row_DebitChartOfAccounts = _GLBank.row_ChartOfAccounts
_GLHeader.row_CreditChartOfAccounts = _GLBank.LiquidAssets_Main.GetChartOfAccounts(_GLBank.DateExecution.Year, 0)
End If
End If
Select Case _GLBank.row_TransactionType
Case eTransactionType.eNormalCredit, eTransactionType.ePartnerCredit, eTransactionType.eCorrectionCreditHUF
_GLRows.CreditAmountHUF = _GLHeader.row_AmountHUF
_GLRows.CreditAmountDEV = _GLHeader.row_AmountDEV
_GLRows.DebitAmountHUF = 0
_GLRows.DebitAmountDEV = 0
_GLRows.InAmountHUF = _GLHeader.row_AmountHUF
_GLRows.InAmountDEV = _GLHeader.row_AmountDEV
_GLRows.InAmountDEV2 = _GLBank.row_AmountDEV2
_GLRows.CurrencyRate2 = _GLBank.row_CurrencyRate2
Case eTransactionType.eNormalDebit, eTransactionType.ePartnerDebit, eTransactionType.eCorrectionDebitHUF
_GLRows.DebitAmountHUF = _GLHeader.row_AmountHUF
_GLRows.DebitAmountDEV = _GLHeader.row_AmountDEV
_GLRows.CreditAmountDEV = 0
_GLRows.CreditAmountDEV = 0
_GLRows.OutAmountHUF = _GLHeader.row_AmountHUF
_GLRows.OutAmountDEV = _GLHeader.row_AmountDEV
_GLRows.OutAmountDEV2 = _GLBank.row_AmountDEV2
_GLRows.CurrencyRate2 = _GLBank.row_CurrencyRate2
End Select
_GLRows.PartnerType = _GLBank.row_PartnerType
_GLRows.AddGLRows(_GLHeader, _GLHeader.row_DebitChartOfAccounts, _GLHeader.row_CreditChartOfAccounts, _
_GLHeader.row_AmountDEV, _GLHeader.row_AmountHUF, _GLBank.LiquidAssets_Main, _
_GLHeader.row_Customer, _GLHeader.row_DateVAT, _GLHeader.row_VAT, _
_GLHeader.row_NoteRows, _GLHeader.row_UniqueObjects, _GLHeader.row_Controlling, _
_GLHeader.row_JobNumberObjects, _GLHeader.row_CostPlace, _GLHeader.row_CostHolder, _
_GLHeader.row_ConnectInfo, eGLRowsTypeVAT.eNettoRow, _GUID, _
_GLBank.row_TransactionType, _CashType, _GLBank.row_PartnerType)
_GLBank.RecalculateTotal()
_GLBank.GetBallanceDEV(_GLBank.LiquidAssets_Main, _GLBank.DateExecution)
_GLBank.GetBallanceHUF(_GLBank.LiquidAssets_Main, _GLBank.DateExecution)
_ocur.CommitChanges()
'--- Pontozás ellenőrzése !!!! ----------------------------------------------------------------------------------------------------------------
Select Case _GLBank.row_TransactionType
Case eTransactionType.ePartnerCredit, eTransactionType.ePartnerDebit
Dim _uow_pci As New UnitOfWork(_ocur.Session.DataLayer)
GLFunctions.ReconfigurePCI(_uow_pci, _GLBank.CustomersFrom, _GLRows.Customer, _GLRows.PartnerType, _GLRows.ConnectInfo)
End Select
'----------------------------------------------------------------------------------------------------------------------------------------------
_GLBank.row_NoteRows = ""
_GLBank.row_AmountDEV = 0
_GLBank.row_AmountHUF = 0
_GLBank.row_PCIGroup = Nothing
_GLBank.row_Customer = Nothing
_GLBank.row_ConnectInfo = ""
_GLBank.row_ChartOfAccounts = Nothing
_GLBank.row_AmountDEV2 = 0
_GLBank.row_CurrencyRate2 = 0
'// Fókusz beállítása !!!!!!!!!!!!!!!!!!!!!!----------------------------------------------------------------
Dim _Action As IModelAction
Dim _IModelActionExtender As IModelActionExtender
For Each _Action In Application.Model.ActionDesign.Actions
If _Action.Id = e.Action.Id Then
_IModelActionExtender = TryCast(_Action, IModelActionExtender)
If _IModelActionExtender IsNot Nothing Then
If String.IsNullOrEmpty(_IModelActionExtender.FocusItem) = False Then
Dim ItemToFocus As ViewItem = TryCast(View, DetailView).FindItem(_IModelActionExtender.FocusItem)
If ItemToFocus IsNot Nothing Then
Dim ItemControl As Object
ItemControl = ItemToFocus.Control
ItemControl.Focus()
End If
End If
End If
Exit For
End If
Next
'--------------------------------------------------------------------------------------------------------
View.Refresh()
End Sub
Private Sub aFinal_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aFinal_GLBank.Execute
GLBank_Final(e)
View.Close(False)
End Sub
#Region "SIS"
Public Sub GLBank_Final(ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs)
If View.SelectedObjects.Count > 0 Then
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _GLBank As GLBank = TryCast(e.SelectedObjects(0), GLBank)
Dim _GLRows As GLRows
For Each _GLBank In e.SelectedObjects
If _GLBank.GLRows.Count <= 0 Then
Throw New Exception("*Nincs rögzített sor !")
End If
For Each _GLRows In _GLBank.GLRows
_GLRows.LiquidAssets = _GLBank.LiquidAssets_Main
Next
_GLBank.GetBallanceHUF(_GLBank.LiquidAssets_Main, _GLBank.DateExecution)
_GLBank.GetBallanceDEV(_GLBank.LiquidAssets_Main, _GLBank.DateExecution)
_GLBank.IsEditable = False
_ocur.CommitChanges()
'// Az összes sorra vonatkozó pontozás újragenerálása, mert változhat a dátum !
For Each _GLRows In _GLBank.GLRows
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
GLFunctions.ReconfigurePCI(_uow, _GLRows.GLHeader.CustomersFrom, _GLRows.Customer, _GLRows.PartnerType, _GLRows.ConnectInfo)
Next
Next
If _GLBank.CurrencyName.ShortName <> "HUF" Then
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
GenerateCurrencyRateAverageStart(_uow, _GLBank.DateExecution.Year, _GLBank)
End If
End If
End Sub
Private Sub GenerateCurrencyRateAverageStart(_uow As UnitOfWork, _Year As Long, _GLBank As GLBank)
Dim _GLRows_Collection As New XPCollection(Of GLRows) _
(PersistentCriteriaEvaluationBehavior.InTransaction, _uow, _
CriteriaOperator.Parse("LiquidAssets.Oid=? and GLHeader.IsEditable=False and GetDate(GLHeader.DateExecution)>=?", _
_GLBank.LiquidAssets_Main.Oid, New Date(_Year, 1, 1)))
Dim _GLRows As GLRows
Dim _SumAmountDEV As Double = 0
Dim _SumAmountHUF As Double = 0
Dim _LiquidAssetsRate As LiquidAssetsRate = _uow.FindObject(Of LiquidAssetsRate)(CriteriaOperator.Parse("LiquidAssets.oid=? and GetYear(DateExecution)=?", _
_GLBank.LiquidAssets_Main.Oid, _
_Year))
If _LiquidAssetsRate IsNot Nothing Then
_SumAmountDEV = _LiquidAssetsRate.AmountDEV
_SumAmountHUF = _LiquidAssetsRate.AmountHUF
Else
'// HA NINCS BEÁLLÍTVA AKKOR NEM FUT LE !"
Exit Sub
End If
_GLRows_Collection.Sorting.Add(New SortProperty("GetDate(GLHeader.DateExecution)", DB.SortingDirection.Ascending))
_GLRows_Collection.Sorting.Add(New SortProperty("InAmountDEV", DB.SortingDirection.Descending))
RaiseEvent InitWork(1, 1, _GLRows_Collection.Count)
For Each _GLRows In _GLRows_Collection
'// A deviza a fix és az MNB árfolyammal újra kell számolni mindent
RaiseEvent DoWork()
If _GLRows.InAmountDEV > 0 Then
Dim _CurrencyRate_MNB_Collection = New XPCollection(Of CurrencyRate) _
(_uow, CriteriaOperator.Parse("CurrencyName.ShortName=? and IsMNB=True and GetDate(DateValid)<=?", _
_GLBank.LiquidAssets_Main.CurrencyName.ShortName, _GLRows.GLHeader.DateExecution.Date))
_CurrencyRate_MNB_Collection.Sorting.Add(New SortProperty("DateValid", DB.SortingDirection.Descending))
If _CurrencyRate_MNB_Collection.Count > 0 Then
For Each _CurrencyRate_MNB In _CurrencyRate_MNB_Collection
If _CurrencyRate_MNB.DateValid.Date = _GLRows.GLHeader.DateExecution.Date Then
_GLRows.InAmountHUF = Math.Round(_CurrencyRate_MNB.RateAverage * _GLRows.InAmountDEV, 2, MidpointRounding.AwayFromZero)
_GLRows.AmountHUF = _GLRows.InAmountHUF
Exit For
End If
Next
End If
End If
Next
RaiseEvent FinalWork
_uow.CommitChanges()
_GLRows_Collection = New XPCollection(Of GLRows) _
(PersistentCriteriaEvaluationBehavior.InTransaction, _uow, _
CriteriaOperator.Parse("LiquidAssets.Oid=? and GLHeader.IsEditable=False and GetDate(GLHeader.DateExecution)>=?", _
_GLBank.LiquidAssets_Main.Oid, New Date(_Year, 1, 1)))
_GLRows_Collection.Sorting.Add(New SortProperty("GetDate(GLHeader.DateExecution)", DB.SortingDirection.Ascending))
_GLRows_Collection.Sorting.Add(New SortProperty("InAmountDEV", DB.SortingDirection.Descending))
_GLRows_Collection.Sorting.Add(New SortProperty("OutAmountDEV", DB.SortingDirection.Ascending))
RaiseEvent InitWork(1, 1, _GLRows_Collection.Count)
For Each _GLRows In _GLRows_Collection
RaiseEvent DoWork()
'// Árfolyamok helyrerakása
If _GLRows.OutAmountDEV > 0 Then
If _SumAmountDEV <> 0 Then
_GLRows.OutAmountHUF = Math.Round(_GLRows.OutAmountDEV * (_SumAmountHUF / _SumAmountDEV), 2, MidpointRounding.AwayFromZero)
_GLRows.AmountHUF = _GLRows.OutAmountHUF
_GLRows.Save()
_uow.CommitChanges()
If _GLRows.PartnerType <> ePartnerType.eNotSet Then
GLFunctions.ReconfigurePCI(_uow, _GLRows.GLHeader.CustomersFrom, _GLRows.Customer, _GLRows.PartnerType, _GLRows.ConnectInfo)
_uow.CommitChanges()
End If
Else
Dim _CurrencyRate_MNB_Collection = New XPCollection(Of CurrencyRate) _
(_uow, CriteriaOperator.Parse("CurrencyName.ShortName=? and IsMNB=True and GetDate(DateValid)<=?", _
_GLBank.LiquidAssets_Main.CurrencyName.ShortName, _GLRows.GLHeader.DateExecution.Date))
_CurrencyRate_MNB_Collection.Sorting.Add(New SortProperty("DateValid", DB.SortingDirection.Descending))
If _CurrencyRate_MNB_Collection.Count > 0 Then
For Each _CurrencyRate_MNB In _CurrencyRate_MNB_Collection
If _CurrencyRate_MNB.DateValid.Date = _GLRows.GLHeader.DateExecution.Date Then
_GLRows.OutAmountHUF = Math.Round(_CurrencyRate_MNB.RateAverage * _GLRows.OutAmountDEV, 2, MidpointRounding.AwayFromZero)
_GLRows.AmountHUF = _GLRows.OutAmountHUF
_GLRows.Save()
_uow.CommitChanges()
If _GLRows.PartnerType <> ePartnerType.eNotSet Then
GLFunctions.ReconfigurePCI(_uow, _GLRows.GLHeader.CustomersFrom, _GLRows.Customer, _GLRows.PartnerType, _GLRows.ConnectInfo)
_uow.CommitChanges()
End If
Exit For
End If
Next
End If
End If
_SumAmountDEV -= Math.Round(_GLRows.OutAmountDEV, 2, MidpointRounding.AwayFromZero)
_SumAmountHUF -= Math.Round(_GLRows.OutAmountHUF, 2, MidpointRounding.AwayFromZero)
If _SumAmountDEV < 0 Then _SumAmountDEV = 0
If _SumAmountHUF < 0 Then _SumAmountHUF = 0
Else
_SumAmountDEV += Math.Round(_GLRows.InAmountDEV, 2, MidpointRounding.AwayFromZero)
_SumAmountHUF += Math.Round(_GLRows.InAmountHUF, 2, MidpointRounding.AwayFromZero)
End If
Next
_uow.CommitChanges()
RaiseEvent FinalWork
End Sub
#End Region
Private Sub aToTableD_GLBank_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aToTableD_GLBank.Execute
'Törli a táblázatban lévő sort
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _GUID As Guid
Dim _GLBank As GLBank = TryCast(View.SelectedObjects(0), GLBank)
Dim _GLRows_ListEditor As ListPropertyEditor
Dim _GLRows As GLRows
Dim i As Long
Dim _CustomersFrom As CustomersFrom
Dim _Customers As Customers
Dim _PartnerType As ePartnerType
Dim _ConnectInfo As String
_GLRows_ListEditor = TryCast(View, DetailView).FindItem("GLRows")
_GLRows = TryCast(_GLRows_ListEditor.ListView.CurrentObject, GLRows)
If _GLRows.GLRowsRateDiff IsNot Nothing Then
Throw New Exception("*Nem lehet a sort törölni mert van árfolyam elszámolás !")
Exit Sub
End If
If _GLRows IsNot Nothing Then
_GUID = _GLRows.GLRowsGUID
selection.Clear()
For Each _GLRows In _GLBank.GLRows
If _GLRows.GLRowsGUID = _GUID Then
selection.Add(_GLRows)
End If
Next
For i = 0 To selection.Count - 1
_GLRows = TryCast(selection(i), GLRows)
If _GLRows.PartnerType = ePartnerType.ePayabels Or _GLRows.PartnerType = ePartnerType.eReceivables Then
_CustomersFrom = _GLBank.CustomersFrom
_Customers = _GLRows.Customer
_ConnectInfo = _GLRows.ConnectInfo
_PartnerType = _GLRows.PartnerType
End If
_GLRows.Delete()
_ocur.CommitChanges()
Dim _uow_pci As New UnitOfWork(_ocur.Session.DataLayer)
GLFunctions.ReconfigurePCI(_uow_pci, _CustomersFrom, _Customers, _PartnerType, _ConnectInfo)
Next
_GLBank.RecalculateTotal()
_ocur.CommitChanges()
View.Refresh()
End If
End Sub
Private Sub aBackToRowEdit_GLBank_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aBackToRowEdit_GLBank.Execute
'Visszatölti a sort editáláshoz
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _GLBank As GLBank = TryCast(View.SelectedObjects(0), GLBank)
Dim _GLRows_ListEditor As ListPropertyEditor
Dim _GLRows As GLRows
Dim _PCIGroup As PCIGroup
Dim _CustomersFrom As CustomersFrom
Dim _Customers As Customers
Dim _PartnerType As ePartnerType
Dim _ConnectInfo As String
_GLRows_ListEditor = TryCast(View, DetailView).FindItem("GLRows")
_GLRows = TryCast(_GLRows_ListEditor.ListView.CurrentObject, GLRows)
If _GLRows IsNot Nothing Then
If _GLRows.GLRowsRateDiff IsNot Nothing Then
Throw New Exception("*Nem lehet a sort törölni mert van árfolyam elszámolás !")
Exit Sub
End If
_GLBank.row_CurrencyName2 = _ocur.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName=?", _GLBank.CurrencyName.ShortName))
_PCIGroup = _ocur.FindObject(Of PCIGroup) _
(CriteriaOperator.Parse("CustomersFrom=? and Customers=? and PartnerType=? and ConnectInfo=? ", _GLRows.GLHeader.CustomersFrom, _
_GLRows.Customer, _GLRows.PartnerType, _GLRows.ConnectInfo), True)
If _PCIGroup IsNot Nothing Then
_GLBank.row_PCIGroup = _PCIGroup
If _PCIGroup.CurrencyName_Account Is Nothing Then
_GLBank.row_CurrencyName2 = _ocur.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName=?", _PCIGroup.CurrencyName.ShortName))
Else
_GLBank.row_CurrencyName2 = _ocur.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName=?", _PCIGroup.CurrencyName_Account.ShortName))
End If
If _GLBank.row_CurrencyName2 Is Nothing Then
_GLBank.row_CurrencyName2 = _ocur.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName=?", _GLBank.CurrencyName.ShortName))
End If
End If
_GLBank.row_TransactionType = _GLRows.TransactionType
_GLBank.row_PartnerType = _GLRows.PartnerType
_GLBank.row_Customer = _GLRows.Customer
_GLBank.row_ConnectInfo = _GLRows.ConnectInfo
_GLBank.row_NoteRows = _GLRows.NoteRows
_GLBank.row_CurrencyRate = _GLRows.CurrencyRate
_GLBank.row_CurrencyRate2 = _GLRows.CurrencyRate2
If _GLRows.InAmountHUF > 0 Then
_GLBank.row_ChartOfAccounts = _GLRows.CreditChartOfAccounts
_GLBank.row_AmountDEV2 = _GLRows.InAmountDEV2
Else
_GLBank.row_ChartOfAccounts = _GLRows.DebitChartOfAccounts
_GLBank.row_AmountDEV2 = _GLRows.OutAmountDEV2
End If
selection.Clear()
Dim _GLRows_GUID_Collection As New XPCollection(Of GLRows)(PersistentCriteriaEvaluationBehavior.InTransaction, _ocur.Session, CriteriaOperator.Parse("GLRowsGUID=?", _GLRows.GLRowsGUID))
Dim _AmountDEV As Double = 0
Dim _AmountHUF As Double = 0
For Each _GLRows In _GLRows_GUID_Collection
_AmountDEV += _GLRows.AmountDEV
_AmountHUF += _GLRows.AmountHUF
selection.Add(_GLRows)
Next
_GLBank.row_AmountDEV = _AmountDEV
_GLBank.row_AmountHUF = _AmountHUF
For i = 0 To selection.Count - 1
_GLRows = TryCast(selection(i), GLRows)
If _GLRows.PartnerType = ePartnerType.ePayabels Or _GLRows.PartnerType = ePartnerType.eReceivables Then
_CustomersFrom = _GLBank.CustomersFrom
_Customers = _GLRows.Customer
_ConnectInfo = _GLRows.ConnectInfo
_PartnerType = _GLRows.PartnerType
End If
_GLRows.Delete()
_ocur.CommitChanges()
Dim _uow_pci As New UnitOfWork(_ocur.Session.DataLayer)
GLFunctions.ReconfigurePCI(_uow_pci, _CustomersFrom, _Customers, _PartnerType, _ConnectInfo)
Next
End If
View.Refresh()
End Sub
Private Sub aImportSavedBank_CustomizePopupWindowParams(ByVal sender As Object, ByVal e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aImportSavedBank.CustomizePopupWindowParams
Dim _GLBank As GLBank = View.SelectedObjects(0)
Dim _ocur As Xpo.XPObjectSpace = View.ObjectSpace
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CS As New CollectionSource(_onew, GetType(RegistryBankTransferView))
Dim _RegistryBankTransferviewCollection As XPCollection = _onew.CreateCollection(GetType(RegistryBankTransferView), _
CriteriaOperator.Parse("BankSavedFileName !='' and RegistryHeader.CustomersFrom=? and (BallanceHUF <> 0 Or BallanceDEV <> 0)", _onew.GetObject(_GLBank.CustomersFrom)))
Dim _KeyCollection As Collection = New Collection()
Dim _RegistryBankTransferView As RegistryBankTransferView
For Each _RegistryBankTransferView In _RegistryBankTransferviewCollection
_KeyCollection.Add(_RegistryBankTransferView.Oid)
Next
Dim _InOperator As New InOperator("Oid", _KeyCollection)
_CS.BeginUpdateCriteria()
_CS.Criteria.Clear()
_CS.Criteria("First") = _InOperator
_CS.EndUpdateCriteria()
e.View = Application.CreateListView("RegistryBankTransfer_ListView_Import", _CS, False)
e.View.Refresh()
End Sub
Private Sub aImportSavedBank_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aImportSavedBank.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
Dim _GLRows As GLRows
Dim _GLHeader As GLHeader = TryCast(View.SelectedObjects(0), GLHeader)
Dim _GLBank As GLBank = TryCast(View.SelectedObjects(0), GLBank)
Dim _RegistryBankTransfer_view_onew As RegistryBankTransferView
Dim _RegistryBankTransfer_view As RegistryBankTransferView
Dim _RegistryBankTransfer As RegistryBankTransfer
Dim _DebitChartOfAccounts As ChartOfAccounts
Dim _CreditChartOfAccounts As ChartOfAccounts
Dim _GUID As Guid
For Each _RegistryBankTransfer_view_onew In e.PopupWindow.View.SelectedObjects
_RegistryBankTransfer_view = _ocur.GetObject(_RegistryBankTransfer_view_onew)
_RegistryBankTransfer = _ocur.FindObject(Of RegistryBankTransfer)(CriteriaOperator.Parse("Oid=?", _RegistryBankTransfer_view.Oid))
_GLRows = _ocur.CreateObject(Of GLRows)()
_GUID = Guid.NewGuid
_DebitChartOfAccounts = _RegistryBankTransfer.RegistryHeader.Customers.CustomersGLParameters.GetChartOfAccounts(_RegistryBankTransfer.RegistryHeader.F_DateExecution.Year, eVATMode.eIn)
_CreditChartOfAccounts = _GLBank.LiquidAssets_Main.GetChartOfAccounts(_RegistryBankTransfer.RegistryHeader.F_DateExecution.Year, 0)
_GLRows.DebitAmountHUF = _RegistryBankTransfer.AmountHUF
_GLRows.DebitAmountDEV = _RegistryBankTransfer.AmountDEV
_GLRows.OutAmountHUF = _RegistryBankTransfer.AmountHUF
_GLRows.OutAmountDEV = _RegistryBankTransfer.AmountDEV
_GLRows.AddGLRows(_GLHeader, _DebitChartOfAccounts, _CreditChartOfAccounts, _
_RegistryBankTransfer.AmountDEV, _RegistryBankTransfer.AmountHUF, _GLHeader.row_LiquidAssets, _
_RegistryBankTransfer.RegistryHeader.Customers, _GLHeader.row_DateVAT, _GLHeader.row_VAT, _
_GLHeader.row_NoteRows, _GLHeader.row_UniqueObjects, _GLHeader.row_Controlling, _
_GLHeader.row_JobNumberObjects, _GLHeader.row_CostPlace, _GLHeader.row_CostHolder, _
_RegistryBankTransfer.RegistryHeader.DocumentNumber, eGLRowsTypeVAT.eNettoRow, _GUID, _
eTransactionType.ePartnerDebit, eCashType.ePartner, ePartnerType.ePayabels)
_ocur.CommitChanges()
GLFunctions.ReconfigurePCI(_uow, _GLBank.CustomersFrom, _RegistryBankTransfer.RegistryHeader.Customers, ePartnerType.ePayabels, _RegistryBankTransfer.RegistryHeader.DocumentNumber)
Next
_GLBank.RecalculateTotal()
View.Refresh()
End Sub
Private Sub aRecalculateBallance_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aRecalculateBallance.Execute
Dim _LiquidAssets As LiquidAssets = TryCast(e.SelectedObjects(0), GLBank).LiquidAssets_Main
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _GLBank_Collection As New XPCollection(Of GLBank)(_ocur.Session, CriteriaOperator.Parse("LiquidAssets_Main=? and IsEditable=False ", _LiquidAssets))
Dim _GLBank As GLBank
Dim _GLRows As GLRows
Dim _InAmountHUF As Double = 0
Dim _OutAmountHUF As Double = 0
Dim _InAmountDEV As Double = 0
Dim _OutAmountDEV As Double = 0
Dim I As Long = 0
Dim _InAmountHUF_Open As Double = 0
Dim _OutAmountHUF_Open As Double = 0
Dim _InAmountDEV_Open As Double = 0
Dim _OutAmountDEV_Open As Double = 0
Dim _InAmountHUF_Close As Double = 0
Dim _OutAmountHUF_Close As Double = 0
Dim _InAmountDEV_Close As Double = 0
Dim _OutAmountDEV_Close As Double = 0
Try
GLOBAL_HAS_Audit = False
If _LiquidAssets IsNot Nothing Then
_GLBank_Collection.Sorting.Add(New SortProperty("DateExecution", DB.SortingDirection.Ascending))
_GLBank_Collection.Sorting.Add(New SortProperty("DocumentNumber", DB.SortingDirection.Ascending))
_InAmountHUF = 0
_InAmountDEV = 0
_OutAmountHUF = 0
_OutAmountDEV = 0
RaiseEvent InitWork(1, 1, _GLBank_Collection.Count)
For Each _GLBank In _GLBank_Collection
_GLBank.BallanceHUF = 0
_GLBank.BallanceDEV = 0
RaiseEvent DoWork()
I += 1
If I > 1 Then
_GLBank.BallanceHUF = _InAmountHUF - _OutAmountHUF
_GLBank.BallanceDEV = _InAmountDEV - _OutAmountDEV
_ocur.CommitChanges()
End If
For Each _GLRows In _GLBank.GLRows
_InAmountDEV += _GLRows.InAmountDEV
_InAmountHUF += _GLRows.InAmountHUF
_OutAmountDEV += _GLRows.OutAmountDEV
_OutAmountHUF += _GLRows.OutAmountHUF
Next
_GLBank.RecalculateTotal()
Next
End If
_ocur.CommitChanges()
View.Refresh()
Catch ex As Exception
MsgBox(ex.Message)
Finally
GLOBAL_HAS_Audit = True
RaiseEvent FinalWork
End Try
End Sub
Private Sub aGLBankDivideRows_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aGLBankDivideRows.CustomizePopupWindowParams
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _GLRowsDivideH As GLRowsDivideH = _onew.CreateObject(Of GLRowsDivideH)()
Dim _GLRows As GLRows = TryCast(View.SelectedObjects(0), GLRows)
If _GLRows IsNot Nothing Then
If _GLRows.PartnerType = ePartnerType.ePayabels Or _GLRows.PartnerType = ePartnerType.eReceivables Then
_GLRowsDivideH.GLRows_Oid = _GLRows.Oid
_GLRowsDivideH.row_Customers = _onew.GetObject(_GLRows.Customer)
_GLRowsDivideH.row_PartnerType = _GLRows.PartnerType
e.View = Application.CreateDetailView(_onew, "GLRowsDivideH_DetailView_ConnectionDivide", False, _GLRowsDivideH)
Else
_GLRowsDivideH.GLRows_Oid = _GLRows.Oid
e.View = Application.CreateDetailView(_onew, "GLRowsDivideH_DetailView", False, _GLRowsDivideH)
End If
End If
End Sub
Private Sub aGLBankDivideRows_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aGLBankDivideRows.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _GLRowsDivideH As GLRowsDivideH = TryCast(e.PopupWindow.View.SelectedObjects(0), GLRowsDivideH)
Dim _GLRows As GLRows = TryCast(View.SelectedObjects(0), GLRows)
If _GLRows IsNot Nothing Then
_GLRows.DivideRows(_ocur, _GLRows, _GLRowsDivideH, True)
End If
End Sub
Private Sub aGenerateGLBankRateDiff_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aGenerateGLBankRateDiff.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _GLBank As GLBank = TryCast(e.SelectedObjects(0), GLBank)
For Each _GLBank In e.SelectedObjects
If Not _GLBank.CurrencyName.ShortName = "HUF" Then
_GLBank.Reconfigure_RateDiff(_ocur, _GLBank)
End If
Next
_ocur.CommitChanges()
View.Refresh()
End Sub
Private Sub aImportPCIGroupBank_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aImportPCIGroupBank.CustomizePopupWindowParams
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _ocur As Xpo.XPObjectSpace = View.ObjectSpace
Dim _GLBank As GLBank = TryCast(View.SelectedObjects(0), GLBank)
Dim _CollectionSource As CollectionSource = New CollectionSource(_onew, GetType(PCIGroup))
Dim _P As PCIGroup
If _GLBank IsNot Nothing Then
_CollectionSource.Criteria.Clear()
_CollectionSource.BeginUpdateCriteria()
_CollectionSource.Criteria("1") = CriteriaOperator.Parse("CurrencyName_Account.ShortName=?", _GLBank.LiquidAssets_Main.CurrencyName.ShortName)
_CollectionSource.Criteria("2") = CriteriaOperator.Parse("PartnerType=?", _GLBank.row_PartnerType)
_CollectionSource.Criteria("3") = CriteriaOperator.Parse("CustomersFrom.Oid=?", _GLBank.CustomersFrom.Oid)
If _GLBank.LiquidAssets_Main.CurrencyName.ShortName = "HUF" Then
_CollectionSource.Criteria("4") = CriteriaOperator.Parse("BallanceHUF>0")
Else
_CollectionSource.Criteria("4") = CriteriaOperator.Parse("BallanceDEV>0")
End If
_CollectionSource.EndUpdateCriteria()
e.View = Application.CreateListView("PCIGroup_ListView_Find", _CollectionSource, True)
End If
End Sub
Private Sub aImportPCIGroupBank_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aImportPCIGroupBank.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _PCIGroup As PCIGroup
Dim _PCIGroup_P As PCIGroup
Dim _GLBank As GLBank = TryCast(View.SelectedObjects(0), GLBank)
Dim _GLHeader As GLHeader = TryCast(_GLBank, GLHeader)
Dim _GLRows As GLRows
Dim _GUID As Guid
Dim _CashType As eCashType
Dim _DebitChartOfAccounts As ChartOfAccounts
Dim _CreditChartOfAccounts As ChartOfAccounts
Dim _TransactionType As eTransactionType
If _GLBank Is Nothing Then Exit Sub
For Each _PCIGroup_P In e.PopupWindow.View.SelectedObjects
_PCIGroup = _ocur.GetObject(_PCIGroup_P)
_GLRows = _ocur.CreateObject(Of GLRows)()
_GUID = Guid.NewGuid()
_CashType = eCashType.ePartner
If _PCIGroup.PartnerType = ePartnerType.eReceivables Then
_DebitChartOfAccounts = _GLBank.LiquidAssets_Main.GetChartOfAccounts(_GLBank.DateExecution.Year, 0)
_CreditChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_GLBank.DateExecution.Year, eVATMode.eOut)
_TransactionType = eTransactionType.ePartnerCredit
Else
_DebitChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_PCIGroup.DateExecution_Account.Year, eVATMode.eIn)
_CreditChartOfAccounts = _GLBank.LiquidAssets_Main.GetChartOfAccounts(_GLBank.DateExecution.Year, 0)
_TransactionType = eTransactionType.ePartnerDebit
End If
Select Case _PCIGroup.PartnerType
Case ePartnerType.eReceivables
_GLRows.CreditAmountHUF = _PCIGroup.BallanceHUF
_GLRows.CreditAmountDEV = _PCIGroup.BallanceDEV
_GLRows.DebitAmountHUF = 0
_GLRows.DebitAmountDEV = 0
_GLRows.InAmountHUF = _PCIGroup.BallanceHUF
_GLRows.InAmountDEV = _PCIGroup.BallanceDEV
Case ePartnerType.ePayabels
_GLRows.DebitAmountHUF = _PCIGroup.BallanceHUF
_GLRows.DebitAmountDEV = _PCIGroup.BallanceDEV
_GLRows.CreditAmountDEV = 0
_GLRows.CreditAmountDEV = 0
_GLRows.OutAmountHUF = _PCIGroup.BallanceHUF
_GLRows.OutAmountDEV = _PCIGroup.BallanceDEV
End Select
_GLRows.PartnerType = _PCIGroup.PartnerType
_GLRows.AddGLRows(_GLHeader, _DebitChartOfAccounts, _CreditChartOfAccounts, _
_PCIGroup.BallanceDEV, _PCIGroup.BallanceHUF, _GLBank.LiquidAssets_Main, _
_PCIGroup.Customers, _GLHeader.row_DateVAT, _GLHeader.row_VAT, _
_GLHeader.row_NoteRows, _GLHeader.row_UniqueObjects, _GLHeader.row_Controlling, _
_GLHeader.row_JobNumberObjects, _GLHeader.row_CostPlace, _GLHeader.row_CostHolder, _
_PCIGroup.ConnectInfo, eGLRowsTypeVAT.eNettoRow, _GUID, _
_TransactionType, _CashType, _PCIGroup.PartnerType)
_GLBank.RecalculateTotal()
_GLBank.GetBallanceDEV(_GLBank.row_LiquidAssets, _GLBank.DateExecution)
_GLBank.GetBallanceHUF(_GLBank.row_LiquidAssets, _GLBank.DateExecution)
_ocur.CommitChanges()
'--- Pontozás ellenőrzése !!!! ----------------------------------------------------------------------------------------------------------------
Dim _uow_pci As New UnitOfWork(_ocur.Session.DataLayer)
GLFunctions.ReconfigurePCI(_uow_pci, _GLBank.CustomersFrom, _GLRows.Customer, _GLRows.PartnerType, _GLRows.ConnectInfo)
Next
End Sub
Private Sub GLBank_DeleteAction_Executed(sender As Object, e As ActionBaseEventArgs)
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
Dim _GLBank As GLBank
Dim _GLRows As GLRows
Dim _GLRows_Collection As XPCollection(Of GLRows)
For Each _GLBank In TryCast(e, SimpleActionExecuteEventArgs).SelectedObjects
'// Pontozás erre a bankra vonatkozólag törölni !
_GLRows_Collection = New XPCollection(Of GLRows)(PersistentCriteriaEvaluationBehavior.InTransaction, _ocur.Session, CriteriaOperator.Parse("PartnerType<>'eNotSet' and GLHeader.Oid=?", _GLBank.Oid), True)
For Each _GLRows In _GLRows_Collection
GLFunctions.ReconfigurePCI(_uow, _GLBank.CustomersFrom, _GLRows.Customer, _GLRows.PartnerType, _GLRows.ConnectInfo)
Next
Next
End Sub
Private Sub aPCICheckBankTransfer_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aPCICheckBankTransfer.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
Dim _RegistryBankTransferView As RegistryBankTransferView
RaiseEvent InitWork(1, 1, View.SelectedObjects.Count)
For Each _RegistryBankTransferView In View.SelectedObjects
RaiseEvent DoWork()
If _RegistryBankTransferView IsNot Nothing Then
GLFunctions.ReconfigurePCI(_uow, _RegistryBankTransferView.RegistryHeader.CustomersFrom, _RegistryBankTransferView.RegistryHeader.Customers, 1, _RegistryBankTransferView.RegistryHeader.F_ConnectInfo)
End If
Next
RaiseEvent FinalWork
Frame.GetController(Of RefreshController).RefreshAction.DoExecute()
End Sub
Private Sub aGetCurrencyRateBank_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aGetCurrencyRateBank.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _GLBank As GLBank = TryCast(View.SelectedObjects(0), GLBank)
If _GLBank IsNot Nothing Then
_GLBank.row_CurrencyRate = _GLBank.LiquidAssets_Main.GetCurrencyRateDate(_ocur, _GLBank.row_TransactionType, _GLBank.LiquidAssets_Main, _GLBank.DateExecution)
End If
End Sub
End Class