Няма описание
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 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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 ds1 As New DataSet : ReadOnly ds2 As New DataSet
  13. Dim N1 As Integer = 0
  14. Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
  15. Private Sub Set_銷售清單()
  16. DataGridView2.DataSource = Nothing : ds1.Clear() : DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing : DataGridView2.ColumnHeadersHeight = 25
  17. DataGridView2.AllowUserToAddRows = False : DataGridView2.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText : DataGridView2.MultiSelect = True
  18. SQL_銷售退貨清單_彙總()
  19. da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close()
  20. DataGridView2.Columns(0).FillWeight = 150 : DataGridView2.Columns(1).FillWeight = 90 : DataGridView2.Columns(2).Visible = False : DataGridView2.Columns(3).FillWeight = 100
  21. DataGridView2.Columns(4).Visible = False : DataGridView2.Columns(5).FillWeight = 90 : DataGridView2.Columns(6).Visible = False : DataGridView2.Columns(7).Visible = False
  22. DataGridView2.Columns(8).Visible = False : DataGridView2.Columns(9).Visible = False
  23. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  24. If DataGridView2.Rows(i).Cells("業務比例").Value.ToString = "" Then : DataGridView2.Rows(i).Cells("業務比例").Value = 0 : End If
  25. If DataGridView2.Rows(i).Cells("司機比例").Value.ToString = "" Then : DataGridView2.Rows(i).Cells("司機比例").Value = 0 : End If
  26. Next
  27. End Sub
  28. Private Sub Set_單據明細()
  29. DataGridView3.DataSource = Nothing : ds2.Clear() : DataGridView3.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing : DataGridView3.ColumnHeadersHeight = 25
  30. DataGridView3.AllowUserToAddRows = False : DataGridView3.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText : DataGridView3.MultiSelect = True
  31. SQL_銷售退貨清單_清單()
  32. da.Fill(ds2) : DataGridView3.DataSource = ds2.Tables(0) : conn.Close()
  33. DataGridView3.Columns(6).DefaultCellStyle.Format = "#,##0" : DataGridView3.Columns(7).DefaultCellStyle.Format = "#,##0"
  34. DataGridView3.Columns(8).DefaultCellStyle.Format = "#,##0.0000" : DataGridView3.Columns(9).DefaultCellStyle.Format = "#,##0" : DataGridView3.Columns(10).DefaultCellStyle.Format = "#,##0"
  35. DataGridView3.Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  36. DataGridView3.Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  37. DataGridView3.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  38. DataGridView3.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  39. DataGridView3.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  40. DataGridView3.Columns(9).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(9).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  41. DataGridView3.Columns(10).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(10).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  42. DataGridView3.Columns(12).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(12).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  43. DataGridView3.Columns(13).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView3.Columns(13).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  44. DataGridView3.Columns(0).Visible = False : DataGridView3.Columns(1).FillWeight = 30 : DataGridView3.Columns(2).FillWeight = 80 : DataGridView3.Columns(3).FillWeight = 150
  45. DataGridView3.Columns(4).FillWeight = 80 : DataGridView3.Columns(5).FillWeight = 80 : DataGridView3.Columns(6).FillWeight = 50 : DataGridView3.Columns(7).FillWeight = 50
  46. DataGridView3.Columns(8).Visible = False : DataGridView3.Columns(9).Visible = False : DataGridView3.Columns(10).Visible = False : DataGridView3.Columns(11).FillWeight = 100
  47. DataGridView3.Columns(12).FillWeight = 80 : DataGridView3.Columns(13).FillWeight = 50 : DataGridView3.Columns(14).Visible = False : DataGridView3.Columns(15).Visible = False
  48. DataGridView3.EditMode = DataGridViewEditMode.EditOnEnter
  49. DataGridView3.Columns(1).ReadOnly = True : DataGridView3.Columns(2).ReadOnly = True : DataGridView3.Columns(3).ReadOnly = True : DataGridView3.Columns(4).ReadOnly = True
  50. DataGridView3.Columns(5).ReadOnly = True : DataGridView3.Columns(6).ReadOnly = True : DataGridView3.Columns(8).ReadOnly = True : DataGridView3.Columns(9).ReadOnly = True
  51. DataGridView3.Columns(10).ReadOnly = True : DataGridView3.Columns(12).ReadOnly = True
  52. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  53. DataGridView3(1, i).Value = i + 1
  54. Next
  55. End Sub
  56. Private Sub ComboBox2下拉表單資料載入()
  57. SQL_客戶資料表_下拉清單讀取()
  58. ComboBox2.Items.Clear() : ComboBox3.Items.Clear() : While (dr.Read()) : ComboBox2.Items.Add(dr("簡稱")) : ComboBox3.Items.Add(dr("編號")) : End While : conn.Close()
  59. End Sub
  60. Private Sub ComboBox6下拉表單資料載入()
  61. SQL_員工名稱下拉清單()
  62. ComboBox6.Items.Clear() : ComboBox8.Items.Clear() : While (dr.Read()) : ComboBox6.Items.Add(dr("名稱")) : ComboBox8.Items.Add(dr("名稱")) : End While : conn.Close()
  63. End Sub
  64. Private Sub ComboBox7下拉表單資料載入()
  65. SQL_傭金比例下拉清單()
  66. ComboBox7.Items.Clear() : ComboBox9.Items.Clear()
  67. While (dr.Read()) : ComboBox7.Items.Add(Strings.Format(dr("比例"), "#,##0.0")) : ComboBox9.Items.Add(Strings.Format(dr("比例"), "#,##0.0")) : End While : conn.Close()
  68. End Sub
  69. Private Sub 銷售退貨清單_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  70. Me.MdiParent = MAOJI_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  71. TextBox9.Enabled = False : TextBox2.Enabled = False : TextBox26.Enabled = False : TextBox3.Enabled = False : TextBox4.Enabled = False : TextBox6.Enabled = False
  72. TextBox10.Enabled = False : TextBox11.Enabled = False : TextBox12.Enabled = False : TextBox14.Enabled = False : TextBox8.Enabled = False
  73. ComboBox2.Enabled = False : ComboBox7.Enabled = False : ComboBox6.Enabled = False : ComboBox8.Enabled = False : ComboBox9.Enabled = False
  74. DateTimePicker1.Enabled = False : DateTimePicker2.Enabled = False
  75. TextBox16.Visible = False : TextBox18.Visible = False : ComboBox3.Visible = False
  76. ComboBox2下拉表單資料載入() : ComboBox6下拉表單資料載入() : ComboBox7下拉表單資料載入() : Set_銷售清單()
  77. End Sub
  78. Private Sub DataGridView2_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView2.CellClick
  79. If e.RowIndex = -1 Then : Else
  80. ComboBox6下拉表單資料載入() : ComboBox7下拉表單資料載入()
  81. TextBox9.Text = DataGridView2.Rows(e.RowIndex).Cells("單據編號").Value.ToString : ComboBox3.Text = DataGridView2.Rows(e.RowIndex).Cells("客戶編號").Value.ToString
  82. TextBox18.Text = DataGridView2.Rows(e.RowIndex).Cells("狀態").Value.ToString : DateTimePicker1.Value = DataGridView2.Rows(e.RowIndex).Cells("銷售下單").Value.ToString
  83. DateTimePicker2.Value = DataGridView2.Rows(e.RowIndex).Cells("客戶交期").Value.ToString : ComboBox6.Text = DataGridView2.Rows(e.RowIndex).Cells("業務").Value.ToString
  84. ComboBox7.Text = Strings.Format(DataGridView2.Rows(e.RowIndex).Cells("業務比例").Value, "#,##0.0") : ComboBox8.Text = DataGridView2.Rows(e.RowIndex).Cells("司機").Value.ToString
  85. ComboBox9.Text = Strings.Format(DataGridView2.Rows(e.RowIndex).Cells("司機比例").Value, "#,##0.0") : 列印用SQL = TextBox9.Text
  86. Set_單據明細() : 客戶資料()
  87. End If
  88. End Sub
  89. Private Sub DataGridView3_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView3.CellClick
  90. If e.RowIndex = -1 Then : Else
  91. TextBox14.Text = DataGridView3.Rows(e.RowIndex).Cells("資料流水號").Value.ToString
  92. End If
  93. End Sub
  94. Private Sub DataGridView3_CellEnter(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView3.CellEnter
  95. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  96. DataGridView3.Rows(i).Cells("台幣單價").Value = DataGridView3.Rows(i).Cells("單價").Value * DataGridView3.Rows(i).Cells("匯率").Value
  97. DataGridView3.Rows(i).Cells("出貨成本_台幣").Value = DataGridView3.Rows(i).Cells("單價").Value * DataGridView3.Rows(i).Cells("匯率").Value * DataGridView3.Rows(i).Cells("數量").Value
  98. DataGridView3(1, i).Value = i + 1
  99. Next i
  100. End Sub
  101. Private Sub 客戶資料()
  102. conn.Close()
  103. If ComboBox3.Text = "CI00000000" Then
  104. SQL_銷售退貨清單_客戶資料_零售一()
  105. If (dr.Read()) Then
  106. TextBox4.Text = dr("付款方式")
  107. End If : conn.Close()
  108. SQL_銷售退貨清單_客戶資料_零售二()
  109. If (dr.Read()) Then
  110. TextBox2.Text = dr("客戶名稱") : TextBox6.Text = dr("手機") : TextBox3.Text = dr("電話") : TextBox8.Text = dr("傳真") : TextBox11.Text = dr("郵遞區號")
  111. TextBox10.Text = dr("店面地址") : TextBox12.Text = dr("送貨地址") : TextBox26.Text = dr("統一編號")
  112. End If : conn.Close()
  113. Else
  114. SQL_銷售退貨清單_客戶資料_銷售二()
  115. If (dr.Read()) Then
  116. TextBox2.Text = dr("店名") : TextBox6.Text = dr("手機") : TextBox3.Text = dr("電話") : TextBox8.Text = dr("傳真") : TextBox11.Text = dr("店面地址郵遞區號")
  117. TextBox10.Text = dr("店面地址") : TextBox12.Text = dr("送貨地址") : TextBox26.Text = dr("統編") : TextBox4.Text = dr("付款方式")
  118. End If : conn.Close()
  119. End If
  120. End Sub
  121. Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
  122. ComboBox3.SelectedIndex = ComboBox2.SelectedIndex : 客戶資料()
  123. End Sub
  124. Private Sub ComboBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox3.SelectedIndexChanged
  125. ComboBox2.SelectedIndex = ComboBox3.SelectedIndex : 客戶資料()
  126. End Sub
  127. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  128. If TextBox9.Text = "" Then : MsgBox("請選擇維修單。") : Else
  129. xlApp = CType(CreateObject("Excel.Application"), Application)
  130. xlBook = xlApp.Workbooks.Add
  131. xlApp.DisplayAlerts = True
  132. xlBook.Activate()
  133. xlSheet = NewMethod(xlBook)
  134. xlSheet.Activate()
  135. xlApp.Visible = True
  136. xlApp.Application.WindowState = xlMaximized
  137. xlSheet.Cells(1, 1) = MAOJI_ERP_SYS.ComboBox2.Text : xlSheet.Cells(2, 1) = 公司地址 : xlSheet.Cells(3, 1) = "銷售退貨單"
  138. xlSheet.Cells(4, 1) = "客戶" : xlSheet.Cells(5, 1) = "統編" : xlSheet.Cells(6, 1) = "地址"
  139. xlSheet.Cells(4, 2) = TextBox2.Text : xlSheet.Cells(5, 2) = TextBox26.Text : xlSheet.Cells(6, 2) = TextBox12.Text
  140. xlSheet.Cells(4, 5) = "單據編號" : xlSheet.Cells(5, 5) = "聯絡手機" : xlSheet.Cells(6, 5) = "聯繫電話"
  141. xlSheet.Cells(4, 6) = TextBox9.Text : xlSheet.Cells(5, 6) = TextBox6.Text : xlSheet.Cells(6, 6) = TextBox3.Text
  142. 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) = "備註"
  143. N1 = 0
  144. For I As Integer = 0 To DataGridView3.Rows.Count - 1
  145. xlSheet.Cells(I + 9, 1) = DataGridView3.Rows(I).Cells("項次").Value
  146. xlSheet.Cells(I + 9, 2) = DataGridView3.Rows(I).Cells("品名").Value
  147. xlSheet.Cells(I + 9, 3) = DataGridView3.Rows(I).Cells("尺寸").Value
  148. xlSheet.Cells(I + 9, 4) = DataGridView3.Rows(I).Cells("材質").Value
  149. xlSheet.Cells(I + 9, 5) = DataGridView3.Rows(I).Cells("數量").Value
  150. xlSheet.Cells(I + 9, 6) = DataGridView3.Rows(I).Cells("備註").Value
  151. N1 = I + 9
  152. Next
  153. xlSheet.Cells(N1 + 1, 1) = "(以下空白)"
  154. xlSheet.Cells(N1 + 3, 1) = "客戶回簽 :" : xlSheet.Cells(N1 + 3, 5) = "收貨人員 :"
  155. AA(xlApp, xlSheet)
  156. xlSheet.PageSetup.PrintArea = ""
  157. xlApp.Cells.Select()
  158. xlSheet.Range("B1").Select()
  159. xlApp.Application.WindowState = xlMinimized
  160. xlSheet.Cells.Select()
  161. MsgBox("列印完成。")
  162. End If
  163. End Sub
  164. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  165. Return CType(xlBook.Worksheets.Add, Worksheet)
  166. End Function
  167. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  168. xlSheet.Cells.Select()
  169. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  170. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  171. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 35
  172. xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 25
  173. xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 20
  174. xlSheet.Rows("1:1").Select
  175. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 24 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  176. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  177. xlSheet.Rows("2:2").Select
  178. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 16 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  179. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  180. xlSheet.Rows("3:3").Select
  181. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 14 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  182. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  183. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 7
  184. xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 35
  185. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 15
  186. xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 15
  187. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 9
  188. xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 25
  189. xlSheet.Range("B4:B6").Select()
  190. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  191. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  192. xlSheet.Range("F4:F6").Select()
  193. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  194. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  195. xlSheet.Rows("7:7").Select : myExcel.Selection.RowHeight = 5
  196. xlSheet.Rows("8:8").Select : myExcel.Selection.RowHeight = 30
  197. xlSheet.Rows("9:" & N1 + 1).Select : myExcel.Selection.RowHeight = 16
  198. xlSheet.Rows(N1 + 2 & ":" & N1 + 2).Select : myExcel.Selection.RowHeight = 5
  199. xlSheet.Rows(N1 + 3 & ":" & N1 + 3).Select : myExcel.Selection.RowHeight = 40
  200. xlSheet.Range("A1:F1").Select()
  201. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  202. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  203. xlSheet.Range("A2:F2").Select()
  204. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  205. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  206. xlSheet.Range("A3:F3").Select()
  207. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  208. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  209. xlSheet.Range("A2:F2").Select()
  210. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  211. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  212. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  213. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  214. xlSheet.Range("A5:F6").Select()
  215. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  216. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  217. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  218. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  219. xlSheet.Range("A8:F8").Select()
  220. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone
  221. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  222. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  223. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  224. xlSheet.Range("A" & N1 + 1 & ":F" & N1 + 1).Select()
  225. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  226. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  227. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin
  228. End With
  229. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  230. myExcel.ActiveWindow.DisplayGridlines = False
  231. xlSheet.Range("B9:D" & N1).Select()
  232. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  233. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  234. xlSheet.Range("E9:E" & N1).Select()
  235. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  236. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  237. End Sub
  238. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  239. If TextBox9.Text = "" Then : MsgBox("沒有選擇要列印的單號 。") : Else : 列印用SQL = TextBox9.Text : PA = "銷售退貨單" : 列印_產品標籤介面.ShowDialog() : End If
  240. End Sub
  241. '-----------------------------滑鼠右鍵------------------------------------------------------------------------------------------------------------------------------------------
  242. Private Sub 重新整理ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新整理ToolStripMenuItem.Click
  243. ComboBox2下拉表單資料載入() : ComboBox6下拉表單資料載入() : ComboBox7下拉表單資料載入() : Set_銷售清單()
  244. End Sub
  245. Private Sub 列印退貨單ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 列印退貨單ToolStripMenuItem.Click
  246. Me.Button3.PerformClick()
  247. End Sub
  248. Private Sub 列印產品標籤ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 列印產品標籤ToolStripMenuItem.Click
  249. Me.Button1.PerformClick()
  250. End Sub
  251. End Class