Açıklama Yok
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

物料採購統計表.vb 51KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. Imports System.Windows.Forms.DataVisualization.Charting
  2. Imports System.IO
  3. Public Class 物料採購統計表
  4. Dim 物料規格, 資料(100), 頁面 As String
  5. Dim 可繪圖 As Boolean
  6. Dim NA1, 關鍵字數量, 移動位置, 關鍵字位置(1000) As Integer
  7. Dim 群組碼(21), 對話框(2) As String
  8. Private Sub Set_群組清單()
  9. Dim ds1 As New DataSet : 群組分類_dgv.DataSource = Nothing : ds1.Clear()
  10. 群組分類_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  11. 群組分類_dgv.ColumnHeadersHeight = 25 : 群組分類_dgv.AllowUserToAddRows = False : 群組分類_dgv.RowTemplate.Height = 45
  12. SQL_物料群組() : da.Fill(ds1) : 群組分類_dgv.DataSource = ds1.Tables(0) : conn.Close() : 次項變形()
  13. End Sub
  14. Private Sub Set_清單()
  15. Dim ds1 As New DataSet : 物料清單_dgv.DataSource = Nothing : ds1.Clear()
  16. 物料清單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  17. 物料清單_dgv.ColumnHeadersHeight = 40 : 物料清單_dgv.AllowUserToAddRows = False : 物料清單_dgv.RowTemplate.Height = 45
  18. PA20 = 關鍵字查詢_tb.Text
  19. If 採購平均單價_ch.Checked = False And 採購數量_ch.Checked = True Then : SQL_採購數量清單()
  20. ElseIf 採購平均單價_ch.Checked = True And 採購數量_ch.Checked = False Then : SQL_採購平均單價清單()
  21. End If
  22. da.Fill(ds1) : 物料清單_dgv.DataSource = ds1.Tables(0) : conn.Close()
  23. 物料清單_dgv.Columns(0).Visible = False : 物料清單_dgv.Columns(1).Width = 120 : 物料清單_dgv.Columns(2).Width = 170
  24. For I As Integer = 0 To 物料清單_dgv.Rows.Count - 1 : 物料清單_dgv.Rows(I).Cells(3).Value = "0"
  25. For II As Integer = 0 To 品名_dgv.Rows.Count - 1
  26. '-------------------------規格合併呈現----------------------------------------------------------------------------------------------------------------------------------------
  27. If 物料清單_dgv.Rows(I).Cells("料號").Value.ToString = 品名_dgv.Rows(II).Cells("料號").Value.ToString Then
  28. PA3 = 品名_dgv.Rows(II).Cells("規格庫抬頭指定").Value : SQL_規格庫抬頭讀取()
  29. If dr.Read() Then
  30. AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8")
  31. End If : conn.Close()
  32. Dim ZA1, ZA2, ZA3, ZA4, ZA5, ZA6, ZA7, ZA8 As String : 物料規格 = ""
  33. If 詳細資料2_ch.Checked = True Then
  34. If 品名_dgv.Rows(II).Cells("A1").Value.ToString <> "" Then
  35. ZA1 = AAA1 & "=" & 品名_dgv.Rows(II).Cells("A1").Value.ToString : 物料規格 = ZA1 : End If
  36. If 品名_dgv.Rows(II).Cells("A2").Value.ToString <> "" Then : ZA2 = AAA2 & "=" & 品名_dgv.Rows(II).Cells("A2").Value
  37. If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  38. If 品名_dgv.Rows(II).Cells("A3").Value.ToString <> "" Then : ZA3 = AAA3 & "=" & 品名_dgv.Rows(II).Cells("A3").Value
  39. If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  40. If 品名_dgv.Rows(II).Cells("A4").Value.ToString <> "" Then : ZA4 = AAA4 & "=" & 品名_dgv.Rows(II).Cells("A4").Value
  41. If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  42. If 品名_dgv.Rows(II).Cells("A5").Value.ToString <> "" Then : ZA5 = AAA5 & "=" & 品名_dgv.Rows(II).Cells("A5").Value
  43. If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  44. If 品名_dgv.Rows(II).Cells("A6").Value.ToString <> "" Then : ZA6 = AAA6 & "=" & 品名_dgv.Rows(II).Cells("A6").Value
  45. If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  46. If 品名_dgv.Rows(II).Cells("A7").Value.ToString <> "" Then : ZA7 = AAA7 & "=" & 品名_dgv.Rows(II).Cells("A7").Value
  47. If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  48. If 品名_dgv.Rows(II).Cells("A8").Value.ToString <> "" Then : ZA8 = AAA8 & "=" & 品名_dgv.Rows(II).Cells("A8").Value
  49. If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  50. Else
  51. If 品名_dgv.Rows(II).Cells("A1").Value.ToString <> "" Then : ZA1 = 品名_dgv.Rows(II).Cells("A1").Value.ToString : 物料規格 = ZA1 : End If
  52. If 品名_dgv.Rows(II).Cells("A2").Value.ToString <> "" Then
  53. ZA2 = 品名_dgv.Rows(II).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  54. If 品名_dgv.Rows(II).Cells("A3").Value.ToString <> "" Then
  55. ZA3 = 品名_dgv.Rows(II).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  56. If 品名_dgv.Rows(II).Cells("A4").Value.ToString <> "" Then
  57. ZA4 = 品名_dgv.Rows(II).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  58. If 品名_dgv.Rows(II).Cells("A5").Value.ToString <> "" Then
  59. ZA5 = 品名_dgv.Rows(II).Cells("A5").Value : If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  60. If 品名_dgv.Rows(II).Cells("A6").Value.ToString <> "" Then
  61. ZA6 = 品名_dgv.Rows(II).Cells("A6").Value : If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  62. If 品名_dgv.Rows(II).Cells("A7").Value.ToString <> "" Then
  63. ZA7 = 品名_dgv.Rows(II).Cells("A7").Value : If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  64. If 品名_dgv.Rows(II).Cells("A8").Value.ToString <> "" Then
  65. ZA8 = 品名_dgv.Rows(II).Cells("A8").Value : If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  66. End If
  67. 物料清單_dgv.Rows(I).Cells(2).Value = 物料規格 : Exit For
  68. End If
  69. Next
  70. For II As Integer = 4 To NN1 + 4
  71. If 物料清單_dgv.Rows(I).Cells(II).Value.ToString = "" Then : 物料清單_dgv.Rows(I).Cells(II).Value = "0" : End If
  72. 物料清單_dgv.Rows(I).Cells(3).Value = CInt(物料清單_dgv.Rows(I).Cells(3).Value.ToString) + CInt(物料清單_dgv.Rows(I).Cells(II).Value.ToString)
  73. Next
  74. Next
  75. If 採購平均單價_ch.Checked = False And 採購數量_ch.Checked = True Then
  76. 物料清單_dgv.Columns(3).FillWeight = 50 : 物料清單_dgv.Columns(3).Visible = True
  77. ElseIf 採購平均單價_ch.Checked = True And 採購數量_ch.Checked = False Then
  78. 物料清單_dgv.Columns(3).FillWeight = 50 : 物料清單_dgv.Columns(3).Visible = False
  79. End If
  80. For II As Integer = 4 To NN1 + 4
  81. 物料清單_dgv.Columns(II).FillWeight = 50 : 物料清單_dgv.Columns(II).DefaultCellStyle.Format = "#,##0"
  82. 物料清單_dgv.Columns(II).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  83. Next
  84. 物料清單_dgv.Columns("總採購量").DefaultCellStyle.Format = "#,##0"
  85. 物料清單_dgv.Columns("總採購量").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  86. 物料清單_dgv.Sort(物料清單_dgv.Columns(0), System.ComponentModel.ListSortDirection.Descending)
  87. End Sub
  88. Private Sub Set_採購日清單()
  89. Dim ds1 As New DataSet : 採購日_dgv.DataSource = Nothing : ds1.Clear()
  90. 採購日_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  91. 採購日_dgv.ColumnHeadersHeight = 25 : 採購日_dgv.AllowUserToAddRows = False
  92. SQL_採購日清單()
  93. da.Fill(ds1) : 採購日_dgv.DataSource = ds1.Tables(0) : conn.Close()
  94. 採購日_dgv.Sort(採購日_dgv.Columns("採購日"), System.ComponentModel.ListSortDirection.Ascending)
  95. PA10 = 採購日_dgv.Rows(0).Cells("採購日").Value.ToString()
  96. For I As Integer = 0 To 採購日_dgv.Rows.Count - 1
  97. If I = 0 Then : 清單列表 = "[" & 採購日_dgv.Rows(I).Cells(0).Value.ToString()
  98. Else : 清單列表 = 清單列表 & "], [" & 採購日_dgv.Rows(I).Cells(0).Value.ToString() : End If
  99. If I = 採購日_dgv.Rows.Count - 1 Then : 清單列表 &= "]" : End If : NN1 = I
  100. PA11 = 採購日_dgv.Rows(I).Cells("採購日").Value.ToString()
  101. Next
  102. End Sub
  103. Private Sub Set_品名清單()
  104. Dim ds1 As New DataSet : 品名_dgv.DataSource = Nothing : ds1.Clear()
  105. 品名_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  106. 品名_dgv.ColumnHeadersHeight = 25 : 品名_dgv.AllowUserToAddRows = False
  107. SQL_品名清單()
  108. da.Fill(ds1) : 品名_dgv.DataSource = ds1.Tables(0) : conn.Close()
  109. End Sub
  110. Private Sub Set_繪圖清單()
  111. Dim ds1 As New DataSet : 繪圖1_dgv.DataSource = Nothing : ds1.Clear()
  112. 繪圖1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  113. 繪圖1_dgv.ColumnHeadersHeight = 25 : 繪圖1_dgv.AllowUserToAddRows = False
  114. SQL_繪圖清單1()
  115. da.Fill(ds1) : 繪圖1_dgv.DataSource = ds1.Tables(0) : conn.Close()
  116. For i As Integer = 0 To 繪圖1_dgv.Rows.Count - 1
  117. If IsDBNull(繪圖1_dgv.Rows(i).Cells("採購數量").Value) = True Then
  118. 繪圖1_dgv.Rows(i).Cells("採購數量").Value = "0" : 繪圖1_dgv.Rows(i).Cells("料號").Value = PA1 : 繪圖1_dgv.Rows(i).Cells("平均單價").Value = "0"
  119. End If
  120. Next
  121. End Sub
  122. Private Sub 語言轉換讀取()
  123. If 系統語言 = "繁體中文" Then : 語言 = "CH" : ElseIf 系統語言 = "English" Then : 語言 = "EN" : ElseIf 系統語言 = "Indonesian" Then : 語言 = "IN" : End If
  124. Me.Text = 系統語言字典("H001-160-" & 語言) : ToolTip1.ToolTipTitle = 系統語言字典("G000-108-" & 語言) : 對話框(0) = 系統語言字典("H211-108-" & 語言)
  125. 詳細資料2_ch.Text = 系統語言字典("H211-100-" & 語言) : 關鍵字_lb.Text = 系統語言字典("H211-101-" & 語言) : 採購平均單價_ch.Text = 系統語言字典("H211-102-" & 語言)
  126. 採購數量_ch.Text = 系統語言字典("H211-103-" & 語言) : 長條圖_ch.Text = 系統語言字典("H211-104-" & 語言) : 折線圖_ch.Text = 系統語言字典("H211-105-" & 語言)
  127. 表頭(12) = 系統語言字典("H211-106-" & 語言) : 表頭(13) = 系統語言字典("H211-107-" & 語言) : 對話框(1) = 系統語言字典("H211-109-" & 語言)
  128. 對話框(2) = 系統語言字典("H211-110-" & 語言)
  129. End Sub
  130. Private Sub 關鍵字查詢_bt_MouseEnter(sender As Object, e As EventArgs) Handles 關鍵字查詢_bt.MouseEnter
  131. ToolTip1.SetToolTip(Me.關鍵字查詢_bt, 系統語言字典("H211-111-" & 語言))
  132. End Sub
  133. Private Sub 上一筆_bt_MouseEnter(sender As Object, e As EventArgs) Handles 上一筆_bt.MouseEnter
  134. ToolTip1.SetToolTip(Me.上一筆_bt, 系統語言字典("H211-112-" & 語言))
  135. End Sub
  136. Private Sub 下一筆_bt_MouseEnter(sender As Object, e As EventArgs) Handles 下一筆_bt.MouseEnter
  137. ToolTip1.SetToolTip(Me.下一筆_bt, 系統語言字典("H211-113-" & 語言))
  138. End Sub
  139. Private Sub 查詢入圖_bt_MouseEnter(sender As Object, e As EventArgs) Handles 查詢入圖_bt.MouseEnter
  140. ToolTip1.SetToolTip(Me.查詢入圖_bt, 系統語言字典("H211-114-" & 語言))
  141. End Sub
  142. Private Sub 清除查詢_bt_MouseEnter(sender As Object, e As EventArgs) Handles 清除查詢_bt.MouseEnter
  143. ToolTip1.SetToolTip(Me.清除查詢_bt, 系統語言字典("H211-115-" & 語言))
  144. End Sub
  145. Private Sub 清除圖表_bt_MouseEnter(sender As Object, e As EventArgs) Handles 清除圖表_bt.MouseEnter
  146. ToolTip1.SetToolTip(Me.清除圖表_bt, 系統語言字典("H211-116-" & 語言))
  147. End Sub
  148. Private Sub 回首頁_bt_MouseEnter(sender As Object, e As EventArgs) Handles 回首頁_bt.MouseEnter
  149. ToolTip1.SetToolTip(Me.回首頁_bt, 系統語言字典("G000-183-" & 語言))
  150. End Sub
  151. Private Sub 回次頁_bt_MouseEnter(sender As Object, e As EventArgs) Handles 回次頁_bt.MouseEnter
  152. ToolTip1.SetToolTip(Me.回次頁_bt, 系統語言字典("G000-184-" & 語言))
  153. End Sub
  154. Private Sub 管材_bt_MouseEnter(sender As Object, e As EventArgs) Handles 管材_bt.MouseEnter
  155. ToolTip1.SetToolTip(Me.管材_bt, 系統語言字典("G000-185-" & 語言))
  156. End Sub
  157. Private Sub 電線_bt_MouseEnter(sender As Object, e As EventArgs) Handles 電線_bt.MouseEnter
  158. ToolTip1.SetToolTip(Me.電線_bt, 系統語言字典("G000-186-" & 語言))
  159. End Sub
  160. Private Sub 電料_bt_MouseEnter(sender As Object, e As EventArgs) Handles 電料_bt.MouseEnter
  161. ToolTip1.SetToolTip(Me.電料_bt, 系統語言字典("G000-187-" & 語言))
  162. End Sub
  163. Private Sub 槽架_bt_MouseEnter(sender As Object, e As EventArgs) Handles 槽架_bt.MouseEnter
  164. ToolTip1.SetToolTip(Me.槽架_bt, 系統語言字典("G000-188-" & 語言))
  165. End Sub
  166. Private Sub 建材_bt_MouseEnter(sender As Object, e As EventArgs) Handles 建材_bt.MouseEnter
  167. ToolTip1.SetToolTip(Me.建材_bt, 系統語言字典("G000-189-" & 語言))
  168. End Sub
  169. Private Sub 五金_bt_MouseEnter(sender As Object, e As EventArgs) Handles 五金_bt.MouseEnter
  170. ToolTip1.SetToolTip(Me.五金_bt, 系統語言字典("G000-190-" & 語言))
  171. End Sub
  172. Private Sub 設備_bt_MouseEnter(sender As Object, e As EventArgs) Handles 設備_bt.MouseEnter
  173. ToolTip1.SetToolTip(Me.設備_bt, 系統語言字典("G000-191-" & 語言))
  174. End Sub
  175. Private Sub 工具_bt_MouseEnter(sender As Object, e As EventArgs) Handles 工具_bt.MouseEnter
  176. ToolTip1.SetToolTip(Me.工具_bt, 系統語言字典("G000-192-" & 語言))
  177. End Sub
  178. Private Sub 日用_bt_MouseEnter(sender As Object, e As EventArgs) Handles 日用_bt.MouseEnter
  179. ToolTip1.SetToolTip(Me.日用_bt, 系統語言字典("G000-193-" & 語言))
  180. End Sub
  181. Private Sub 其他_bt_MouseEnter(sender As Object, e As EventArgs) Handles 其他_bt.MouseEnter
  182. ToolTip1.SetToolTip(Me.其他_bt, 系統語言字典("G000-194-" & 語言))
  183. End Sub
  184. Private Sub 物料採購統計表_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  185. Me.MdiParent = HX_PGS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  186. 風格() : H(211) = True : 介面 = "H211" : 語言轉換讀取() : 顯示說明(999, True)
  187. Panel1.SendToBack() : 主頁_p.BringToFront() : Chart1.Visible = False
  188. Set_採購日清單()
  189. 物料採購統計表_Siz()
  190. End Sub
  191. Private Sub 物料採購統計表_Siz()
  192. MyMod.清單字體大小調整()
  193. 物料清單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  194. End Sub
  195. Private Sub 物料採購統計表_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
  196. MyMod.虛擬桌面開啟()
  197. End Sub
  198. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  199. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  200. End Sub
  201. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  202. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  203. End Sub
  204. Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
  205. 介面 = "H211" : 語言轉換讀取()
  206. End Sub
  207. Private Sub 繪圖()
  208. If 折線圖_ch.Checked = True Then
  209. Chart1.Series.Add(資料(NA1) & "_1") : Chart1.Series(資料(NA1) & "_1").ChartType = SeriesChartType.Line
  210. Chart1.Series(資料(NA1) & "_1").IsVisibleInLegend = False
  211. End If
  212. If 長條圖_ch.Checked = True Then
  213. Chart1.Series.Add(資料(NA1)) : Chart1.Series(資料(NA1)).ChartType = SeriesChartType.Column
  214. End If
  215. Chart1.ChartAreas(0).BackColor = Color.Transparent : Chart1.Legends(0).BackColor = Color.Transparent
  216. Chart1.ChartAreas(0).AxisY.LabelStyle.Font = New Font("Arial", 8) : Chart1.ChartAreas(0).AxisY.LabelStyle.Format = "#,##0" & " M"
  217. Dim NUDAA As Integer
  218. If 數列_NUD.Value >= 繪圖1_dgv.Rows.Count - 1 Or 數列_NUD.Value = 0 Then : NUDAA = 繪圖1_dgv.Rows.Count - 1
  219. ElseIf 數列_NUD.Value < 繪圖1_dgv.Rows.Count - 1 Then : NUDAA = 數列_NUD.Value : End If
  220. For II As Integer = 0 To NUDAA
  221. If 採購平均單價_ch.Checked = False And 採購數量_ch.Checked = True Then
  222. If 長條圖_ch.Checked = True Then
  223. Chart1.Series(資料(NA1)).Points.AddXY(繪圖1_dgv.Rows(NUDAA - II).Cells("採購日").Value.ToString, 繪圖1_dgv.Rows(NUDAA - II).Cells("採購數量").Value.ToString)
  224. End If
  225. If 折線圖_ch.Checked = True Then
  226. Chart1.Series(資料(NA1) & "_1").Points.AddXY(繪圖1_dgv.Rows(NUDAA - II).Cells("採購日").Value.ToString, 繪圖1_dgv.Rows(NUDAA - II).Cells("採購數量").Value.ToString)
  227. End If
  228. ElseIf 採購平均單價_ch.Checked = True And 採購數量_ch.Checked = False Then
  229. If 長條圖_ch.Checked = True Then
  230. Chart1.Series(資料(NA1)).Points.AddXY(繪圖1_dgv.Rows(NUDAA - II).Cells("採購日").Value.ToString, 繪圖1_dgv.Rows(NUDAA - II).Cells("平均單價").Value.ToString)
  231. End If
  232. If 折線圖_ch.Checked = True Then
  233. Chart1.Series(資料(NA1) & "_1").Points.AddXY(繪圖1_dgv.Rows(NUDAA - II).Cells("採購日").Value.ToString, 繪圖1_dgv.Rows(NUDAA - II).Cells("平均單價").Value.ToString)
  234. End If
  235. End If
  236. Next : NA1 = NA1 + 1
  237. If 深色風格 = False Then
  238. Chart1.Legends(0).ForeColor = Color.Black
  239. Chart1.ChartAreas(0).AxisX.MajorGrid.LineColor = Color.Black : Chart1.ChartAreas(0).AxisY.MajorGrid.LineColor = Color.Black
  240. Chart1.ChartAreas(0).AxisX.LineColor = Color.Black : Chart1.ChartAreas(0).AxisY.LineColor = Color.Black
  241. Chart1.ChartAreas(0).AxisX.LabelStyle.ForeColor = Color.Black : Chart1.ChartAreas(0).AxisY.LabelStyle.ForeColor = Color.Black
  242. Else
  243. Chart1.Legends(0).ForeColor = Color.White
  244. Chart1.ChartAreas(0).AxisX.MajorGrid.LineColor = Color.White : Chart1.ChartAreas(0).AxisY.MajorGrid.LineColor = Color.White
  245. Chart1.ChartAreas(0).AxisX.LineColor = Color.White : Chart1.ChartAreas(0).AxisY.LineColor = Color.White
  246. Chart1.ChartAreas(0).AxisX.LabelStyle.ForeColor = Color.White : Chart1.ChartAreas(0).AxisY.LabelStyle.ForeColor = Color.White
  247. End If
  248. End Sub
  249. Private Sub 物料清單_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 物料清單_dgv.CellClick
  250. If e.RowIndex = -1 Then : Else
  251. PA1 = 物料清單_dgv.Rows(e.RowIndex).Cells("料號").Value.ToString : Set_繪圖清單()
  252. If 繪圖1_dgv.Rows.Count > 0 Then
  253. For i As Integer = 0 To NA1
  254. 可繪圖 = True
  255. If 資料(i) = 物料清單_dgv.Rows(e.RowIndex).Cells(表頭(12)).Value.ToString & " " & 物料清單_dgv.Rows(e.RowIndex).Cells(表頭(13)).Value.ToString Then
  256. 可繪圖 = False : Exit For
  257. End If
  258. Next
  259. If 可繪圖 = True Then
  260. Try
  261. 資料(NA1) = 物料清單_dgv.Rows(e.RowIndex).Cells(表頭(12)).Value.ToString & " " & 物料清單_dgv.Rows(e.RowIndex).Cells(表頭(13)).Value.ToString : 繪圖()
  262. Catch ex As Exception : MGB(ex.Message, 1) : End Try
  263. End If
  264. End If
  265. End If
  266. End Sub
  267. Private Sub 查詢入圖_bt_Click(sender As Object, e As EventArgs) Handles 查詢入圖_bt.Click
  268. Chart1.Series.Clear()
  269. For I As Integer = 0 To 關鍵字數量
  270. If 關鍵字位置(I) = 1 Then
  271. PA1 = 物料清單_dgv.Rows(I).Cells("料號").Value.ToString : Set_繪圖清單()
  272. If 繪圖1_dgv.Rows.Count > 0 Then
  273. For II As Integer = 0 To NA1
  274. 可繪圖 = True
  275. If 資料(II) = 物料清單_dgv.Rows(I).Cells(表頭(12)).Value.ToString & " " & 物料清單_dgv.Rows(I).Cells(表頭(13)).Value.ToString Then
  276. 可繪圖 = False : Exit For
  277. End If
  278. Next
  279. If 可繪圖 = True Then
  280. Try
  281. 資料(NA1) = 物料清單_dgv.Rows(I).Cells(表頭(12)).Value.ToString & " " & 物料清單_dgv.Rows(I).Cells(表頭(13)).Value.ToString : 繪圖()
  282. Catch ex As Exception : MGB(ex.Message, 1) : End Try
  283. End If
  284. End If
  285. End If
  286. Next
  287. End Sub
  288. Private Sub 詳細資料2_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 詳細資料2_ch.Click
  289. If 詳細資料2_ch.Checked = True Then : 詳細資料2_ch.Checked = True : Else : 詳細資料2_ch.Checked = False : End If : Set_清單()
  290. End Sub
  291. Private Sub 採購平均單價_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 採購平均單價_ch.Click
  292. 採購平均單價_ch.Checked = True : 採購數量_ch.Checked = False : 清除圖表_bt.PerformClick() : Set_清單()
  293. End Sub
  294. Private Sub 採購數量_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 採購數量_ch.Click
  295. 採購平均單價_ch.Checked = False : 採購數量_ch.Checked = True : 清除圖表_bt.PerformClick() : Set_清單()
  296. End Sub
  297. Private Sub 關鍵字查詢_bt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 關鍵字查詢_bt.Click
  298. If 關鍵字查詢_tb.Text = "" Then : MGB(對話框(0), 1) : Else
  299. Set_清單() : 關鍵字數量 = 0 : For I As Integer = 0 To 1000 : 關鍵字位置(I) = 0 : Next
  300. Dim Str1, Str2 As String
  301. For I As Integer = 0 To 物料清單_dgv.Rows.Count - 1
  302. 物料清單_dgv.Rows(I).DefaultCellStyle.BackColor = Color.White
  303. Str1 = 物料清單_dgv.Rows(I).Cells(表頭(12)).Value.ToString() : Str2 = 關鍵字查詢_tb.Text
  304. Dim Stu As Boolean = Str1.Contains(Str2)
  305. If Stu = True Then
  306. If 深色風格 = False Then
  307. 物料清單_dgv.Rows(I).DefaultCellStyle.BackColor = Color.LightPink
  308. Else
  309. 物料清單_dgv.Rows(I).DefaultCellStyle.BackColor = Color.Red
  310. End If : 關鍵字位置(I) = 1 : 關鍵字數量 = I : 移動位置 = 0
  311. End If
  312. Next : 下一筆_bt.PerformClick()
  313. End If
  314. End Sub
  315. Private Sub 長條圖_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 長條圖_ch.Click
  316. If 長條圖_ch.Checked = False And 折線圖_ch.Checked = False Then : 長條圖_ch.Checked = True : End If
  317. End Sub
  318. Private Sub 折線圖_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 折線圖_ch.Click
  319. If 長條圖_ch.Checked = False And 折線圖_ch.Checked = False Then : 折線圖_ch.Checked = True : End If
  320. End Sub
  321. Private Sub 清除查詢_bt_Click(sender As Object, e As EventArgs) Handles 清除查詢_bt.Click
  322. 關鍵字數量 = 0 : For I As Integer = 0 To 1000 : 關鍵字位置(I) = 0 : Next : 清除圖表_bt.PerformClick()
  323. 關鍵字查詢_tb.Text = "%%" : 關鍵字查詢_bt.PerformClick() : 關鍵字查詢_tb.Text = ""
  324. For I As Integer = 0 To 物料清單_dgv.Rows.Count - 1
  325. If 深色風格 = False Then
  326. 物料清單_dgv.Rows(I).DefaultCellStyle.BackColor = Color.White
  327. Else
  328. 物料清單_dgv.Rows(I).DefaultCellStyle.BackColor = Color.DimGray
  329. End If
  330. Next
  331. End Sub
  332. Private Sub 上一筆_bt_Click(sender As Object, e As EventArgs) Handles 上一筆_bt.Click
  333. If 移動位置 = 0 Then : MGB(對話框(1), 1) : Else
  334. Dim 減項 As Integer = 移動位置
  335. For I As Integer = 0 To 移動位置
  336. 減項 -= 1
  337. If 關鍵字位置(減項) = 1 Then : 物料清單_dgv.CurrentCell = 物料清單_dgv.Rows(減項).Cells(1) : 移動位置 = 減項 : Exit For : End If
  338. If 減項 = 0 Then : 移動位置 = 0 : Exit Sub : End If
  339. Next
  340. End If
  341. End Sub
  342. Private Sub 下一筆_bt_Click(sender As Object, e As EventArgs) Handles 下一筆_bt.Click
  343. If 移動位置 >= 關鍵字數量 Then : MGB(對話框(2), 1) : Else
  344. For I As Integer = 移動位置 To 關鍵字數量
  345. If 關鍵字位置(I) = 1 Then : 物料清單_dgv.CurrentCell = 物料清單_dgv.Rows(I).Cells(1) : 移動位置 = I + 1 : Exit For : End If
  346. If 移動位置 = 關鍵字數量 Then : 移動位置 = 關鍵字數量 : End If
  347. Next
  348. End If
  349. End Sub
  350. Private Sub 清除圖表_bt_Click(sender As Object, e As EventArgs) Handles 清除圖表_bt.Click
  351. Chart1.Series.Clear() : For i As Integer = 0 To NA1 : 資料(i) = "" : Next : NA1 = 0
  352. End Sub
  353. Private Sub 回首頁_bt_Click(sender As Object, e As EventArgs) Handles 回首頁_bt.Click
  354. 物料查詢 = False : 主頁_p.BringToFront()
  355. End Sub
  356. Private Sub 回次頁_bt_Click(sender As Object, e As EventArgs) Handles 回次頁_bt.Click
  357. If 頁面 = "1" Then : 主頁_p.BringToFront() : ElseIf 頁面 = "2" Then : 次頁_p.BringToFront() : Else : 主頁_p.BringToFront() : End If
  358. End Sub
  359. Private Sub 次項變形()
  360. For i As Integer = 1 To 21 : Dim 選擇 As Panel = CType(Me.Controls.Find("AP" & i, True)(0), Panel) : 選擇.Visible = False : Next
  361. Dim SS As Integer
  362. If 群組分類_dgv.Rows.Count > 21 Then : SS = 21 : Else : SS = 群組分類_dgv.Rows.Count : End If
  363. For i As Integer = 1 To SS : Dim 選擇 As Panel = CType(Me.Controls.Find("AP" & i, True)(0), Panel) : 選擇.Visible = True : Next
  364. Dim 轉檔 As Boolean
  365. For i As Integer = 0 To 群組分類_dgv.Rows.Count - 1
  366. Dim 選擇 As PictureBox = CType(Me.Controls.Find("PB_" & i + 1, True)(0), PictureBox)
  367. If IsDBNull(群組分類_dgv.Rows(i).Cells(2).Value) = True Then : 轉檔 = False : Else : 轉檔 = True : End If
  368. While 轉檔 = True
  369. Dim unused As Byte() = New Byte(-1) {}
  370. Dim bytes As Byte() = DirectCast(群組分類_dgv.Rows(i).Cells(2).Value, Byte())
  371. Dim oStream As New MemoryStream(bytes)
  372. 選擇.Image = Bitmap.FromStream(oStream) : 轉檔 = False
  373. End While : conn.Close() : 選擇.SizeMode = 4
  374. Dim 選擇1 As TextBox = CType(Me.Controls.Find("TB_" & i + 1, True)(0), TextBox) : 選擇1.Text = 群組分類_dgv.Rows(i).Cells(1).Value.ToString
  375. '---------未做換頁計算---------------------------------------------
  376. 群組碼(i + 1) = 群組分類_dgv.Rows(i).Cells(0).Value.ToString
  377. Next
  378. End Sub
  379. Private Sub 管材_bt_Click(sender As Object, e As EventArgs) Handles 管材_bt.Click
  380. 頁面 = "1" : PA1 = "管材" : Set_群組清單() : 次頁_p.BringToFront()
  381. End Sub
  382. Private Sub 電線_bt_Click(sender As Object, e As EventArgs) Handles 電線_bt.Click
  383. 頁面 = "1" : PA1 = "電線" : Set_群組清單() : 次頁_p.BringToFront()
  384. End Sub
  385. Private Sub 電料_bt_Click(sender As Object, e As EventArgs) Handles 電料_bt.Click
  386. 頁面 = "1" : PA1 = "電料" : Set_群組清單() : 次頁_p.BringToFront()
  387. End Sub
  388. Private Sub 槽架_bt_Click(sender As Object, e As EventArgs) Handles 槽架_bt.Click
  389. 頁面 = "1" : PA1 = "槽架" : Set_群組清單() : 次頁_p.BringToFront()
  390. End Sub
  391. Private Sub 建材_bt_Click(sender As Object, e As EventArgs) Handles 建材_bt.Click
  392. 頁面 = "1" : PA1 = "建材" : Set_群組清單() : 次頁_p.BringToFront()
  393. End Sub
  394. Private Sub 五金_bt_Click(sender As Object, e As EventArgs) Handles 五金_bt.Click
  395. 頁面 = "1" : PA1 = "五金" : Set_群組清單() : 次頁_p.BringToFront()
  396. End Sub
  397. Private Sub 設備_bt_Click(sender As Object, e As EventArgs) Handles 設備_bt.Click
  398. 頁面 = "1" : PA1 = "設備" : Set_群組清單() : 次頁_p.BringToFront()
  399. End Sub
  400. Private Sub 工具_bt_Click(sender As Object, e As EventArgs) Handles 工具_bt.Click
  401. 頁面 = "1" : PA1 = "工具" : Set_群組清單() : 次頁_p.BringToFront()
  402. End Sub
  403. Private Sub 日用_bt_Click(sender As Object, e As EventArgs) Handles 日用_bt.Click
  404. 頁面 = "1" : PA1 = "日用" : Set_群組清單() : 次頁_p.BringToFront()
  405. End Sub
  406. Private Sub 其他_bt_Click(sender As Object, e As EventArgs) Handles 其他_bt.Click
  407. 頁面 = "1" : PA1 = "其他" : Set_群組清單() : 次頁_p.BringToFront()
  408. End Sub
  409. Private Sub 載入時繪圖()
  410. Chart1.Series.Clear()
  411. If 物料清單_dgv.Rows.Count > 0 Then : PA1 = 物料清單_dgv.Rows(0).Cells("料號").Value.ToString : Set_繪圖清單()
  412. If 繪圖1_dgv.Rows.Count > 0 Then
  413. For i As Integer = 0 To NA1
  414. 可繪圖 = True
  415. If 資料(i) = 物料清單_dgv.Rows(0).Cells(表頭(12)).Value.ToString & " " & 物料清單_dgv.Rows(0).Cells(表頭(13)).Value.ToString Then : 可繪圖 = False : Exit For : End If
  416. Next
  417. If 可繪圖 = True Then
  418. Try
  419. 資料(NA1) = 物料清單_dgv.Rows(0).Cells(表頭(12)).Value.ToString & " " & 物料清單_dgv.Rows(0).Cells(表頭(13)).Value.ToString : 繪圖()
  420. Catch ex As Exception : MGB(ex.Message, 1) : End Try
  421. End If
  422. End If
  423. End If
  424. End Sub
  425. Private Sub PB_1_Click(sender As Object, e As EventArgs) Handles PB_1.Click
  426. 頁面 = "2" : PA2 = 群組碼(1) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  427. End Sub
  428. Private Sub PB_2_Click(sender As Object, e As EventArgs) Handles PB_2.Click
  429. 頁面 = "2" : PA2 = 群組碼(2) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  430. End Sub
  431. Private Sub PB_3_Click(sender As Object, e As EventArgs) Handles PB_3.Click
  432. 頁面 = "2" : PA2 = 群組碼(3) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  433. End Sub
  434. Private Sub PB_4_Click(sender As Object, e As EventArgs) Handles PB_4.Click
  435. 頁面 = "2" : PA2 = 群組碼(4) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  436. End Sub
  437. Private Sub PB_5_Click(sender As Object, e As EventArgs) Handles PB_5.Click
  438. 頁面 = "2" : PA2 = 群組碼(5) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  439. End Sub
  440. Private Sub PB_6_Click(sender As Object, e As EventArgs) Handles PB_6.Click
  441. 頁面 = "2" : PA2 = 群組碼(6) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  442. End Sub
  443. Private Sub PB_7_Click(sender As Object, e As EventArgs) Handles PB_7.Click
  444. 頁面 = "2" : PA2 = 群組碼(7) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  445. End Sub
  446. Private Sub PB_8_Click(sender As Object, e As EventArgs) Handles PB_8.Click
  447. 頁面 = "2" : PA2 = 群組碼(8) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  448. End Sub
  449. Private Sub PB_9_Click(sender As Object, e As EventArgs) Handles PB_9.Click
  450. 頁面 = "2" : PA2 = 群組碼(9) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  451. End Sub
  452. Private Sub PB_10_Click(sender As Object, e As EventArgs) Handles PB_10.Click
  453. 頁面 = "2" : PA2 = 群組碼(10) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  454. End Sub
  455. Private Sub PB_11_Click(sender As Object, e As EventArgs) Handles PB_11.Click
  456. 頁面 = "2" : PA2 = 群組碼(11) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  457. End Sub
  458. Private Sub PB_12_Click(sender As Object, e As EventArgs) Handles PB_12.Click
  459. 頁面 = "2" : PA2 = 群組碼(12) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  460. End Sub
  461. Private Sub PB_13_Click(sender As Object, e As EventArgs) Handles PB_13.Click
  462. 頁面 = "2" : PA2 = 群組碼(13) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  463. End Sub
  464. Private Sub PB_14_Click(sender As Object, e As EventArgs) Handles PB_14.Click
  465. 頁面 = "2" : PA2 = 群組碼(14) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  466. End Sub
  467. Private Sub PB_15_Click(sender As Object, e As EventArgs) Handles PB_15.Click
  468. 頁面 = "2" : PA2 = 群組碼(15) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  469. End Sub
  470. Private Sub PB_16_Click(sender As Object, e As EventArgs) Handles PB_16.Click
  471. 頁面 = "2" : PA2 = 群組碼(16) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  472. End Sub
  473. Private Sub PB_17_Click(sender As Object, e As EventArgs) Handles PB_17.Click
  474. 頁面 = "2" : PA2 = 群組碼(17) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  475. End Sub
  476. Private Sub PB_18_Click(sender As Object, e As EventArgs) Handles PB_18.Click
  477. 頁面 = "2" : PA2 = 群組碼(18) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  478. End Sub
  479. Private Sub PB_19_Click(sender As Object, e As EventArgs) Handles PB_19.Click
  480. 頁面 = "2" : PA2 = 群組碼(19) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  481. End Sub
  482. Private Sub PB_20_Click(sender As Object, e As EventArgs) Handles PB_20.Click
  483. 頁面 = "2" : PA2 = 群組碼(20) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  484. End Sub
  485. Private Sub PB_21_Click(sender As Object, e As EventArgs) Handles PB_21.Click
  486. 頁面 = "2" : PA2 = 群組碼(21) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  487. End Sub
  488. Private Sub TB_1_TextChanged(sender As Object, e As EventArgs) Handles TB_1.Click
  489. 頁面 = "2" : PA2 = 群組碼(1) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  490. End Sub
  491. Private Sub TB_2_TextChanged(sender As Object, e As EventArgs) Handles TB_2.Click
  492. 頁面 = "2" : PA2 = 群組碼(2) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  493. End Sub
  494. Private Sub TB_3_TextChanged(sender As Object, e As EventArgs) Handles TB_3.Click
  495. 頁面 = "2" : PA2 = 群組碼(3) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  496. End Sub
  497. Private Sub TB_4_TextChanged(sender As Object, e As EventArgs) Handles TB_4.Click
  498. 頁面 = "2" : PA2 = 群組碼(4) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  499. End Sub
  500. Private Sub TB_5_TextChanged(sender As Object, e As EventArgs) Handles TB_5.Click
  501. 頁面 = "2" : PA2 = 群組碼(5) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  502. End Sub
  503. Private Sub TB_6_TextChanged(sender As Object, e As EventArgs) Handles TB_6.Click
  504. 頁面 = "2" : PA2 = 群組碼(6) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  505. End Sub
  506. Private Sub TB_7_TextChanged(sender As Object, e As EventArgs) Handles TB_7.Click
  507. 頁面 = "2" : PA2 = 群組碼(7) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  508. End Sub
  509. Private Sub TB_8_TextChanged(sender As Object, e As EventArgs) Handles TB_8.Click
  510. 頁面 = "2" : PA2 = 群組碼(8) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  511. End Sub
  512. Private Sub TB_9_TextChanged(sender As Object, e As EventArgs) Handles TB_9.Click
  513. 頁面 = "2" : PA2 = 群組碼(9) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  514. End Sub
  515. Private Sub TB_10_TextChanged(sender As Object, e As EventArgs) Handles TB_10.Click
  516. 頁面 = "2" : PA2 = 群組碼(10) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  517. End Sub
  518. Private Sub TB_11_TextChanged(sender As Object, e As EventArgs) Handles TB_11.Click
  519. 頁面 = "2" : PA2 = 群組碼(11) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  520. End Sub
  521. Private Sub TB_12_TextChanged(sender As Object, e As EventArgs) Handles TB_12.Click
  522. 頁面 = "2" : PA2 = 群組碼(12) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  523. End Sub
  524. Private Sub TB_13_TextChanged(sender As Object, e As EventArgs) Handles TB_13.Click
  525. 頁面 = "2" : PA2 = 群組碼(13) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  526. End Sub
  527. Private Sub TB_14_TextChanged(sender As Object, e As EventArgs) Handles TB_14.Click
  528. 頁面 = "2" : PA2 = 群組碼(14) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  529. End Sub
  530. Private Sub TB_15_TextChanged(sender As Object, e As EventArgs) Handles TB_15.Click
  531. 頁面 = "2" : PA2 = 群組碼(15) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  532. End Sub
  533. Private Sub TB_16_TextChanged(sender As Object, e As EventArgs) Handles TB_16.Click
  534. 頁面 = "2" : PA2 = 群組碼(16) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  535. End Sub
  536. Private Sub TB_17_TextChanged(sender As Object, e As EventArgs) Handles TB_17.Click
  537. 頁面 = "2" : PA2 = 群組碼(17) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  538. End Sub
  539. Private Sub TB_18_TextChanged(sender As Object, e As EventArgs) Handles TB_18.Click
  540. 頁面 = "2" : PA2 = 群組碼(18) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  541. End Sub
  542. Private Sub TB_19_TextChanged(sender As Object, e As EventArgs) Handles TB_19.Click
  543. 頁面 = "2" : PA2 = 群組碼(19) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  544. End Sub
  545. Private Sub TB_20_TextChanged(sender As Object, e As EventArgs) Handles TB_20.Click
  546. 頁面 = "2" : PA2 = 群組碼(20) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  547. End Sub
  548. Private Sub TB_21_TextChanged(sender As Object, e As EventArgs) Handles TB_21.Click
  549. 頁面 = "2" : PA2 = 群組碼(21) : 主頁_p.SendToBack() : 次頁_p.SendToBack() : Set_品名清單() : Chart1.Visible = True : Set_清單() : NA1 = 0 : 載入時繪圖()
  550. End Sub
  551. Private Sub 風格()
  552. If 深色風格 = False Then
  553. Me.BackColor = SystemColors.Control : Panel2.BackColor = SystemColors.Control : 主頁_p.BackColor = SystemColors.Control : 次頁_p.BackColor = SystemColors.Control
  554. 關鍵字_lb.ForeColor = Color.Black : 採購平均單價_ch.ForeColor = Color.Black : 採購數量_ch.ForeColor = Color.Black : 詳細資料2_ch.ForeColor = Color.Black
  555. 長條圖_ch.ForeColor = Color.Black : 折線圖_ch.ForeColor = Color.Black
  556. 語轉扭_bt.BackColor = Color.White : 語轉扭_bt.ForeColor = Color.Black : 回首頁_bt.BackColor = Color.White : 回首頁_bt.ForeColor = Color.Black
  557. 回次頁_bt.BackColor = Color.White : 回次頁_bt.ForeColor = Color.Black : 關鍵字查詢_bt.BackColor = Color.White : 關鍵字查詢_bt.ForeColor = Color.Black
  558. 上一筆_bt.BackColor = Color.White : 上一筆_bt.ForeColor = Color.Black : 下一筆_bt.BackColor = Color.White : 下一筆_bt.ForeColor = Color.Black
  559. 查詢入圖_bt.BackColor = Color.White : 查詢入圖_bt.ForeColor = Color.Black : 清除查詢_bt.BackColor = Color.White : 清除查詢_bt.ForeColor = Color.Black
  560. 清除圖表_bt.BackColor = Color.White : 清除圖表_bt.ForeColor = Color.Black : 管材_bt.BackColor = Color.White : 電線_bt.BackColor = Color.White
  561. 電料_bt.BackColor = Color.White : 槽架_bt.BackColor = Color.White : 五金_bt.BackColor = Color.White : 設備_bt.BackColor = Color.White
  562. 工具_bt.BackColor = Color.White : 日用_bt.BackColor = Color.White : 其他_bt.BackColor = Color.White
  563. 關鍵字查詢_tb.BackColor = Color.White : 關鍵字查詢_tb.ForeColor = Color.Black
  564. TB_1.BackColor = Color.White : TB_1.ForeColor = Color.Black : TB_2.BackColor = Color.White : TB_2.ForeColor = Color.Black
  565. TB_3.BackColor = Color.White : TB_3.ForeColor = Color.Black : TB_4.BackColor = Color.White : TB_4.ForeColor = Color.Black
  566. TB_5.BackColor = Color.White : TB_5.ForeColor = Color.Black : TB_6.BackColor = Color.White : TB_6.ForeColor = Color.Black
  567. TB_7.BackColor = Color.White : TB_7.ForeColor = Color.Black : TB_8.BackColor = Color.White : TB_8.ForeColor = Color.Black
  568. TB_9.BackColor = Color.White : TB_9.ForeColor = Color.Black : TB_10.BackColor = Color.White : TB_10.ForeColor = Color.Black
  569. TB_11.BackColor = Color.White : TB_11.ForeColor = Color.Black : TB_12.BackColor = Color.White : TB_12.ForeColor = Color.Black
  570. TB_13.BackColor = Color.White : TB_13.ForeColor = Color.Black : TB_14.BackColor = Color.White : TB_14.ForeColor = Color.Black
  571. TB_15.BackColor = Color.White : TB_15.ForeColor = Color.Black : TB_16.BackColor = Color.White : TB_16.ForeColor = Color.Black
  572. TB_17.BackColor = Color.White : TB_17.ForeColor = Color.Black : TB_18.BackColor = Color.White : TB_18.ForeColor = Color.Black
  573. TB_19.BackColor = Color.White : TB_19.ForeColor = Color.Black : TB_20.BackColor = Color.White : TB_20.ForeColor = Color.Black
  574. TB_21.BackColor = Color.White : TB_21.ForeColor = Color.Black
  575. PB_1.BackColor = Color.White : PB_2.BackColor = Color.White : PB_3.BackColor = Color.White : PB_4.BackColor = Color.White : PB_5.BackColor = Color.White
  576. PB_6.BackColor = Color.White : PB_7.BackColor = Color.White : PB_8.BackColor = Color.White : PB_9.BackColor = Color.White : PB_10.BackColor = Color.White
  577. PB_11.BackColor = Color.White : PB_12.BackColor = Color.White : PB_13.BackColor = Color.White : PB_14.BackColor = Color.White : PB_15.BackColor = Color.White
  578. PB_16.BackColor = Color.White : PB_17.BackColor = Color.White : PB_18.BackColor = Color.White : PB_19.BackColor = Color.White : PB_20.BackColor = Color.White
  579. PB_21.BackColor = Color.White
  580. 物料清單_dgv.EnableHeadersVisualStyles = True : 物料清單_dgv.BackgroundColor = Color.White : 物料清單_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
  581. 物料清單_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightPink
  582. 物料清單_dgv.DefaultCellStyle.BackColor = Color.White : 物料清單_dgv.DefaultCellStyle.ForeColor = Color.Black
  583. Else
  584. Me.BackColor = Color.Black : Panel2.BackColor = Color.Black : 主頁_p.BackColor = Color.Black : 次頁_p.BackColor = Color.Black
  585. 關鍵字_lb.ForeColor = Color.White : 採購平均單價_ch.ForeColor = Color.White : 採購數量_ch.ForeColor = Color.White : 詳細資料2_ch.ForeColor = Color.White
  586. 長條圖_ch.ForeColor = Color.White : 折線圖_ch.ForeColor = Color.White
  587. 語轉扭_bt.BackColor = Color.DimGray : 語轉扭_bt.ForeColor = Color.White : 回首頁_bt.BackColor = Color.DimGray : 回首頁_bt.ForeColor = Color.White
  588. 回次頁_bt.BackColor = Color.DimGray : 回次頁_bt.ForeColor = Color.White : 關鍵字查詢_bt.BackColor = Color.DimGray : 關鍵字查詢_bt.ForeColor = Color.White
  589. 上一筆_bt.BackColor = Color.DimGray : 上一筆_bt.ForeColor = Color.White : 下一筆_bt.BackColor = Color.DimGray : 下一筆_bt.ForeColor = Color.White
  590. 查詢入圖_bt.BackColor = Color.DimGray : 查詢入圖_bt.ForeColor = Color.White : 清除查詢_bt.BackColor = Color.DimGray : 清除查詢_bt.ForeColor = Color.White
  591. 清除圖表_bt.BackColor = Color.DimGray : 清除圖表_bt.ForeColor = Color.White : 管材_bt.BackColor = Color.DimGray : 電線_bt.BackColor = Color.DimGray
  592. 電料_bt.BackColor = Color.DimGray : 槽架_bt.BackColor = Color.DimGray : 五金_bt.BackColor = Color.DimGray : 設備_bt.BackColor = Color.DimGray
  593. 工具_bt.BackColor = Color.DimGray : 日用_bt.BackColor = Color.DimGray : 其他_bt.BackColor = Color.DimGray
  594. 關鍵字查詢_tb.BackColor = Color.DimGray : 關鍵字查詢_tb.ForeColor = Color.White
  595. TB_1.BackColor = Color.Black : TB_1.ForeColor = Color.White : TB_2.BackColor = Color.Black : TB_2.ForeColor = Color.White
  596. TB_3.BackColor = Color.Black : TB_3.ForeColor = Color.White : TB_4.BackColor = Color.Black : TB_4.ForeColor = Color.White
  597. TB_5.BackColor = Color.Black : TB_5.ForeColor = Color.White : TB_6.BackColor = Color.Black : TB_6.ForeColor = Color.White
  598. TB_7.BackColor = Color.Black : TB_7.ForeColor = Color.White : TB_8.BackColor = Color.Black : TB_8.ForeColor = Color.White
  599. TB_9.BackColor = Color.Black : TB_9.ForeColor = Color.White : TB_10.BackColor = Color.Black : TB_10.ForeColor = Color.White
  600. TB_11.BackColor = Color.Black : TB_11.ForeColor = Color.White : TB_12.BackColor = Color.Black : TB_12.ForeColor = Color.White
  601. TB_13.BackColor = Color.Black : TB_13.ForeColor = Color.White : TB_14.BackColor = Color.Black : TB_14.ForeColor = Color.White
  602. TB_15.BackColor = Color.Black : TB_15.ForeColor = Color.White : TB_16.BackColor = Color.Black : TB_16.ForeColor = Color.White
  603. TB_17.BackColor = Color.Black : TB_17.ForeColor = Color.White : TB_18.BackColor = Color.Black : TB_18.ForeColor = Color.White
  604. TB_19.BackColor = Color.Black : TB_19.ForeColor = Color.White : TB_20.BackColor = Color.Black : TB_20.ForeColor = Color.White
  605. TB_21.BackColor = Color.Black : TB_21.ForeColor = Color.White
  606. PB_1.BackColor = Color.DimGray : PB_2.BackColor = Color.DimGray : PB_3.BackColor = Color.DimGray : PB_4.BackColor = Color.DimGray : PB_5.BackColor = Color.DimGray
  607. PB_6.BackColor = Color.DimGray : PB_7.BackColor = Color.DimGray : PB_8.BackColor = Color.DimGray : PB_9.BackColor = Color.DimGray : PB_10.BackColor = Color.DimGray
  608. PB_11.BackColor = Color.DimGray : PB_12.BackColor = Color.DimGray : PB_13.BackColor = Color.DimGray : PB_14.BackColor = Color.DimGray : PB_15.BackColor = Color.DimGray
  609. PB_16.BackColor = Color.DimGray : PB_17.BackColor = Color.DimGray : PB_18.BackColor = Color.DimGray : PB_19.BackColor = Color.DimGray : PB_20.BackColor = Color.DimGray
  610. PB_21.BackColor = Color.DimGray
  611. 物料清單_dgv.EnableHeadersVisualStyles = False : 物料清單_dgv.BackgroundColor = Color.DimGray : 物料清單_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
  612. 物料清單_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 物料清單_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray
  613. 物料清單_dgv.DefaultCellStyle.BackColor = Color.Black : 物料清單_dgv.DefaultCellStyle.ForeColor = Color.White
  614. End If
  615. End Sub
  616. End Class