No Description
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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. Option Strict Off
  2. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  3. Imports Microsoft.Office.Interop.Excel.Constants
  4. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  5. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  6. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  7. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  8. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  9. Imports Microsoft.Office.Interop.Excel.XlWindowState
  10. Imports Microsoft.Office.Interop.Excel
  11. Public Class 維修單申請
  12. ReadOnly ds As New DataSet : ReadOnly ds1 As New DataSet : ReadOnly ds2 As New DataSet
  13. Dim EDR As Integer = 0 : Dim ESTR As String : Dim HHJJ As String : Dim N1 As Integer = 0
  14. Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
  15. Private Sub Set_清單()
  16. DataGridView1.DataSource = Nothing : ds.Clear() : DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing : DataGridView1.ColumnHeadersHeight = 40
  17. DataGridView1.AllowUserToAddRows = False : DataGridView1.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText : DataGridView1.MultiSelect = True
  18. SQL_維修單申請清單()
  19. da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
  20. DataGridView1.Columns(0).FillWeight = 130 : DataGridView1.Columns(1).Visible = False : DataGridView1.Columns(2).Visible = False : DataGridView1.Columns(3).FillWeight = 350
  21. DataGridView1.Columns(4).Visible = False : DataGridView1.Columns(5).Visible = False : DataGridView1.Columns(6).Visible = False : DataGridView1.Columns(7).FillWeight = 85
  22. DataGridView1.Columns(8).Visible = False : DataGridView1.Columns(9).FillWeight = 85 : DataGridView1.Columns(10).Visible = False : DataGridView1.Columns(11).FillWeight = 90
  23. DataGridView1.Columns(12).Visible = False : DataGridView1.Columns(13).FillWeight = 90 : DataGridView1.Columns(14).Visible = False
  24. DataGridView1.Columns(6).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(7).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(8).DefaultCellStyle.Format = "#,##0"
  25. DataGridView1.Columns(9).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(10).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(11).DefaultCellStyle.Format = "#,##0"
  26. DataGridView1.Columns(12).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(13).DefaultCellStyle.Format = "#,##0"
  27. DataGridView1.Columns(0).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(0).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  28. DataGridView1.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  29. DataGridView1.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  30. DataGridView1.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  31. DataGridView1.Columns(9).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(9).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  32. DataGridView1.Columns(10).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(10).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  33. DataGridView1.Columns(11).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(11).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  34. DataGridView1.Columns(12).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(12).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  35. DataGridView1.Columns(13).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(13).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  36. DataGridView1.Columns(0).ReadOnly = True : DataGridView1.Columns(3).ReadOnly = True : DataGridView1.Columns(4).ReadOnly = True : DataGridView1.Columns(5).ReadOnly = True
  37. DataGridView1.Columns(6).ReadOnly = True : DataGridView1.Columns(7).ReadOnly = True : DataGridView1.Columns(8).ReadOnly = True : DataGridView1.Columns(9).ReadOnly = True
  38. DataGridView1.Columns(10).ReadOnly = True : DataGridView1.Columns(11).ReadOnly = True : DataGridView1.Columns(12).ReadOnly = True : DataGridView1.Columns(13).ReadOnly = True
  39. DataGridView1.Columns(7).DefaultCellStyle.BackColor = Color.MistyRose : DataGridView1.Columns(8).DefaultCellStyle.BackColor = Color.MistyRose
  40. DataGridView1.Columns(9).DefaultCellStyle.BackColor = Color.LightYellow : DataGridView1.Columns(10).DefaultCellStyle.BackColor = Color.LightYellow
  41. DataGridView1.Columns(11).DefaultCellStyle.BackColor = Color.LightGreen : DataGridView1.Columns(12).DefaultCellStyle.BackColor = Color.LightGreen
  42. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  43. If DataGridView1.Rows(i).Cells("未入庫").Value.ToString = "" Then : DataGridView1.Rows(i).Cells("未入庫").Value = 0 : End If
  44. If DataGridView1.Rows(i).Cells("在途成本_台幣").Value.ToString = "" Then : DataGridView1.Rows(i).Cells("在途成本_台幣").Value = 0 : End If
  45. If DataGridView1.Rows(i).Cells("未出庫").Value.ToString = "" Then : DataGridView1.Rows(i).Cells("未出庫").Value = 0 : End If
  46. If DataGridView1.Rows(i).Cells("備貨成本_台幣").Value.ToString = "" Then : DataGridView1.Rows(i).Cells("備貨成本_台幣").Value = 0 : End If
  47. DataGridView1.Rows(i).Cells("可領用").Value = DataGridView1.Rows(i).Cells("庫存").Value + DataGridView1.Rows(i).Cells("未入庫").Value - DataGridView1.Rows(i).Cells("未出庫").Value
  48. Next
  49. TextBox13.Text = "" : TextBox7.Text = "" : TextBox15.Text = "0" : NumericUpDown1.Value = 0
  50. End Sub
  51. Private Sub Set_維修清單()
  52. DataGridView2.DataSource = Nothing : ds1.Clear() : DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing : DataGridView2.ColumnHeadersHeight = 25
  53. DataGridView2.AllowUserToAddRows = False : DataGridView2.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText : DataGridView2.MultiSelect = True
  54. SQL_維修單申請_彙總()
  55. da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close()
  56. DataGridView2.Columns(0).FillWeight = 150 : DataGridView2.Columns(1).FillWeight = 90 : DataGridView2.Columns(2).Visible = False : DataGridView2.Columns(3).FillWeight = 100
  57. DataGridView2.Columns(4).FillWeight = 80 : DataGridView2.Columns(5).FillWeight = 90 : DataGridView2.Columns(6).Visible = False : DataGridView2.Columns(7).Visible = False
  58. DataGridView2.Columns(8).Visible = False : DataGridView2.Columns(9).Visible = False
  59. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  60. If DataGridView2.Rows(i).Cells("業務比例").Value.ToString = "" Then : DataGridView2.Rows(i).Cells("業務比例").Value = 0 : End If
  61. If DataGridView2.Rows(i).Cells("司機比例").Value.ToString = "" Then : DataGridView2.Rows(i).Cells("司機比例").Value = 0 : End If
  62. Next
  63. End Sub
  64. Private Sub Set_單據明細()
  65. DataGridView3.DataSource = Nothing : ds2.Clear() : DataGridView3.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing : DataGridView3.ColumnHeadersHeight = 25
  66. DataGridView3.AllowUserToAddRows = False : DataGridView3.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText : DataGridView3.MultiSelect = True
  67. SQL_維修單申請_清單()
  68. da.Fill(ds2) : DataGridView3.DataSource = ds2.Tables(0) : conn.Close()
  69. DataGridView3.Columns(6).DefaultCellStyle.Format = "#,##0" : DataGridView3.Columns(7).DefaultCellStyle.Format = "#,##0"
  70. DataGridView3.Columns(8).DefaultCellStyle.Format = "#,##0.0000" : DataGridView3.Columns(9).DefaultCellStyle.Format = "#,##0" : DataGridView3.Columns(10).DefaultCellStyle.Format = "#,##0"
  71. DataGridView3.Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  72. DataGridView3.Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  73. DataGridView3.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  74. DataGridView3.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  75. DataGridView3.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  76. DataGridView3.Columns(9).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(9).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  77. DataGridView3.Columns(10).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(10).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  78. DataGridView3.Columns(12).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(12).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  79. DataGridView3.Columns(13).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(13).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  80. DataGridView3.Columns(0).Visible = False : DataGridView3.Columns(1).FillWeight = 30 : DataGridView3.Columns(2).FillWeight = 80 : DataGridView3.Columns(3).FillWeight = 150
  81. DataGridView3.Columns(4).FillWeight = 80 : DataGridView3.Columns(5).FillWeight = 80 : DataGridView3.Columns(6).FillWeight = 50 : DataGridView3.Columns(7).FillWeight = 50
  82. DataGridView3.Columns(8).Visible = False : DataGridView3.Columns(9).Visible = False : DataGridView3.Columns(10).Visible = False : DataGridView3.Columns(11).FillWeight = 100
  83. DataGridView3.Columns(12).FillWeight = 80 : DataGridView3.Columns(13).FillWeight = 50 : DataGridView3.Columns(14).Visible = False
  84. DataGridView3.EditMode = DataGridViewEditMode.EditOnEnter
  85. DataGridView3.Columns(1).ReadOnly = True : DataGridView3.Columns(2).ReadOnly = True : DataGridView3.Columns(3).ReadOnly = True : DataGridView3.Columns(4).ReadOnly = True
  86. DataGridView3.Columns(5).ReadOnly = True : DataGridView3.Columns(6).ReadOnly = True : DataGridView3.Columns(8).ReadOnly = True : DataGridView3.Columns(9).ReadOnly = True
  87. DataGridView3.Columns(10).ReadOnly = True : DataGridView3.Columns(12).ReadOnly = True
  88. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  89. DataGridView3(1, i).Value = i + 1
  90. Next
  91. End Sub
  92. Private Sub ComboBox1下拉表單資料載入()
  93. SQL_物料頁碼清單()
  94. ComboBox1.Items.Clear() : While (dr.Read()) : ComboBox1.Items.Add(dr("頁碼")) : End While : conn.Close()
  95. End Sub
  96. Private Sub ComboBox2下拉表單資料載入()
  97. SQL_客戶資料表_下拉清單讀取()
  98. ComboBox2.Items.Clear() : ComboBox3.Items.Clear() : While (dr.Read()) : ComboBox2.Items.Add(dr("簡稱")) : ComboBox3.Items.Add(dr("編號")) : End While : conn.Close()
  99. End Sub
  100. Private Sub ComboBox5下拉表單資料載入()
  101. SQL_倉名下拉清單()
  102. ComboBox5.Items.Clear() : While (dr.Read()) : ComboBox5.Items.Add(dr("倉名")) : End While : conn.Close()
  103. End Sub
  104. Private Sub ComboBox5_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox5.SelectedIndexChanged
  105. PA = ComboBox5.Text : SQL_倉名編號取得()
  106. If dr.Read() Then : TextBox19.Text = dr("倉名編號") : End If : conn.Close() : Set_清單()
  107. End Sub
  108. Private Sub 維修單申請_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  109. Me.MdiParent = MAOJI_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  110. CheckBox1.Checked = True : TextBox7.Enabled = False : TextBox13.Enabled = False : TextBox15.Enabled = False : TextBox9.Enabled = False : TextBox14.Enabled = False
  111. RadioButton4.Checked = True : TextBox16.Visible = False : ComboBox3.Visible = False : TextBox18.Visible = False
  112. ComboBox5下拉表單資料載入() : ComboBox1下拉表單資料載入() : ComboBox2下拉表單資料載入() : Set_維修清單() : ComboBox5.SelectedIndex = 0
  113. End Sub
  114. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
  115. If e.RowIndex = -1 Then : Else
  116. TextBox13.Text = DataGridView1.Rows(e.RowIndex).Cells("供應商編號").Value.ToString : TextBox7.Text = DataGridView1.Rows(e.RowIndex).Cells("料號").Value.ToString
  117. TextBox16.Text = DataGridView1.Rows(e.RowIndex).Cells("加權成本_台幣").Value.ToString : TextBox17.Text = DataGridView1.Rows(e.RowIndex).Cells("售價").Value.ToString
  118. TextBox15.Text = Strings.Format(DataGridView1.Rows(e.RowIndex).Cells("庫存").Value - DataGridView1.Rows(e.RowIndex).Cells("未出庫").Value, "#,##0")
  119. TextBox17.Text = Strings.Format(Val(TextBox17.Text), "#,##0")
  120. End If
  121. End Sub
  122. Private Sub DataGridView1_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView1.RowPostPaint
  123. Dim linePen As New Pen(Color.Blue, 2)
  124. If e.RowIndex = DataGridView1.Rows.Count - 1 Then : Exit Sub
  125. Else
  126. If CheckBox1.Checked = True Then
  127. If DataGridView1(0, e.RowIndex).Value.ToString <> DataGridView1(0, e.RowIndex + 1).Value.ToString Then
  128. Dim startX As Integer = IIf(DataGridView1.RowHeadersVisible, DataGridView1.RowHeadersWidth, 0)
  129. Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  130. Dim endX As Integer = startX + DataGridView1.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView1.HorizontalScrollingOffset
  131. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  132. End If
  133. Else
  134. If DataGridView1(2, e.RowIndex).Value.ToString <> DataGridView1(2, e.RowIndex + 1).Value.ToString Then
  135. Dim startX As Integer = IIf(DataGridView1.RowHeadersVisible, DataGridView1.RowHeadersWidth, 0)
  136. Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  137. Dim endX As Integer = startX + DataGridView1.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView1.HorizontalScrollingOffset
  138. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  139. End If
  140. End If
  141. End If
  142. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  143. If DataGridView1.Rows(i).Cells("可領用").Value = 0 Then : DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.LightPink : End If
  144. Next
  145. End Sub
  146. Private Sub DataGridView2_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView2.CellClick
  147. If e.RowIndex = -1 Then : Else
  148. ComboBox2下拉表單資料載入()
  149. TextBox9.Text = DataGridView2.Rows(e.RowIndex).Cells("單據編號").Value.ToString : ComboBox3.Text = DataGridView2.Rows(e.RowIndex).Cells("客戶編號").Value.ToString
  150. DateTimePicker1.Value = DataGridView2.Rows(e.RowIndex).Cells("銷售下單").Value.ToString : DateTimePicker2.Value = DataGridView2.Rows(e.RowIndex).Cells("客戶交期").Value.ToString
  151. If ComboBox3.Text = "CI00000000" Then
  152. SQL_維修單申請_客戶資料_零售二()
  153. If (dr.Read()) Then
  154. TextBox2.Text = dr("客戶名稱") : TextBox3.Text = dr("電話") : TextBox11.Text = "" : TextBox12.Text = dr("送貨地址") : TextBox26.Text = dr("統一編號")
  155. End If : conn.Close()
  156. End If
  157. 列印用SQL = TextBox9.Text
  158. Set_單據明細()
  159. End If
  160. End Sub
  161. Private Sub DataGridView3_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView3.CellClick
  162. If e.RowIndex = -1 Then : Else
  163. TextBox14.Text = DataGridView3.Rows(e.RowIndex).Cells("資料流水號").Value.ToString
  164. End If
  165. End Sub
  166. Private Sub DataGridView3_CellEnter(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView3.CellEnter
  167. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  168. DataGridView3.Rows(i).Cells("台幣單價").Value = DataGridView3.Rows(i).Cells("單價").Value * DataGridView3.Rows(i).Cells("匯率").Value
  169. DataGridView3.Rows(i).Cells("出貨成本_台幣").Value = DataGridView3.Rows(i).Cells("單價").Value * DataGridView3.Rows(i).Cells("匯率").Value * DataGridView3.Rows(i).Cells("數量").Value
  170. DataGridView3(1, i).Value = i + 1
  171. Next i
  172. End Sub
  173. Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.Click
  174. CheckBox1.Checked = True : CheckBox2.Checked = False : Set_清單()
  175. End Sub
  176. Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.Click
  177. CheckBox1.Checked = False : CheckBox2.Checked = True : Set_清單()
  178. End Sub
  179. Private Sub TextBox5_TextChanged(sender As Object, e As EventArgs) Handles TextBox5.TextChanged
  180. PA = TextBox5.Text : SQL_維修單申請_客戶資料表關鍵字查詢()
  181. ComboBox2.Items.Clear() : ComboBox3.Items.Clear() : While (dr.Read()) : ComboBox2.Items.Add(dr("簡稱")) : ComboBox3.Items.Add(dr("編號")) : End While : conn.Close()
  182. End Sub
  183. Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
  184. Set_清單()
  185. End Sub
  186. Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
  187. Set_清單()
  188. End Sub
  189. Private Sub 客戶資料()
  190. conn.Close()
  191. If ComboBox3.Text = "CI00000000" Then
  192. TextBox2.Text = "" : TextBox3.Text = "" : TextBox11.Text = "" : TextBox12.Text = "" : TextBox26.Text = ""
  193. Else
  194. SQL_維修單申請_客戶資料_銷售二()
  195. If (dr.Read()) Then
  196. TextBox2.Text = dr("店名") : TextBox3.Text = dr("電話") : TextBox11.Text = dr("聯絡人") : TextBox12.Text = dr("送貨地址") : TextBox26.Text = dr("統編")
  197. End If : conn.Close()
  198. End If
  199. End Sub
  200. Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
  201. ComboBox3.SelectedIndex = ComboBox2.SelectedIndex : 客戶資料()
  202. End Sub
  203. Private Sub ComboBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox3.SelectedIndexChanged
  204. ComboBox2.SelectedIndex = ComboBox3.SelectedIndex : 客戶資料()
  205. End Sub
  206. Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDown1.TextChanged
  207. If NumericUpDown1.Value > Val(TextBox15.Text) Then
  208. MsgBox("可申請數只剩下 " & TextBox15.Text & " ,不可大於可申請數。")
  209. NumericUpDown1.Value = 0
  210. End If
  211. End Sub
  212. Private Sub Set_日期格式轉換()
  213. If TextBox9.Text = "" Then
  214. If CheckBox3.Checked = False Then
  215. DTP = Strings.Format(Today(), "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd") : DTP2 = Strings.Format(DateTimePicker2.Value, "yyyy/MM/dd")
  216. Else
  217. DTP = Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd") : DTP1 = Strings.Format(DateTimePicker1.Value, "yyyyMMdd") : DTP2 = Strings.Format(DateTimePicker2.Value, "yyyy/MM/dd")
  218. End If
  219. Else
  220. DTP = Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd") : DTP1 = Strings.Format(DateTimePicker1.Value, "yyyyMMdd") : DTP2 = Strings.Format(DateTimePicker2.Value, "yyyy/MM/dd")
  221. End If
  222. End Sub
  223. Private Sub Set_自動生成流水號()
  224. SQL_倉儲明細表流水號最後一筆()
  225. If dr.Read() Then : EDR = Double.Parse(Strings.Right(dr("資料流水號").ToString, 8)) : Else : EDR = 0 : End If : conn.Close() : EDR += 1
  226. If EDR < 10 Then : ESTR = "WD" & "0000000" & EDR
  227. ElseIf EDR > 9 And EDR < 100 Then : ESTR = "WD" & "000000" & EDR
  228. ElseIf EDR > 99 And EDR < 1000 Then : ESTR = "WD" & "00000" & EDR
  229. ElseIf EDR > 999 And EDR < 10000 Then : ESTR = "WD" & "0000" & EDR
  230. ElseIf EDR > 9999 And EDR < 100000 Then : ESTR = "WD" & "000" & EDR
  231. ElseIf EDR > 99999 And EDR < 100000 Then : ESTR = "WD" & "00" & EDR
  232. ElseIf EDR > 999999 And EDR < 1000000 Then : ESTR = "WD" & "0" & EDR
  233. ElseIf EDR > 9999999 Then : ESTR = "WD" & EDR : End If
  234. End Sub
  235. Private Sub 存檔1()
  236. Dim SSDD As Integer = 0
  237. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  238. 資料數 = DataGridView3.Rows.Count : MyModule1.進度條()
  239. PA1 = DataGridView3.Rows(i).Cells("資料流水號").Value
  240. SQL_倉儲明細表_入庫日期讀取()
  241. If dr.Read() Then
  242. If dr("入庫日期").ToString = "" Then
  243. NU1 = DataGridView3.Rows(i).Cells("單價").Value : NU2 = DataGridView3.Rows(i).Cells("數量").Value
  244. PA1 = DataGridView3.Rows(i).Cells("備註").Value : PA2 = DTP2 : PA3 = DataGridView3.Rows(i).Cells("資料流水號").Value
  245. SQL_出貨單申請_倉儲明細表修改_出庫() : conn.Close()
  246. Else
  247. conn.Close() : SSDD += 1
  248. End If
  249. End If
  250. Next : MAOJI_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0 : If SSDD = 0 Then : Else : MsgBox("共有 " & SSDD & "筆資料已入庫,沒有變更。") : End If
  251. End Sub
  252. Private Sub Set_新增明細()
  253. HHJJ = TextBox18.Text
  254. PA1 = ESTR : PA2 = TextBox9.Text : PA3 = TextBox13.Text : PA4 = TextBox7.Text : NU1 = TextBox16.Text : NU2 = 1 : NU3 = 0 : NU4 = NumericUpDown1.Value : PA5 = HHJJ : PA6 = DTP
  255. PA7 = ComboBox3.Text : NU5 = TextBox17.Text : PA8 = TextBox19.Text : PA9 = DTP2
  256. SQL_倉儲明細表新增() : conn.Close() : MsgBox("資料新增完畢 。") : Set_單據明細()
  257. End Sub
  258. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  259. If TextBox7.Text = "" Then : MsgBox("料號沒有選擇") : Else
  260. If ComboBox3.Text = "" Then : MsgBox("客戶沒有選擇") : Else
  261. If NumericUpDown1.Value = 0 Then : MsgBox("數量不可為零") : Else
  262. If TextBox9.Text = "" Then
  263. '----------------------自动生成單據編號-------------------------------------------------------------------------
  264. Dim NUM1 As Integer : Set_日期格式轉換()
  265. For i As Integer = 1 To 999
  266. NUM1 = 0 + i
  267. If NUM1 < 10 Then : TextBox9.Text = "WD-" & DTP1 & "-00" & NUM1
  268. ElseIf NUM1 > 9 And NUM1 < 100 Then : TextBox9.Text = "WD-" & DTP1 & "-0" & NUM1
  269. ElseIf NUM1 > 99 Then : TextBox9.Text = "WD-" & DTP1 & "-" & NUM1 : End If
  270. PA1 = TextBox9.Text : 列印用SQL = TextBox9.Text : SQL_倉儲明細表生成單據編號()
  271. If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  272. Next
  273. If ComboBox3.Text = "CI00000000" Then
  274. SQL_出貨單申請_零售客戶記錄表流水號最後一筆()
  275. If dr.Read() Then : EDR = Double.Parse(Strings.Right(dr("零售流水號").ToString, 8)) : Else : EDR = 0 : End If : conn.Close() : EDR += 1
  276. If EDR < 10 Then : ESTR = "B" & "0000000" & EDR
  277. ElseIf EDR > 9 And EDR < 100 Then : ESTR = "B" & "000000" & EDR
  278. ElseIf EDR > 99 And EDR < 1000 Then : ESTR = "B" & "00000" & EDR
  279. ElseIf EDR > 999 And EDR < 10000 Then : ESTR = "B" & "0000" & EDR
  280. ElseIf EDR > 9999 And EDR < 100000 Then : ESTR = "B" & "000" & EDR
  281. ElseIf EDR > 99999 And EDR < 100000 Then : ESTR = "B" & "00" & EDR
  282. ElseIf EDR > 999999 And EDR < 1000000 Then : ESTR = "B" & "0" & EDR
  283. ElseIf EDR > 9999999 Then : ESTR = "B" & EDR : End If : PA1 = ESTR
  284. SQL_維修單申請_零售客戶記錄表新增() : conn.Close()
  285. End If
  286. Set_自動生成流水號() : TextBox14.Text = ESTR : conn.Close() : 存檔1() : Set_新增明細() : Set_維修清單()
  287. Else
  288. Set_日期格式轉換() : Set_自動生成流水號() : TextBox14.Text = ESTR : conn.Close() : 存檔1() : Set_新增明細()
  289. End If : Set_清單()
  290. End If
  291. End If
  292. End If
  293. End Sub
  294. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  295. Set_日期格式轉換() : 存檔1() : Set_單據明細() : Set_清單() : Set_維修清單() : MsgBox("資料修改,存檔完畢 。")
  296. End Sub
  297. Private Sub 切換時格式清空()
  298. TextBox9.Text = "" : TextBox15.Text = "0" : DateTimePicker1.Value = Today() : DateTimePicker2.Value = Today() : TextBox14.Text = "" : TextBox2.Text = ""
  299. TextBox3.Text = "" : TextBox11.Text = "" : TextBox13.Text = "" : TextBox12.Text = "" : TextBox26.Text = ""
  300. DataGridView3.DataSource = Nothing : ds2.Clear()
  301. End Sub
  302. Private Sub RadioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton4.Click
  303. RadioButton4.Checked = True : RadioButton3.Checked = False : Set_維修清單() : Button1.Enabled = True : Button3.Enabled = True
  304. 新增物料到維修單ToolStripMenuItem.Enabled = True : 刪除採購單中選中的物料ToolStripMenuItem.Enabled = True : 修改存檔ToolStripMenuItem.Enabled = True
  305. 切換時格式清空() : ComboBox2.Enabled = True
  306. End Sub
  307. Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton3.Click
  308. RadioButton4.Checked = False : RadioButton3.Checked = True : Set_維修清單() : Button1.Enabled = False : Button3.Enabled = False
  309. 新增物料到維修單ToolStripMenuItem.Enabled = False : 刪除採購單中選中的物料ToolStripMenuItem.Enabled = False : 修改存檔ToolStripMenuItem.Enabled = False
  310. 切換時格式清空() : ComboBox2.Enabled = True
  311. End Sub
  312. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  313. Me.開立新的維修單ToolStripMenuItem.PerformClick()
  314. End Sub
  315. Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
  316. If 列印用SQL = "" Then : MsgBox("請選擇維修單。") : Else
  317. xlApp = CType(CreateObject("Excel.Application"), Application)
  318. xlBook = xlApp.Workbooks.Add
  319. xlApp.DisplayAlerts = True
  320. xlBook.Activate()
  321. xlSheet = NewMethod(xlBook)
  322. xlSheet.Activate()
  323. xlApp.Visible = True
  324. xlApp.Application.WindowState = xlMaximized
  325. xlSheet.Cells(1, 1) = MAOJI_ERP_SYS.ComboBox2.Text : xlSheet.Cells(2, 1) = 公司地址 : xlSheet.Cells(3, 1) = "維修單"
  326. xlSheet.Cells(4, 1) = "客戶" : xlSheet.Cells(5, 1) = "統編" : xlSheet.Cells(6, 1) = "地址"
  327. xlSheet.Cells(4, 2) = TextBox2.Text : xlSheet.Cells(5, 2) = TextBox26.Text : xlSheet.Cells(6, 2) = TextBox12.Text
  328. xlSheet.Cells(4, 5) = "單據編號" : xlSheet.Cells(5, 5) = "客戶聯絡" : xlSheet.Cells(6, 5) = "聯繫電話"
  329. xlSheet.Cells(4, 6) = TextBox9.Text : xlSheet.Cells(5, 6) = TextBox11.Text : xlSheet.Cells(6, 6) = TextBox3.Text
  330. xlSheet.Cells(8, 1) = "NO" : xlSheet.Cells(8, 2) = "品名" : xlSheet.Cells(8, 3) = "尺寸" : xlSheet.Cells(8, 4) = "材質" : xlSheet.Cells(8, 5) = "數量" : xlSheet.Cells(8, 6) = "備註"
  331. N1 = 0
  332. For I As Integer = 0 To DataGridView3.Rows.Count - 1
  333. xlSheet.Cells(I + 9, 1) = DataGridView3.Rows(I).Cells("項次").Value
  334. xlSheet.Cells(I + 9, 2) = DataGridView3.Rows(I).Cells("品名").Value
  335. xlSheet.Cells(I + 9, 3) = DataGridView3.Rows(I).Cells("尺寸").Value
  336. xlSheet.Cells(I + 9, 4) = DataGridView3.Rows(I).Cells("材質").Value
  337. xlSheet.Cells(I + 9, 5) = DataGridView3.Rows(I).Cells("數量").Value
  338. xlSheet.Cells(I + 9, 6) = DataGridView3.Rows(I).Cells("備註").Value
  339. N1 = I + 9
  340. Next
  341. xlSheet.Cells(N1 + 1, 1) = "(以下空白)"
  342. xlSheet.Cells(N1 + 3, 1) = "客戶回簽 :" : xlSheet.Cells(N1 + 3, 5) = "維修人員 :"
  343. AA(xlApp, xlSheet)
  344. xlSheet.PageSetup.PrintArea = ""
  345. xlApp.Cells.Select()
  346. xlSheet.Range("B1").Select()
  347. xlApp.Application.WindowState = xlMinimized
  348. xlSheet.Cells.Select()
  349. MsgBox("列印完成。")
  350. End If : 列印用SQL = ""
  351. End Sub
  352. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  353. Return CType(xlBook.Worksheets.Add, Worksheet)
  354. End Function
  355. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  356. xlSheet.Cells.Select()
  357. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  358. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  359. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 35
  360. xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 25
  361. xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 20
  362. xlSheet.Rows("1:1").Select
  363. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 24 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  364. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  365. xlSheet.Rows("2:2").Select
  366. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 16 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  367. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  368. xlSheet.Rows("3:3").Select
  369. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 14 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  370. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  371. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 7
  372. xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 35
  373. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 15
  374. xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 15
  375. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 9
  376. xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 25
  377. xlSheet.Range("B4:B6").Select()
  378. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  379. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  380. xlSheet.Range("F4:F6").Select()
  381. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  382. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  383. xlSheet.Rows("7:7").Select : myExcel.Selection.RowHeight = 5
  384. xlSheet.Rows("8:8").Select : myExcel.Selection.RowHeight = 30
  385. xlSheet.Rows("9:" & N1 + 1).Select : myExcel.Selection.RowHeight = 16
  386. xlSheet.Rows(N1 + 2 & ":" & N1 + 2).Select : myExcel.Selection.RowHeight = 5
  387. xlSheet.Rows(N1 + 3 & ":" & N1 + 3).Select : myExcel.Selection.RowHeight = 40
  388. xlSheet.Range("A1:F1").Select()
  389. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  390. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  391. xlSheet.Range("A2:F2").Select()
  392. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  393. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  394. xlSheet.Range("A3:F3").Select()
  395. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  396. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  397. xlSheet.Range("A2:F2").Select()
  398. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  399. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  400. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  401. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  402. xlSheet.Range("A5:F6").Select()
  403. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  404. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  405. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  406. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  407. xlSheet.Range("A8:F8").Select()
  408. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone
  409. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  410. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  411. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  412. xlSheet.Range("A" & N1 + 1 & ":F" & N1 + 1).Select()
  413. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  414. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  415. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin
  416. End With
  417. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  418. myExcel.ActiveWindow.DisplayGridlines = False
  419. xlSheet.Range("B9:D" & N1).Select()
  420. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  421. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  422. xlSheet.Range("E9:E" & N1).Select()
  423. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  424. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  425. End Sub
  426. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  427. If TextBox9.Text = "" Then : MsgBox("沒有選擇要列印的單號 。") : Else : 列印用SQL = TextBox9.Text : PA = "維修申請單" : 列印_產品標籤介面.ShowDialog() : End If
  428. End Sub
  429. '-----------------------------滑鼠右鍵------------------------------------------------------------------------------------------------------------------------------------------
  430. Private Sub 重新整理ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新整理ToolStripMenuItem.Click
  431. Set_清單() : Set_維修清單() : ComboBox2下拉表單資料載入()
  432. End Sub
  433. Private Sub 開立新的採購單ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 開立新的維修單ToolStripMenuItem.Click
  434. 切換時格式清空() : ComboBox1下拉表單資料載入() : ComboBox2下拉表單資料載入() : Set_清單() : Set_維修清單() : Me.RadioButton4.PerformClick()
  435. End Sub
  436. Private Sub 新增物料到採購單ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 新增物料到維修單ToolStripMenuItem.Click
  437. Me.Button1.PerformClick()
  438. End Sub
  439. Private Sub 刪除採購單中選中的物料ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 刪除採購單中選中的物料ToolStripMenuItem.Click
  440. PA1 = TextBox14.Text : SQL_倉儲明細表_出庫日期讀取()
  441. If dr("出庫日期") = "" Then : conn.Close()
  442. If TextBox14.Text = "" Then : MsgBox("沒有選擇要刪除的料號 。")
  443. Else
  444. Dim aa1 As MsgBoxResult = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
  445. If aa1 = MsgBoxResult.Ok Then
  446. PA1 = TextBox14.Text : SQL_倉儲明細表刪除() : conn.Close()
  447. '-----------------最後一筆資料刪除時要把零售客戶紀錄中的資料一起刪除-----------------------------------------------------
  448. If DataGridView3.Rows.Count = 1 Then : SQL_維修單申請_零售客戶記錄表刪除() : conn.Close() : End If : TextBox14.Text = "" : Set_單據明細()
  449. End If
  450. End If
  451. Else
  452. conn.Close() : MsgBox("已入庫的資料不可刪除 。")
  453. End If
  454. End Sub
  455. Private Sub 修改存檔ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 修改存檔ToolStripMenuItem.Click
  456. Me.Button3.PerformClick()
  457. End Sub
  458. Private Sub 列印單據ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 列印單據ToolStripMenuItem.Click
  459. Me.Button5.PerformClick()
  460. End Sub
  461. Private Sub 列印產品標籤ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 列印產品標籤ToolStripMenuItem.Click
  462. Me.Button4.PerformClick()
  463. End Sub
  464. End Class