설명 없음
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 40KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. Option Strict Off
  2. Imports System.IO
  3. Imports System.Net
  4. Public Class 量產訂單明細表
  5. Private ReadOnly ds, ds2, ds3 As New DataSet
  6. Dim 已超出 As Boolean
  7. Dim Date1, Date2, Date3, Date4, Date5, Date6, Date7 As String
  8. Dim 新流水號3 As String
  9. Private m_Leftx As Integer = 152
  10. Private m_Lefty As Integer = 0
  11. Dim m_MousePosX, m_MousePosY, m_DeltaX, m_DeltaY As Integer
  12. Private Sub 基本資料載入()
  13. SQL_基本資料載入()
  14. If dr.Read() Then
  15. Number_tb.Text = dr("客戶訂單號").ToString : Vendor_tb.Text = dr("供應商資料").ToString : 備註_tb.Text = dr("供應商地址").ToString
  16. 工廠_tb.Text = dr("生產工廠").ToString : TotalNumber_tb.Text = Format(Val(dr("訂單數量").ToString), "#,##0")
  17. Else : Number_tb.Text = "" : End If : conn.Close()
  18. End Sub
  19. Private Sub Set_訂單清單()
  20. 表單3_dgv.DataSource = Nothing : ds.Clear()
  21. 表單3_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  22. 表單3_dgv.ColumnHeadersHeight = 25
  23. 表單3_dgv.AllowUserToAddRows = False
  24. SQL_訂單清單()
  25. da.Fill(ds) : 表單3_dgv.DataSource = ds.Tables(0) : conn.Close()
  26. 表單3_dgv.Columns(0).Visible = False : 表單3_dgv.Columns(1).Visible = False
  27. 表單3_dgv.Columns(2).FillWeight = 120 : 表單3_dgv.Columns(3).FillWeight = 150 : 表單3_dgv.Columns(4).FillWeight = 100 : 表單3_dgv.Columns(5).FillWeight = 70
  28. 表單3_dgv.Columns(6).FillWeight = 40 : 表單3_dgv.Columns(7).FillWeight = 40 : 表單3_dgv.Columns(8).FillWeight = 40 : 表單3_dgv.Columns(9).FillWeight = 40
  29. 表單3_dgv.Columns(10).FillWeight = 40 : 表單3_dgv.Columns(11).FillWeight = 40 : 表單3_dgv.Columns(12).FillWeight = 40 : 表單3_dgv.Columns(13).FillWeight = 40
  30. 表單3_dgv.Columns(14).FillWeight = 40 : 表單3_dgv.Columns(15).FillWeight = 40 : 表單3_dgv.Columns(16).FillWeight = 40 : 表單3_dgv.Columns(17).FillWeight = 40
  31. 表單3_dgv.Columns(18).FillWeight = 40 : 表單3_dgv.Columns(19).FillWeight = 40 : 表單3_dgv.Columns(20).FillWeight = 40 : 表單3_dgv.Columns(21).FillWeight = 40
  32. 表單3_dgv.Columns(22).FillWeight = 40 : 表單3_dgv.Columns(23).FillWeight = 40 : 表單3_dgv.Columns(24).FillWeight = 40 : 表單3_dgv.Columns(25).FillWeight = 40
  33. 表單3_dgv.Columns(26).FillWeight = 60 : 表單3_dgv.Columns(27).Visible = False
  34. 表單3_dgv.Columns(7).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(8).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(9).DefaultCellStyle.Format = "#,##0"
  35. 表單3_dgv.Columns(10).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(11).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(12).DefaultCellStyle.Format = "#,##0"
  36. 表單3_dgv.Columns(13).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(14).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(15).DefaultCellStyle.Format = "#,##0"
  37. 表單3_dgv.Columns(16).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(17).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(18).DefaultCellStyle.Format = "#,##0"
  38. 表單3_dgv.Columns(19).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(20).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(21).DefaultCellStyle.Format = "#,##0"
  39. 表單3_dgv.Columns(22).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(23).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(24).DefaultCellStyle.Format = "#,##0"
  40. 表單3_dgv.Columns(25).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(26).DefaultCellStyle.Format = "#,##0" : 表單3_dgv.Columns(6).DefaultCellStyle.Format = "#,##0"
  41. 表單3_dgv.EditMode = DataGridViewEditMode.EditOnEnter
  42. End Sub
  43. Private Sub Set_清單2()
  44. 表單1_dgv.DataSource = Nothing : ds2.Clear()
  45. 表單1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  46. 表單1_dgv.ColumnHeadersHeight = 25
  47. 表單1_dgv.AllowUserToAddRows = False
  48. SQL_訂單附件資料()
  49. da.Fill(ds2) : 表單1_dgv.DataSource = ds2.Tables(0) : conn.Close()
  50. 表單1_dgv.Columns(0).FillWeight = 120 : 表單1_dgv.Columns(1).FillWeight = 45
  51. End Sub
  52. Private Sub Set_清單3()
  53. 表單2_dgv.DataSource = Nothing : ds3.Clear()
  54. 表單2_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  55. 表單2_dgv.ColumnHeadersHeight = 25
  56. 表單2_dgv.AllowUserToAddRows = False
  57. SQL_訂單控制表1()
  58. da.Fill(ds3) : 表單2_dgv.DataSource = ds3.Tables(0) : conn.Close()
  59. 表單2_dgv.Columns(0).FillWeight = 85 : 表單2_dgv.Columns(1).FillWeight = 70 : 表單2_dgv.Columns(2).FillWeight = 130 : 表單2_dgv.Columns(3).FillWeight = 120
  60. 表單2_dgv.Columns(4).FillWeight = 130 : 表單2_dgv.Columns(5).FillWeight = 80 : 表單2_dgv.Columns(6).FillWeight = 50 : 表單2_dgv.Columns(7).FillWeight = 80
  61. 表單2_dgv.Columns(8).FillWeight = 90 : 表單2_dgv.Columns(9).FillWeight = 90 : 表單2_dgv.Columns(10).FillWeight = 90
  62. 表單2_dgv.Columns(11).Visible = False : 表單2_dgv.Columns(12).Visible = False
  63. 表單2_dgv.Columns(13).FillWeight = 62 : 表單2_dgv.Columns(14).FillWeight = 80 : 表單2_dgv.Columns(15).FillWeight = 120 : 表單2_dgv.Columns(16).FillWeight = 130
  64. 表單2_dgv.Columns(17).Visible = False : 表單2_dgv.Columns(18).Visible = False : 表單2_dgv.Columns(19).Visible = False : 表單2_dgv.Columns(20).Visible = False
  65. 表單2_dgv.Columns(21).Visible = False : 表單2_dgv.Columns(22).Visible = False : 表單2_dgv.Columns(23).Visible = False : 表單2_dgv.Columns(24).Visible = False
  66. 表單2_dgv.Columns(25).Visible = False : 表單2_dgv.Columns(26).Visible = False : 表單2_dgv.Columns(27).Visible = False : 表單2_dgv.Columns(28).Visible = False
  67. 表單2_dgv.Columns(29).Visible = False : 表單2_dgv.Columns(30).Visible = False : 表單2_dgv.Columns(31).Visible = False : 表單2_dgv.Columns(32).Visible = False
  68. 表單2_dgv.Columns(33).Visible = False : 表單2_dgv.Columns(34).Visible = False : 表單2_dgv.Columns(35).Visible = False : 表單2_dgv.Columns(36).Visible = False
  69. 表單2_dgv.Columns(37).Visible = False : 表單2_dgv.Columns(38).Visible = False : 表單2_dgv.Columns(39).Visible = False : 表單2_dgv.Columns(40).Visible = False
  70. 表單2_dgv.Columns(41).Visible = False : 表單2_dgv.Columns(42).Visible = False : 表單2_dgv.Columns(43).Visible = False : 表單2_dgv.Columns(44).Visible = False
  71. 表單2_dgv.Columns(45).Visible = False : 表單2_dgv.Columns(46).Visible = False : 表單2_dgv.Columns(47).Visible = False : 表單2_dgv.Columns(48).Visible = False
  72. 表單2_dgv.Columns(49).Visible = False : 表單2_dgv.Columns(50).Visible = False : 表單2_dgv.Columns(51).Visible = False : 表單2_dgv.Columns(52).Visible = False
  73. 表單2_dgv.Columns(53).Visible = False : 表單2_dgv.Columns(54).Visible = False : 表單2_dgv.Columns(55).Visible = False : 表單2_dgv.Columns(56).Visible = False
  74. 表單2_dgv.Columns(57).Visible = False : 表單2_dgv.Columns(58).Visible = False : 表單2_dgv.Columns(59).Visible = False
  75. 表單2_dgv.Columns(7).DefaultCellStyle.Format = "#,##0"
  76. 表單2_dgv.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  77. 表單2_dgv.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  78. 表單2_dgv.EditMode = DataGridViewEditMode.EditOnEnter
  79. End Sub
  80. Private Sub Set_格式設定1()
  81. Number_tb.Enabled = False : TextBox3.Enabled = False : 訂單號_tb.Enabled = False : 工廠_tb.Enabled = False : TotalNumber_tb.Enabled = False : TextBox7.Visible = False
  82. 日期_dtp.Format = DateTimePickerFormat.Custom : 日期_dtp.CustomFormat = " "
  83. 日期1_dtp.Format = DateTimePickerFormat.Custom : 日期1_dtp.CustomFormat = " "
  84. 日期3_dtp.Format = DateTimePickerFormat.Custom : 日期3_dtp.CustomFormat = " "
  85. 日期4_dtp.Format = DateTimePickerFormat.Custom : 日期4_dtp.CustomFormat = " "
  86. 日期6_dtp.Format = DateTimePickerFormat.Custom : 日期6_dtp.CustomFormat = " "
  87. 日期7_dtp.Format = DateTimePickerFormat.Custom : 日期7_dtp.CustomFormat = " "
  88. 日期5_dtp.Format = DateTimePickerFormat.Custom : 日期5_dtp.CustomFormat = " "
  89. ShippingCarrier_tb.Text = "" : VendorReference_tb.Text = ""
  90. CustomerName_tb.Text = "" : SalesOrder_tb.Text = "" : DeliveryAddress_tb.Text = ""
  91. End Sub
  92. Private Sub Set_自動彙總1()
  93. Dim 加總(20) As Double
  94. 加總(0) = 0 : 加總(1) = 0 : 加總(2) = 0 : 加總(3) = 0 : 加總(4) = 0 : 加總(5) = 0 : 加總(6) = 0 : 加總(7) = 0 : 加總(8) = 0
  95. 加總(9) = 0 : 加總(10) = 0 : 加總(11) = 0 : 加總(12) = 0 : 加總(13) = 0 : 加總(14) = 0 : 加總(15) = 0 : 加總(16) = 0 : 加總(17) = 0 : 加總(18) = 0 : 加總(19) = 0 : 加總(20) = 0
  96. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計_tb.Text = "0" : Else : 加總(19) += 表單3_dgv.Rows(i).Cells("4").Value : End If
  97. Next i : 合計_tb.Text = Format(Val(加總(19)), "#,##0") : If 合計_tb.Text = "0" Then : 合計_tb.ForeColor = Color.Black : Else : 合計_tb.ForeColor = Color.Red : End If
  98. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計1_tb.Text = "0" : Else : 加總(20) += 表單3_dgv.Rows(i).Cells("4.5").Value : End If
  99. Next i : 合計1_tb.Text = Format(Val(加總(20)), "#,##0") : If 合計1_tb.Text = "0" Then : 合計1_tb.ForeColor = Color.Black : Else : 合計1_tb.ForeColor = Color.Red : End If
  100. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計2_tb.Text = "0" : Else : 加總(0) += 表單3_dgv.Rows(i).Cells("5").Value : End If
  101. Next i : 合計2_tb.Text = Format(Val(加總(0)), "#,##0") : If 合計2_tb.Text = "0" Then : 合計2_tb.ForeColor = Color.Black : Else : 合計2_tb.ForeColor = Color.Red : End If
  102. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計3_tb.Text = "0" : Else : 加總(1) += 表單3_dgv.Rows(i).Cells("5.5").Value : End If
  103. Next i : 合計3_tb.Text = Format(Val(加總(1)), "#,##0") : If 合計3_tb.Text = "0" Then : 合計3_tb.ForeColor = Color.Black : Else : 合計3_tb.ForeColor = Color.Red : End If
  104. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計4_tb.Text = "0" : Else : 加總(2) += 表單3_dgv.Rows(i).Cells("6").Value : End If
  105. Next i : 合計4_tb.Text = Format(Val(加總(2)), "#,##0") : If 合計4_tb.Text = "0" Then : 合計4_tb.ForeColor = Color.Black : Else : 合計4_tb.ForeColor = Color.Red : End If
  106. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計5_tb.Text = "0" : Else : 加總(3) += 表單3_dgv.Rows(i).Cells("6.5").Value : End If
  107. Next i : 合計5_tb.Text = Format(Val(加總(3)), "#,##0") : If 合計5_tb.Text = "0" Then : 合計5_tb.ForeColor = Color.Black : Else : 合計5_tb.ForeColor = Color.Red : End If
  108. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計6_tb.Text = "0" : Else : 加總(4) += 表單3_dgv.Rows(i).Cells("7").Value : End If
  109. Next i : 合計6_tb.Text = Format(Val(加總(4)), "#,##0") : If 合計6_tb.Text = "0" Then : 合計6_tb.ForeColor = Color.Black : Else : 合計6_tb.ForeColor = Color.Red : End If
  110. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計7_tb.Text = "0" : Else : 加總(5) += 表單3_dgv.Rows(i).Cells("7.5").Value : End If
  111. Next i : 合計7_tb.Text = Format(Val(加總(5)), "#,##0") : If 合計7_tb.Text = "0" Then : 合計7_tb.ForeColor = Color.Black : Else : 合計7_tb.ForeColor = Color.Red : End If
  112. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計8_tb.Text = "0" : Else : 加總(6) += 表單3_dgv.Rows(i).Cells("8").Value : End If
  113. Next i : 合計8_tb.Text = Format(Val(加總(6)), "#,##0") : If 合計8_tb.Text = "0" Then : 合計8_tb.ForeColor = Color.Black : Else : 合計8_tb.ForeColor = Color.Red : End If
  114. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計9_tb.Text = "0" : Else : 加總(7) += 表單3_dgv.Rows(i).Cells("8.5").Value : End If
  115. Next i : 合計9_tb.Text = Format(Val(加總(7)), "#,##0") : If 合計9_tb.Text = "0" Then : 合計9_tb.ForeColor = Color.Black : Else : 合計9_tb.ForeColor = Color.Red : End If
  116. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計10_tb.Text = "0" : Else : 加總(8) += 表單3_dgv.Rows(i).Cells("9").Value : End If
  117. Next i : 合計10_tb.Text = Format(Val(加總(8)), "#,##0") : If 合計10_tb.Text = "0" Then : 合計10_tb.ForeColor = Color.Black : Else : 合計10_tb.ForeColor = Color.Red : End If
  118. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計11_tb.Text = "0" : Else : 加總(9) += 表單3_dgv.Rows(i).Cells("9.5").Value : End If
  119. Next i : 合計11_tb.Text = Format(Val(加總(9)), "#,##0") : If 合計11_tb.Text = "0" Then : 合計11_tb.ForeColor = Color.Black : Else : 合計11_tb.ForeColor = Color.Red : End If
  120. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計12_tb.Text = "0" : Else : 加總(10) += 表單3_dgv.Rows(i).Cells("10").Value : End If
  121. Next i : 合計12_tb.Text = Format(Val(加總(10)), "#,##0") : If 合計12_tb.Text = "0" Then : 合計12_tb.ForeColor = Color.Black : Else : 合計12_tb.ForeColor = Color.Red : End If
  122. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計13_tb.Text = "0" : Else : 加總(11) += 表單3_dgv.Rows(i).Cells("10.5").Value : End If
  123. Next i : 合計13_tb.Text = Format(Val(加總(11)), "#,##0") : If 合計13_tb.Text = "0" Then : 合計13_tb.ForeColor = Color.Black : Else : 合計13_tb.ForeColor = Color.Red : End If
  124. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計14_tb.Text = "0" : Else : 加總(12) += 表單3_dgv.Rows(i).Cells("11").Value : End If
  125. Next i : 合計14_tb.Text = Format(Val(加總(12)), "#,##0") : If 合計14_tb.Text = "0" Then : 合計14_tb.ForeColor = Color.Black : Else : 合計14_tb.ForeColor = Color.Red : End If
  126. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計15_tb.Text = "0" : Else : 加總(17) += 表單3_dgv.Rows(i).Cells("11.5").Value : End If
  127. Next i : 合計15_tb.Text = Format(Val(加總(17)), "#,##0") : If 合計15_tb.Text = "0" Then : 合計15_tb.ForeColor = Color.Black : Else : 合計15_tb.ForeColor = Color.Red : End If
  128. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計16_tb.Text = "0" : Else : 加總(13) += 表單3_dgv.Rows(i).Cells("12").Value : End If
  129. Next i : 合計16_tb.Text = Format(Val(加總(13)), "#,##0") : If 合計16_tb.Text = "0" Then : 合計16_tb.ForeColor = Color.Black : Else : 合計16_tb.ForeColor = Color.Red : End If
  130. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計17_tb.Text = "0" : Else : 加總(18) += 表單3_dgv.Rows(i).Cells("12.5").Value : End If
  131. Next i : 合計17_tb.Text = Format(Val(加總(18)), "#,##0") : If 合計17_tb.Text = "0" Then : 合計17_tb.ForeColor = Color.Black : Else : 合計17_tb.ForeColor = Color.Red : End If
  132. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計18_tb.Text = "0" : Else : 加總(14) += 表單3_dgv.Rows(i).Cells("13").Value : End If
  133. Next i : 合計18_tb.Text = Format(Val(加總(14)), "#,##0") : If 合計18_tb.Text = "0" Then : 合計18_tb.ForeColor = Color.Black : Else : 合計18_tb.ForeColor = Color.Red : End If
  134. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1 : If 表單3_dgv.RowCount = 0 Then : 合計19_tb.Text = "0" : Else : 加總(15) += 表單3_dgv.Rows(i).Cells("14").Value : End If
  135. Next i : 合計19_tb.Text = Format(Val(加總(15)), "#,##0") : If 合計19_tb.Text = "0" Then : 合計19_tb.ForeColor = Color.Black : Else : 合計19_tb.ForeColor = Color.Red : End If
  136. 加總(16) = 加總(0) + 加總(1) + 加總(2) + 加總(3) + 加總(4) + 加總(5) + 加總(6) + 加總(7) + 加總(8) + 加總(9) + 加總(10) + 加總(11) + 加總(12) + 加總(13) + 加總(14) +
  137. 加總(15) + 加總(17) + 加總(18) + 加總(19) + 加總(20)
  138. 合計20_tb.Text = Format(Val(加總(16)), "#,##0")
  139. 加總(16) = 0
  140. If 合計20_tb.Text = "0" Then : 合計20_tb.ForeColor = Color.Black : Else : 合計20_tb.ForeColor = Color.Blue : End If
  141. End Sub
  142. Private Sub 下拉表單資料載入1()
  143. SQL_客戶控制表() : Brand_cb.Items.Clear()
  144. While (dr.Read()) : Brand_cb.Items.Add(dr("客戶簡稱")) : End While : conn.Close()
  145. '------------------------------------------------------------------------------------------------------------------
  146. SQL_MODEOFDELIVERY() : Delivery_cb.Items.Clear()
  147. While (dr.Read()) : Delivery_cb.Items.Add(dr("MODEOFDELIVERY")) : End While : conn.Close()
  148. '-------------------------------------------------------------------------------------------------------------------
  149. SQL_DELIVERYTERMS() : Terms_cb.Items.Clear()
  150. While (dr.Read()) : Terms_cb.Items.Add(dr("DELIVERYTERMS")) : End While : conn.Close()
  151. '-------------------------------------------------------------------------------------------------------------------
  152. SQL_港口清單() : FromPort_cb.Items.Clear()
  153. While (dr.Read()) : FromPort_cb.Items.Add(dr("FOB")) : End While : conn.Close()
  154. '-------------------------------------------------------------------------------------------------------------------
  155. SQL_TOPORT() : ToPort_cb.Items.Clear()
  156. While (dr.Read()) : ToPort_cb.Items.Add(dr("TOPORT")) : End While : conn.Close()
  157. '-------------------------------------------------------------------------------------------------------------------
  158. SQL_REMARK() : Remark_cb.Items.Clear()
  159. While (dr.Read()) : Remark_cb.Items.Add(dr("REMARK")) : End While : conn.Close()
  160. End Sub
  161. Private Sub 量產訂單明細表_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  162. WINPROFIT_ERP_SYS.WindowState = 2 : Me.MdiParent = WINPROFIT_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True : Set_格式設定1() : 資料刪除_bt.Enabled = False
  163. GroupBox1.Visible = False : 日期2_dtp.Visible = False
  164. If PA = "" Then : Else
  165. 訂單號_tb.Text = PA
  166. 下拉表單資料載入1() : 基本資料載入() : SQL_查詢資料()
  167. If dr.Read() Then
  168. Delivery_cb.Text = dr("ModeOfDelivery").ToString : Terms_cb.Text = dr("DeliveryTerms").ToString : FromPort_cb.Text = dr("FromPort").ToString
  169. ToPort_cb.Text = dr("ToPort").ToString : ShippingCarrier_tb.Text = dr("ShippingCarrier").ToString : VendorReference_tb.Text = dr("VendorReference").ToString
  170. CustomerName_tb.Text = dr("CustomerName").ToString : SalesOrder_tb.Text = dr("SalesOrder").ToString : DeliveryAddress_tb.Text = dr("DeliveryAddress").ToString
  171. Brand_cb.Text = dr("Brand").ToString : CustomerRequisition_tb.Text = dr("CustomerRequisition").ToString
  172. Date1 = dr("CreatedDate").ToString : Date2 = dr("OrgShipDate").ToString : Date3 = dr("ModifiedDate").ToString
  173. Date4 = dr("ShipDate").ToString : Date5 = dr("下單日").ToString : Date6 = dr("交期").ToString : Date7 = dr("ETADate").ToString
  174. If Date1 = " " Or Date1 = "" Then : Else : 日期_dtp.Format = DateTimePickerFormat.Short : 日期_dtp.Text = dr("CreatedDate").ToString : End If
  175. If Date2 = " " Or Date2 = "" Then : Else : 日期1_dtp.Format = DateTimePickerFormat.Short : 日期1_dtp.Text = dr("OrgShipDate").ToString : End If
  176. If Date3 = " " Or Date3 = "" Then : Else : 日期3_dtp.Format = DateTimePickerFormat.Short : 日期3_dtp.Text = dr("ModifiedDate").ToString : End If
  177. If Date4 = " " Or Date4 = "" Then : Else : 日期4_dtp.Format = DateTimePickerFormat.Short : 日期4_dtp.Text = dr("ShipDate").ToString : End If
  178. If Date5 = " " Or Date5 = "" Then : Else : 日期6_dtp.Format = DateTimePickerFormat.Short : 日期6_dtp.Text = dr("下單日").ToString : End If
  179. If Date6 = " " Or Date6 = "" Then : Else : 日期7_dtp.Format = DateTimePickerFormat.Short : 日期7_dtp.Text = dr("交期").ToString : End If
  180. If Date7 = " " Or Date7 = "" Then : Else : 日期5_dtp.Format = DateTimePickerFormat.Short : 日期5_dtp.Text = dr("ETADate").ToString : End If
  181. Remark_cb.Text = dr("REMARK").ToString
  182. End If
  183. conn.Close()
  184. Set_訂單清單() : Set_自動彙總1() : Set_清單3() : Set_清單2()
  185. 訂單屬性_tb.Text = 表單2_dgv.Rows(0).Cells("CFMSPEC").Value
  186. PictureBox1.Image = Nothing
  187. PA7 = 表單2_dgv.Rows(0).Cells("BUYER").Value : PA8 = 表單2_dgv.Rows(0).Cells("型體號碼").Value
  188. PA9 = 表單2_dgv.Rows(0).Cells("型體名稱").Value
  189. SQL_第一筆圖片()
  190. If dr.Read() Then : PictureBox1.Image = Nothing : SQL_第一筆圖片()
  191. While dr.Read() = True
  192. Dim unused As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  193. Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  194. End While : conn.Close()
  195. Else : PictureBox1.Image = Nothing : SQL_第一筆圖片1()
  196. If dr.Read() Then : PictureBox1.Image = Nothing : SQL_第一筆圖片1()
  197. While dr.Read() = True
  198. Dim unused1 As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  199. Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  200. End While
  201. conn.Close()
  202. Else : SQL_圖片() : PictureBox1.Image = Nothing
  203. If dr.Read() Then : PictureBox1.Image = Nothing : SQL_圖片()
  204. While dr.Read() = True
  205. Dim unused2 As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  206. Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  207. End While : conn.Close()
  208. Else : conn.Close() : End If
  209. End If
  210. End If : PictureBox1.SizeMode = 4
  211. 列印用SQL1 = 訂單號_tb.Text
  212. End If : PA = "" : PA5 = ""
  213. End Sub
  214. Private Sub DataGridView2_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 表單1_dgv.CellClick
  215. PictureBox2.Image = Nothing : PA6 = 表單1_dgv.Rows(e.RowIndex).Cells("訂單流水號").Value : PA7 = 表單1_dgv.Rows(e.RowIndex).Cells("附件數").Value
  216. SQL_一筆訂單附件資料()
  217. While dr.Read() = True
  218. Dim unused As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  219. Dim oStream As New MemoryStream(bytes) : PictureBox2.Image = Bitmap.FromStream(oStream)
  220. End While
  221. conn.Close()
  222. PictureBox2.SizeMode = 4
  223. End Sub
  224. Private Sub DataGridView3_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 表單2_dgv.CellClick
  225. If e.RowIndex = -1 Then : Else
  226. PictureBox1.Image = Nothing
  227. PA7 = 表單2_dgv.Rows(0).Cells("BUYER").Value : PA8 = 表單2_dgv.Rows(0).Cells("型體號碼").Value
  228. PA9 = 表單2_dgv.Rows(0).Cells("型體名稱").Value
  229. SQL_第一筆圖片()
  230. If dr.Read() Then : PictureBox1.Image = Nothing : SQL_第一筆圖片()
  231. While dr.Read() = True
  232. Dim unused As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  233. Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  234. End While : conn.Close()
  235. Else : PictureBox1.Image = Nothing : SQL_第一筆圖片1()
  236. If dr.Read() Then : PictureBox1.Image = Nothing : SQL_第一筆圖片1()
  237. While dr.Read() = True
  238. Dim unused1 As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  239. Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  240. End While
  241. conn.Close()
  242. Else : SQL_圖片() : PictureBox1.Image = Nothing
  243. If dr.Read() Then : PictureBox1.Image = Nothing : SQL_圖片()
  244. While dr.Read() = True
  245. Dim unused2 As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  246. Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  247. End While : conn.Close()
  248. Else : conn.Close() : End If
  249. End If
  250. End If : PictureBox1.SizeMode = 4
  251. End If
  252. End Sub
  253. Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 表單3_dgv.CellEndEdit
  254. TotalNumber_tb.Text = "0"
  255. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1
  256. 表單2_dgv.Rows(i).Cells("訂單數量").Value = 表單3_dgv.Rows(i).Cells("4").Value + 表單3_dgv.Rows(i).Cells("4.5").Value + 表單3_dgv.Rows(i).Cells("5").Value +
  257. 表單3_dgv.Rows(i).Cells("5.5").Value + 表單3_dgv.Rows(i).Cells("6").Value + 表單3_dgv.Rows(i).Cells("6.5").Value + 表單3_dgv.Rows(i).Cells("7").Value +
  258. 表單3_dgv.Rows(i).Cells("7.5").Value + 表單3_dgv.Rows(i).Cells("8").Value + 表單3_dgv.Rows(i).Cells("8.5").Value + 表單3_dgv.Rows(i).Cells("9").Value +
  259. 表單3_dgv.Rows(i).Cells("9.5").Value + 表單3_dgv.Rows(i).Cells("10").Value + 表單3_dgv.Rows(i).Cells("10.5").Value + 表單3_dgv.Rows(i).Cells("11").Value +
  260. 表單3_dgv.Rows(i).Cells("11.5").Value + 表單3_dgv.Rows(i).Cells("12").Value + 表單3_dgv.Rows(i).Cells("12.5").Value + 表單3_dgv.Rows(i).Cells("13").Value +
  261. 表單3_dgv.Rows(i).Cells("14").Value
  262. 表單3_dgv.Rows(i).Cells("TOTAL").Value = 表單2_dgv.Rows(i).Cells("訂單數量").Value
  263. Next i
  264. For i As Integer = 0 To 表單2_dgv.Rows.Count - 1
  265. TotalNumber_tb.Text = Val(TotalNumber_tb.Text) + 表單2_dgv.Rows(i).Cells("訂單數量").Value
  266. Next i
  267. TotalNumber_tb.Text = Format(Val(TotalNumber_tb.Text), "#,##0")
  268. Set_自動彙總1()
  269. End Sub
  270. Private Sub DataGridView3_CellEndEdit(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles 表單2_dgv.CellEndEdit
  271. Dim EU(2) As String
  272. EU(0) = 表單2_dgv("交期開始", e.RowIndex).Value.ToString
  273. If EU(0) = "" Then
  274. Else
  275. 日期2_dtp.Text = EU(0)
  276. 表單2_dgv.Rows(e.RowIndex).Cells("交期開始").Value = Format(日期2_dtp.Value, "yyyy/MM/dd")
  277. End If
  278. EU(1) = 表單2_dgv("交期結束", e.RowIndex).Value.ToString
  279. If EU(1) = "" Then
  280. Else
  281. 日期2_dtp.Text = EU(1)
  282. 表單2_dgv.Rows(e.RowIndex).Cells("交期結束").Value = Format(日期2_dtp.Value, "yyyy/MM/dd")
  283. End If
  284. EU(2) = 表單2_dgv("工廠交期", e.RowIndex).Value.ToString
  285. If EU(2) = "" Then
  286. Else
  287. 日期2_dtp.Text = EU(2)
  288. 表單2_dgv.Rows(e.RowIndex).Cells("工廠交期").Value = Format(日期2_dtp.Value, "yyyy/MM/dd")
  289. End If
  290. End Sub
  291. Private Sub ComboBox8_SelectedIndexChanged(sender As Object, e As EventArgs) Handles Remark_cb.TextChanged
  292. SQL_DELIVERYADDRESS2()
  293. If dr.Read() Then : DeliveryAddress_tb.Text = dr("DELIVERYADDRESS").ToString : End If : conn.Close()
  294. End Sub
  295. Private Sub Button30_Click(sender As Object, e As EventArgs) Handles 返回訂單控制表_bt.Click
  296. Me.Close()
  297. 列印用SQL = ""
  298. End Sub
  299. Private Sub Button12_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click
  300. OD(0) = Number_tb.Text : OD(1) = 日期_dtp.Text : OD(2) = Brand_cb.Text : OD(3) = Vendor_tb.Text : OD(4) = Delivery_cb.Text
  301. OD(5) = Terms_cb.Text : OD(6) = 備註_tb.Text
  302. OD(7) = 日期1_dtp.Text : OD(8) = FromPort_cb.Text : OD(9) = ToPort_cb.Text : OD(10) = ShippingCarrier_tb.Text : OD(11) = VendorReference_tb.Text
  303. OD(12) = 日期3_dtp.Text : OD(13) = CustomerName_tb.Text : OD(14) = 日期4_dtp.Text : OD(15) = SalesOrder_tb.Text
  304. OD(16) = 日期5_dtp.Text : OD(17) = DeliveryAddress_tb.Text
  305. OD(18) = 訂單號_tb.Text : OD(19) = 工廠_tb.Text : OD(20) = 日期6_dtp.Text : OD(21) = 日期7_dtp.Text
  306. OD(40) = Remark_cb.Text
  307. OD(22) = 合計2_tb.Text : OD(23) = 合計3_tb.Text : OD(24) = 合計4_tb.Text : OD(25) = 合計5_tb.Text : OD(26) = 合計6_tb.Text
  308. OD(27) = 合計7_tb.Text : OD(28) = 合計8_tb.Text : OD(29) = 合計9_tb.Text : OD(30) = 合計10_tb.Text : OD(31) = 合計11_tb.Text
  309. OD(32) = 合計12_tb.Text : OD(33) = 合計13_tb.Text : OD(34) = 合計14_tb.Text : OD(35) = 合計16_tb.Text : OD(36) = 合計18_tb.Text
  310. OD(37) = 合計19_tb.Text : OD(38) = 合計20_tb.Text : OD(39) = CustomerRequisition_tb.Text : OD(41) = 合計15_tb.Text : OD(42) = 合計17_tb.Text
  311. OD(43) = 合計_tb.Text : OD(44) = 合計1_tb.Text : OD(45) = 訂單屬性_tb.Text
  312. 列印_訂單明細.Show()
  313. End Sub
  314. Private Sub Set_日期格式轉換()
  315. DTPs(0) = 日期_dtp.Text : DTPs(1) = 日期1_dtp.Text : DTPs(2) = 日期3_dtp.Text : DTPs(3) = 日期4_dtp.Text : DTPs(4) = 日期6_dtp.Text
  316. DTPs(5) = 日期7_dtp.Text : DTPs(6) = 日期5_dtp.Text
  317. If DTPs(0) = " " Then : DTPs(0) = "" : Else : DTPs(0) = Format(日期_dtp.Value, "yyyy/MM/dd") : End If
  318. If DTPs(1) = " " Then : DTPs(1) = "" : Else : DTPs(1) = Format(日期1_dtp.Value, "yyyy/MM/dd") : End If
  319. If DTPs(2) = " " Then : DTPs(2) = "" : Else : DTPs(2) = Format(日期3_dtp.Value, "yyyy/MM/dd") : End If
  320. If DTPs(3) = " " Then : DTPs(3) = "" : Else : DTPs(3) = Format(日期4_dtp.Value, "yyyy/MM/dd") : End If
  321. If DTPs(4) = " " Then : DTPs(4) = "" : Else : DTPs(4) = Format(日期6_dtp.Value, "yyyy/MM/dd") : End If
  322. If DTPs(5) = " " Then : DTPs(5) = "" : Else : DTPs(5) = Format(日期7_dtp.Value, "yyyy/MM/dd") : End If
  323. If DTPs(6) = " " Then : DTPs(6) = "" : Else : DTPs(6) = Format(日期5_dtp.Value, "yyyy/MM/dd") : End If
  324. End Sub
  325. Private Sub Button8_Click(sender As Object, e As EventArgs) Handles 資料存檔_bt.Click
  326. Set_日期格式轉換()
  327. SQL_修改訂單明細表抬頭() : conn.Close()
  328. For i As Integer = 0 To 表單2_dgv.Rows.Count - 1
  329. 資料數 = 表單2_dgv.Rows.Count : MyModule1.進度條()
  330. PA8 = 表單2_dgv.Rows(i).Cells("訂單數量").Value : PA9 = 表單2_dgv.Rows(i).Cells("交期開始").Value
  331. PA10 = 表單2_dgv.Rows(i).Cells("交期結束").Value : PA11 = 表單2_dgv.Rows(i).Cells("備註").Value
  332. PA12 = 表單2_dgv.Rows(i).Cells("工廠交期").Value : PA13 = 表單2_dgv.Rows(i).Cells("BUYER").Value
  333. PA14 = 表單2_dgv.Rows(i).Cells("資料流水號").Value
  334. SQL_修改訂單控制表5() : conn.Close()
  335. Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  336. For i As Integer = 0 To 表單3_dgv.Rows.Count - 1
  337. 資料數 = 表單3_dgv.Rows.Count : MyModule1.進度條()
  338. PA15 = 表單3_dgv.Rows(i).Cells("4").Value : PA16 = 表單3_dgv.Rows(i).Cells("4.5").Value
  339. PA17 = 表單3_dgv.Rows(i).Cells("5").Value : PA18 = 表單3_dgv.Rows(i).Cells("5.5").Value
  340. PA19 = 表單3_dgv.Rows(i).Cells("6").Value : PA20 = 表單3_dgv.Rows(i).Cells("6.5").Value
  341. PA21 = 表單3_dgv.Rows(i).Cells("7").Value : PA22 = 表單3_dgv.Rows(i).Cells("7.5").Value
  342. PA23 = 表單3_dgv.Rows(i).Cells("8").Value : PA24 = 表單3_dgv.Rows(i).Cells("8.5").Value
  343. PA25 = 表單3_dgv.Rows(i).Cells("9").Value : PA26 = 表單3_dgv.Rows(i).Cells("9.5").Value
  344. PA27 = 表單3_dgv.Rows(i).Cells("10").Value : PA28 = 表單3_dgv.Rows(i).Cells("10.5").Value
  345. PA29 = 表單3_dgv.Rows(i).Cells("11").Value : PA30 = 表單3_dgv.Rows(i).Cells("11.5").Value
  346. PA31 = 表單3_dgv.Rows(i).Cells("12").Value : PA32 = 表單3_dgv.Rows(i).Cells("12.5").Value
  347. PA33 = 表單3_dgv.Rows(i).Cells("13").Value : PA7 = 表單3_dgv.Rows(i).Cells("14").Value
  348. PA4 = 表單3_dgv.Rows(i).Cells("資料流水號").Value
  349. SQL_修改訂單明細表1() : conn.Close()
  350. Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  351. MsgBox("存檔完成。")
  352. End Sub
  353. Private Sub Button6_Click(sender As Object, e As EventArgs) Handles 訂單附件導入_bt.Click
  354. Dim NUM1 As Integer
  355. SQL_訂單附件資料1()
  356. If dr.Read() Then : 新流水號3 = dr("附件數") : Else : 新流水號3 = "V00" : End If : conn.Close()
  357. NUM1 = Double.Parse(Strings.Right(新流水號3, 2)) + 1
  358. If NUM1 < 10 Then : 新流水號3 = "V" & "0" & NUM1
  359. ElseIf NUM1 > 9 Then : 新流水號3 = "V" & NUM1
  360. End If
  361. TextBox3.Text = 新流水號3
  362. GroupBox1.Visible = True
  363. If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
  364. WebBrowser2.Navigate(FolderBrowserDialog1.SelectedPath)
  365. End If
  366. End Sub
  367. Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
  368. GroupBox1.Visible = False
  369. End Sub
  370. Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
  371. If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
  372. WebBrowser2.Navigate(FolderBrowserDialog1.SelectedPath)
  373. End If
  374. End Sub
  375. Private Sub TextBox4_DragEnter(sender As Object, e As DragEventArgs) Handles TextBox4.DragEnter
  376. If e.Data.GetDataPresent(DataFormats.FileDrop) Then : Dim files As String()
  377. Try : files = CType(e.Data.GetData(DataFormats.FileDrop), String()) : TextBox4.Text = files(files.Length - 1)
  378. Catch ex As Exception : MessageBox.Show(ex.Message) : Return : End Try
  379. End If
  380. Dim STR2 As Integer = 0 : TextBox7.Text = TextBox4.Text
  381. If TextBox4.Text = "" Then : Else
  382. For i As Integer = 0 To 9999 : Dim STR1 As Integer = Strings.Len(TextBox7.Text)
  383. If Strings.Right((TextBox7.Text), 1) <> "\" Then : STR1 -= 1 : STR2 += 1
  384. If STR1 = 0 Then : TextBox7.Text = "" : TextBox4.Text = "" : i = 9999
  385. Else : TextBox7.Text = Strings.Left((TextBox7.Text), STR1) : End If
  386. Else
  387. TextBox7.Text = Strings.Right((TextBox4.Text), STR2)
  388. TextBox4.Text = TextBox7.Text : i = 9999
  389. End If
  390. Next
  391. Dim files As String() : files = CType(e.Data.GetData(DataFormats.FileDrop), String())
  392. TextBox7.Text = files(files.Length - 1)
  393. End If
  394. End Sub
  395. Private Sub TextBox4_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs) Handles TextBox4.DragDrop
  396. Dim files As Array = e.Data.GetData(DataFormats.FileDrop)
  397. For Each file As String In files
  398. TextBox4.AppendText(file + Environment.NewLine)
  399. Next
  400. End Sub
  401. Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
  402. If TextBox3.Text = "" Or TextBox4.Text = "" Then : MsgBox("請注意圖片檔案已準備完畢") : Else
  403. PA49 = TextBox7.Text : SQL_新增訂單附件資料() : conn.Close()
  404. PictureBox2.Image = Nothing
  405. SQL_訂單附件資料3()
  406. While dr.Read() = True
  407. Dim unused As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  408. Dim oStream As New MemoryStream(bytes) : PictureBox2.Image = Bitmap.FromStream(oStream)
  409. End While
  410. conn.Close() : PictureBox2.SizeMode = 4 : TextBox3.Text = "" : TextBox4.Text = "" : MsgBox("新增完成") : GroupBox1.Visible = False : Set_清單2()
  411. End If
  412. End Sub
  413. Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles PictureBox2.MouseUp
  414. m_DeltaX = m_MousePosX - e.X : m_DeltaY = m_MousePosY - e.Y : m_Leftx -= m_DeltaX : m_Lefty -= m_DeltaY : Picturemove(sender, e)
  415. Me.Cursor = Cursors.Arrow
  416. End Sub
  417. Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles PictureBox2.MouseDown
  418. Me.Cursor = Cursors.Hand : m_MousePosX = e.X : m_MousePosY = e.Y
  419. End Sub
  420. Private Sub Picturemove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
  421. Dim myBit As New Bitmap(PictureBox2.Image)
  422. Dim myPicGrh As Graphics = Me.PictureBox2.CreateGraphics
  423. myPicGrh.Clear(Me.PictureBox2.BackColor)
  424. myPicGrh.DrawImageUnscaled(myBit, m_Leftx - 152, m_Lefty)
  425. myBit.Dispose()
  426. myPicGrh.Dispose()
  427. End Sub
  428. Private Sub Button20_Click(sender As Object, e As EventArgs) Handles 放大_bt.Click
  429. Dim image = PictureBox2.Image
  430. Dim g As Graphics = PictureBox2.CreateGraphics
  431. g.DrawImage(image, New Rectangle(0, 0, image.Width * 1.01, image.Height * 1.01))
  432. End Sub
  433. Private Sub Button11_Click(sender As Object, e As EventArgs) Handles 復原_bt.Click
  434. PictureBox2.Refresh()
  435. End Sub
  436. Private Sub Button25_Click(sender As Object, e As EventArgs) Handles 順時鐘90度旋轉_bt.Click
  437. PictureBox2.Image.RotateFlip(RotateFlipType.Rotate90FlipNone) : PictureBox2.Refresh() : PictureBox2.SizeMode = 4
  438. End Sub
  439. Private Sub Button24_Click(sender As Object, e As EventArgs) Handles 逆時鐘90度旋轉_bt.Click
  440. PictureBox2.Image.RotateFlip(RotateFlipType.Rotate270FlipNone) : PictureBox2.Refresh() : PictureBox2.SizeMode = 4
  441. End Sub
  442. Private Sub Button23_Click(sender As Object, e As EventArgs) Handles 水平翻轉_bt.Click
  443. PictureBox2.Image.RotateFlip(RotateFlipType.Rotate180FlipY) : PictureBox2.Refresh() : PictureBox2.SizeMode = 4
  444. End Sub
  445. Private Sub Button21_Click(sender As Object, e As EventArgs) Handles 垂直翻轉_bt.Click
  446. PictureBox2.Image.RotateFlip(RotateFlipType.Rotate180FlipX) : PictureBox2.Refresh() : PictureBox2.SizeMode = 4
  447. End Sub
  448. Private Sub Button26_Click(sender As Object, e As EventArgs) Handles 更新BUYER_bt.Click
  449. For i As Integer = 0 To 表單2_dgv.Rows.Count - 1
  450. 表單2_dgv.Rows(i).Cells("BUYER").Value = Brand_cb.Text
  451. Next
  452. MsgBox("注意還未存檔喔")
  453. End Sub
  454. Private Sub 表單3_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 表單3_dgv.MouseUp
  455. If 表單3_dgv.SelectedCells.Count = 1 Then
  456. 已超出 = False
  457. End If
  458. If 表單3_dgv.SelectedCells.Count > 0 Then
  459. If 表單3_dgv.SelectedCells(0).ColumnIndex >= 6 And 表單3_dgv.SelectedCells(0).ColumnIndex <= 25 Then
  460. If 已超出 = False Then
  461. Dim x As Double = 0
  462. For i As Integer = 0 To 表單3_dgv.SelectedCells.Count - 1
  463. x += Val(表單3_dgv.Rows(表單3_dgv.SelectedCells.Item(i).RowIndex).Cells(表單3_dgv.SelectedCells.Item(i).ColumnIndex).Value)
  464. Next i
  465. WINPROFIT_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(x, "#,##0.0")
  466. Else
  467. WINPROFIT_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0.0")
  468. End If
  469. Else
  470. 已超出 = True
  471. WINPROFIT_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0.0")
  472. End If
  473. End If
  474. End Sub
  475. End Class