198 lines
10 KiB
VB.net
198 lines
10 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.ExpressApp.Win.SystemModule
|
|
Imports DevExpress.XtraGrid.Views.Grid
|
|
Imports DevExpress.ExpressApp.Editors
|
|
Imports DevExpress.ExpressApp.Win.Editors
|
|
Imports DevExpress.XtraGrid.Columns
|
|
Imports DevExpress.ExpressApp.SystemModule
|
|
Imports DevExpress.Data.Filtering
|
|
Imports DevExpress.Xpo
|
|
Imports System.Linq
|
|
Imports System.Linq.Expressions
|
|
Imports DevExpress.XtraEditors
|
|
|
|
Public Class GLAccountsVC
|
|
Inherits Nuvolar.Module.GLAccountsVC
|
|
Dim _WaitFormClass As New WaitFormClass
|
|
Private _GridListEditor As GridListEditor
|
|
Public Sub New()
|
|
MyBase.New()
|
|
|
|
'This call is required by the Component Designer.
|
|
InitializeComponent()
|
|
RegisterActions(components)
|
|
|
|
End Sub
|
|
Protected Overrides Sub OnActivated()
|
|
MyBase.OnActivated()
|
|
If View.Id = "GLAccounts_DetailView" Or View.Id = "GLAccounts_GLRows_ListView" Then
|
|
Frame.GetController(Of WinModificationsController).ModificationsHandlingMode = DevExpress.ExpressApp.SystemModule.ModificationsHandlingMode.AutoRollback
|
|
End If
|
|
If View.Id = "GLHeader_GLRows_ListView_Accounts" Then
|
|
Frame.GetController(Of ToolbarVisibilityController).Active.SetItemValue("", False)
|
|
Frame.GetController(Of ToolbarVisibilityController).SetToolbarVisibility(False)
|
|
End If
|
|
AddHandler DoWork, AddressOf _WaitFormClass.DoWork
|
|
AddHandler InitWork, AddressOf _WaitFormClass.Initwork
|
|
AddHandler FinalWork, AddressOf _WaitFormClass.Finalwork
|
|
|
|
AddHandler View.ControlsCreated, AddressOf View_Controlcreated
|
|
End Sub
|
|
Protected Overrides Sub OnDeactivated()
|
|
MyBase.OnDeactivated()
|
|
If View.Id = "GLHeader_GLRows_ListView_Accounts" Then
|
|
Frame.GetController(Of ToolbarVisibilityController).Active.SetItemValue("", True)
|
|
Frame.GetController(Of ToolbarVisibilityController).SetToolbarVisibility(True)
|
|
End If
|
|
RemoveHandler DoWork, AddressOf _WaitFormClass.DoWork
|
|
RemoveHandler InitWork, AddressOf _WaitFormClass.Initwork
|
|
RemoveHandler FinalWork, AddressOf _WaitFormClass.Finalwork
|
|
End Sub
|
|
Protected Overrides Sub OnViewControlsCreated()
|
|
MyBase.OnViewControlsCreated()
|
|
If View.Id = "GLAccounts_ListView" Then
|
|
Dim editor As ListEditor = (CType(View, ListView)).Editor
|
|
Dim gridView As GridView = (CType(editor, GridListEditor)).GridView
|
|
AddHandler gridView.SelectionChanged, AddressOf GridView_SelectionChanged
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub GridView_SelectionChanged(ByVal sender As Object, ByVal e As DevExpress.Data.SelectionChangedEventArgs)
|
|
Dim gridView As GridView = TryCast(sender, GridView)
|
|
If View Is Nothing Then Exit Sub
|
|
If View.SelectedObjects.Count = 1 Then
|
|
Dim _GLAccounts As GLAccounts = TryCast(View.SelectedObjects(0), GLAccounts)
|
|
If _GLAccounts Is Nothing Then
|
|
Else
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController).Active.SetItemValue("", True)
|
|
If _GLAccounts.IsEditable = False Then
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController).Active.SetItemValue("", False)
|
|
End If
|
|
End If
|
|
ElseIf View.SelectedObjects.Count > 1 Then
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController).Active.SetItemValue("", False)
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub View_Controlcreated(sender As Object, e As EventArgs)
|
|
'If View.Id = "GLAccounts_DetailView" Or View.Id = "GLCassa_DetailView" Or View.Id = "GLBank_DetailView" Or View.Id = "GLCompensation_DetailView" Or View.Id = "GLMixed_DetailView" Then
|
|
' Dim _row_NoteRows As ViewItem = TryCast(View, DetailView).FindItem("row_NoteRows")
|
|
' Dim _NoteHeader As ViewItem = TryCast(View, DetailView).FindItem("NoteHeader")
|
|
|
|
' Dim _StringComboUserControl As StringComboUserControl
|
|
' Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
|
|
' If _row_NoteRows IsNot Nothing Then
|
|
' _StringComboUserControl = TryCast(_row_NoteRows.Control, StringComboUserControl)
|
|
' If _StringComboUserControl IsNot Nothing Then
|
|
' '//------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
' Dim _DocumentNote_xpquery = New XPQuery(Of DocumentNote)(_onew.Session)
|
|
' Dim query = From _DocumentNote In _DocumentNote_xpquery _
|
|
' Where _DocumentNote.IsActive = True
|
|
' Select New With {Key .NoteRows = _DocumentNote.ShortName}
|
|
' For Each item In query
|
|
' _StringComboUserControl.ComboBoxEdit1.Properties.Items.Add(item.NoteRows)
|
|
' Next
|
|
' '--------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
' AddHandler _StringComboUserControl.ComboBoxEdit1.KeyDown, AddressOf StringComboUserControl_KeyDown
|
|
|
|
' End If
|
|
' End If
|
|
' If _NoteHeader IsNot Nothing Then
|
|
' _StringComboUserControl = TryCast(_NoteHeader.Control, StringComboUserControl)
|
|
' If _StringComboUserControl IsNot Nothing Then
|
|
' '//------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
' Dim _DocumentNote_xpquery = New XPQuery(Of DocumentNote)(_onew.Session)
|
|
' Dim query = From _DocumentNote In _DocumentNote_xpquery _
|
|
' Where _DocumentNote.IsActive = True
|
|
' Select New With {Key .NoteHeader = _DocumentNote.ShortName}
|
|
' For Each item In query
|
|
' _StringComboUserControl.ComboBoxEdit1.Properties.Items.Add(item.NoteHeader)
|
|
' Next
|
|
' '--------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
' AddHandler _StringComboUserControl.ComboBoxEdit1.KeyDown, AddressOf StringComboUserControl_KeyDown
|
|
|
|
' End If
|
|
' End If
|
|
'End If
|
|
If View.Id = "GLAccounts_DetailView" Or View.Id = "GLCassa_DetailView" Or View.Id = "GLBank_DetailView" Or View.Id = "GLCompensation_DetailView" Or View.Id = "GLMixed_DetailView" Then
|
|
Dim _row_NoteRows As ViewItem = TryCast(View, DetailView).FindItem("row_NoteRows")
|
|
Dim _NoteHeader As ViewItem = TryCast(View, DetailView).FindItem("NoteHeader")
|
|
|
|
Dim _ComboBoxEdit As ComboBoxEdit
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
|
|
If _row_NoteRows IsNot Nothing Then
|
|
_ComboBoxEdit = TryCast(_row_NoteRows.Control, ComboBoxEdit)
|
|
If _ComboBoxEdit IsNot Nothing Then
|
|
'//------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
Dim _DocumentNote_xpquery = New XPQuery(Of DocumentNote)(_onew.Session)
|
|
Dim query = From _DocumentNote In _DocumentNote_xpquery _
|
|
Where _DocumentNote.IsActive = True
|
|
Select New With {Key .NoteRows = _DocumentNote.ShortName}
|
|
For Each item In query
|
|
_ComboBoxEdit.Properties.Items.Add(item.NoteRows)
|
|
Next
|
|
'--------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
AddHandler _ComboBoxEdit.KeyDown, AddressOf StringComboUserControl_KeyDown
|
|
|
|
End If
|
|
End If
|
|
If _NoteHeader IsNot Nothing Then
|
|
_ComboBoxEdit = TryCast(_NoteHeader.Control, ComboBoxEdit)
|
|
If _ComboBoxEdit IsNot Nothing Then
|
|
'//------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
Dim _DocumentNote_xpquery = New XPQuery(Of DocumentNote)(_onew.Session)
|
|
Dim query = From _DocumentNote In _DocumentNote_xpquery _
|
|
Where _DocumentNote.IsActive = True
|
|
Select New With {Key .NoteHeader = _DocumentNote.ShortName}
|
|
For Each item In query
|
|
_ComboBoxEdit.Properties.Items.Add(item.NoteHeader)
|
|
Next
|
|
'--------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
AddHandler _ComboBoxEdit.KeyDown, AddressOf StringComboUserControl_KeyDown
|
|
|
|
End If
|
|
End If
|
|
End If
|
|
End Sub
|
|
Private Sub StringComboUserControl_KeyDown(sender As Object, e As Windows.Forms.KeyEventArgs)
|
|
If e.KeyCode = System.Windows.Forms.Keys.F12 Then
|
|
'// Kell egy mentés
|
|
If TryCast(sender, DevExpress.XtraEditors.ComboBoxEdit) IsNot Nothing Then
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _DocumentNote As DocumentNote = Nothing
|
|
Dim _ShortName As String = TryCast(sender, DevExpress.XtraEditors.ComboBoxEdit).Text
|
|
|
|
_DocumentNote = _onew.FindObject(Of DocumentNote)(CriteriaOperator.Parse("ShortName=?", _ShortName))
|
|
If _DocumentNote Is Nothing Then
|
|
_DocumentNote = _onew.CreateObject(Of DocumentNote)()
|
|
_DocumentNote.ShortName = _ShortName
|
|
_DocumentNote.IsActive = True
|
|
_onew.CommitChanges()
|
|
End If
|
|
End If
|
|
e.Handled = True
|
|
End If
|
|
End Sub
|
|
|
|
|
|
End Class
|