ms Import frmInvDashboard1
This commit is contained in:
@@ -176,12 +176,12 @@ Public Class frmMain
|
||||
If SHOW_CHARTS = True Then
|
||||
|
||||
If BASEDATA_DT_CHARTS.Rows.Count = 0 Then
|
||||
NavBarItemDashboard.Visible = False
|
||||
bbtnitDashboardInv.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||||
Else
|
||||
NavBarItemDashboard.Visible = True
|
||||
bbtnitDashboardInv.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||||
End If
|
||||
Else
|
||||
NavBarItemDashboard.Visible = False
|
||||
bbtnitDashboardInv.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
@@ -484,192 +484,10 @@ Public Class frmMain
|
||||
BindingNavigator1.Dock = DockStyle.Top
|
||||
GridControl_Docs.Visible = True
|
||||
GridControl_Docs.Dock = DockStyle.Fill
|
||||
SplitContainerDashboard.Visible = False
|
||||
SplitContainerDashboard.Dock = DockStyle.None
|
||||
|
||||
End If
|
||||
End Sub
|
||||
Sub Layout_Dashboard()
|
||||
Try
|
||||
|
||||
If GridControl_Docs.Visible = True Then
|
||||
BindingNavigator1.Dock = DockStyle.None
|
||||
BindingNavigator1.Visible = False
|
||||
|
||||
|
||||
GridControl_Docs.Dock = DockStyle.None
|
||||
GridControl_Docs.Visible = False
|
||||
Dim groupCount As Integer
|
||||
Dim charts As List(Of ChartControl)
|
||||
SplitContainerDashboard.Visible = True
|
||||
Dim oGroups As DataRowCollection = BASEDATA_DT_CHARTS.Rows
|
||||
groupCount = oGroups.Count
|
||||
Configure_Split_Containers(groupCount)
|
||||
charts = New List(Of ChartControl) From {ChartTopLeft, ChartTopRight, ChartBottomLeft, ChartBottomRight}
|
||||
If groupCount > 1 Then
|
||||
LOGGER.Debug($"ChartCreating...Found more than one charts [{groupCount}]")
|
||||
For Each gRow As DataRow In oGroups
|
||||
Dim oGroupIndex As Integer = oGroups.IndexOf(gRow)
|
||||
Dim oGroupID As String = gRow.Item("GROUP_ID")
|
||||
|
||||
Dim groupCharts = BASEDATA_DT_CHARTS.Select(String.Format("GROUP_ID = '{0}'", oGroupID))
|
||||
Dim chart As ChartControl
|
||||
|
||||
For Each cRow As DataRow In groupCharts
|
||||
|
||||
Dim oChartType = cRow.Item("TYPE_CHART")
|
||||
LOGGER.Debug($"oChartType [{oChartType}]")
|
||||
Dim oChartTitle = cRow.Item("TITLE")
|
||||
LOGGER.Debug($"oChartTitle [{oChartTitle}]")
|
||||
Dim guid = cRow.Item("GUID")
|
||||
LOGGER.Debug($"guid [{guid}]")
|
||||
Dim oChartValue = cRow.Item("VALUE")
|
||||
Dim oChartArgument = cRow.Item("ARGUMENT")
|
||||
Dim oSqlchart = cRow.Item("SQL_COMMAND")
|
||||
oSqlchart = oSqlchart.Replace("@USER", USER_USERNAME)
|
||||
Dim DATA_DT As DataTable = ClassDatabase.Return_Datatable(oSqlchart)
|
||||
|
||||
Dim series As Series = Create_Series(oChartTitle, oChartType)
|
||||
|
||||
' Select Current Chart
|
||||
chart = Select_Chart(oGroupIndex)
|
||||
chart = charts.Item(oGroupIndex)
|
||||
Try
|
||||
chart.Series.Clear()
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
|
||||
End Try
|
||||
' Set DataSource
|
||||
chart.DataSource = DATA_DT
|
||||
|
||||
' Set shown Columns for Chart
|
||||
series.ArgumentDataMember = oChartArgument
|
||||
series.ValueDataMembers.AddRange(New String() {oChartValue})
|
||||
|
||||
'set some options
|
||||
chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True
|
||||
|
||||
' Show Data
|
||||
chart.Series.Add(series)
|
||||
|
||||
Next ' End Charts
|
||||
Next 'End Groups
|
||||
Else
|
||||
' Create Charts
|
||||
For Each cRow As DataRow In BASEDATA_DT_CHARTS.Rows
|
||||
|
||||
Dim chart As ChartControl
|
||||
|
||||
Dim chartIndex As Integer = BASEDATA_DT_CHARTS.Rows.IndexOf(cRow)
|
||||
|
||||
Dim oChartType = cRow.Item("TYPE_CHART")
|
||||
Dim oChartTitle = cRow.Item("TITLE")
|
||||
Dim guid = cRow.Item("GUID")
|
||||
Dim oChartValue = cRow.Item("VALUE")
|
||||
Dim oChartArgument = cRow.Item("ARGUMENT")
|
||||
Dim oSqlchart = cRow.Item("SQL_COMMAND")
|
||||
|
||||
oSqlchart = clsPatterns.ReplaceInternalValues(oSqlchart)
|
||||
oSqlchart = clsPatterns.ReplaceUserValues(oSqlchart, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
||||
|
||||
oSqlchart = oSqlchart.ToString.ToUpper.Replace("@USER_ID", USER_ID)
|
||||
oSqlchart = oSqlchart.ToString.ToUpper.Replace("@USER", USER_USERNAME)
|
||||
Dim DATA_DT As DataTable = ClassDatabase.Return_Datatable(oSqlchart)
|
||||
|
||||
' Create Series based on type
|
||||
Dim series As Series = Create_Series(oChartTitle, oChartType)
|
||||
|
||||
' Select Current Chart
|
||||
chart = Select_Chart(chartIndex)
|
||||
Try
|
||||
chart.Series.Clear()
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
|
||||
End Try
|
||||
' Set DataSource
|
||||
chart.DataSource = DATA_DT
|
||||
|
||||
' Set shown Columns for Chart
|
||||
series.ArgumentDataMember = oChartArgument
|
||||
series.ValueDataMembers.AddRange(New String() {oChartValue})
|
||||
|
||||
'set some options
|
||||
chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True
|
||||
chart.OptionsPrint.SizeMode = Printing.PrintSizeMode.Stretch
|
||||
|
||||
' Show Data
|
||||
chart.Series.Add(series)
|
||||
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
LOGGER.Info("Layout Dashboard - Error: " & ex.Message)
|
||||
MsgBox("Unexpected Error in Layout Dashboard - Error: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, ADDITIONAL_TITLE)
|
||||
End Try
|
||||
End Sub
|
||||
Private Function Create_Series(title As String, type As String) As Series
|
||||
Dim series As Series
|
||||
LOGGER.Debug($"In Create new series: type [{type}]")
|
||||
Select Case type
|
||||
Case "BAR"
|
||||
LOGGER.Debug("Create new series: ViewType.Bar")
|
||||
series = New Series(title, ViewType.Bar)
|
||||
Case "LINE"
|
||||
LOGGER.Debug("Create new series: ViewType.Line")
|
||||
series = New Series(title, ViewType.Line)
|
||||
Case "AREA"
|
||||
LOGGER.Debug("Create new series: ViewType.Area")
|
||||
series = New Series(title, ViewType.Area)
|
||||
Case "PIE"
|
||||
LOGGER.Debug("Create new series: ViewType.Pie")
|
||||
series = New Series(title, ViewType.Pie)
|
||||
series.Label.TextPattern = "{A}: {VP:p0}"
|
||||
Dim view As PieSeriesView = DirectCast(series.View, PieSeriesView)
|
||||
view.Titles.Add(New SeriesTitle())
|
||||
view.Titles(0).Text = title
|
||||
Case Else
|
||||
series = New Series(title, ViewType.Bar)
|
||||
End Select
|
||||
|
||||
Return series
|
||||
End Function
|
||||
Private Function Select_Chart(index As Integer)
|
||||
Select Case index
|
||||
Case 0
|
||||
Return ChartTopLeft
|
||||
Case 1
|
||||
Return ChartTopRight
|
||||
Case 2
|
||||
Return ChartBottomLeft
|
||||
Case Else
|
||||
Return ChartBottomRight
|
||||
End Select
|
||||
End Function
|
||||
Private Sub Configure_Split_Containers(VisibleContainers As Integer)
|
||||
Select Case VisibleContainers
|
||||
Case 1
|
||||
' Show only ChartTopLeft
|
||||
SplitContainerTop.Panel2Collapsed = True
|
||||
' Collapse SplitContainerBottom
|
||||
SplitContainerDashboard.Panel2Collapsed = True
|
||||
Case 2
|
||||
' Collapse SplitContainerBottom
|
||||
SplitContainerDashboard.Panel2Collapsed = True
|
||||
Case 3
|
||||
' Collapse ChartBottomRight
|
||||
SplitContainerBottom.Panel2Collapsed = True
|
||||
' Show SplitContainerBottom
|
||||
SplitContainerDashboard.Panel2Collapsed = False
|
||||
Case 4
|
||||
' Show SplitContainerBottom
|
||||
SplitContainerDashboard.Panel2Collapsed = False
|
||||
End Select
|
||||
SplitContainerDashboard.Dock = DockStyle.Fill
|
||||
End Sub
|
||||
|
||||
Sub Load_single_Profile()
|
||||
Try
|
||||
@@ -1389,7 +1207,6 @@ Public Class frmMain
|
||||
End Sub
|
||||
Sub Load_Grid_Overview()
|
||||
Dim oStopWatch As New RefreshHelper.SW("Load_Grid_Overview(LGO)")
|
||||
SplitContainerDashboard.Visible = False
|
||||
Layout_Single_Profile()
|
||||
GRID_LOAD_TYPE = "OVERVIEW"
|
||||
CURRENT_CLICKED_PROFILE_ID = 0
|
||||
@@ -1602,13 +1419,7 @@ Public Class frmMain
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub NavBarItemDashboard_LinkClicked(sender As Object, e As NavBarLinkEventArgs)
|
||||
If TimerRefresh.Enabled = True Then
|
||||
TimerRefresh.Enabled = False
|
||||
End If
|
||||
Layout_Dashboard()
|
||||
frmInvDashboard.Show()
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub TabellenlayoutZurücksetzenToolStripMenuItem_Click_1(sender As Object, e As EventArgs) Handles TabellenlayoutZurücksetzenToolStripMenuItem.Click
|
||||
Reset_GridLayout()
|
||||
@@ -1969,112 +1780,7 @@ Public Class frmMain
|
||||
BarEditItem1.EditValue = e.ProgressPercentage
|
||||
End Sub
|
||||
|
||||
Private Sub bwSync_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles bwSync.RunWorkerCompleted
|
||||
|
||||
'BarEditItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||||
End Sub
|
||||
|
||||
Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles Panel1.Paint
|
||||
|
||||
End Sub
|
||||
Sub ExportChart2Pdf(pMyChart As ChartControl, pFilePath As String)
|
||||
Try
|
||||
pMyChart.OptionsPrint.ImageFormat = DevExpress.XtraCharts.Printing.PrintImageFormat.Metafile
|
||||
pMyChart.ExportToPdf(pFilePath, New DevExpress.XtraPrinting.PdfExportOptions With {
|
||||
.ConvertImagesToJpeg = False
|
||||
})
|
||||
' Exports to a stream as PDF.
|
||||
Dim pdfStream As FileStream = New FileStream(pFilePath, FileMode.Create)
|
||||
pMyChart.ExportToPdf(pdfStream)
|
||||
' ...
|
||||
pdfStream.Close()
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs)
|
||||
SaveFileDialog1.Filter = "PDF Files (*.pdf*)|*.pdf"
|
||||
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
|
||||
ExportChart2Pdf(ChartTopLeft, SaveFileDialog1.FileName)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs)
|
||||
SaveFileDialog1.Filter = "PDF Files (*.pdf*)|*.pdf"
|
||||
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
|
||||
ExportChart2Pdf(ChartTopRight, SaveFileDialog1.FileName)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs)
|
||||
SaveFileDialog1.Filter = "PDF Files (*.pdf*)|*.pdf"
|
||||
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
|
||||
ExportChart2Pdf(ChartBottomLeft, SaveFileDialog1.FileName)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ToolStripButton4_Click(sender As Object, e As EventArgs)
|
||||
SaveFileDialog1.Filter = "PDF Files (*.pdf*)|*.pdf"
|
||||
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
|
||||
ExportChart2Pdf(ChartBottomRight, SaveFileDialog1.FileName)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ToolStripButton5_Click(sender As Object, e As EventArgs)
|
||||
SaveFileDialog1.Filter = "PNG Files(* .png *)|*.png"
|
||||
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
|
||||
ExportCharttoimage(ChartTopLeft, SaveFileDialog1.FileName)
|
||||
End If
|
||||
End Sub
|
||||
Sub ExportCharttoimage(pMyChart As ChartControl, pFilePath As String)
|
||||
Try
|
||||
SaveChartImageToFile(pMyChart, ImageFormat.Png, pFilePath)
|
||||
Dim image As Image = GetChartImage(pMyChart, ImageFormat.Png)
|
||||
image.Save(pFilePath)
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
Private Sub SaveChartImageToFile(ByVal chart As ChartControl, ByVal format As ImageFormat, ByVal fileName As String)
|
||||
' Create an image in the specified format from the chart
|
||||
' and save it to the specified path.
|
||||
chart.ExportToImage(fileName, format)
|
||||
End Sub
|
||||
Private Function GetChartImage(ByVal chart As ChartControl, ByVal format As ImageFormat) As Image
|
||||
' Create an image.
|
||||
Dim image As Image = Nothing
|
||||
|
||||
' Create an image of the chart.
|
||||
Using s As New MemoryStream()
|
||||
chart.ExportToImage(s, format)
|
||||
image = System.Drawing.Image.FromStream(s)
|
||||
End Using
|
||||
|
||||
' Return the image.
|
||||
Return image
|
||||
End Function
|
||||
|
||||
Private Sub ToolStripButton6_Click(sender As Object, e As EventArgs)
|
||||
SaveFileDialog1.Filter = "PNG Files(* .png *)|*.png"
|
||||
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
|
||||
ExportCharttoimage(ChartTopRight, SaveFileDialog1.FileName)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ToolStripButton7_Click(sender As Object, e As EventArgs)
|
||||
SaveFileDialog1.Filter = "PNG Files(* .png *)|*.png"
|
||||
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
|
||||
ExportCharttoimage(ChartBottomLeft, SaveFileDialog1.FileName)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ToolStripButton8_Click(sender As Object, e As EventArgs)
|
||||
SaveFileDialog1.Filter = "PNG Files(* .png *)|*.png"
|
||||
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
|
||||
ExportCharttoimage(ChartBottomRight, SaveFileDialog1.FileName)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub Timer5Mins_Tick(sender As Object, e As EventArgs) Handles Timer5Mins.Tick
|
||||
|
||||
If Not bwBasicData.IsBusy Then
|
||||
@@ -2119,7 +1825,11 @@ Public Class frmMain
|
||||
BarEditItem1.EditValue = e.ProgressPercentage
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
|
||||
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitDashboardInv.ItemClick
|
||||
If Application.OpenForms().OfType(Of frmInvDashboard).Any Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
frmInvDashboard.Show()
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user