109 lines
4.0 KiB
VB.net
109 lines
4.0 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 System.IO
|
|
|
|
Imports DevExpress.XtraGrid.Views.Grid
|
|
Imports DevExpress.XtraPivotGrid
|
|
Imports DevExpress.ExpressApp.Win.Editors
|
|
Imports DevExpress.ExpressApp.PivotGrid.Win
|
|
Imports DevExpress.ExpressApp.SystemModule
|
|
Imports DevExpress.ExpressApp.Editors
|
|
Imports DevExpress.Persistent.BaseImpl
|
|
Imports DevExpress.ExpressApp.Model
|
|
Public Class InvoiceRowsPivotVC
|
|
Inherits SISBusiness.Module.InvoiceRowsPivotVC
|
|
Dim _FileNameGrid = Path.GetTempPath & "ReportGrid.xml"
|
|
Dim _FileNamePivotGrid = Path.GetTempPath & "ReportPivotGrid.xml"
|
|
|
|
Public Sub New()
|
|
MyBase.New()
|
|
|
|
'This call is required by the Component Designer.
|
|
InitializeComponent()
|
|
RegisterActions(components)
|
|
|
|
End Sub
|
|
Protected Overrides Sub OnActivated()
|
|
MyBase.OnActivated()
|
|
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _User As User
|
|
|
|
If _ocur IsNot Nothing Then
|
|
_User = _ocur.GetObjectByKey(Of User)(_ocur.GetKeyValue(SecuritySystem.CurrentUser))
|
|
End If
|
|
|
|
If View.Id = "InvoiceRowsPivot_InvoiceRows_Table_ListView" Then
|
|
If _User.Oid <> SecuritySystem.CurrentUserId Then
|
|
Frame.GetController(Of CentralListViewVC).aSaveCentralListViewSettings.Active.SetItemValue("", False)
|
|
End If
|
|
End If
|
|
If View.Id = "InvoiceRowsPivot_InvoiceRows_Pivot_ListView" Then
|
|
AddHandler View.ControlsCreated, AddressOf View_ControlCreated
|
|
End If
|
|
End Sub
|
|
Protected Overrides Sub OnDeactivated()
|
|
MyBase.OnDeactivated()
|
|
If View.Id = "InvoiceRowsPivot_InvoiceRows_Table_ListView" Then
|
|
Frame.GetController(Of CentralListViewVC).aSaveCentralListViewSettings.Active.SetItemValue("", True)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub View_ControlCreated(sender As Object, e As EventArgs)
|
|
If View.Id = "InvoiceRowsPivot_InvoiceRows_Pivot_ListView" Then
|
|
TryCast(TryCast(View, ListView).Editor, PivotGridListEditor).PivotGridControl.OptionsData.DataFieldUnboundExpressionMode = DataFieldUnboundExpressionMode.UseSummaryValues
|
|
AddHandler TryCast(TryCast(View, ListView).Editor, PivotGridListEditor).PivotGridControl.CustomSummary, AddressOf PivotGridControl_CustomSummary
|
|
'AddHandler TryCast(TryCast(View, ListView).Editor, PivotGridListEditor).PivotGridControl., AddressOf PivotGridControl_CustomSummary
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub PivotGridControl_CustomSummary(sender As Object, e As PivotGridCustomSummaryEventArgs)
|
|
'If Not e.DataField Is Then Return
|
|
'' A variable which counts the number of orders whose sum exceeds $500.
|
|
'Dim order500Count As Integer = 0
|
|
'' Get the record set corresponding to the current cell.
|
|
'Dim ds As PivotDrillDownDataSource = e.CreateDrillDownDataSource()
|
|
'' Iterate through the records and count the orders.
|
|
'Dim i As Integer
|
|
'For i = 0 To ds.RowCount - 1
|
|
' Dim row As PivotDrillDownDataRow = ds(i)
|
|
' ' Get the order's total sum.
|
|
' Dim orderSum As Decimal = row(fieldExtendedPrice)
|
|
' If orderSum >= minSum Then order500Count = order500Count + 1
|
|
'Next
|
|
'' Calculate the percentage.
|
|
'If ds.RowCount > 0 Then
|
|
' e.CustomValue = order500Count / ds.RowCount
|
|
'End If
|
|
'Beep()
|
|
'e.CustomValue = -1000
|
|
'Dim ds As PivotDrillDownDataSource = e.CreateDrillDownDataSource()
|
|
''If ds.RowCount > 0 Then
|
|
'' e.CustomValue = -200
|
|
''End If
|
|
'If e.DataField.FieldName = "GrossMarginPercent" Then
|
|
' For i = 0 To ds.RowCount - 1
|
|
' Dim row As PivotDrillDownDataRow = ds(i)
|
|
|
|
' Next
|
|
'End If
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
End Class
|