Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

司機佣金計算.vb 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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
  13. Dim 新項次 As String
  14. Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet : Dim N1 As Integer
  15. Private Sub Set_司機佣金清單()
  16. DataGridView1.DataSource = Nothing : ds.Clear() : DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing : DataGridView1.ColumnHeadersHeight = 25
  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 = 100 : DataGridView1.Columns(1).FillWeight = 80 : DataGridView1.Columns(2).FillWeight = 80 : DataGridView1.Columns(3).FillWeight = 250
  21. DataGridView1.Columns(4).FillWeight = 80 : DataGridView1.Columns(5).FillWeight = 80 : DataGridView1.Columns(6).FillWeight = 80 : DataGridView1.Columns(7).FillWeight = 80
  22. DataGridView1.Columns(8).FillWeight = 80 : DataGridView1.Columns(9).FillWeight = 60 : DataGridView1.Columns(10).FillWeight = 60 : DataGridView1.Columns(11).Visible = False
  23. DataGridView1.Columns(4).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(5).DefaultCellStyle.Format = "#,##0"
  24. DataGridView1.Columns(7).DefaultCellStyle.Format = "#,##0.0" : DataGridView1.Columns(8).DefaultCellStyle.Format = "#,##0"
  25. DataGridView1.Columns(0).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(0).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  26. DataGridView1.Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  27. DataGridView1.Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  28. DataGridView1.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(4).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  29. DataGridView1.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(5).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  30. DataGridView1.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  31. DataGridView1.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  32. DataGridView1.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  33. TextBox1.Text = "0"
  34. For I As Integer = 0 To 9 : DataGridView1.Columns(I).ReadOnly = True : Next
  35. For I As Integer = 0 To DataGridView1.Rows.Count - 1
  36. If DataGridView1.Rows(I).Cells("已立帳").Value.ToString = "" Then : DataGridView1.Rows(I).Cells("已立帳").Value = False : End If
  37. DataGridView1.Rows(I).Cells("選擇").Value = False : TextBox1.Text = Val(TextBox1.Text) + DataGridView1.Rows(I).Cells("佣金").Value
  38. Next
  39. TextBox1.Text = Strings.Format(Val(TextBox1.Text), "#,##0")
  40. End Sub
  41. Private Sub ComboBox2下拉表單資料載入()
  42. SQL_銷售司機人員清單()
  43. ComboBox2.Items.Clear() : While (dr.Read()) : ComboBox2.Items.Add(dr("司機")) : End While : conn.Close()
  44. End Sub
  45. Private Sub ComboBox1下拉表單資料載入()
  46. SQL_會計科目_第一階()
  47. ComboBox5.Items.Clear() : ComboBox1.Items.Clear() : While (dr.Read()) : ComboBox5.Items.Add(dr("第一階")) : ComboBox1.Items.Add(dr("編號")) : End While : conn.Close()
  48. End Sub
  49. Private Sub ComboBox3下拉表單資料載入()
  50. PA = ComboBox1.Text : SQL_會計科目_第二階()
  51. ComboBox3.Items.Clear() : ComboBox4.Items.Clear() : While (dr.Read()) : ComboBox3.Items.Add(dr("第二階")) : ComboBox4.Items.Add(dr("編號")) : End While : conn.Close() : PA = ""
  52. End Sub
  53. Private Sub ComboBox6下拉表單資料載入()
  54. PA = ComboBox4.Text : SQL_會計科目_第三階()
  55. ComboBox7.Items.Clear() : ComboBox6.Items.Clear() : While (dr.Read()) : ComboBox7.Items.Add(dr("會計科目")) : ComboBox6.Items.Add(dr("編號")) : End While : conn.Close()
  56. If ComboBox7.Items.Count <> 0 Then : ComboBox7.SelectedIndex = 0 : End If
  57. End Sub
  58. Private Sub 日期格式()
  59. If 會計月.Checked = True Then
  60. '-------------日期一----------------------------------------------------------------------------------------
  61. DTP = Strings.Left(Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd"), 8) & "01" : DateTimePicker1.Value = DTP
  62. DateTimePicker1.Value = DateTimePicker1.Value.AddMonths(-1)
  63. DTP = Strings.Left(Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd"), 8) & "26" : DateTimePicker1.Value = DTP
  64. '-------------日期二----------------------------------------------------------------------------------------
  65. DTP = Strings.Left(Strings.Format(DateTimePicker2.Value, "yyyy/MM/dd"), 8) & "25" : DateTimePicker2.Value = DTP
  66. Else
  67. '-------------日期一----------------------------------------------------------------------------------------
  68. DateTimePicker1.Value = DateTimePicker1.Value.AddMonths(1)
  69. DTP = Strings.Left(Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd"), 8) & "01" : DateTimePicker1.Value = DTP
  70. '-------------日期二----------------------------------------------------------------------------------------
  71. Dim iDays As Integer = DateTime.DaysInMonth(Strings.Left(Strings.Format(DateTimePicker2.Value, "yyyy/MM/dd"), 4), Strings.Mid(Strings.Format(DateTimePicker2.Value, "yyyy/MM/dd"), 6, 2))
  72. DTP = Strings.Left(Strings.Format(DateTimePicker2.Value, "yyyy/MM/dd"), 8) & iDays : DateTimePicker2.Value = DTP
  73. End If
  74. End Sub
  75. Private Sub 司機佣金計算_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  76. Me.MdiParent = MAOJI_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  77. ComboBox6.Visible = False : TextBox2.Visible = False
  78. ComboBox1下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox6下拉表單資料載入() : ComboBox2下拉表單資料載入() : ComboBox2.SelectedIndex = 0 : 日期格式() : Set_司機佣金清單()
  79. End Sub
  80. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
  81. If e.RowIndex = -1 Then : Else
  82. TextBox3.Text = DataGridView1.Rows(e.RowIndex).Cells("單據編號").Value
  83. End If
  84. End Sub
  85. Private Sub DataGridView1_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView1.RowPostPaint
  86. Dim linePen As New Pen(Color.Blue, 2)
  87. If e.RowIndex = DataGridView1.Rows.Count - 1 Then : Exit Sub
  88. Else
  89. If DataGridView1(0, e.RowIndex).Value.ToString <> DataGridView1(0, e.RowIndex + 1).Value.ToString Then
  90. Dim startX As Integer = IIf(DataGridView1.RowHeadersVisible, DataGridView1.RowHeadersWidth, 0)
  91. Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  92. Dim endX As Integer = startX + DataGridView1.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView1.HorizontalScrollingOffset
  93. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  94. End If
  95. End If
  96. End Sub
  97. Private Sub ComboBox5_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox5.TextChanged
  98. ComboBox1.SelectedIndex = ComboBox5.SelectedIndex : TextBox9.Text = "" : ComboBox3下拉表單資料載入() : ComboBox6下拉表單資料載入()
  99. End Sub
  100. Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.TextChanged
  101. ComboBox5.SelectedIndex = ComboBox1.SelectedIndex : ComboBox3下拉表單資料載入() : ComboBox6下拉表單資料載入()
  102. End Sub
  103. Private Sub ComboBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox3.TextChanged
  104. ComboBox4.SelectedIndex = ComboBox3.SelectedIndex : ComboBox6下拉表單資料載入()
  105. End Sub
  106. Private Sub ComboBox4_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox4.TextChanged
  107. ComboBox3.SelectedIndex = ComboBox4.SelectedIndex : ComboBox6下拉表單資料載入()
  108. End Sub
  109. Private Sub ComboBox7_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox7.SelectedIndexChanged
  110. ComboBox6.SelectedIndex = ComboBox7.SelectedIndex
  111. End Sub
  112. Private Sub ComboBox6_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox6.SelectedIndexChanged
  113. ComboBox7.SelectedIndex = ComboBox6.SelectedIndex
  114. End Sub
  115. Private Sub TextBox9_TextChanged(sender As Object, e As EventArgs) Handles TextBox9.TextChanged
  116. PA = TextBox9.Text : SQL_會計科目_關鍵字()
  117. ComboBox7.Items.Clear() : ComboBox6.Items.Clear() : While (dr.Read()) : ComboBox7.Items.Add(dr("會計科目")) : ComboBox6.Items.Add(dr("編號")) : End While : conn.Close()
  118. If ComboBox7.Items.Count <> 0 Then : ComboBox7.SelectedIndex = 0 : End If : PA = ""
  119. End Sub
  120. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  121. DateTimePicker1.Value = DateTimePicker1.Value.AddMonths(-1) : DateTimePicker2.Value = DateTimePicker2.Value.AddMonths(-1) : Set_司機佣金清單()
  122. End Sub
  123. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  124. DateTimePicker1.Value = DateTimePicker1.Value.AddMonths(1) : DateTimePicker2.Value = DateTimePicker2.Value.AddMonths(1) : Set_司機佣金清單()
  125. End Sub
  126. Private Sub 會計月_CheckedChanged(sender As Object, e As EventArgs) Handles 會計月.Click
  127. 會計月.Checked = True : 一般月.Checked = False : 日期格式() : Set_司機佣金清單()
  128. End Sub
  129. Private Sub 一般月_CheckedChanged(sender As Object, e As EventArgs) Handles 一般月.Click
  130. 會計月.Checked = False : 一般月.Checked = True : 日期格式() : Set_司機佣金清單()
  131. End Sub
  132. Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
  133. Set_司機佣金清單()
  134. End Sub
  135. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  136. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  137. If TextBox3.Text = DataGridView1.Rows(i).Cells("單據編號").Value.ToString Then
  138. DataGridView1.Rows(i).Cells("選擇").Value = True
  139. End If
  140. Next i
  141. End Sub
  142. Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
  143. For i As Integer = 0 To DataGridView1.Rows.Count - 1 : DataGridView1.Rows(i).Cells("選擇").Value = True : Next i
  144. End Sub
  145. Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
  146. For i As Integer = 0 To DataGridView1.Rows.Count - 1 : DataGridView1.Rows(i).Cells("選擇").Value = False : Next i
  147. End Sub
  148. Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
  149. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  150. If TextBox3.Text = DataGridView1.Rows(i).Cells("單據編號").Value.ToString Then
  151. DataGridView1.Rows(i).Cells("已立帳").Value = False
  152. End If
  153. Next i
  154. End Sub
  155. Private Sub Set_日期格式轉換()
  156. If CheckBox1.Checked = False Then : DTP = Strings.Format(Today(), "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd")
  157. Else : DTP1 = Strings.Format(DateTimePicker3.Value, "yyyyMMdd") : DTP = Strings.Format(DateTimePicker3.Value, "yyyy/MM/dd") : End If
  158. End Sub
  159. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  160. Dim 確認 As Boolean = False
  161. If ComboBox6.Text = "" Then : MsgBox("請選擇會計科目。")
  162. Else
  163. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  164. If DataGridView1.Rows(i).Cells("選擇").Value = True Then
  165. 確認 = True : Exit For
  166. End If
  167. Next
  168. If 確認 = False Then : MsgBox("沒有選擇任何一筆要轉收支帳的佣金明細。")
  169. Else
  170. Dim NUM1 As Integer : Set_日期格式轉換()
  171. For ii As Integer = 1 To 999
  172. NUM1 = 0 + ii
  173. If NUM1 < 10 Then : TextBox2.Text = "OE-" & DTP1 & "-00" & NUM1
  174. ElseIf NUM1 > 9 And NUM1 < 100 Then : TextBox2.Text = "OE-" & DTP1 & "-0" & NUM1
  175. ElseIf NUM1 > 99 Then : TextBox2.Text = "OE-" & DTP1 & "-" & NUM1 : End If : PA = TextBox2.Text
  176. SQL_營運成本收支單申請_支付單號流水號()
  177. If dr.Read() Then : Else : ii = 999 : End If
  178. Next
  179. SQL_營運成本控制表新增()
  180. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  181. 資料數 = DataGridView1.Rows.Count : MyModule1.進度條()
  182. If DataGridView1.Rows(i).Cells("已立帳").Value = False Then
  183. If DataGridView1.Rows(i).Cells("選擇").Value = True Then
  184. SQL_營運成本明細表項次新增查詢()
  185. If dr.Read() Then : 新項次 = dr("項次") : Else : 新項次 = "00" : End If : conn.Close() : NUM1 = Double.Parse(新項次) + 1
  186. If NUM1 < 10 Then : 新項次 = "0" & NUM1
  187. ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1 : End If
  188. PA1 = TextBox2.Text : PA2 = 新項次 : PA3 = ComboBox6.Text : PA6 = DataGridView1.Rows(i).Cells("資料流水號").Value
  189. PA4 = DataGridView1.Rows(i).Cells("簡稱").Value & "-" & DataGridView1.Rows(i).Cells("品名").Value & "-" & DataGridView1.Rows(i).Cells("司機").Value & "司機佣金"
  190. NU1 = DataGridView1.Rows(i).Cells("佣金").Value : PA5 = "" : NU2 = 0 : NU3 = 0 : NU4 = 0
  191. SQL_營運成本明細表新增() : SQL_司機佣金計算表_轉立收支單修改()
  192. End If
  193. End If
  194. Next i : MAOJI_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  195. MsgBox("財務收支單(傳票)申請完成,請通知主管審核。") : Set_司機佣金清單()
  196. End If
  197. End If
  198. End Sub
  199. Private Sub 列印()
  200. N1 = 0
  201. xlSheet.Cells(1, 1) = DateTimePicker1.Value & " 到 " & DateTimePicker2.Value & " " & ComboBox2.Text & " 司機佣金費用"
  202. xlSheet.Cells(2, 1) = "單據編號" : xlSheet.Cells(2, 2) = "出貨日期" : xlSheet.Cells(2, 3) = "客戶" : xlSheet.Cells(2, 4) = "品名" : xlSheet.Cells(2, 5) = "售價"
  203. xlSheet.Cells(2, 6) = "數量" : xlSheet.Cells(2, 7) = "比例" : xlSheet.Cells(2, 8) = "佣金"
  204. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  205. xlSheet.Cells(i + 3, 1) = DataGridView1.Rows(i).Cells("單據編號").Value : xlSheet.Cells(i + 3, 2) = DataGridView1.Rows(i).Cells("出貨日期").Value
  206. xlSheet.Cells(i + 3, 3) = DataGridView1.Rows(i).Cells("簡稱").Value : xlSheet.Cells(i + 3, 4) = DataGridView1.Rows(i).Cells("品名").Value
  207. xlSheet.Cells(i + 3, 5) = DataGridView1.Rows(i).Cells("售價").Value : xlSheet.Cells(i + 3, 6) = DataGridView1.Rows(i).Cells("數量").Value
  208. xlSheet.Cells(i + 3, 7) = DataGridView1.Rows(i).Cells("比例").Value : xlSheet.Cells(i + 3, 8) = DataGridView1.Rows(i).Cells("佣金").Value
  209. N1 = i + 3
  210. Next
  211. xlSheet.Cells(N1 + 2, 7) = "合計" : xlSheet.Cells(N1 + 2, 8) = "=SUM(H3:H" & N1 & ")"
  212. End Sub
  213. Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
  214. ComboBox2下拉表單資料載入()
  215. xlApp = CType(CreateObject("Excel.Application"), Application)
  216. xlBook = xlApp.Workbooks.Add
  217. xlApp.DisplayAlerts = True
  218. xlApp.Visible = True
  219. xlApp.Application.WindowState = xlMaximized
  220. For i As Integer = 1 To ComboBox2.Items.Count - 1
  221. ComboBox2.SelectedIndex = i
  222. If DataGridView1.Rows.Count = 0 Then : Else
  223. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Name = ComboBox2.Text : 列印() : AA(xlApp, xlSheet)
  224. End If
  225. Next
  226. xlSheet.PageSetup.PrintArea = ""
  227. xlApp.Cells.Select()
  228. xlSheet.Range("B1").Select()
  229. xlApp.Application.WindowState = xlMinimized
  230. xlSheet.Cells.Select()
  231. MsgBox("列印完成。")
  232. End Sub
  233. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  234. Return CType(xlBook.Worksheets.Add, Worksheet)
  235. End Function
  236. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  237. xlSheet.Cells.Select()
  238. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  239. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  240. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 25
  241. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 17
  242. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  243. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  244. xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 9
  245. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  246. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  247. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 9
  248. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  249. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  250. xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 35
  251. xlSheet.Columns("E:F").Select : myExcel.Selection.NumberFormatLocal = "#,##0_ ;[紅色]-#,##0 "
  252. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  253. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  254. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 6
  255. xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 6
  256. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 10
  257. xlSheet.Columns("G:G").Select : myExcel.Selection.NumberFormatLocal = "#,##0.0_ ;[紅色]-#,##0.0 "
  258. xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 12 : myExcel.Selection.NumberFormatLocal = "#,##0_ ;[紅色]-#,##0 "
  259. xlSheet.Range("A1:H1").Select()
  260. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  261. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  262. xlSheet.Range("A1:H" & N1 & "").Select()
  263. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  264. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  265. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  266. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  267. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  268. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  269. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  270. myExcel.ActiveWindow.DisplayGridlines = False
  271. xlSheet.Rows("3:3").Select : myExcel.ActiveWindow.FreezePanes = True
  272. xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 25
  273. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False
  274. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.AutoFilter
  275. End Sub
  276. '-----------------------------滑鼠右鍵------------------------------------------------------------------------------------------------------------------------------------------
  277. Private Sub 重新整理ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新整理ToolStripMenuItem.Click
  278. ComboBox1下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox6下拉表單資料載入() : ComboBox2下拉表單資料載入() : ComboBox2.SelectedIndex = 0 : 日期格式() : Set_司機佣金清單()
  279. End Sub
  280. Private Sub 依據單號全部選擇ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 依據單號全部選擇ToolStripMenuItem.Click
  281. Me.Button3.PerformClick()
  282. End Sub
  283. Private Sub 依據單號取消立帳ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 依據單號取消立帳ToolStripMenuItem.Click
  284. Me.Button6.PerformClick()
  285. End Sub
  286. Private Sub 全部選擇ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 全部選擇ToolStripMenuItem.Click
  287. Me.Button13.PerformClick()
  288. End Sub
  289. Private Sub 全部取消ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 全部取消ToolStripMenuItem.Click
  290. Me.Button12.PerformClick()
  291. End Sub
  292. Private Sub 列印成EXCELToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 列印成EXCELToolStripMenuItem.Click
  293. Me.Button5.PerformClick()
  294. End Sub
  295. Private Sub 開立收支單ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 開立收支單ToolStripMenuItem.Click
  296. Me.Button4.PerformClick()
  297. End Sub
  298. End Class