Приложение Д (Разработка ЭИС Информационная поддержка принятия управленческих решений для руководства ООО Цветметснаб)
Описание файла
Файл "Приложение Д" внутри архива находится в следующих папках: Разработка ЭИС Информационная поддержка принятия управленческих решений для руководства ООО Цветметснаб, Приложения. Документ из архива "Разработка ЭИС Информационная поддержка принятия управленческих решений для руководства ООО Цветметснаб", который расположен в категории "". Всё это находится в предмете "дипломы и вкр" из 12 семестр (4 семестр магистратуры), которые можно найти в файловом архиве РТУ МИРЭА. Не смотря на прямую связь этого архива с РТУ МИРЭА, его также можно найти и в других разделах. Архив можно найти в разделе "остальное", в предмете "диплом" в общих файлах.
Онлайн просмотр документа "Приложение Д"
Текст из документа "Приложение Д"
Приложение Д
Текст программы
Public Class MainForm
Class Values
Dim Items(10) As Object
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Dim DB As New System.Data.SqlServerCe.SqlCeEngine()
'DB.LocalConnectionString = ConfigurationManager.ConnectionStrings("Smoke.My.MySettings.SmokeDBConnectionString").ConnectionString
'DB.Upgrade()
End Sub
Private Sub TradeClient_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TradeClient.Click
EditTradeClientForm.ShowDialog()
End Sub
Private Sub PriceList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PriceList.Click
ProductionEditForm.ShowDialog()
End Sub
Private Sub DataMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataMenuItem.Click
EditValueForm.ShowDialog()
End Sub
Private Sub AnalyseForm1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AnalyseForm1.Click
If SelectPeriodForm.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim conn As New SqlServerCe.SqlCeConnection(ConfigurationManager.ConnectionStrings(Utilits.DBConnectionString).ConnectionString)
conn.Open()
Dim SQLText = "SELECT SUM(Sales.[Plan]) AS [Plan], SUM(Sales.Fact) AS Fact, Production.ProductionName " + Environment.NewLine
SQLText += "FROM Production" + Environment.NewLine
SQLText += "INNER JOIN Sales ON Production.ProductionID = Sales.ProductionID" + Environment.NewLine
SQLText += "WHERE (Sales.SaleDate >= @StartDate) AND (Sales.SaleDate <= @FinishDate) " + Environment.NewLine
SQLText += "GROUP BY Production.ProductionName" + Environment.NewLine
SQLText += "ORDER BY ProductionName"
Dim cmd As New SqlServerCe.SqlCeCommand(SQLText, conn)
Dim Param As New SqlServerCe.SqlCeParameter("@StartDate", System.Data.SqlDbType.DateTime)
Param.Direction = ParameterDirection.Input
Param.SourceColumn = "SaleDate"
Param.Value = SelectPeriodForm.StartDTP.Value
cmd.Parameters.Add(Param)
Param = New SqlServerCe.SqlCeParameter("@FinishDate", System.Data.SqlDbType.DateTime)
Param.Direction = ParameterDirection.Input
Param.SourceColumn = "SaleDate"
Param.Value = SelectPeriodForm.FinishDTP.Value
cmd.Parameters.Add(Param)
Dim T As New ReportDS.Report1TableDataTable
Dim Reader As SqlServerCe.SqlCeDataReader = cmd.ExecuteReader
While Reader.Read
Dim R As ReportDS.Report1TableRow = T.NewReport1TableRow
R.PLAN = Reader("Plan")
R.FACT = Reader("Fact")
R.NAME = Reader("ProductionName")
R.DEV = Reader("Fact") - Reader("Plan")
If Not IsDBNull(Reader("Plan")) AndAlso Reader("Plan") <> 0 Then
Dim Res As Double = Reader("Fact") / Reader("Plan") * 100
R.PROCENT = Res.ToString("N2")
End If
T.Rows.Add(R)
End While
Reader.Close()
conn.Close()
ReportForm1.ReportViewer1.LocalReport.DataSources.Clear()
Dim AList(0) As Microsoft.Reporting.WinForms.ReportParameter
AList(0) = New Microsoft.Reporting.WinForms.ReportParameter("Period", "Период с " + SelectPeriodForm.StartDTP.Value.ToString("dd.MM.yyyy") + " по " + SelectPeriodForm.FinishDTP.Value.ToString("dd.MM.yyyy"))
ReportForm1.ReportViewer1.LocalReport.SetParameters(AList)
Dim RDS As New Microsoft.Reporting.WinForms.ReportDataSource("ReportDS_Report1Table", T)
ReportForm1.ReportViewer1.LocalReport.DataSources.Add(RDS)
ReportForm1.ShowDialog()
End If
End Sub
Public Class Table3CountRating
Implements IComparer
Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare
Dim ax As ReportDS.Report3TableRow = x
Dim ay As ReportDS.Report3TableRow = y
If ax.BLOCK_COUNT > ay.BLOCK_COUNT Then : Return -1
ElseIf ax.BLOCK_COUNT < ay.BLOCK_COUNT Then : Return 1
Else : Return 0
End If
End Function
End Class
Public Class Table3SummaRating
Implements IComparer
Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare
Dim ax As ReportDS.Report3TableRow = x
Dim ay As ReportDS.Report3TableRow = y
If ax.SUMM_COUNT > ay.SUMM_COUNT Then : Return -1
ElseIf ax.SUMM_COUNT < ay.SUMM_COUNT Then : Return 1
Else : Return 0
End If
End Function
End Class
Public Class Table3Name
Implements IComparer
Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare
Dim ax As ReportDS.Report3TableRow = x
Dim ay As ReportDS.Report3TableRow = y
If ax.NAME > ay.NAME Then : Return -1
ElseIf ax.NAME < ay.NAME Then : Return 1
Else : Return 0
End If
End Function
End Class
Public Class Table2Name
Implements IComparer
Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare
Dim ax As ReportDS.Report2TableRow = x
Dim ay As ReportDS.Report2TableRow = y
If ax.NAME > ay.NAME Then : Return 1
ElseIf ax.NAME < ay.NAME Then : Return -1
Else : Return 0
End If
End Function
End Class
Private Sub AnalyseForm2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AnalyseForm2.Click
If SelectPeriodForm2.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim conn As New SqlServerCe.SqlCeConnection(ConfigurationManager.ConnectionStrings(Utilits.DBConnectionString).ConnectionString)
conn.Open()
Dim SQLStr As String = "SELECT Client.ClientName,SUM(Sales.Fact) AS Fact, SUM(Sales.Fact * (Production.SellPrice - Production.BuyPrice)) AS Summa From Client" + Environment.NewLine
SQLStr += "INNER JOIN Sales ON Sales.ClientID = Client.ClientID" + Environment.NewLine
SQLStr += "INNER JOIN Production ON Production.ProductionID = Sales.ProductionID" + Environment.NewLine
SQLStr += "WHERE (Sales.SaleDate >= @StartDate) AND (Sales.SaleDate <= @FinishDate) GROUP BY Client.ClientName"
Dim cmd As New SqlServerCe.SqlCeCommand(SQLStr, conn)
Dim Param As New SqlServerCe.SqlCeParameter("@StartDate", System.Data.SqlDbType.DateTime)
Param.Direction = ParameterDirection.Input
Param.SourceColumn = "SaleDate"
Param.Value = SelectPeriodForm2.StartDTP.Value
cmd.Parameters.Add(Param)
Param = New SqlServerCe.SqlCeParameter("@FinishDate", System.Data.SqlDbType.DateTime)
Param.Direction = ParameterDirection.Input
Param.SourceColumn = "SaleDate"
Param.Value = SelectPeriodForm2.FinishDTP.Value
cmd.Parameters.Add(Param)
Dim T As New ReportDS.Report2TableDataTable
Dim Reader As SqlServerCe.SqlCeDataReader = cmd.ExecuteReader
Dim List As New ArrayList
While Reader.Read
Dim R As ReportDS.Report2TableRow = T.NewReport2TableRow
List.Add(R)
R.NAME = Reader("ClientName")
R.COUNT_CURR = Reader("Fact")
R.SUMM_CURR = Reader("Summa")
End While
Reader.Close()
cmd.Parameters("@StartDate").Value = SelectPeriodForm2.PrevStartDTP.Value
cmd.Parameters("@FinishDate").Value = SelectPeriodForm2.PrevFinishDTP.Value
Reader = cmd.ExecuteReader
While Reader.Read
Dim R As ReportDS.Report2TableRow = Nothing
For Each TR As ReportDS.Report2TableRow In List
If TR.NAME = Reader("ClientName") Then
R = TR
Exit For
End If
Next
If R Is Nothing Then
R = T.NewReport2TableRow
R.NAME = Reader("ClientName")
List.Add(R)
End If
R.COUNT_PREV = Reader("Fact")
R.SUMM_PREV = Reader("Summa")
End While
List.Sort(New Table2Name)
For I As Integer = 0 To List.Count - 1
Dim R As ReportDS.Report2TableRow = List(I)
If Not R.IsCOUNT_CURRNull AndAlso Not R.IsCOUNT_PREVNull Then R.COUNT_DEV = CInt(R.COUNT_CURR) - CInt(R.COUNT_PREV)
If Not R.IsSUMM_CURRNull AndAlso Not R.IsSUMM_PREVNull Then R.SUMM_DEV = (R.SUMM_CURR - R.SUMM_PREV).ToString("N2")
T.Rows.Add(R)
Next
Reader.Close()
conn.Close()
Dim AList(1) As Microsoft.Reporting.WinForms.ReportParameter
AList(0) = New Microsoft.Reporting.WinForms.ReportParameter("StartPeriod", "Предыдущий период с " + SelectPeriodForm2.PrevStartDTP.Value.ToString("dd.MM.yyyy") + " по " + SelectPeriodForm2.PrevFinishDTP.Value.ToString("dd.MM.yyyy"))
AList(1) = New Microsoft.Reporting.WinForms.ReportParameter("FinishPeriod", "Отчетный период с " + SelectPeriodForm2.StartDTP.Value.ToString("dd.MM.yyyy") + " по " + SelectPeriodForm2.FinishDTP.Value.ToString("dd.MM.yyyy"))
ReportForm2.ReportViewer1.LocalReport.SetParameters(AList)
ReportForm2.ReportViewer1.LocalReport.DataSources.Clear()
Dim RDS As New Microsoft.Reporting.WinForms.ReportDataSource("ReportDS_Report2Table", T)
ReportForm2.ReportViewer1.LocalReport.DataSources.Add(RDS)
ReportForm2.ShowDialog()
End If
End Sub
Private Sub AnalyseForm3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AnalyseForm3.Click
If SelectPeriodForm.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim conn As New SqlServerCe.SqlCeConnection(ConfigurationManager.ConnectionStrings(Utilits.DBConnectionString).ConnectionString)
conn.Open()
Dim SQLStr As String = "" + Environment.NewLine
SQLStr += "" + Environment.NewLine
Dim cmd As New SqlServerCe.SqlCeCommand("SELECT Production.ProductionName, SUM(Sales.Fact) AS Fact, SUM(Sales.Fact * (Production.SellPrice - Production.BuyPrice)) AS Summa FROM Sales INNER JOIN Production ON Sales.ProductionID = Production.ProductionID WHERE (Sales.SaleDate >= @StartDate) AND (Sales.SaleDate <= @FinishDate) GROUP BY Production.ProductionName ORDER BY Production.ProductionName", conn)
Dim Param As New SqlServerCe.SqlCeParameter("@StartDate", System.Data.SqlDbType.DateTime)
Param.Direction = ParameterDirection.Input
Param.SourceColumn = "SaleDate"
Param.Value = SelectPeriodForm.StartDTP.Value
cmd.Parameters.Add(Param)
Param = New SqlServerCe.SqlCeParameter("@FinishDate", System.Data.SqlDbType.DateTime)
Param.Direction = ParameterDirection.Input
Param.SourceColumn = "SaleDate"
Param.Value = SelectPeriodForm.FinishDTP.Value
cmd.Parameters.Add(Param)
Dim T As New ReportDS.Report3TableDataTable
Dim Reader As SqlServerCe.SqlCeDataReader = cmd.ExecuteReader
Dim List As New ArrayList
While Reader.Read
Dim R As ReportDS.Report3TableRow = T.NewReport3TableRow
List.Add(R)
R.NAME = Reader("ProductionName")
R.BLOCK_COUNT = Reader("Fact")
R.SUMM_COUNT = Reader("Summa")
End While
List.Sort(New Table3CountRating)
For I As Integer = 0 To List.Count - 1 : CType(List(I), ReportDS.Report3TableRow).BLOCK_RATING = I + 1 : Next
List.Sort(New Table3SummaRating)
For I As Integer = 0 To List.Count - 1 : CType(List(I), ReportDS.Report3TableRow).SUMM_RATING = I + 1 : Next
List.Sort(New Table3Name)
For I As Integer = 0 To List.Count - 1
Dim R As ReportDS.Report3TableRow = List(I)
T.Rows.Add(R)
Next
Reader.Close()
conn.Close()
Dim AList(0) As Microsoft.Reporting.WinForms.ReportParameter
AList(0) = New Microsoft.Reporting.WinForms.ReportParameter("Period", "Период с " + SelectPeriodForm.StartDTP.Value.ToString("dd.MM.yyyy") + " по " + SelectPeriodForm.FinishDTP.Value.ToString("dd.MM.yyyy"))
ReportForm3.ReportViewer1.LocalReport.SetParameters(AList)
ReportForm3.ReportViewer1.LocalReport.DataSources.Clear()
Dim RDS As New Microsoft.Reporting.WinForms.ReportDataSource("ReportDS_Report3Table", T)
ReportForm3.ReportViewer1.LocalReport.DataSources.Add(RDS)
ReportForm3.ShowDialog()