1374 lines
78 KiB
VB.net
1374 lines
78 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.ExpressApp.CloneObject
|
|
Imports System.IO
|
|
|
|
Imports DevExpress.WebUtils
|
|
|
|
|
|
Public Class PCIVC
|
|
Inherits DevExpress.ExpressApp.ViewController
|
|
Protected selection As ArrayList
|
|
Protected noselect As Boolean = False
|
|
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()
|
|
MyBase.OnActivated()
|
|
AddHandler View.SelectionChanged, AddressOf view_SelectionChanged
|
|
|
|
|
|
Frame.GetController(Of PCIVC).aPCIGenerate.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PCIVC).aPCICheck.Active.SetItemValue("", False)
|
|
|
|
'-- Pontozások
|
|
Frame.GetController(Of PCIVC).aCreateConnectionDirectDifferentCurrency.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PCIVC).aCreateConnectionDirect.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PCIVC).aCreateConnectionDrop.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PCIVC).aCreateRateDiffPCIGroup.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PCIVC).aCreateConnectionLiquidAssets.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PCIVC).aCreateConnectionDivide.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PCIVC).aCreateConnectionAccount.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PCIVC).aCreateRoundingPCIGroup.Active.SetItemValue("", False)
|
|
|
|
'--- Betekintések ...
|
|
Frame.GetController(Of PCIVC).aViewAttachmentsPCIGroup.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PCIVC).aViewPCIDGroup.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PCIVC).aViewRegistryPCIGroup.Active.SetItemValue("", False)
|
|
|
|
If View.Id = "PCIGroup_ListView_DelayedPay" Then
|
|
Frame.GetController(Of PCIVC).aViewAttachmentsPCIGroup.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aViewPCIDGroup.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aPCICheck.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aRepairPCIGroup.Active.SetItemValue("", False)
|
|
End If
|
|
If View.Id = "PCIGroup_ListView" Then
|
|
Frame.GetController(Of NewObjectViewController)?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of ListViewProcessCurrentObjectController)?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DeleteObjectsViewController)?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of ModificationsController)?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of CloneObjectViewController)?.Active.SetItemValue("", False)
|
|
|
|
|
|
|
|
Frame.GetController(Of PCIVC).aPCIGenerate.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aPCICheck.Active.SetItemValue("", True)
|
|
|
|
Frame.GetController(Of PCIVC).aViewAttachmentsPCIGroup.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aViewPCIDGroup.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aViewRegistryPCIGroup.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aCreateRoundingPCIGroup.Active.SetItemValue("", True)
|
|
End If
|
|
|
|
If View.Id = "PCIDetail_ListView" Then
|
|
Frame.GetController(Of NewObjectViewController)?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of ListViewProcessCurrentObjectController)?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DeleteObjectsViewController)?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of ModificationsController)?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of CloneObjectViewController)?.Active.SetItemValue("", False)
|
|
|
|
|
|
Frame.GetController(Of PCIVC).aCreateConnectionDirectDifferentCurrency.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aCreateConnectionDirect.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aCreateConnectionDrop.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aCreateConnectionLiquidAssets.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aCreateConnectionDivide.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aCreateConnectionAccount.Active.SetItemValue("", True)
|
|
End If
|
|
|
|
If View.Id = "PCIGroup_ListView_Rate" Then
|
|
Frame.GetController(Of PCIVC).aCreateRateDiffPCIGroup.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aPCICheck.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aViewAttachmentsPCIGroup.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aViewPCIDGroup.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aViewRegistryPCIGroup.Active.SetItemValue("", True)
|
|
End If
|
|
|
|
If View.Id = "PCIGroup_ListView_Rounding" Then
|
|
Frame.GetController(Of PCIVC).aCreateRoundingPCIGroup.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aViewAttachmentsPCIGroup.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aViewPCIDGroup.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aViewRegistryPCIGroup.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PCIVC).aPCICheck.Active.SetItemValue("", True)
|
|
End If
|
|
|
|
|
|
End Sub
|
|
Protected Overrides Sub OnDeactivated()
|
|
MyBase.OnDeactivated()
|
|
Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", True)
|
|
RemoveHandler View.SelectionChanged, AddressOf view_SelectionChanged
|
|
End Sub
|
|
Private Sub view_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs)
|
|
Dim _PCIDetail As PCIDetail
|
|
Dim _PCIGroup As PCIGroup
|
|
If View Is Nothing Then Exit Sub
|
|
|
|
If View.Id Like "PCIDetail*" And noselect = False Then
|
|
selection.Clear()
|
|
For Each _PCIDetail In View.SelectedObjects
|
|
selection.Add(_PCIDetail)
|
|
Next
|
|
End If
|
|
|
|
If View.Id = "PCIGroup_ListView_Rate" And noselect = False Then
|
|
selection.Clear()
|
|
For Each _PCIGroup In View.SelectedObjects
|
|
selection.Add(_PCIGroup)
|
|
Next
|
|
End If
|
|
If View.Id = "PCIGroup_ListView_Rounding" And noselect = False Then
|
|
selection.Clear()
|
|
For Each _PCIGroup In View.SelectedObjects
|
|
selection.Add(_PCIGroup)
|
|
Next
|
|
End If
|
|
If View.Id = "PCIGroup_ListView" And noselect = False Then
|
|
selection.Clear()
|
|
For Each _PCIGroup In View.SelectedObjects
|
|
selection.Add(_PCIGroup)
|
|
Next
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub aPCIGenerate_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aPCIGenerate.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
|
|
Dim _GLAccounts As GLAccounts
|
|
Dim _GLRows As GLRows
|
|
Dim _InvoiceHeader As InvoiceHeader
|
|
Dim _RegistryHeader As RegistryHeader
|
|
|
|
'// Ki kell dobni minden korábbi pontozást !
|
|
'Dim _PCIDetail_Collection As New XPCollection(Of PCIDetail)(_uow)
|
|
'_uow.Delete(_PCIDetail_Collection)
|
|
|
|
'Dim _PCIGroup_Collection As New XPCollection(Of PCIGroup)(_uow)
|
|
'_uow.Delete(_PCIGroup_Collection)
|
|
|
|
Select Case GLOBAL_SQLType
|
|
Case eSQLType.PostgreSQL
|
|
_uow.ExecuteNonQuery("delete from ""PCIDetail""")
|
|
_uow.ExecuteNonQuery("update ""InvoiceHeader"" set ""PCIGroup""=Null")
|
|
_uow.ExecuteNonQuery("update ""PCIGroupAging"" set ""PCIGroup""=Null")
|
|
_uow.ExecuteNonQuery("delete from ""PCIGroup""")
|
|
_uow.CommitChanges()
|
|
Case Else
|
|
_uow.ExecuteNonQuery("delete from PCIDetail")
|
|
_uow.ExecuteNonQuery("update InvoiceHeader set PCIGroup=Null")
|
|
_uow.ExecuteNonQuery("update PCIGroupAging set PCIGroup=Null")
|
|
_uow.ExecuteNonQuery("delete from PCIGroup")
|
|
_uow.CommitChanges()
|
|
|
|
End Select
|
|
|
|
'//
|
|
|
|
Dim _GLAccounts_Collection As New XPCollection(Of GLAccounts)(PersistentCriteriaEvaluationBehavior.InTransaction, _
|
|
_uow, CriteriaOperator.Parse("IsDeleted=False and PartnerType in (0,1) and IsEditable=False"))
|
|
RaiseEvent InitWork(1, 1, _GLAccounts_Collection.Count)
|
|
For Each _GLAccounts In _GLAccounts_Collection
|
|
RaiseEvent DoWork()
|
|
GLFunctions.ReconfigurePCI(_uow, _GLAccounts.CustomersFrom, _GLAccounts.Customers, _GLAccounts.PartnerType, _GLAccounts.ConnectInfo)
|
|
Next
|
|
RaiseEvent FinalWork
|
|
|
|
Dim _GLRows_Collection As New XPCollection(Of GLRows)(_uow, CriteriaOperator.Parse("isnull(Customer)=False and PartnerType in (0,1)"))
|
|
RaiseEvent InitWork(1, 1, _GLRows_Collection.Count)
|
|
For Each _GLRows In _GLRows_Collection
|
|
RaiseEvent DoWork()
|
|
GLFunctions.ReconfigurePCI(_uow, _GLRows.GLHeader.CustomersFrom, _GLRows.Customer, _GLRows.PartnerType, _GLRows.ConnectInfo)
|
|
Next
|
|
RaiseEvent FinalWork
|
|
|
|
Dim _InvoiceHeader_Collection As New XPCollection(Of InvoiceHeader)(_uow, CriteriaOperator.Parse("isnull(Customers)=False and IsEditable=False and isnull(GLAccounts)=True"))
|
|
RaiseEvent InitWork(1, 1, _InvoiceHeader_Collection.Count)
|
|
For Each _InvoiceHeader In _InvoiceHeader_Collection
|
|
RaiseEvent DoWork()
|
|
GLFunctions.ReconfigurePCI(_uow, _InvoiceHeader.CustomersFrom, _InvoiceHeader.Customers, 0, _InvoiceHeader.ConnectInfo)
|
|
Next
|
|
RaiseEvent FinalWork
|
|
|
|
Dim _RegistryHeader_Collection As New XPCollection(Of RegistryHeader)(_uow, CriteriaOperator.Parse("RegistryAcceptState=0 and RegistryType.RegistryMainType=0 and IsEditable=False and isnull(F_GLAccounts)=True"))
|
|
RaiseEvent InitWork(1, 1, _RegistryHeader_Collection.Count)
|
|
For Each _RegistryHeader In _RegistryHeader_Collection
|
|
RaiseEvent DoWork()
|
|
GLFunctions.ReconfigurePCI(_uow, _RegistryHeader.CustomersFrom, _RegistryHeader.Customers, 1, _RegistryHeader.DocumentNumber)
|
|
Next
|
|
RaiseEvent FinalWork
|
|
|
|
If Frame.GetController(Of RefreshController).Active.ResultValue = True Then
|
|
If Frame.GetController(Of RefreshController).RefreshAction.Active.ResultValue = True Then
|
|
Frame.GetController(Of RefreshController).RefreshAction.DoExecute()
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub aViewPCIDGroup_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aViewPCIDGroup.Execute
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _PCIGroup As PCIGroup = TryCast(View.SelectedObjects(0), PCIGroup)
|
|
|
|
ViewPDCI.ViewPDCIDetail(_onew, Application, e, _PCIGroup.CustomersFrom, _
|
|
_PCIGroup.Customers, _PCIGroup.PartnerType, _
|
|
_PCIGroup.ConnectInfo)
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionDirect_Cancel(ByVal sender As Object, ByVal e As System.EventArgs) Handles aCreateConnectionDirect.Cancel
|
|
noselect = False
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionDirect_CustomizePopupWindowParams(ByVal sender As Object, ByVal e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aCreateConnectionDirect.CustomizePopupWindowParams
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _PartnerConnectionInfoCleanUp_PopupWindow As PartnerConnectionInfoCleanUp_PopupWindow
|
|
Dim _PCIDetail As PCIDetail
|
|
Dim _PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem As PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem
|
|
|
|
Dim _CustomersFrom As CustomersFrom
|
|
Dim _Customers As Customers
|
|
Dim _PartnerType As ePartnerType
|
|
Dim _IsAccount As Boolean = False
|
|
Dim _AccountCount As Long = 0
|
|
Dim _Currency_Account As String
|
|
noselect = True
|
|
|
|
_PartnerConnectionInfoCleanUp_PopupWindow = _onew.FindObject(Of PartnerConnectionInfoCleanUp_PopupWindow)(CriteriaOperator.Parse("1=1"))
|
|
|
|
If _PartnerConnectionInfoCleanUp_PopupWindow Is Nothing Then
|
|
_PartnerConnectionInfoCleanUp_PopupWindow = _onew.CreateObject(Of PartnerConnectionInfoCleanUp_PopupWindow)()
|
|
End If
|
|
|
|
If _PartnerConnectionInfoCleanUp_PopupWindow.PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem.Count > 0 Then
|
|
_onew.Delete(_PartnerConnectionInfoCleanUp_PopupWindow.PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem)
|
|
End If
|
|
|
|
For Each _PCIDetail In selection
|
|
If _PCIDetail.MainType = "01-Account" Then
|
|
_PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo = _PCIDetail.ConnectInfo
|
|
_PartnerType = _PCIDetail.PartnerType
|
|
_Customers = _PCIDetail.Customers
|
|
_CustomersFrom = _PCIDetail.CustomersFrom
|
|
_Currency_Account = _PCIDetail.CurrencyName_Account.ShortName
|
|
_IsAccount = True
|
|
_AccountCount += 1
|
|
End If
|
|
Next
|
|
If _IsAccount = False Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Legalább egy számlát ki kell választani !")
|
|
End If
|
|
If _AccountCount > 1 Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Csak egy számlát lehet kiválasztani !")
|
|
End If
|
|
_IsAccount = False
|
|
For Each _PCIDetail In selection
|
|
Select Case _PCIDetail.MainType
|
|
Case "03-Cassa", "02-Bank", "04-Compensation"
|
|
If _PCIDetail.CustomersFrom.Oid <> _CustomersFrom.Oid Or _
|
|
_PCIDetail.Customers.Oid <> _Customers.Oid Or _
|
|
_PCIDetail.PartnerType <> _PartnerType Then
|
|
_onew.Rollback()
|
|
Throw New Exception("*Csak azonos saját cég, partner és partner tipusú bizonylatokat lehet kijelölni !")
|
|
Else
|
|
If _PCIDetail.CurrencyName.ShortName = _Currency_Account Or _Currency_Account = "HUF" Then
|
|
_PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem = _onew.CreateObject(Of PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem)()
|
|
_PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem.PartnerConnectionInfoCleanUp_PopupWindow = _PartnerConnectionInfoCleanUp_PopupWindow
|
|
_PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem.PCIDetail = _onew.GetObjectByKey(Of PCIDetail)(_PCIDetail.Oid)
|
|
Else
|
|
_onew.Rollback()
|
|
Throw New Exception("*Eltérõ devizanemû tételek !")
|
|
End If
|
|
End If
|
|
End Select
|
|
Next
|
|
If _PartnerConnectionInfoCleanUp_PopupWindow.PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem.Count <= 0 Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Legalább egy pénzügyi sort ki kell választani !")
|
|
|
|
End If
|
|
|
|
e.View = Application.CreateDetailView(_onew, "PartnerConnectionInfoCleanUp_PopupWindow_DetailView_Direct", False, _PartnerConnectionInfoCleanUp_PopupWindow)
|
|
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionDirect_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aCreateConnectionDirect.Execute
|
|
'-- Ez a kijelölt sorokat összepontozza ---------------------------------------------------------------------------------
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
|
|
Dim _PartnerConnectionInfoCleanUp_PopupWindow As PartnerConnectionInfoCleanUp_PopupWindow = TryCast(e.PopupWindow.View.SelectedObjects(0), PartnerConnectionInfoCleanUp_PopupWindow)
|
|
Dim _PCIDetail As PCIDetail
|
|
Dim _ConnectInfo_Prev As String = ""
|
|
Dim _ConnectInfo_Next As String = ""
|
|
Dim _GLRows As GLRows
|
|
Dim _GLAccounts As GLAccounts
|
|
For Each _PCIDetail In selection
|
|
Select Case _PCIDetail.MainType
|
|
Case "03-Cassa", "02-Bank", "04-Compensation"
|
|
If _PCIDetail.GLRows IsNot Nothing Then
|
|
_GLRows = _ocur.FindObject(Of GLRows)(CriteriaOperator.Parse("Oid=?", _PCIDetail.GLRows.Oid), True)
|
|
If _GLRows IsNot Nothing Then
|
|
_ConnectInfo_Prev = _GLRows.ConnectInfo
|
|
_GLRows.ConnectInfo = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_ConnectInfo_Next = _GLRows.ConnectInfo
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Prev)
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Next)
|
|
End If
|
|
End If
|
|
Case "01-Account"
|
|
If _PCIDetail.InvoiceHeader IsNot Nothing Then
|
|
_ConnectInfo_Prev = _PCIDetail.InvoiceHeader.ConnectInfo
|
|
_PCIDetail.InvoiceHeader.ConnectInfo = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_ConnectInfo_Next = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_PCIDetail.InvoiceHeader.Save()
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Prev)
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Next)
|
|
End If
|
|
If _PCIDetail.RegistryHeader IsNot Nothing Then
|
|
_ConnectInfo_Prev = _PCIDetail.RegistryHeader.F_ConnectInfo
|
|
_PCIDetail.RegistryHeader.F_ConnectInfo = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_ConnectInfo_Next = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_PCIDetail.RegistryHeader.Save()
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Prev)
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Next)
|
|
End If
|
|
If _PCIDetail.GLAccounts IsNot Nothing Then
|
|
_GLAccounts = _PCIDetail.GLAccounts
|
|
_ConnectInfo_Prev = _GLAccounts.ConnectInfo
|
|
_GLAccounts.row_ConnectInfo = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_ConnectInfo_Next = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_GLAccounts.Save()
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Prev)
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Next)
|
|
End If
|
|
End Select
|
|
Next
|
|
|
|
Frame.GetController(Of RefreshController).RefreshAction.DoExecute()
|
|
noselect = False
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionLiquidAssets_Cancel(ByVal sender As Object, ByVal e As System.EventArgs) Handles aCreateConnectionLiquidAssets.Cancel
|
|
noselect = False
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionLiquidAssets_CustomizePopupWindowParams(ByVal sender As Object, ByVal e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aCreateConnectionLiquidAssets.CustomizePopupWindowParams
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _PartnerConnectionInfoCleanUp_PopupWindow As PartnerConnectionInfoCleanUp_PopupWindow
|
|
Dim _PCIDetail As PCIDetail
|
|
Dim _PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem As PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem
|
|
|
|
Dim _CustomersFrom As CustomersFrom
|
|
Dim _Customers As Customers
|
|
Dim _PartnerType As ePartnerType
|
|
Dim _IsAccount As Boolean = False
|
|
|
|
noselect = True
|
|
|
|
_PartnerConnectionInfoCleanUp_PopupWindow = _onew.FindObject(Of PartnerConnectionInfoCleanUp_PopupWindow)(CriteriaOperator.Parse("1=1"))
|
|
|
|
If _PartnerConnectionInfoCleanUp_PopupWindow Is Nothing Then
|
|
_PartnerConnectionInfoCleanUp_PopupWindow = _onew.CreateObject(Of PartnerConnectionInfoCleanUp_PopupWindow)()
|
|
End If
|
|
|
|
If _PartnerConnectionInfoCleanUp_PopupWindow.PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem.Count > 0 Then
|
|
_onew.Delete(_PartnerConnectionInfoCleanUp_PopupWindow.PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem)
|
|
End If
|
|
|
|
For Each _PCIDetail In selection
|
|
If _PCIDetail.MainType = "01-Account" Then
|
|
_IsAccount = True
|
|
Exit For
|
|
End If
|
|
_PartnerType = _PCIDetail.PartnerType
|
|
_Customers = _PCIDetail.Customers
|
|
_CustomersFrom = _PCIDetail.CustomersFrom
|
|
|
|
Next
|
|
|
|
If _IsAccount = True Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Csak pénzügyi teljesítéseket lehet kiválasztani !")
|
|
End If
|
|
|
|
_IsAccount = False
|
|
For Each _PCIDetail In selection
|
|
Select Case _PCIDetail.MainType
|
|
Case "03-Cassa", "02-Bank", "04-Compensation"
|
|
If _PCIDetail.CustomersFrom.Oid <> _CustomersFrom.Oid Or _
|
|
_PCIDetail.Customers.Oid <> _Customers.Oid Or _
|
|
_PCIDetail.PartnerType <> _PartnerType Then
|
|
_onew.Rollback()
|
|
Throw New Exception("*Csak azonos saját cég, partner és partner tipusú bizonylatokat lehet kijelölni !")
|
|
Else
|
|
_PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem = _onew.CreateObject(Of PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem)()
|
|
_PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem.PartnerConnectionInfoCleanUp_PopupWindow = _PartnerConnectionInfoCleanUp_PopupWindow
|
|
_PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem.PCIDetail = _onew.GetObjectByKey(Of PCIDetail)(_PCIDetail.Oid)
|
|
End If
|
|
End Select
|
|
Next
|
|
If _PartnerConnectionInfoCleanUp_PopupWindow.PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem.Count <= 0 Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Legalább egy pénzügyi sort ki kell választani !")
|
|
End If
|
|
|
|
e.View = Application.CreateDetailView(_onew, "PartnerConnectionInfoCleanUp_PopupWindow_DetailView_LiquidAssets", False, _PartnerConnectionInfoCleanUp_PopupWindow)
|
|
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionLiquidAssets_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aCreateConnectionLiquidAssets.Execute
|
|
'-- Ez a kijelölt sorokat összepontozza ---------------------------------------------------------------------------------
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
|
|
Dim _PartnerConnectionInfoCleanUp_PopupWindow As PartnerConnectionInfoCleanUp_PopupWindow = TryCast(e.PopupWindow.View.SelectedObjects(0), PartnerConnectionInfoCleanUp_PopupWindow)
|
|
Dim _PCIDetail As PCIDetail
|
|
Dim _ConnectInfo_Prev As String = ""
|
|
Dim _ConnectInfo_Next As String = ""
|
|
Dim _GLRows As GLRows
|
|
For Each _PCIDetail In selection
|
|
Select Case _PCIDetail.MainType
|
|
Case "03-Cassa", "02-Bank", "04-Compensation"
|
|
If _PCIDetail.GLRows IsNot Nothing Then
|
|
_GLRows = _ocur.FindObject(Of GLRows)(CriteriaOperator.Parse("Oid=?", _PCIDetail.GLRows.Oid), True)
|
|
If _GLRows IsNot Nothing Then
|
|
_ConnectInfo_Prev = _GLRows.ConnectInfo
|
|
_GLRows.ConnectInfo = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_ConnectInfo_Next = _GLRows.ConnectInfo
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Prev)
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Next)
|
|
End If
|
|
End If
|
|
Case "01-Account"
|
|
|
|
End Select
|
|
Next
|
|
|
|
Frame.GetController(Of RefreshController).RefreshAction.DoExecute()
|
|
noselect = False
|
|
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionDivide_Cancel(ByVal sender As Object, ByVal e As System.EventArgs) Handles aCreateConnectionDivide.Cancel
|
|
noselect = False
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionDivide_CustomizePopupWindowParams(ByVal sender As Object, ByVal e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aCreateConnectionDivide.CustomizePopupWindowParams
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _GLRowsDivideH As GLRowsDivideH = _onew.CreateObject(Of GLRowsDivideH)()
|
|
Dim _PCIDetail As PCIDetail = TryCast(View.SelectedObjects(0), PCIDetail)
|
|
|
|
If _PCIDetail IsNot Nothing Then
|
|
_GLRowsDivideH.GLRows_Oid = _PCIDetail.GLRows.Oid
|
|
_GLRowsDivideH.row_Customers = _onew.GetObject(_PCIDetail.Customers)
|
|
_GLRowsDivideH.row_PartnerType = _PCIDetail.PartnerType
|
|
e.View = Application.CreateDetailView(_onew, "GLRowsDivideH_DetailView_ConnectionDivide", False, _GLRowsDivideH)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionDivide_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aCreateConnectionDivide.Execute
|
|
'-- Sor bontása
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _GLRowsDivideH As GLRowsDivideH = TryCast(e.PopupWindow.View.SelectedObjects(0), GLRowsDivideH)
|
|
Dim _PCIDetail As PCIDetail = TryCast(View.SelectedObjects(0), PCIDetail)
|
|
|
|
Select Case _PCIDetail.MainType
|
|
Case "02-Bank", "03-Cassa"
|
|
Case Else
|
|
_ocur.Rollback()
|
|
Throw New Exception("*Csak banki és pénztári tételt lehet szétbontani pontozási számokra !")
|
|
End Select
|
|
|
|
Dim _GLRows As GLRows = _ocur.GetObjectByKey(Of GLRows)(_PCIDetail.GLRows.Oid)
|
|
If _GLRows IsNot Nothing Then
|
|
_GLRows.DivideRows(_ocur, _GLRows, _GLRowsDivideH, True)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionDirectDifferentCurrency_Cancel(ByVal sender As Object, ByVal e As System.EventArgs) Handles aCreateConnectionDirectDifferentCurrency.Cancel
|
|
noselect = False
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionDirectDifferentCurrency_CustomizePopupWindowParams(ByVal sender As Object, ByVal e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aCreateConnectionDirectDifferentCurrency.CustomizePopupWindowParams
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
|
|
Dim _PCIDetail As PCIDetail
|
|
Dim _PCIDetail_Account As PCIDetail
|
|
Dim _PCIDetail_Connect As PCIDetail
|
|
Dim _RateDiffCurrencyPopUp As RateDiffCurrencyPopUp = _onew.CreateObject(Of RateDiffCurrencyPopUp)()
|
|
Dim _IsAccount As Boolean = False
|
|
Dim _AccountCount As Long = 0
|
|
Dim _CurrencyName_Account As CurrencyName
|
|
noselect = True
|
|
|
|
For Each _PCIDetail In selection
|
|
If _PCIDetail.MainType = "01-Account" Then
|
|
If _PCIDetail.CurrencyName_Account.ShortName <> "HUF" Then
|
|
_PCIDetail_Account = _PCIDetail
|
|
_CurrencyName_Account = _PCIDetail.CurrencyName_Account
|
|
_IsAccount = True
|
|
_AccountCount += 1
|
|
End If
|
|
End If
|
|
Next
|
|
If _IsAccount = False Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Legalább egy számlát ki kell választani ami NEM HUF !")
|
|
End If
|
|
If _AccountCount > 1 Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Csak egy számlát lehet kiválasztani !")
|
|
End If
|
|
|
|
If selection.Count > 2 Or selection.Count = 0 Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Csak egy számlát és egy pénzügyi teljesítést kell kiválazstani !")
|
|
End If
|
|
|
|
For Each _PCIDetail In selection
|
|
Select Case _PCIDetail.MainType
|
|
Case "03-Cassa", "02-Bank", "04-Compensation"
|
|
_PCIDetail_Connect = _PCIDetail
|
|
If _PCIDetail.CurrencyName.ShortName = "HUF" Then
|
|
_RateDiffCurrencyPopUp.IsHUF = True
|
|
Else
|
|
_RateDiffCurrencyPopUp.IsHUF = False
|
|
End If
|
|
Exit For
|
|
End Select
|
|
Next
|
|
|
|
If _PCIDetail_Account.CustomersFrom.Oid <> _PCIDetail_Connect.CustomersFrom.Oid Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Csak azonos saját cégû bizonylatokat lehet kiválasztani !")
|
|
End If
|
|
|
|
If _PCIDetail_Account.Customers.Oid <> _PCIDetail_Connect.Customers.Oid Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Csak azonos partnerû bizonylatokat lehet kiválasztani !")
|
|
End If
|
|
|
|
If _PCIDetail_Account.PartnerType <> _PCIDetail_Connect.PartnerType Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Csak azonos partner tipusú bizonylatokat lehet kiválasztani !")
|
|
End If
|
|
|
|
e.View = Application.CreateDetailView(_onew, "RateDiffCurrencyPopUp_DetailView", False, _RateDiffCurrencyPopUp)
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionDirectDifferentCurrency_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aCreateConnectionDirectDifferentCurrency.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
|
|
Dim _RateDiffCurrencyPopUp As RateDiffCurrencyPopUp = TryCast(e.PopupWindow.View.SelectedObjects(0), RateDiffCurrencyPopUp)
|
|
Dim _GLRows As GLRows
|
|
Dim _ConnectInfo As String = ""
|
|
Dim _PCIDetail As PCIDetail
|
|
Dim _ConnectInfo_Prev As String = ""
|
|
Dim _ConnectInfo_Next As String = ""
|
|
|
|
For Each _PCIDetail In selection
|
|
Select Case _PCIDetail.MainType
|
|
Case "01-Account"
|
|
_ConnectInfo = _PCIDetail.ConnectInfo
|
|
Exit For
|
|
End Select
|
|
Next
|
|
For Each _PCIDetail In selection
|
|
Select Case _PCIDetail.MainType
|
|
Case "03-Cassa", "02-Bank", "04-Compensation"
|
|
If _PCIDetail.GLRows IsNot Nothing Then
|
|
_GLRows = _ocur.GetObjectByKey(Of GLRows)(_PCIDetail.GLRows.Oid)
|
|
_ConnectInfo_Prev = _GLRows.ConnectInfo
|
|
_GLRows.ConnectInfo = _ConnectInfo
|
|
_ConnectInfo_Next = _GLRows.ConnectInfo
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Prev)
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Next)
|
|
If _PCIDetail.CurrencyName.ShortName = "HUF" Then
|
|
If _GLRows.InAmountHUF > 0 Then
|
|
_GLRows.InAmountDEV2 = Math.Round(_GLRows.InAmountHUF / Math.Round(_RateDiffCurrencyPopUp.CurrencyRate, 2, MidpointRounding.AwayFromZero), 2, MidpointRounding.AwayFromZero)
|
|
_GLRows.CurrencyRate2 = Math.Round(_RateDiffCurrencyPopUp.CurrencyRate, 2, MidpointRounding.AwayFromZero)
|
|
Else
|
|
_GLRows.OutAmountDEV2 = Math.Round(_GLRows.OutAmountHUF / Math.Round(_RateDiffCurrencyPopUp.CurrencyRate, 2, MidpointRounding.AwayFromZero), 2, MidpointRounding.AwayFromZero)
|
|
_GLRows.CurrencyRate2 = Math.Round(_RateDiffCurrencyPopUp.CurrencyRate, 2, MidpointRounding.AwayFromZero)
|
|
End If
|
|
Else
|
|
If _GLRows.InAmountDEV > 0 Then
|
|
_GLRows.InAmountDEV2 = Math.Round(_GLRows.InAmountDEV / Math.Round(_RateDiffCurrencyPopUp.CurrencyRate, 2, MidpointRounding.AwayFromZero), 2, MidpointRounding.AwayFromZero)
|
|
_GLRows.CurrencyRate2 = Math.Round(_RateDiffCurrencyPopUp.CurrencyRate, 2, MidpointRounding.AwayFromZero)
|
|
Else
|
|
_GLRows.OutAmountDEV2 = Math.Round(_GLRows.OutAmountDEV / Math.Round(_RateDiffCurrencyPopUp.CurrencyRate, 2, MidpointRounding.AwayFromZero), 2, MidpointRounding.AwayFromZero)
|
|
_GLRows.CurrencyRate2 = Math.Round(_RateDiffCurrencyPopUp.CurrencyRate, 2, MidpointRounding.AwayFromZero)
|
|
End If
|
|
End If
|
|
Exit For
|
|
End If
|
|
End Select
|
|
Next
|
|
_ocur.CommitChanges()
|
|
noselect = False
|
|
Frame.GetController(Of RefreshController).RefreshAction.DoExecute()
|
|
End Sub
|
|
|
|
Private Sub aViewRegistryPCIGroup_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aViewRegistryPCIGroup.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _PCIGroup As PCIGroup = TryCast(View.SelectedObjects(0), PCIGroup)
|
|
|
|
If _PCIGroup IsNot Nothing Then
|
|
ViewRegistry.ViewRegistry(_ocur, Application, e, _PCIGroup.CustomersFrom, _
|
|
_PCIGroup.Customers, _PCIGroup.ConnectInfo)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub aViewAttachmentsPCIGroup_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aViewAttachmentsPCIGroup.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _PCIGroup As PCIGroup = TryCast(View.SelectedObjects(0), PCIGroup)
|
|
|
|
If _PCIGroup IsNot Nothing Then
|
|
ViewAttachments.ViewAttachments(_ocur, Frame, _PCIGroup.CustomersFrom, _
|
|
_PCIGroup.Customers, _PCIGroup.ConnectInfo, _
|
|
"")
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionDrop_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCreateConnectionDrop.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
|
|
Dim _PCIDetail As PCIDetail
|
|
Dim _GLRows As GLRows
|
|
Dim _ConnectInfo_Prev As String = ""
|
|
Dim _ConnectInfo_Next As String = ""
|
|
|
|
RaiseEvent InitWork(1, 1, View.SelectedObjects.Count)
|
|
For Each _PCIDetail In View.SelectedObjects
|
|
RaiseEvent DoWork()
|
|
Select Case _PCIDetail.MainType
|
|
Case "02-Bank", "03-Cassa", "04-Compensation"
|
|
If _PCIDetail.GLRows IsNot Nothing Then
|
|
_GLRows = _ocur.FindObject(Of GLRows)(CriteriaOperator.Parse("Oid=?", _PCIDetail.GLRows.Oid), True)
|
|
If _GLRows IsNot Nothing Then
|
|
_ConnectInfo_Prev = _GLRows.ConnectInfo
|
|
_GLRows.ConnectInfo = ""
|
|
_ConnectInfo_Next = _GLRows.ConnectInfo
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Prev)
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Next)
|
|
End If
|
|
End If
|
|
Case "01-Account"
|
|
If _PCIDetail.InvoiceHeader IsNot Nothing Then
|
|
_ConnectInfo_Prev = _PCIDetail.InvoiceHeader.ConnectInfo
|
|
_PCIDetail.InvoiceHeader.ConnectInfo = _PCIDetail.InvoiceHeader.DocumentNumber
|
|
_ConnectInfo_Next = _PCIDetail.InvoiceHeader.DocumentNumber
|
|
_PCIDetail.InvoiceHeader.Save()
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Prev)
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Next)
|
|
End If
|
|
If _PCIDetail.RegistryHeader IsNot Nothing Then
|
|
_ConnectInfo_Prev = _PCIDetail.RegistryHeader.F_ConnectInfo
|
|
_PCIDetail.RegistryHeader.F_ConnectInfo = _PCIDetail.RegistryHeader.DocumentNumber
|
|
_ConnectInfo_Next = _PCIDetail.RegistryHeader.DocumentNumber
|
|
_PCIDetail.RegistryHeader.Save()
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Prev)
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Next)
|
|
End If
|
|
If _PCIDetail.GLAccounts IsNot Nothing Then
|
|
Dim _GLAccounts As GLAccounts
|
|
_GLAccounts = _PCIDetail.GLAccounts
|
|
_ConnectInfo_Prev = _GLAccounts.ConnectInfo
|
|
_GLAccounts.row_ConnectInfo = _GLAccounts.DocumentNumber
|
|
_ConnectInfo_Next = _GLAccounts.DocumentNumber
|
|
_GLAccounts.Save()
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Prev)
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Next)
|
|
End If
|
|
End Select
|
|
Next
|
|
_ocur.CommitChanges()
|
|
RaiseEvent FinalWork
|
|
End Sub
|
|
|
|
Private Sub aCreateRateDiffPCIGroup_Cancel(ByVal sender As Object, ByVal e As System.EventArgs) Handles aCreateRateDiffPCIGroup.Cancel
|
|
noselect = False
|
|
End Sub
|
|
|
|
Private Sub aCreateRateDiffPCIGroup_CustomizePopupWindowParams(ByVal sender As Object, ByVal e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aCreateRateDiffPCIGroup.CustomizePopupWindowParams
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _RateDiffPopUp As RateDiffPopUp = _onew.CreateObject(Of RateDiffPopUp)()
|
|
noselect = True
|
|
_RateDiffPopUp.DateExecution = Now
|
|
|
|
e.View = Application.CreateDetailView(_onew, "RateDiffPopUp_DetailView", False, _RateDiffPopUp)
|
|
End Sub
|
|
|
|
Private Sub aCreateRateDiffPCIGroup_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aCreateRateDiffPCIGroup.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
|
|
Dim _RateDiffPopUp As RateDiffPopUp = TryCast(e.PopupWindow.View.SelectedObjects(0), RateDiffPopUp)
|
|
Dim _PCIGroup As PCIGroup
|
|
Dim _GLHeader_Ratediff As GLMixed = Nothing
|
|
Dim _GLRows_RateDiff As GLRows
|
|
Dim _DebitChartOfAccounts As ChartOfAccounts
|
|
Dim _CreditChartOfAccounts As ChartOfAccounts
|
|
Dim _Controlling As Controlling
|
|
Dim _GLMixedNG As GLMixedNG
|
|
|
|
Dim _GLHeader_RateDiffParameter = _ocur.FindObject(Of GLHeader_RateDiffParameter)(CriteriaOperator.Parse("1=1"))
|
|
If _GLHeader_RateDiffParameter Is Nothing Then Exit Sub
|
|
|
|
Dim _ChartOfAccounts_RateDiff_Win As ChartOfAccounts = _GLHeader_RateDiffParameter.GetChartOfAccounts(_RateDiffPopUp.DateExecution.Year, eWinLoss.eRateDiffWin)
|
|
Dim _ChartOfAccounts_RateDiff_Loss As ChartOfAccounts = _GLHeader_RateDiffParameter.GetChartOfAccounts(_RateDiffPopUp.DateExecution.Year, eWinLoss.eRateDiffLoss)
|
|
Dim _Controlling_RateDiff_Win As Controlling = _GLHeader_RateDiffParameter.Controlling_RateDiff_Win
|
|
Dim _Controlling_RateDiff_Loss As Controlling = _GLHeader_RateDiffParameter.Controlling_RateDiff_Loss
|
|
|
|
Dim _CustomersFrom As CustomersFrom
|
|
Dim i As Long = 0
|
|
Dim _InAmountHUF As Double = 0
|
|
Dim _OutAmountHUF As Double = 0
|
|
|
|
If selection.Count <= 0 Then Exit Sub
|
|
|
|
For Each _PCIGroup In selection
|
|
If i = 0 Then
|
|
_CustomersFrom = _PCIGroup.CustomersFrom
|
|
i = 1
|
|
End If
|
|
If _PCIGroup.CustomersFrom.Oid <> _CustomersFrom.Oid Then
|
|
Throw New Exception("*Csak azonos saját cégû sorok jelölhetõ ki egyszerre !")
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
_GLHeader_Ratediff = _ocur.CreateObject(Of GLMixed)()
|
|
_GLHeader_Ratediff.CustomersFrom = _CustomersFrom
|
|
_GLMixedNG = _ocur.FindObject(Of GLMixedNG)(CriteriaOperator.Parse("CustomersFrom=?", _GLHeader_Ratediff.CustomersFrom), True)
|
|
If _GLMixedNG IsNot Nothing Then
|
|
If _GLHeader_Ratediff.DocumentNumber = "" Then
|
|
_GLHeader_Ratediff.DocumentNumber = _GLMixedNG.NumberGenerator.GetNewNumber(_GLMixedNG.NumberGenerator_RateDiff)
|
|
End If
|
|
End If
|
|
_GLHeader_Ratediff.DateExecution = _RateDiffPopUp.DateExecution
|
|
_GLHeader_Ratediff.DateCreated = _RateDiffPopUp.DateExecution
|
|
_GLHeader_Ratediff.NoteHeader = _RateDiffPopUp.Description
|
|
_GLHeader_Ratediff.CurrencyRate = 1
|
|
|
|
_GLHeader_Ratediff.GLDocumentType = eGLDocumentType.eGLRateDiff
|
|
_GLHeader_Ratediff.IsEditable = False
|
|
_GLHeader_Ratediff.IsStorno = False
|
|
_GLHeader_Ratediff.CurrencyName = _ocur.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName='HUF'"))
|
|
|
|
For Each _PCIGroup In selection
|
|
_OutAmountHUF = 0
|
|
_InAmountHUF = 0
|
|
Select Case _PCIGroup.PartnerType
|
|
Case ePartnerType.ePayabels
|
|
If _PCIGroup.BallanceHUF > 0 Then 'Árfolyam nyereség szállító
|
|
_DebitChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_GLHeader_Ratediff.DateExecution.Year, eVATMode.eIn)
|
|
_CreditChartOfAccounts = _ChartOfAccounts_RateDiff_Win
|
|
_Controlling = _Controlling_RateDiff_Win
|
|
_OutAmountHUF = Math.Abs(_PCIGroup.BallanceHUF)
|
|
Else 'Árfolyam veszteség szállító
|
|
_DebitChartOfAccounts = _ChartOfAccounts_RateDiff_Loss
|
|
_CreditChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_GLHeader_Ratediff.DateExecution.Year, eVATMode.eIn)
|
|
_Controlling = _Controlling_RateDiff_Loss
|
|
_InAmountHUF = Math.Abs(_PCIGroup.BallanceHUF)
|
|
End If
|
|
Case ePartnerType.eReceivables
|
|
If _PCIGroup.BallanceHUF > 0 Then ' Árfolyam veszteség vevõ
|
|
_DebitChartOfAccounts = _ChartOfAccounts_RateDiff_Loss
|
|
_CreditChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_GLHeader_Ratediff.DateExecution.Year, eVATMode.eOut)
|
|
_Controlling = _Controlling_RateDiff_Loss
|
|
_InAmountHUF = Math.Abs(_PCIGroup.BallanceHUF)
|
|
Else 'Árfolyam nyereség vevõ
|
|
_DebitChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_GLHeader_Ratediff.DateExecution.Year, eVATMode.eOut)
|
|
_CreditChartOfAccounts = _ChartOfAccounts_RateDiff_Win
|
|
_Controlling = _Controlling_RateDiff_Win
|
|
_OutAmountHUF = Math.Abs(_PCIGroup.BallanceHUF)
|
|
End If
|
|
End Select
|
|
|
|
_GLRows_RateDiff = _ocur.CreateObject(Of GLRows)()
|
|
_GLRows_RateDiff.GLHeader = _GLHeader_Ratediff
|
|
_GLRows_RateDiff.InAmountHUF = _InAmountHUF
|
|
_GLRows_RateDiff.OutAmountHUF = _OutAmountHUF
|
|
_GLRows_RateDiff.AddGLRows(_GLHeader_Ratediff, _DebitChartOfAccounts, _CreditChartOfAccounts, 0, Math.Abs(_PCIGroup.BallanceHUF), Nothing, _
|
|
_PCIGroup.Customers, Nothing, Nothing, "", Nothing, _Controlling, Nothing, Nothing, Nothing, _PCIGroup.ConnectInfo, _
|
|
eGLRowsTypeVAT.eNettoRow, Guid.NewGuid, eTransactionType.eNotSet, eCashType.ePartner, _PCIGroup.PartnerType)
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIGroup.CustomersFrom, _PCIGroup.Customers, _PCIGroup.PartnerType, _PCIGroup.ConnectInfo)
|
|
|
|
Next
|
|
|
|
_ocur.CommitChanges()
|
|
|
|
Frame.GetController(Of RefreshController).RefreshAction.DoExecute()
|
|
noselect = False
|
|
End Sub
|
|
|
|
Private Sub aPCICheck_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aPCICheck.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
|
|
|
|
Dim _PCIGroup As PCIGroup
|
|
|
|
RaiseEvent InitWork(1, 1, View.SelectedObjects.Count)
|
|
For Each _PCIGroup In View.SelectedObjects
|
|
RaiseEvent DoWork()
|
|
If _PCIGroup IsNot Nothing Then
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIGroup.CustomersFrom, _PCIGroup.Customers, _PCIGroup.PartnerType, _PCIGroup.ConnectInfo)
|
|
End If
|
|
Next
|
|
RaiseEvent FinalWork
|
|
|
|
Frame.GetController(Of RefreshController).RefreshAction.DoExecute()
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionAccount_CustomizePopupWindowParams(ByVal sender As Object, ByVal e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aCreateConnectionAccount.CustomizePopupWindowParams
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _PartnerConnectionInfoCleanUp_PopupWindow As PartnerConnectionInfoCleanUp_PopupWindow
|
|
Dim _PCIDetail As PCIDetail
|
|
Dim _PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem As PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem
|
|
|
|
Dim _CustomersFrom As CustomersFrom
|
|
Dim _Customers As Customers
|
|
Dim _PartnerType As ePartnerType
|
|
Dim _IsAccount As Boolean = False
|
|
Dim _AccountCount As Long = 0
|
|
Dim _Currency_Account As String
|
|
noselect = True
|
|
|
|
_PartnerConnectionInfoCleanUp_PopupWindow = _onew.FindObject(Of PartnerConnectionInfoCleanUp_PopupWindow)(CriteriaOperator.Parse("1=1"))
|
|
|
|
If _PartnerConnectionInfoCleanUp_PopupWindow Is Nothing Then
|
|
_PartnerConnectionInfoCleanUp_PopupWindow = _onew.CreateObject(Of PartnerConnectionInfoCleanUp_PopupWindow)()
|
|
End If
|
|
|
|
If _PartnerConnectionInfoCleanUp_PopupWindow.PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem.Count > 0 Then
|
|
_onew.Delete(_PartnerConnectionInfoCleanUp_PopupWindow.PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem)
|
|
End If
|
|
|
|
For Each _PCIDetail In selection
|
|
If _PCIDetail.MainType = "01-Account" And (_PCIDetail.AmountDEV_Account > 0 Or _PCIDetail.AmountHUF_Account > 0) Then
|
|
_PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo = _PCIDetail.ConnectInfo
|
|
_PartnerType = _PCIDetail.PartnerType
|
|
_Customers = _PCIDetail.Customers
|
|
_CustomersFrom = _PCIDetail.CustomersFrom
|
|
_Currency_Account = _PCIDetail.CurrencyName_Account.ShortName
|
|
_IsAccount = True
|
|
_AccountCount += 1
|
|
End If
|
|
Next
|
|
If _IsAccount = False Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Legalább egy pozitív számlát ki kell választani !")
|
|
End If
|
|
If _AccountCount > 1 Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Csak egy pozitív számlát lehet kiválasztani !")
|
|
End If
|
|
_IsAccount = False
|
|
For Each _PCIDetail In selection
|
|
If _PCIDetail.MainType = "01-Account" And (_PCIDetail.AmountDEV_Account < 0 Or _PCIDetail.AmountHUF_Account < 0) Then
|
|
If _PCIDetail.CustomersFrom.Oid <> _CustomersFrom.Oid Or _
|
|
_PCIDetail.Customers.Oid <> _Customers.Oid Or _
|
|
_PCIDetail.PartnerType <> _PartnerType Then
|
|
_onew.Rollback()
|
|
Throw New Exception("*Csak azonos saját cég, partner és partner tipusú bizonylatokat lehet kijelölni !")
|
|
Else
|
|
If _PCIDetail.CurrencyName.ShortName = _Currency_Account Or _Currency_Account = "HUF" Then
|
|
_PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem = _onew.CreateObject(Of PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem)()
|
|
_PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem.PartnerConnectionInfoCleanUp_PopupWindow = _PartnerConnectionInfoCleanUp_PopupWindow
|
|
_PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem.PCIDetail = _onew.GetObjectByKey(Of PCIDetail)(_PCIDetail.Oid)
|
|
Else
|
|
_onew.Rollback()
|
|
Throw New Exception("*Eltérõ devizanemû tételek !")
|
|
End If
|
|
End If
|
|
End If
|
|
Next
|
|
If _PartnerConnectionInfoCleanUp_PopupWindow.PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem.Count <= 0 Then
|
|
_onew.Rollback()
|
|
noselect = False
|
|
Throw New Exception("*Legalább egy negatív számlát ki kell választani !")
|
|
|
|
End If
|
|
|
|
e.View = Application.CreateDetailView(_onew, "PartnerConnectionInfoCleanUp_PopupWindow_DetailView_Direct", False, _PartnerConnectionInfoCleanUp_PopupWindow)
|
|
End Sub
|
|
|
|
Private Sub aCreateConnectionAccount_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aCreateConnectionAccount.Execute
|
|
'Számlák és stornó vagy jóváíró számlák összepontozása
|
|
'-- Ez a kijelölt sorokat összepontozza ---------------------------------------------------------------------------------
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
|
|
Dim _PartnerConnectionInfoCleanUp_PopupWindow As PartnerConnectionInfoCleanUp_PopupWindow = TryCast(e.PopupWindow.View.SelectedObjects(0), PartnerConnectionInfoCleanUp_PopupWindow)
|
|
Dim _PCIDetail As PCIDetail
|
|
Dim _ConnectInfo_Prev As String = ""
|
|
Dim _ConnectInfo_Next As String = ""
|
|
|
|
|
|
Dim _GLAccounts As GLAccounts
|
|
|
|
For Each _PCIDetail In selection
|
|
Select Case _PCIDetail.MainType
|
|
Case "01-Account"
|
|
If _PCIDetail.InvoiceHeader IsNot Nothing Then
|
|
_ConnectInfo_Prev = _PCIDetail.InvoiceHeader.ConnectInfo
|
|
_PCIDetail.InvoiceHeader.ConnectInfo = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_ConnectInfo_Next = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_PCIDetail.InvoiceHeader.Save()
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Prev)
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Next)
|
|
End If
|
|
If _PCIDetail.RegistryHeader IsNot Nothing Then
|
|
_ConnectInfo_Prev = _PCIDetail.RegistryHeader.F_ConnectInfo
|
|
_PCIDetail.RegistryHeader.F_ConnectInfo = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_ConnectInfo_Next = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_PCIDetail.RegistryHeader.Save()
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Prev)
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Next)
|
|
End If
|
|
If _PCIDetail.GLAccounts IsNot Nothing Then
|
|
_GLAccounts = _PCIDetail.GLAccounts
|
|
_ConnectInfo_Prev = _GLAccounts.ConnectInfo
|
|
_GLAccounts.row_ConnectInfo = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_ConnectInfo_Next = _PartnerConnectionInfoCleanUp_PopupWindow.ConnectInfo
|
|
_GLAccounts.Save()
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Prev)
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _ConnectInfo_Next)
|
|
End If
|
|
End Select
|
|
Next
|
|
|
|
Frame.GetController(Of RefreshController).RefreshAction.DoExecute()
|
|
noselect = False
|
|
End Sub
|
|
|
|
Private Sub aCreateRoundingPCIGroup_Cancel(ByVal sender As Object, ByVal e As System.EventArgs) Handles aCreateRoundingPCIGroup.Cancel
|
|
noselect = False
|
|
End Sub
|
|
|
|
Private Sub aCreateRoundingPCIGroup_CustomizePopupWindowParams(ByVal sender As Object, ByVal e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aCreateRoundingPCIGroup.CustomizePopupWindowParams
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _RateDiffPopUp As RateDiffPopUp = _onew.CreateObject(Of RateDiffPopUp)()
|
|
|
|
noselect = True
|
|
_RateDiffPopUp.DateExecution = Now
|
|
e.View = Application.CreateDetailView(_onew, "RateDiffPopUp_DetailView", False, _RateDiffPopUp)
|
|
End Sub
|
|
|
|
Private Sub aCreateRoundingPCIGroup_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aCreateRoundingPCIGroup.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
|
|
Dim _RateDiffPopUp As RateDiffPopUp = TryCast(e.PopupWindow.View.SelectedObjects(0), RateDiffPopUp)
|
|
Dim _PCIGroup As PCIGroup
|
|
Dim _GLHeader_Rounding As GLMixed = Nothing
|
|
Dim _GLRows_Rounding As GLRows
|
|
Dim _DebitChartOfAccounts As ChartOfAccounts = Nothing
|
|
Dim _CreditChartOfAccounts As ChartOfAccounts = Nothing
|
|
Dim _Controlling As Controlling = Nothing
|
|
Dim _GLMixedNG As GLMixedNG
|
|
Dim _Rate As Double = 1
|
|
|
|
|
|
Dim _GLHeader_RoundingParameter = _ocur.FindObject(Of GLHeader_RateDiffParameter)(CriteriaOperator.Parse("1=1"))
|
|
If _GLHeader_RoundingParameter Is Nothing Then
|
|
Throw New Exception("*Nincs beállítva az elengedési paraméter !")
|
|
Exit Sub
|
|
End If
|
|
|
|
|
|
Dim _ChartOfAccounts_Rounding_Win As ChartOfAccounts = _GLHeader_RoundingParameter.GetChartOfAccounts(_RateDiffPopUp.DateExecution.Year, eWinLoss.eRoundingWin)
|
|
Dim _ChartOfAccounts_Rounding_Loss As ChartOfAccounts = _GLHeader_RoundingParameter.GetChartOfAccounts(_RateDiffPopUp.DateExecution.Year, eWinLoss.eRoundingLoss)
|
|
Dim _Controlling_Rounding_Win As Controlling = _GLHeader_RoundingParameter.Controlling_Rounding_Win
|
|
Dim _Controlling_Rounding_Loss As Controlling = _GLHeader_RoundingParameter.Controlling_Rounding_Loss
|
|
|
|
|
|
If _ChartOfAccounts_Rounding_Loss Is Nothing Or _
|
|
_ChartOfAccounts_Rounding_Win Is Nothing Then
|
|
Throw New Exception("*Nincs beállítva az elengedési paraméter !")
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim _CurrencyName As CurrencyName = Nothing
|
|
Dim _CustomersFrom As CustomersFrom = Nothing
|
|
Dim i As Long = 0
|
|
Dim _InAmountHUF As Double = 0
|
|
Dim _OutAmountHUF As Double = 0
|
|
Dim _InAmountDEV As Double = 0
|
|
Dim _OutAmountDEV As Double = 0
|
|
|
|
If selection.Count <= 0 Then Exit Sub
|
|
|
|
For Each _PCIGroup In selection
|
|
If i = 0 Then
|
|
_CustomersFrom = _PCIGroup.CustomersFrom
|
|
_CurrencyName = _PCIGroup.CurrencyName_Account
|
|
If _PCIGroup.AmountDEV_Account <> 0 Then
|
|
_Rate = _PCIGroup.AmountHUF_Account / _PCIGroup.AmountDEV_Account
|
|
End If
|
|
i = 1
|
|
End If
|
|
If _PCIGroup.CustomersFrom.Oid <> _CustomersFrom.Oid Then
|
|
Throw New Exception("*Csak azonos saját cégû sorok jelölhetõ ki egyszerre !")
|
|
Exit For
|
|
End If
|
|
|
|
If _PCIGroup.CurrencyName_Account.Oid <> _CurrencyName.Oid Then
|
|
Throw New Exception("*Csak azonos devizával rendelkezõ sorok jelölhetõ ki egyszerre !")
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
_GLHeader_Rounding = _ocur.CreateObject(Of GLMixed)()
|
|
_GLHeader_Rounding.CustomersFrom = _CustomersFrom
|
|
_GLMixedNG = _ocur.FindObject(Of GLMixedNG)(CriteriaOperator.Parse("CustomersFrom=?", _GLHeader_Rounding.CustomersFrom), True)
|
|
If _GLMixedNG IsNot Nothing Then
|
|
If _GLHeader_Rounding.DocumentNumber = "" Then
|
|
_GLHeader_Rounding.DocumentNumber = _GLMixedNG.NumberGenerator.GetNewNumber(_GLMixedNG.NumberGenerator_Rounding)
|
|
End If
|
|
End If
|
|
_GLHeader_Rounding.DateExecution = _RateDiffPopUp.DateExecution
|
|
_GLHeader_Rounding.DateCreated = _RateDiffPopUp.DateExecution
|
|
_GLHeader_Rounding.NoteHeader = _RateDiffPopUp.Description
|
|
|
|
|
|
|
|
_GLHeader_Rounding.GLDocumentType = eGLDocumentType.eGLRateDiff
|
|
_GLHeader_Rounding.IsEditable = False
|
|
_GLHeader_Rounding.IsStorno = False
|
|
|
|
|
|
For Each _PCIGroup In selection
|
|
_GLHeader_Rounding.CurrencyName = _PCIGroup.CurrencyName_Account
|
|
_OutAmountDEV = 0
|
|
_OutAmountHUF = 0
|
|
_InAmountDEV = 0
|
|
_InAmountHUF = 0
|
|
If _PCIGroup.CurrencyName_Account.ShortName = "HUF" Then
|
|
Select Case _PCIGroup.PartnerType
|
|
Case ePartnerType.ePayabels
|
|
If _PCIGroup.BallanceHUF > 0 Then 'Elengedés nyereség
|
|
_DebitChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_GLHeader_Rounding.DateExecution.Year, eVATMode.eIn)
|
|
_CreditChartOfAccounts = _ChartOfAccounts_Rounding_Win
|
|
_Controlling = _Controlling_Rounding_Win
|
|
_OutAmountHUF = Math.Abs(_PCIGroup.BallanceHUF)
|
|
Else 'Elengedés veszteség
|
|
_DebitChartOfAccounts = _ChartOfAccounts_Rounding_Loss
|
|
_CreditChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_GLHeader_Rounding.DateExecution.Year, eVATMode.eIn)
|
|
_Controlling = _Controlling_Rounding_Loss
|
|
_InAmountHUF = Math.Abs(_PCIGroup.BallanceHUF)
|
|
End If
|
|
Case ePartnerType.eReceivables
|
|
If _PCIGroup.BallanceHUF > 0 Then ' Elengedés veszteség
|
|
_DebitChartOfAccounts = _ChartOfAccounts_Rounding_Loss
|
|
_CreditChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_GLHeader_Rounding.DateExecution.Year, eVATMode.eOut)
|
|
_Controlling = _Controlling_Rounding_Loss
|
|
_InAmountHUF = Math.Abs(_PCIGroup.BallanceHUF)
|
|
Else 'Elengedés nyereség
|
|
_DebitChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_GLHeader_Rounding.DateExecution.Year, eVATMode.eOut)
|
|
_CreditChartOfAccounts = _ChartOfAccounts_Rounding_Win
|
|
_Controlling = _Controlling_Rounding_Win
|
|
_OutAmountHUF = Math.Abs(_PCIGroup.BallanceHUF)
|
|
End If
|
|
End Select
|
|
Else
|
|
Select Case _PCIGroup.PartnerType
|
|
|
|
Case ePartnerType.ePayabels
|
|
If _PCIGroup.BallanceDEV > 0 Then 'Elengedés nyereség szállító
|
|
_DebitChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_GLHeader_Rounding.DateExecution.Year, eVATMode.eIn)
|
|
_CreditChartOfAccounts = _ChartOfAccounts_Rounding_Win
|
|
_Controlling = _Controlling_Rounding_Win
|
|
_OutAmountDEV = Math.Abs(_PCIGroup.BallanceDEV)
|
|
Else 'Elengedés veszteség szállító
|
|
_DebitChartOfAccounts = _ChartOfAccounts_Rounding_Loss
|
|
_CreditChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_GLHeader_Rounding.DateExecution.Year, eVATMode.eIn)
|
|
_Controlling = _Controlling_Rounding_Loss
|
|
_InAmountDEV = Math.Abs(_PCIGroup.BallanceDEV)
|
|
End If
|
|
Case ePartnerType.eReceivables
|
|
If _PCIGroup.BallanceDEV > 0 Then ' Elengedés veszteség vevő
|
|
_DebitChartOfAccounts = _ChartOfAccounts_Rounding_Loss
|
|
_CreditChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_GLHeader_Rounding.DateExecution.Year, eVATMode.eOut)
|
|
_Controlling = _Controlling_Rounding_Loss
|
|
_InAmountDEV = Math.Abs(_PCIGroup.BallanceDEV)
|
|
Else 'Elengedés nyereség vevő
|
|
_DebitChartOfAccounts = _PCIGroup.Customers.CustomersGLParameters.GetChartOfAccounts(_GLHeader_Rounding.DateExecution.Year, eVATMode.eOut)
|
|
_CreditChartOfAccounts = _ChartOfAccounts_Rounding_Win
|
|
_Controlling = _Controlling_Rounding_Win
|
|
_OutAmountDEV = Math.Abs(_PCIGroup.BallanceDEV)
|
|
End If
|
|
End Select
|
|
|
|
End If
|
|
|
|
_GLRows_Rounding = _ocur.CreateObject(Of GLRows)()
|
|
_GLRows_Rounding.GLHeader = _GLHeader_Rounding
|
|
If _PCIGroup.CurrencyName_Account.ShortName = "HUF" Then
|
|
_GLRows_Rounding.InAmountHUF = _InAmountHUF
|
|
_GLRows_Rounding.OutAmountHUF = _OutAmountHUF
|
|
_GLRows_Rounding.InAmountDEV = 0
|
|
_GLRows_Rounding.OutAmountDEV = 0
|
|
|
|
_GLRows_Rounding.AddGLRows(_GLHeader_Rounding, _DebitChartOfAccounts, _CreditChartOfAccounts, 0, Math.Abs(_PCIGroup.BallanceHUF), Nothing, _
|
|
_PCIGroup.Customers, Nothing, Nothing, "", Nothing, _Controlling, Nothing, Nothing, Nothing, _PCIGroup.ConnectInfo, _
|
|
eGLRowsTypeVAT.eNettoRow, Guid.NewGuid, eTransactionType.eNotSet, eCashType.ePartner, _PCIGroup.PartnerType)
|
|
Else
|
|
|
|
_GLHeader_Rounding.CurrencyRate = _Rate
|
|
_GLRows_Rounding.InAmountHUF = Math.Round(_InAmountDEV * _Rate, 0, MidpointRounding.AwayFromZero)
|
|
_GLRows_Rounding.OutAmountHUF = Math.Round(_OutAmountDEV * _Rate, 0, MidpointRounding.AwayFromZero)
|
|
_GLRows_Rounding.InAmountDEV = _InAmountDEV
|
|
_GLRows_Rounding.OutAmountDEV = _OutAmountDEV
|
|
|
|
_GLRows_Rounding.AddGLRows(_GLHeader_Rounding, _DebitChartOfAccounts, _CreditChartOfAccounts, Math.Abs(_PCIGroup.BallanceDEV), Math.Round(Math.Abs(_PCIGroup.BallanceDEV) * _Rate, 0, MidpointRounding.AwayFromZero), Nothing, _
|
|
_PCIGroup.Customers, Nothing, Nothing, "", Nothing, _Controlling, Nothing, Nothing, Nothing, _PCIGroup.ConnectInfo, _
|
|
eGLRowsTypeVAT.eNettoRow, Guid.NewGuid, eTransactionType.eNotSet, eCashType.ePartner, _PCIGroup.PartnerType)
|
|
|
|
End If
|
|
_ocur.CommitChanges()
|
|
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIGroup.CustomersFrom, _PCIGroup.Customers, _PCIGroup.PartnerType, _PCIGroup.ConnectInfo)
|
|
|
|
Next
|
|
|
|
_ocur.CommitChanges()
|
|
|
|
Frame.GetController(Of RefreshController).RefreshAction.DoExecute()
|
|
noselect = False
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub aPCICheckCustomers_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aPCICheckCustomers.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _PCIDetail As PCIDetail = TryCast(View.SelectedObjects(0), PCIDetail)
|
|
Dim _Uow As New UnitOfWork(_ocur.Session.DataLayer)
|
|
Dim _Customers_OID As String = ""
|
|
If _PCIDetail IsNot Nothing Then
|
|
_Customers_OID = _PCIDetail.Customers.Oid.ToString
|
|
|
|
RaiseEvent InitWork(1, 1, 4)
|
|
Select Case GLOBAL_SQLType
|
|
Case eSQLType.PostgreSQL
|
|
_Uow.ExecuteNonQuery("delete from ""PCIDetail"" Where ""Customers""='" & _Customers_OID & "'")
|
|
RaiseEvent DoWork()
|
|
_Uow.ExecuteNonQuery("update ""InvoiceHeader"" set ""PCIGroup""=Null Where ""Customers""='" & _Customers_OID & "'")
|
|
RaiseEvent DoWork()
|
|
_Uow.ExecuteNonQuery("update ""PCIGroupAging"" set ""PCIGroup""=Null Where ""Customers""='" & _Customers_OID & "'")
|
|
RaiseEvent DoWork()
|
|
_Uow.ExecuteNonQuery("delete from ""PCIGroup"" Where ""Customers""='" & _Customers_OID & "'")
|
|
RaiseEvent DoWork()
|
|
_Uow.CommitChanges()
|
|
Case Else
|
|
_Uow.ExecuteNonQuery("delete from PCIDetail Where Customers='" & _Customers_OID & "'")
|
|
RaiseEvent DoWork()
|
|
_Uow.ExecuteNonQuery("update InvoiceHeader set PCIGroup=Null Where Customers='" & _Customers_OID & "'")
|
|
RaiseEvent DoWork()
|
|
_Uow.ExecuteNonQuery("update PCIGroupAging set PCIGroup=Null Where Customers='" & _Customers_OID & "'")
|
|
RaiseEvent DoWork()
|
|
_Uow.ExecuteNonQuery("delete from PCIGroup Where Customers='" & _Customers_OID & "'")
|
|
RaiseEvent DoWork()
|
|
_Uow.CommitChanges()
|
|
End Select
|
|
RaiseEvent FinalWork
|
|
|
|
'// InvoiceHeader,GLAccount,RegistryHeader,GLRows
|
|
|
|
|
|
Dim _InvoiceHeader_Collection As New XPCollection(Of InvoiceHeader)(_Uow, _
|
|
CriteriaOperator.Parse("IsDeleted=False and isnull(DocumentNumber)=False and Customers.Oid=? and IsEditable=False and isnull(GLAccounts)=True", _Customers_OID))
|
|
Dim _InvoiceHeader As InvoiceHeader
|
|
RaiseEvent InitWork(1, 1, _InvoiceHeader_Collection.Count)
|
|
For Each _InvoiceHeader In _InvoiceHeader_Collection
|
|
RaiseEvent DoWork()
|
|
GLFunctions.ReconfigurePCI(_Uow, _InvoiceHeader.CustomersFrom, _InvoiceHeader.Customers, 0, _InvoiceHeader.ConnectInfo)
|
|
Next
|
|
RaiseEvent FinalWork
|
|
|
|
Dim _RegistryHeader_Collection As New XPCollection(Of RegistryHeader) _
|
|
(_Uow, CriteriaOperator.Parse("IsStorno=False and IsDeleted=False and RegistryAcceptState=0 and RegistryType.RegistryMainType =0 and Customers.Oid=? and IsEditable=False and isnull(F_GLAccounts)=True", _Customers_OID))
|
|
Dim _RegistryHeader As RegistryHeader
|
|
|
|
RaiseEvent InitWork(1, 1, _RegistryHeader_Collection.Count)
|
|
For Each _RegistryHeader In _RegistryHeader_Collection
|
|
RaiseEvent DoWork()
|
|
GLFunctions.ReconfigurePCI(_Uow, _RegistryHeader.CustomersFrom, _RegistryHeader.Customers, 1, _RegistryHeader.F_ConnectInfo)
|
|
Next
|
|
RaiseEvent FinalWork
|
|
|
|
Dim _GLAccounts_Collection As New XPCollection(Of GLAccounts)(PersistentCriteriaEvaluationBehavior.InTransaction, _
|
|
_Uow, CriteriaOperator.Parse("IsDeleted=False and Customers.Oid=? and IsEditable=False", _
|
|
_Customers_OID))
|
|
Dim _GLAccounts As GLAccounts
|
|
RaiseEvent DoWork()
|
|
For Each _GLAccounts In _GLAccounts_Collection
|
|
GLFunctions.ReconfigurePCI(_Uow, _GLAccounts.CustomersFrom, _GLAccounts.Customers, _GLAccounts.PartnerType, _GLAccounts.ConnectInfo)
|
|
Next
|
|
|
|
Dim _GLRows_Collection As New XPCollection(Of GLRows)(_Uow, CriteriaOperator.Parse("GLHeader.IsDeleted=False and Customer.Oid=? and GLHeader.GLDocumentType in (0,2,3,4,5)", _Customers_OID))
|
|
Dim _GLRows As GLRows
|
|
RaiseEvent InitWork(1, 1, _GLRows_Collection.Count)
|
|
For Each _GLRows In _GLRows_Collection
|
|
RaiseEvent DoWork()
|
|
GLFunctions.ReconfigurePCI(_Uow, _GLRows.GLHeader.CustomersFrom, _GLRows.Customer, _GLRows.PartnerType, _GLRows.ConnectInfo)
|
|
Next
|
|
RaiseEvent FinalWork
|
|
|
|
_Uow.CommitChanges()
|
|
_ocur.CommitChanges()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub aRepairPCIGroup_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aRepairPCIGroup.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
|
|
|
|
|
|
Dim _GLAccounts_Collection As New XPCollection(Of GLAccounts)(_uow, CriteriaOperator.Parse("IsNull(ConnectInfo)=True or ConnectInfo='' and IsEditable=False"))
|
|
Dim _GLAccounts As GLAccounts
|
|
Dim _GLRows As GLRows
|
|
RaiseEvent InitWork(1, 1, _GLAccounts_Collection.Count)
|
|
For Each _GLAccounts In _GLAccounts_Collection
|
|
RaiseEvent DoWork()
|
|
_GLAccounts.ConnectInfo = _GLAccounts.DocumentNumber
|
|
|
|
For Each _GLRows In _GLAccounts.GLRows
|
|
_GLRows.ConnectInfo = _GLRows.GLHeader.DocumentNumber
|
|
Next
|
|
|
|
_uow.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _GLAccounts.CustomersFrom, _GLAccounts.Customers, _GLAccounts.PartnerType, _GLAccounts.ConnectInfo)
|
|
_uow.CommitChanges()
|
|
|
|
Next
|
|
RaiseEvent FinalWork
|
|
End Sub
|
|
|
|
Private Sub aRemoveRatediffPCIDetail_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aRemoveRatediffPCIDetail.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
|
|
Dim _PCIDetail As PCIDetail
|
|
|
|
RaiseEvent InitWork(1, 1, View.SelectedObjects.Count)
|
|
For Each _PCIDetail In View.SelectedObjects
|
|
RaiseEvent DoWork()
|
|
If _PCIDetail.MainType = "05-Ratediff" Then
|
|
_ocur.Delete(_PCIDetail.GLRows)
|
|
_ocur.CommitChanges()
|
|
GLFunctions.ReconfigurePCI(_uow, _PCIDetail.CustomersFrom, _PCIDetail.Customers, _PCIDetail.PartnerType, _PCIDetail.ConnectInfo)
|
|
End If
|
|
Next
|
|
RaiseEvent FinalWork
|
|
End Sub
|
|
|
|
Private Sub aViewPCIDGroup_Customers_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aViewPCIDGroup_Customers.Execute
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _PCIGroup As PCIGroup = TryCast(View.SelectedObjects(0), PCIGroup)
|
|
|
|
ViewPDCI.ViewPDCIDetail_Customers(_onew, Application, e, _PCIGroup.CustomersFrom, _PCIGroup.Customers)
|
|
End Sub
|
|
|
|
Private Sub aViewCPB_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aViewCPB.Execute
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _PCIGroup As PCIGroup = TryCast(View.SelectedObjects(0), PCIGroup)
|
|
Dim _AssetsHandlingCPB As AssetsHandlingCPB
|
|
|
|
If _PCIGroup IsNot Nothing Then
|
|
_AssetsHandlingCPB = _onew.CreateObject(Of AssetsHandlingCPB)()
|
|
_AssetsHandlingCPB.Customers = _onew.GetObject(_PCIGroup.Customers)
|
|
e.ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, "AssetsHandlingCPB_DetailView", True, _AssetsHandlingCPB)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub aPCIGroup_ChangeInfo_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aPCIGroup_ChangeInfo.CustomizePopupWindowParams
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _AssetsHandlingGroupChange As AssetsHandlingGroupChange = _onew.CreateObject(Of AssetsHandlingGroupChange)()
|
|
_AssetsHandlingGroupChange.QueueIndex = 0
|
|
e.View = Application.CreateDetailView(_onew, "AssetsHandlingGroupChange_DetailView", False, _AssetsHandlingGroupChange)
|
|
End Sub
|
|
|
|
Private Sub aPCIGroup_ChangeInfo_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aPCIGroup_ChangeInfo.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _PCIGroup As PCIGroup
|
|
Dim _AssetsHandlingGroupChange As AssetsHandlingGroupChange = TryCast(e.PopupWindow.View.SelectedObjects(0), AssetsHandlingGroupChange)
|
|
|
|
|
|
RaiseEvent InitWork(1, 1, View.SelectedObjects.Count)
|
|
Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", False)
|
|
|
|
For Each _PCIGroup In View.SelectedObjects
|
|
RaiseEvent DoWork()
|
|
|
|
If _PCIGroup.InvoiceHeader IsNot Nothing Then
|
|
If _AssetsHandlingGroupChange.IsAssetsHandling_InvoiceHeader_Modifies = True Then _PCIGroup.InvoiceHeader.IsAssetsHandling = _AssetsHandlingGroupChange.IsAssetsHandling_InvoiceHeader
|
|
If _AssetsHandlingGroupChange.IsAssetsHandling_Note_Invoice Then _PCIGroup.InvoiceHeader.AssetsHandling_Note = _AssetsHandlingGroupChange.AssetsHandling_Note_Invoice
|
|
If _AssetsHandlingGroupChange.IsQueueIndex Then
|
|
_PCIGroup.InvoiceHeader.AssetsHandlingStatus = _ocur.GetObject(_AssetsHandlingGroupChange.AssetsHandlingStatus)
|
|
End If
|
|
End If
|
|
If _AssetsHandlingGroupChange.IsAssetsHandling_Note_Customers Then _PCIGroup.Customers.AssetsHandling_Note = _AssetsHandlingGroupChange.AssetsHandling_Note_Customers
|
|
If _AssetsHandlingGroupChange.IsLateChargeModifies Then _PCIGroup.InvoiceHeader.IsLateCharge = _AssetsHandlingGroupChange.IsLateCharge
|
|
Next
|
|
RaiseEvent FinalWork
|
|
_ocur.CommitChanges()
|
|
|
|
Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", True)
|
|
End Sub
|
|
|
|
Private Sub aViewPCIDGroup_GLDetails_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aViewPCIDGroup_GLDetails.Execute
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _PCIGroup As PCIGroup = TryCast(View.SelectedObjects(0), PCIGroup)
|
|
|
|
ViewPDCI.ViewGLDetails(_onew, Application, e, _PCIGroup.CustomersFrom, _
|
|
_PCIGroup.Customers, _PCIGroup.PartnerType, _
|
|
_PCIGroup.ConnectInfo)
|
|
End Sub
|
|
End Class
|