Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

預告訂單轉量產訂單.vb 40KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. Option Strict Off
  2. Public Class 預告訂單轉量產訂單
  3. Private ReadOnly ds, ds1, ds2, ds3, ds4 As New DataSet
  4. Dim DTP, DTP1 As String
  5. Private Sub Set_DGV1載入前設定()
  6. DataGridView1.DataSource = Nothing : ds.Clear()
  7. DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  8. DataGridView1.ColumnHeadersHeight = 25
  9. DataGridView1.AllowUserToAddRows = False
  10. DataGridView1.RowTemplate.Height = 50
  11. ConnOpen()
  12. End Sub
  13. Private Sub Set_DGV1載入後設定()
  14. CmdSet_For_DGV() : da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close() : Set_grid()
  15. End Sub
  16. Private Sub Set_清單()
  17. Set_DGV1載入前設定()
  18. If PA = "" Then
  19. SQL1 = "SELECT PAO, ConstructionName AS C_N, 季節, 客戶, BUYER, 工廠, 型體號碼, 型體名稱, 總數量, ETD, ISSUE_DATE, FOB, ConstructionName, PS, 制單人, 制單時間, 版次, 訂單屬性
  20. FROM 預告訂單控制表 ORDER BY ConstructionName, PAO DESC, 版次 DESC"
  21. Else
  22. SQL1 = "SELECT PAO, ConstructionName AS C_N, 季節, 客戶, BUYER, 工廠, 型體號碼, 型體名稱, 總數量, ETD, ISSUE_DATE, FOB, ConstructionName, PS, 制單人, 制單時間, 版次,
  23. 訂單屬性
  24. FROM 預告訂單控制表 " &
  25. "WHERE (SO LIKE N'%" & PA & "%') OR (季節 LIKE N'%" & PA & "%') OR (客戶 LIKE N'%" & PA & "%') OR (型體號碼 LIKE N'%" & PA & "%') OR (型體名稱 LIKE N'%" & PA & "%') " &
  26. "OR (ISSUE_DATE LIKE N'%" & PA & "%') OR (ETD LIKE N'%" & PA & "%') OR (FOB LIKE N'%" & PA & "%') OR (ConstructionName LIKE N'%" & PA & "%') OR (PS LIKE N'%" & PA & "%') " &
  27. "OR (制單人 LIKE N'%" & PA & "%') ORDER BY ConstructionName, PAO DESC, 版次 DESC"
  28. End If
  29. Set_DGV1載入後設定()
  30. End Sub
  31. Private Sub Set_grid()
  32. If CheckBox1.Checked = False Then
  33. DataGridView1.Size = New Size(475, 453)
  34. DataGridView1.Columns(0).FillWeight = 85 : DataGridView1.Columns(1).FillWeight = 70 : DataGridView1.Columns(2).FillWeight = 60 : DataGridView1.Columns(4).FillWeight = 95
  35. DataGridView1.Columns(6).FillWeight = 95 : DataGridView1.Columns(7).Visible = False
  36. Else
  37. DataGridView1.Size = New Size(745, 453)
  38. DataGridView1.Columns(0).FillWeight = 85 : DataGridView1.Columns(1).FillWeight = 55 : DataGridView1.Columns(2).FillWeight = 65 : DataGridView1.Columns(4).FillWeight = 170
  39. DataGridView1.Columns(6).FillWeight = 150 : DataGridView1.Columns(7).Visible = True : DataGridView1.Columns(7).FillWeight = 150
  40. End If
  41. DataGridView1.Columns(3).Visible = False : DataGridView1.Columns(5).Visible = False : DataGridView1.Columns(8).Visible = False : DataGridView1.Columns(9).Visible = False
  42. DataGridView1.Columns(10).Visible = False : DataGridView1.Columns(11).Visible = False : DataGridView1.Columns(12).Visible = False : DataGridView1.Columns(13).Visible = False
  43. DataGridView1.Columns(14).Visible = False : DataGridView1.Columns(15).Visible = False : DataGridView1.Columns(16).FillWeight = 45 : DataGridView1.Columns(17).Visible = False
  44. End Sub
  45. Private Sub Set_清單1()
  46. DataGridView2.DataSource = Nothing : ds1.Clear()
  47. DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  48. DataGridView2.ColumnHeadersHeight = 25
  49. DataGridView2.AllowUserToAddRows = False
  50. ConnOpen()
  51. SQL1 = "SELECT 預告訂單清單.顏色, METOO選擇按鈕.選擇
  52. FROM METOO選擇按鈕 RIGHT OUTER JOIN 預告訂單清單 ON METOO選擇按鈕.對應 = 預告訂單清單.顏色 LEFT OUTER JOIN 預告訂單控制表 ON 預告訂單清單.PAO = 預告訂單控制表.PAO AND
  53. 預告訂單清單.版次 = 預告訂單控制表.版次
  54. WHERE (預告訂單控制表.PAO LIKE '" & TextBox1.Text & "') AND (預告訂單控制表.版次 LIKE '" & TextBox2.Text & "') GROUP BY 預告訂單清單.顏色, METOO選擇按鈕.選擇"
  55. CmdSet_For_DGV()
  56. da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close()
  57. DataGridView2.Columns(0).FillWeight = 110 : DataGridView2.Columns(1).FillWeight = 40
  58. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  59. DataGridView2.Rows(i).Cells("選擇").Value = False
  60. Next i
  61. End Sub
  62. Private Sub Set_清單2()
  63. DataGridView4.DataSource = Nothing : ds2.Clear()
  64. DataGridView4.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  65. DataGridView4.ColumnHeadersHeight = 25
  66. DataGridView4.AllowUserToAddRows = False
  67. ConnOpen()
  68. SQL1 = "SELECT 訂單流水號, 客戶訂單號, ConstructionName, ModeOfDelivery, DeliveryTerms, OrgShipDate, FromPort, ToPort,
  69. ShippingCarrier, VendorReference, ModifiedDate, CustomerName, ShipDate, SalesOrder, DeliveryAddress, 下單日,
  70. 交期, ETADate, CreatedDate, Brand, CustomerRequisition, 工廠
  71. FROM 訂單明細表抬頭 ORDER BY 訂單流水號 DESC"
  72. CmdSet_For_DGV()
  73. da.Fill(ds2) : DataGridView4.DataSource = ds2.Tables(0) : conn.Close()
  74. DataGridView4.Columns(0).FillWeight = 120 : DataGridView4.Columns(1).FillWeight = 150 : DataGridView4.Columns(2).Visible = False : DataGridView4.Columns(3).Visible = False
  75. DataGridView4.Columns(4).Visible = False : DataGridView4.Columns(5).Visible = False : DataGridView4.Columns(6).Visible = False : DataGridView4.Columns(7).Visible = False
  76. DataGridView4.Columns(8).Visible = False : DataGridView4.Columns(9).Visible = False : DataGridView4.Columns(10).Visible = False : DataGridView4.Columns(11).Visible = False
  77. DataGridView4.Columns(12).Visible = False : DataGridView4.Columns(13).Visible = False : DataGridView4.Columns(14).Visible = False : DataGridView4.Columns(15).FillWeight = 90
  78. DataGridView4.Columns(16).FillWeight = 90 : DataGridView4.Columns(17).Visible = False : DataGridView4.Columns(18).Visible = False : DataGridView4.Columns(19).Visible = False
  79. DataGridView4.Columns(20).Visible = False : DataGridView4.Columns(21).Visible = False
  80. TextBox14.Text = "0.00"
  81. For i As Integer = 0 To DataGridView5.Rows.Count - 1
  82. DataGridView3.Rows(i).Cells("訂單數量").Value = DataGridView5.Rows(i).Cells("4").Value + DataGridView5.Rows(i).Cells("4.5").Value + DataGridView5.Rows(i).Cells("5").Value +
  83. DataGridView5.Rows(i).Cells("5.5").Value + DataGridView5.Rows(i).Cells("6").Value + DataGridView5.Rows(i).Cells("6.5").Value + DataGridView5.Rows(i).Cells("7").Value +
  84. DataGridView5.Rows(i).Cells("7.5").Value + DataGridView5.Rows(i).Cells("8").Value + DataGridView5.Rows(i).Cells("8.5").Value + DataGridView5.Rows(i).Cells("9").Value +
  85. DataGridView5.Rows(i).Cells("9.5").Value + DataGridView5.Rows(i).Cells("10").Value + DataGridView5.Rows(i).Cells("10.5").Value + DataGridView5.Rows(i).Cells("11").Value +
  86. DataGridView5.Rows(i).Cells("11.5").Value + DataGridView5.Rows(i).Cells("12").Value + DataGridView5.Rows(i).Cells("12.5").Value + DataGridView5.Rows(i).Cells("13").Value +
  87. DataGridView5.Rows(i).Cells("14").Value
  88. Next i
  89. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  90. TextBox14.Text = Val(TextBox14.Text) + DataGridView3.Rows(i).Cells("訂單數量").Value
  91. Next i
  92. TextBox14.Text = Format(Val(TextBox14.Text), "#,##0.00")
  93. End Sub
  94. Private Sub Set_清單3()
  95. DataGridView3.DataSource = Nothing : ds3.Clear()
  96. DataGridView3.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  97. DataGridView3.ColumnHeadersHeight = 40
  98. DataGridView3.AllowUserToAddRows = False
  99. ConnOpen()
  100. SQL1 = "SELECT 資料流水號, 年份季度, 客戶訂單號, 型體號碼, GOODBOX AS 型體名稱, APMA確認 AS 顏色, TVW AS 楦型, 訂單數量, 工廠回復交期 AS 工廠交期, 客戶交期 AS 交期開始, 客戶交期1 AS 交期結束,
  101. 單價, 總金額, 備註, 生產工廠, 訂單種類, BUYER, CFMSPEC, CFMSAMPLE, TRIAL1, TRIAL2, TRIAL3, TRIAL4, 包裝確認時間, 貼標時間, 裁斷時間, 針車時間, 成型時間, 驗貨時間,
  102. 實際離廠日, 訂單流水號, 明細建檔, LEATHER, LEA_Note, CXL, CXLTime, 出貨數量, PO_S_Date, Requested_XF, Confirm_XF, Revised_XF, Special_Packaging, Remarks, 出貨地,
  103. 楦頭號, 材質, 長期試穿, 面料, 副料, 中底, 鞋墊, 大底, 跟, 工廠進度表備註1, 七號模具, 工廠進度表備註2, 國標測試, 客戶包裝確認, 東莞業務備註, 驗貨報告圖片
  104. FROM 訂單控制表 WHERE 訂單流水號 LIKE N'" & TextBox12.Text & "' ORDER BY GOODBOX, APMA確認, TVW"
  105. CmdSet_For_DGV()
  106. da.Fill(ds3) : DataGridView3.DataSource = ds3.Tables(0) : conn.Close()
  107. DataGridView3.Columns(0).FillWeight = 85 : DataGridView3.Columns(1).FillWeight = 70 : DataGridView3.Columns(2).FillWeight = 130 : DataGridView3.Columns(3).FillWeight = 120
  108. DataGridView3.Columns(4).FillWeight = 130 : DataGridView3.Columns(5).FillWeight = 80 : DataGridView3.Columns(6).FillWeight = 50 : DataGridView3.Columns(7).FillWeight = 80
  109. DataGridView3.Columns(8).FillWeight = 90 : DataGridView3.Columns(9).FillWeight = 90 : DataGridView3.Columns(10).FillWeight = 90
  110. DataGridView3.Columns(11).Visible = False : DataGridView3.Columns(12).Visible = False
  111. DataGridView3.Columns(13).FillWeight = 130 : DataGridView3.Columns(14).FillWeight = 80 : DataGridView3.Columns(15).FillWeight = 120 : DataGridView3.Columns(16).FillWeight = 130
  112. DataGridView3.Columns(17).Visible = False : DataGridView3.Columns(18).Visible = False : DataGridView3.Columns(19).Visible = False : DataGridView3.Columns(20).Visible = False
  113. DataGridView3.Columns(21).Visible = False : DataGridView3.Columns(22).Visible = False : DataGridView3.Columns(23).Visible = False : DataGridView3.Columns(24).Visible = False
  114. DataGridView3.Columns(25).Visible = False : DataGridView3.Columns(26).Visible = False : DataGridView3.Columns(27).Visible = False : DataGridView3.Columns(28).Visible = False
  115. DataGridView3.Columns(29).Visible = False : DataGridView3.Columns(30).Visible = False : DataGridView3.Columns(31).Visible = False : DataGridView3.Columns(32).Visible = False
  116. DataGridView3.Columns(33).Visible = False : DataGridView3.Columns(34).Visible = False : DataGridView3.Columns(35).Visible = False : DataGridView3.Columns(36).Visible = False
  117. DataGridView3.Columns(37).Visible = False : DataGridView3.Columns(38).Visible = False : DataGridView3.Columns(39).Visible = False : DataGridView3.Columns(40).Visible = False
  118. DataGridView3.Columns(41).Visible = False : DataGridView3.Columns(42).Visible = False : DataGridView3.Columns(43).Visible = False : DataGridView3.Columns(44).Visible = False
  119. DataGridView3.Columns(45).Visible = False : DataGridView3.Columns(46).Visible = False : DataGridView3.Columns(47).Visible = False : DataGridView3.Columns(48).Visible = False
  120. DataGridView3.Columns(49).Visible = False : DataGridView3.Columns(50).Visible = False : DataGridView3.Columns(51).Visible = False : DataGridView3.Columns(52).Visible = False
  121. DataGridView3.Columns(53).Visible = False : DataGridView3.Columns(54).Visible = False : DataGridView3.Columns(55).Visible = False : DataGridView3.Columns(56).Visible = False
  122. DataGridView3.Columns(57).Visible = False : DataGridView3.Columns(58).Visible = False : DataGridView3.Columns(59).Visible = False
  123. DataGridView3.Columns(7).DefaultCellStyle.Format = "#,##0"
  124. DataGridView3.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  125. DataGridView3.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  126. DataGridView3.EditMode = DataGridViewEditMode.EditOnEnter
  127. End Sub
  128. Private Sub Set_清單4()
  129. DataGridView5.DataSource = Nothing : ds4.Clear()
  130. DataGridView5.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  131. DataGridView5.ColumnHeadersHeight = 25
  132. DataGridView5.AllowUserToAddRows = False
  133. ConnOpen()
  134. SQL1 = "SELECT 資料流水號, 客戶訂單號, ItemNumber, ProductName, Color, DM, [4], [4.5], [5], [5.5], [6], [6.5], [7], [7.5], [8], [8.5], [9], [9.5], [10], [10.5], [11], [11.5], [12], [12.5],
  135. [13], [14], 訂單流水號
  136. FROM 訂單明細表 WHERE 訂單流水號 LIKE N'" & TextBox12.Text & "' ORDER BY ProductName, Color, DM"
  137. CmdSet_For_DGV()
  138. da.Fill(ds4) : DataGridView5.DataSource = ds4.Tables(0) : conn.Close()
  139. DataGridView5.Columns(0).FillWeight = 85 : DataGridView5.Columns(1).FillWeight = 150 : DataGridView5.Columns(2).FillWeight = 120 : DataGridView5.Columns(3).FillWeight = 150
  140. DataGridView5.Columns(4).FillWeight = 80 : DataGridView5.Columns(5).FillWeight = 50 : DataGridView5.Columns(6).FillWeight = 38 : DataGridView5.Columns(7).FillWeight = 37
  141. DataGridView5.Columns(8).FillWeight = 38 : DataGridView5.Columns(9).FillWeight = 37 : DataGridView5.Columns(10).FillWeight = 38 : DataGridView5.Columns(11).FillWeight = 37
  142. DataGridView5.Columns(12).FillWeight = 38 : DataGridView5.Columns(13).FillWeight = 37 : DataGridView5.Columns(14).FillWeight = 38 : DataGridView5.Columns(15).FillWeight = 37
  143. DataGridView5.Columns(16).FillWeight = 38 : DataGridView5.Columns(17).FillWeight = 37 : DataGridView5.Columns(18).FillWeight = 38 : DataGridView5.Columns(19).FillWeight = 37
  144. DataGridView5.Columns(20).FillWeight = 38 : DataGridView5.Columns(21).FillWeight = 37 : DataGridView5.Columns(22).FillWeight = 38 : DataGridView5.Columns(23).FillWeight = 37
  145. DataGridView5.Columns(24).FillWeight = 38 : DataGridView5.Columns(25).FillWeight = 37 : DataGridView5.Columns(26).Visible = False
  146. DataGridView5.EditMode = DataGridViewEditMode.EditOnEnter
  147. End Sub
  148. Private Sub ComboBox1下拉表單資料載入()
  149. ConnOpen()
  150. SQL1 = "SELECT 楦型 FROM 訂單控制表楦型清單 ORDER BY 楦型"
  151. CmdSet_For_dr() : ComboBox1.Items.Clear() : While (dr.Read()) : ComboBox1.Items.Add(dr("楦型")) : End While : conn.Close()
  152. End Sub
  153. Private Sub ComboBox2下拉表單資料載入()
  154. ConnOpen()
  155. SQL1 = "SELECT BUYER FROM 預告訂單控制表 GROUP BY BUYER ORDER BY BUYER DESC"
  156. CmdSet_For_dr() : ComboBox2.Items.Clear() : While (dr.Read()) : ComboBox2.Items.Add(dr("BUYER")) : End While : conn.Close()
  157. End Sub
  158. Private Sub ComboBox4下拉表單資料載入()
  159. ConnOpen()
  160. SQL1 = "SELECT MODEOFDELIVERY FROM MODEOFDELIVERY"
  161. CmdSet_For_dr() : ComboBox4.Items.Clear() : While (dr.Read()) : ComboBox4.Items.Add(dr("MODEOFDELIVERY")) : End While : conn.Close()
  162. End Sub
  163. Private Sub ComboBox5下拉表單資料載入()
  164. ConnOpen()
  165. SQL1 = "SELECT DELIVERYTERMS FROM DELIVERYTERMS"
  166. CmdSet_For_dr() : ComboBox5.Items.Clear() : While (dr.Read()) : ComboBox5.Items.Add(dr("DELIVERYTERMS")) : End While : conn.Close()
  167. End Sub
  168. Private Sub ComboBox6下拉表單資料載入()
  169. ConnOpen()
  170. SQL1 = "SELECT FOB FROM 港口清單"
  171. CmdSet_For_dr() : ComboBox6.Items.Clear() : While (dr.Read()) : ComboBox6.Items.Add(dr("FOB")) : End While : conn.Close()
  172. End Sub
  173. Private Sub ComboBox7下拉表單資料載入()
  174. ConnOpen()
  175. SQL1 = "SELECT TOPORT FROM TOPORT ORDER BY TOPORT"
  176. CmdSet_For_dr() : ComboBox7.Items.Clear() : While (dr.Read()) : ComboBox7.Items.Add(dr("TOPORT")) : End While : conn.Close()
  177. End Sub
  178. Private Sub ComboBox8下拉表單資料載入()
  179. ConnOpen()
  180. SQL1 = "SELECT REMARK FROM DELIVERYADDRESS ORDER BY REMARK"
  181. CmdSet_For_dr() : ComboBox8.Items.Clear() : While (dr.Read()) : ComboBox8.Items.Add(dr("REMARK")) : End While : conn.Close()
  182. End Sub
  183. Private Sub ComboBox9下拉表單資料載入()
  184. ConnOpen()
  185. SQL1 = "SELECT 工廠 FROM 工廠控制表 GROUP BY 工廠 ORDER BY 工廠"
  186. CmdSet_For_dr() : ComboBox9.Items.Clear() : While (dr.Read()) : ComboBox9.Items.Add(dr("工廠")) : End While : conn.Close()
  187. End Sub
  188. Private Sub 預告訂單轉量產訂單_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  189. Me.MdiParent = WINPROFIT_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  190. TextBox1.Enabled = False : TextBox2.Enabled = False : TextBox4.Enabled = False : TextBox6.Enabled = False : TextBox7.Enabled = False : TextBox5.Enabled = False
  191. TextBox8.Enabled = False : TextBox9.Enabled = False : TextBox11.Enabled = False : TextBox12.Enabled = False : TextBox14.Enabled = False : TextBox15.Enabled = False
  192. Button4.Enabled = False : Button3.Enabled = False : Button17.Enabled = False : Button12.Enabled = False : DateTimePicker1.Visible = False
  193. ComboBox4下拉表單資料載入() : ComboBox5下拉表單資料載入() : ComboBox6下拉表單資料載入() : ComboBox7下拉表單資料載入() : ComboBox8下拉表單資料載入() : ComboBox9下拉表單資料載入()
  194. ComboBox1下拉表單資料載入() : ComboBox2下拉表單資料載入()
  195. Set_清單() : Set_清單2()
  196. End Sub
  197. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
  198. If e.RowIndex = -1 Then : Else
  199. TextBox1.Text = DataGridView1.Rows(e.RowIndex).Cells("PAO").Value : TextBox2.Text = DataGridView1.Rows(e.RowIndex).Cells("版次").Value
  200. ComboBox2.Text = DataGridView1.Rows(e.RowIndex).Cells("BUYER").Value : TextBox4.Text = DataGridView1.Rows(e.RowIndex).Cells("季節").Value
  201. ComboBox9.Text = DataGridView1.Rows(e.RowIndex).Cells("工廠").Value : TextBox6.Text = DataGridView1.Rows(e.RowIndex).Cells("型體號碼").Value
  202. TextBox7.Text = DataGridView1.Rows(e.RowIndex).Cells("型體名稱").Value : TextBox8.Text = DataGridView1.Rows(e.RowIndex).Cells("ETD").Value
  203. TextBox9.Text = DataGridView1.Rows(e.RowIndex).Cells("ISSUE_DATE").Value : ComboBox6.Text = DataGridView1.Rows(e.RowIndex).Cells("FOB").Value
  204. TextBox11.Text = DataGridView1.Rows(e.RowIndex).Cells("ConstructionName").Value : TextBox5.Text = DataGridView1.Rows(e.RowIndex).Cells("訂單屬性").Value
  205. Set_清單1()
  206. End If
  207. End Sub
  208. Private Sub DataGridView4_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView4.CellClick
  209. If e.RowIndex = -1 Then : Else
  210. ComboBox7.Text = DataGridView4.Rows(e.RowIndex).Cells("ToPort").Value : ComboBox4.Text = DataGridView4.Rows(e.RowIndex).Cells("ModeOfDelivery").Value
  211. ComboBox5.Text = DataGridView4.Rows(e.RowIndex).Cells("DeliveryTerms").Value : ComboBox6.Text = DataGridView4.Rows(e.RowIndex).Cells("FromPort").Value
  212. TextBox13.Text = DataGridView4.Rows(e.RowIndex).Cells("客戶訂單號").Value : TextBox16.Text = DataGridView4.Rows(e.RowIndex).Cells("DeliveryAddress").Value
  213. TextBox11.Text = DataGridView4.Rows(e.RowIndex).Cells("CustomerName").Value : ComboBox9.Text = DataGridView4.Rows(e.RowIndex).Cells("工廠").Value
  214. TextBox8.Text = DataGridView4.Rows(e.RowIndex).Cells("交期").Value : TextBox9.Text = DataGridView4.Rows(e.RowIndex).Cells("下單日").Value
  215. ComboBox6.Text = DataGridView4.Rows(e.RowIndex).Cells("FromPort").Value : TextBox11.Text = DataGridView4.Rows(e.RowIndex).Cells("ConstructionName").Value
  216. TextBox12.Text = DataGridView4.Rows(e.RowIndex).Cells("訂單流水號").Value : ComboBox2.Text = DataGridView4.Rows(e.RowIndex).Cells("Brand").Value
  217. ConnOpen()
  218. SQL1 = "SELECT REMARK FROM DELIVERYADDRESS WHERE DELIVERYADDRESS LIKE '" & TextBox16.Text & "'"
  219. CmdSet_For_dr()
  220. If dr.Read() Then : ComboBox8.Text = dr("REMARK").ToString : End If : conn.Close()
  221. Set_清單3() : Set_清單4()
  222. End If
  223. End Sub
  224. Private Sub DataGridView3_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView3.CellClick
  225. If e.RowIndex = -1 Then : Else
  226. TextBox15.Text = DataGridView3.Rows(e.RowIndex).Cells("資料流水號").Value
  227. TextBox5.Text = DataGridView3.Rows(e.RowIndex).Cells("CFMSPEC").Value
  228. End If
  229. End Sub
  230. Private Sub DataGridView5_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView5.CellClick
  231. If e.RowIndex = -1 Then : Else
  232. TextBox15.Text = DataGridView5.Rows(e.RowIndex).Cells("資料流水號").Value
  233. End If
  234. End Sub
  235. Private Sub DataGridView3_CellEndEdit(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView3.CellEndEdit
  236. Dim EU(2) As String
  237. EU(0) = DataGridView3("交期開始", e.RowIndex).Value.ToString
  238. If EU(0) = "" Then
  239. Else
  240. DateTimePicker1.Text = EU(0)
  241. DataGridView3.Rows(e.RowIndex).Cells("交期開始").Value = Format(DateTimePicker1.Value, "yyyy/MM/dd")
  242. End If
  243. EU(1) = DataGridView3("交期結束", e.RowIndex).Value.ToString
  244. If EU(1) = "" Then
  245. Else
  246. DateTimePicker1.Text = EU(1)
  247. DataGridView3.Rows(e.RowIndex).Cells("交期結束").Value = Format(DateTimePicker1.Value, "yyyy/MM/dd")
  248. End If
  249. EU(2) = DataGridView3("工廠交期", e.RowIndex).Value.ToString
  250. If EU(2) = "" Then
  251. Else
  252. DateTimePicker1.Text = EU(2)
  253. DataGridView3.Rows(e.RowIndex).Cells("工廠交期").Value = Format(DateTimePicker1.Value, "yyyy/MM/dd")
  254. End If
  255. End Sub
  256. Private Sub DataGridView5_CellContentClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView5.CellEndEdit
  257. TextBox14.Text = "0"
  258. For i As Integer = 0 To DataGridView5.Rows.Count - 1
  259. DataGridView3.Rows(i).Cells("訂單數量").Value = DataGridView5.Rows(i).Cells("4").Value + DataGridView5.Rows(i).Cells("4.5").Value + DataGridView5.Rows(i).Cells("5").Value +
  260. DataGridView5.Rows(i).Cells("5.5").Value + DataGridView5.Rows(i).Cells("6").Value + DataGridView5.Rows(i).Cells("6.5").Value + DataGridView5.Rows(i).Cells("7").Value +
  261. DataGridView5.Rows(i).Cells("7.5").Value + DataGridView5.Rows(i).Cells("8").Value + DataGridView5.Rows(i).Cells("8.5").Value + DataGridView5.Rows(i).Cells("9").Value +
  262. DataGridView5.Rows(i).Cells("9.5").Value + DataGridView5.Rows(i).Cells("10").Value + DataGridView5.Rows(i).Cells("10.5").Value + DataGridView5.Rows(i).Cells("11").Value +
  263. DataGridView5.Rows(i).Cells("11.5").Value + DataGridView5.Rows(i).Cells("12").Value + DataGridView5.Rows(i).Cells("12.5").Value + DataGridView5.Rows(i).Cells("13").Value +
  264. DataGridView5.Rows(i).Cells("14").Value
  265. Next i
  266. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  267. TextBox14.Text = Val(TextBox14.Text) + DataGridView3.Rows(i).Cells("訂單數量").Value
  268. Next i
  269. TextBox14.Text = Format(Val(TextBox14.Text), "#,##0")
  270. End Sub
  271. Private Sub ComboBox8_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox8.TextChanged
  272. ConnOpen()
  273. SQL1 = "SELECT DELIVERYADDRESS FROM DELIVERYADDRESS WHERE REMARK LIKE '" & ComboBox8.Text & "'"
  274. CmdSet_For_dr()
  275. If dr.Read() Then : TextBox16.Text = dr("DELIVERYADDRESS").ToString : End If : conn.Close()
  276. End Sub
  277. Private Sub ComboBox9_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox9.TextChanged
  278. ConnOpen()
  279. SQL1 = "SELECT 工廠, 供應商資料, 供應商地址 FROM 工廠控制表 WHERE 工廠 LIKE '" & ComboBox9.Text & "'"
  280. CmdSet_For_dr()
  281. If dr.Read() Then : TextBox18.Text = dr("供應商資料").ToString : TextBox17.Text = dr("供應商地址").ToString : End If : conn.Close()
  282. End Sub
  283. Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
  284. Set_grid()
  285. End Sub
  286. Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
  287. FACTORY_資料管理.Show() : FACTORY_資料管理.BringToFront() : ComboBox9下拉表單資料載入()
  288. End Sub
  289. Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
  290. DELIVERY_ADDRESS__資料管理.Show() : DELIVERY_ADDRESS__資料管理.BringToFront() : ComboBox8下拉表單資料載入()
  291. End Sub
  292. Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
  293. 清單修改.Close() : 交貨條件修改 = True : 清單修改.ShowDialog() : ComboBox5下拉表單資料載入() : 交貨條件修改 = False
  294. End Sub
  295. Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
  296. 清單修改.Close() : 港口清單修改 = True : 清單修改.ShowDialog() : ComboBox6下拉表單資料載入() : 港口清單修改 = False
  297. End Sub
  298. Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
  299. 清單修改.Close() : 到港清單修改 = True : 清單修改.ShowDialog() : ComboBox7下拉表單資料載入() : 到港清單修改 = False
  300. End Sub
  301. Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
  302. 清單修改.Close() : 交貨管道修改 = True : 清單修改.ShowDialog() : ComboBox4下拉表單資料載入() : 交貨管道修改 = False
  303. End Sub
  304. Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
  305. PA = InputBox("請輸入要查詢的關鍵字") : Set_清單() : PA = ""
  306. End Sub
  307. Private Sub Button32_Click(sender As Object, e As EventArgs) Handles Button32.Click
  308. PA = "" : Set_清單()
  309. End Sub
  310. Private Sub Set_日期格式轉換()
  311. DTP = Format(Today(), "yyyy/MM/dd") & "-" & Format(TimeOfDay(), "HH:mm:ss") : DTP1 = Format(Today(), "yyyyMMdd")
  312. End Sub
  313. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  314. Dim aa1 As MsgBoxResult
  315. aa1 = MsgBox("確定要生成--新的--量產訂單號碼?", MsgBoxStyle.OkCancel)
  316. If aa1 = MsgBoxResult.Ok Then
  317. Button1.Enabled = False : Button11.Enabled = False : Button4.Enabled = True : Button3.Enabled = False : Button17.Enabled = False
  318. Dim NUM0 As Integer
  319. Set_日期格式轉換()
  320. For i As Integer = 1 To 999
  321. NUM0 = 0 + i
  322. If NUM0 < 10 Then : TextBox12.Text = "WP-" & DTP1 & "-00" & NUM0
  323. ElseIf NUM0 > 9 And NUM0 < 100 Then : TextBox12.Text = "WP-" & DTP1 & "-0" & NUM0
  324. ElseIf NUM0 > 99 Then : TextBox12.Text = "WP-" & DTP1 & "-" & NUM0
  325. End If
  326. ConnOpen()
  327. SQL1 = "SELECT TOP (1) 訂單流水號 FROM 訂單控制表 WHERE ( 訂單流水號 LIKE '" & TextBox12.Text & "')"
  328. CmdSet_For_dr()
  329. If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  330. Next
  331. End If
  332. End Sub
  333. Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
  334. If TextBox12.Text = "" Then
  335. MsgBox("請先選擇量產訂單號")
  336. Else
  337. Set_DGV1載入前設定()
  338. SQL1 = "SELECT PAO, ConstructionName AS C_N, 季節, 客戶, BUYER, 工廠, 型體號碼, 型體名稱, 總數量, ETD, ISSUE_DATE, FOB, ConstructionName, PS, 制單人, 制單時間, 版次
  339. FROM 預告訂單控制表
  340. WHERE (BUYER LIKE N'%" & ComboBox2.Text & "%') AND (ConstructionName LIKE N'%" & TextBox11.Text & "%')
  341. ORDER BY ConstructionName, PAO DESC, 版次 DESC"
  342. Set_DGV1載入後設定()
  343. Button1.Enabled = False : Button11.Enabled = False : Button12.Enabled = True : Button3.Enabled = True : Button17.Enabled = True
  344. End If
  345. End Sub
  346. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  347. If TextBox11.Text = "" Or TextBox9.Text = "" Or ComboBox2.Text = "" Or TextBox8.Text = "" Or TextBox13.Text = "" Or ComboBox4.Text = "" Or ComboBox5.Text = "" Or ComboBox6.Text = "" Or
  348. ComboBox7.Text = "" Or ComboBox8.Text = "" Or ComboBox9.Text = "" Then
  349. MsgBox("生成量產訂單抬頭之前,請注意紅色字體部分資料不可有誤。")
  350. Else
  351. Set_DGV1載入前設定()
  352. SQL1 = "SELECT PAO, ConstructionName AS C_N, 季節, 客戶, BUYER, 工廠, 型體號碼, 型體名稱, 總數量, ETD, ISSUE_DATE, FOB, ConstructionName, PS, 制單人, 制單時間, 版次
  353. FROM 預告訂單控制表
  354. WHERE (BUYER LIKE N'%" & ComboBox2.Text & "%') AND (ConstructionName LIKE N'%" & TextBox11.Text & "%')
  355. ORDER BY ConstructionName, PAO DESC, 版次 DESC"
  356. Set_DGV1載入後設定()
  357. ConnOpen()
  358. SQL1 = "INSERT INTO 訂單明細表抬頭 (客戶訂單號, 訂單流水號, ConstructionName, ModeOfDelivery, DeliveryTerms, OrgShipDate, FromPort, ToPort,
  359. ShippingCarrier, VendorReference, ModifiedDate, CustomerName, ShipDate, SalesOrder, DeliveryAddress, 下單日,
  360. 交期, ETADate, CreatedDate, Brand, CustomerRequisition, 工廠)
  361. VALUES (N'" & TextBox13.Text & "', N'" & TextBox12.Text & "', N'" & TextBox11.Text & "', N'" & ComboBox4.Text & "', N'" & ComboBox5.Text & "', N'" & TextBox8.Text &
  362. "', N'" & ComboBox6.Text & "', N'" & ComboBox7.Text & "', N'', N'', N'" & TextBox9.Text & "', N'" & TextBox11.Text & "', N'" & TextBox8.Text & "', N'', N'" & TextBox16.Text &
  363. "', N'" & TextBox9.Text & "', N'" & TextBox8.Text & "', N'', N'" & TextBox9.Text & "', N'" & ComboBox2.Text & "', N'', N'" & ComboBox9.Text & "')"
  364. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  365. Button1.Enabled = False : Button11.Enabled = False : Button4.Enabled = False : Button12.Enabled = True : Button9.Enabled = False : Button32.Enabled = False
  366. End If
  367. End Sub
  368. Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
  369. If ComboBox1.Text = "" Then
  370. MsgBox("沒有選擇楦型。")
  371. Else
  372. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  373. 資料數 = DataGridView2.Rows.Count : MyModule1.進度條()
  374. If DataGridView2.Rows(i).Cells("選擇").Value = True Then
  375. ConnOpen()
  376. SQL1 = "SELECT TOP (1) 資料流水號 FROM 訂單控制表 GROUP BY 資料流水號 ORDER BY 資料流水號 DESC"
  377. CmdSet_For_dr()
  378. If dr.Read() Then : TextBox15.Text = dr("資料流水號").ToString : Else : TextBox15.Text = "PO00000000" : End If
  379. conn.Close()
  380. Dim NUM1 As Integer
  381. NUM1 = Double.Parse(Strings.Right(TextBox15.Text, 8)) + 1
  382. If NUM1 < 10 Then : TextBox15.Text = "PO" & "0000000" & NUM1
  383. ElseIf NUM1 > 9 And NUM1 < 100 Then : TextBox15.Text = "PO" & "000000" & NUM1
  384. ElseIf NUM1 > 99 And NUM1 < 1000 Then : TextBox15.Text = "PO" & "00000" & NUM1
  385. ElseIf NUM1 > 999 And NUM1 < 10000 Then : TextBox15.Text = "PO" & "0000" & NUM1
  386. ElseIf NUM1 > 9999 And NUM1 < 100000 Then : TextBox15.Text = "PO" & "000" & NUM1
  387. ElseIf NUM1 > 99999 And NUM1 < 100000 Then : TextBox15.Text = "PO" & "00" & NUM1
  388. ElseIf NUM1 > 999999 And NUM1 < 1000000 Then : TextBox15.Text = "PO" & "0" & NUM1
  389. ElseIf NUM1 > 9999999 Then : TextBox15.Text = "PO" & NUM1 + 1
  390. End If
  391. ConnOpen()
  392. SQL1 = "INSERT INTO 訂單控制表 (訂單流水號, 年份季度, 客戶訂單號, 型體號碼, GOODBOX, 訂單數量, 客戶交期, 客戶交期1, 單價, 總金額, 備註, 生產工廠, 訂單種類, BUYER, CFMSPEC, CFMSAMPLE, TRIAL1,
  393. TRIAL2, TRIAL3, TRIAL4, 包裝確認時間, 貼標時間, 裁斷時間, 針車時間, 成型時間, 驗貨時間, 實際離廠日, 資料流水號, 明細建檔, LEATHER, LEA_Note, CXL, CXLTime,
  394. 出貨數量, PO_S_Date, Requested_XF, Confirm_XF, Revised_XF, Special_Packaging, Remarks, 出貨地, TVW, 楦頭號, 材質, 長期試穿, 面料, 副料, 中底, 鞋墊, 大底, 跟,
  395. 工廠進度表備註1, 七號模具, 工廠進度表備註2, 國標測試, 客戶包裝確認, 東莞業務備註, APMA確認, 驗貨報告圖片)
  396. VALUES (N'" & TextBox12.Text & "', N'" & TextBox4.Text & "', N'" & TextBox13.Text & "', N'" & TextBox6.Text & "', N'" & TextBox7.Text & "', N'0', N'" & TextBox8.Text &
  397. "', N'" & TextBox8.Text & "', N'0', N'0', N'', N'" & ComboBox9.Text & "', N'" & TextBox1.Text & "-" & TextBox2.Text & "', N'" & ComboBox2.Text & "', N'" & TextBox5.Text &
  398. "', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'" & TextBox15.Text & "', N'0', N'', N'', N'0', N'', N'0', N'', N'', N'', N'', N'', N'', N'', N'" & ComboBox1.Text &
  399. "', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'0', N'', N'', N'" & DataGridView2.Rows(i).Cells("顏色").Value & "', N'')"
  400. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  401. ConnOpen()
  402. SQL1 = "INSERT INTO 訂單明細表 (訂單流水號, 客戶訂單號, ItemNumber, ProductName, Color, DM, [4], [4.5], [5], [5.5], [6], [6.5], [7], [7.5], [8], [8.5], [9],
  403. [9.5], [10], [10.5], [11], [11.5], [12], [12.5], [13], [14], 資料流水號)
  404. VALUES (N'" & TextBox12.Text & "', N'" & TextBox13.Text & "', N'" & TextBox6.Text & "', N'" & TextBox7.Text & "', N'" & DataGridView2.Rows(i).Cells("顏色").Value &
  405. "', N'" & ComboBox1.Text & "', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'" & TextBox15.Text & "')"
  406. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  407. End If
  408. Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  409. Set_清單3() : Set_清單4() : ComboBox1下拉表單資料載入()
  410. Button3.Enabled = True : Button17.Enabled = True
  411. End If
  412. End Sub
  413. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  414. ConnOpen()
  415. SQL1 = "UPDATE 訂單明細表抬頭 SET ModeOfDelivery = N'" & ComboBox4.Text & "', DeliveryTerms = N'" & ComboBox5.Text & "', FromPort = N'" & ComboBox6.Text & "', ToPort = N'" & ComboBox7.Text & "',
  416. 工廠 = N'" & ComboBox9.Text & "', DeliveryAddress = N'" & TextBox16.Text & "' WHERE (訂單流水號 LIKE N'" & TextBox12.Text & "')"
  417. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  418. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  419. 資料數 = DataGridView3.Rows.Count : MyModule1.進度條()
  420. ConnOpen()
  421. SQL1 = "UPDATE 訂單控制表 SET 訂單數量 = N'" & DataGridView3.Rows(i).Cells("訂單數量").Value & "', 客戶交期 = N'" & DataGridView3.Rows(i).Cells("交期開始").Value &
  422. "', 客戶交期1 = N'" & DataGridView3.Rows(i).Cells("交期結束").Value & "', 備註 = N'" & DataGridView3.Rows(i).Cells("備註").Value &
  423. "', 工廠回復交期 = N'" & DataGridView3.Rows(i).Cells("工廠交期").Value & "', BUYER = N'" & DataGridView3.Rows(i).Cells("BUYER").Value & "'
  424. WHERE (資料流水號 LIKE N'" & DataGridView3.Rows(i).Cells("資料流水號").Value & "')"
  425. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  426. Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  427. For i As Integer = 0 To DataGridView5.Rows.Count - 1
  428. 資料數 = DataGridView5.Rows.Count : MyModule1.進度條()
  429. ConnOpen()
  430. SQL1 = "UPDATE 訂單明細表 SET [4] = N'" & DataGridView5.Rows(i).Cells("4").Value & "', [4.5] = N'" & DataGridView5.Rows(i).Cells("4.5").Value &
  431. "', [5] = N'" & DataGridView5.Rows(i).Cells("5").Value & "', [5.5] = N'" & DataGridView5.Rows(i).Cells("5.5").Value &
  432. "', [6] = N'" & DataGridView5.Rows(i).Cells("6").Value & "', [6.5] = N'" & DataGridView5.Rows(i).Cells("6.5").Value &
  433. "', [7] = N'" & DataGridView5.Rows(i).Cells("7").Value & "', [7.5] = N'" & DataGridView5.Rows(i).Cells("7.5").Value &
  434. "', [8] = N'" & DataGridView5.Rows(i).Cells("8").Value & "', [8.5] = N'" & DataGridView5.Rows(i).Cells("8.5").Value &
  435. "', [9] = N'" & DataGridView5.Rows(i).Cells("9").Value & "', [9.5] = N'" & DataGridView5.Rows(i).Cells("9.5").Value &
  436. "', [10] = N'" & DataGridView5.Rows(i).Cells("10").Value & "', [10.5] = N'" & DataGridView5.Rows(i).Cells("10.5").Value &
  437. "', [11] = N'" & DataGridView5.Rows(i).Cells("11").Value & "', [11.5] = N'" & DataGridView5.Rows(i).Cells("11.5").Value &
  438. "', [12] = N'" & DataGridView5.Rows(i).Cells("12").Value & "', [12.5] = N'" & DataGridView5.Rows(i).Cells("12.5").Value &
  439. "', [13] = N'" & DataGridView5.Rows(i).Cells("13").Value & "', [14] = N'" & DataGridView5.Rows(i).Cells("14").Value & "'
  440. WHERE (資料流水號 LIKE N'" & DataGridView5.Rows(i).Cells("資料流水號").Value & "')"
  441. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  442. Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  443. MsgBox("存檔完成。") : Set_清單() : Set_清單2() : Set_清單2()
  444. Button1.Enabled = True : Button11.Enabled = True : Button4.Enabled = False : Button12.Enabled = False : Button3.Enabled = False : Button17.Enabled = False
  445. Button9.Enabled = True : Button32.Enabled = True
  446. End Sub
  447. Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
  448. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  449. DataGridView2.Rows(i).Cells("選擇").Value = False
  450. Next i
  451. End Sub
  452. Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
  453. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  454. DataGridView2.Rows(i).Cells("選擇").Value = True
  455. Next i
  456. End Sub
  457. Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
  458. If TextBox15.Text = "" Then
  459. MsgBox("未選擇需要刪除的資料")
  460. Else
  461. ConnOpen()
  462. SQL1 = "DELETE FROM 訂單控制表 WHERE (資料流水號 LIKE N'" & TextBox15.Text & "')"
  463. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  464. ConnOpen()
  465. SQL1 = "DELETE FROM 訂單明細表 WHERE (資料流水號 LIKE N'" & TextBox15.Text & "')"
  466. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  467. Set_清單3() : Set_清單4()
  468. End If
  469. End Sub
  470. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  471. Set_清單2()
  472. End Sub
  473. Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
  474. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  475. DataGridView3.Rows(i).Cells("BUYER").Value = ComboBox2.Text
  476. Next
  477. MsgBox("注意還未存檔喔")
  478. End Sub
  479. End Class