Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

採購單歷史檔案.vb 83KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903
  1. Option Strict Off
  2. Imports System.IO
  3. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  4. Imports Microsoft.Office.Interop.Excel.Constants
  5. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  6. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  7. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  8. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  9. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  10. Imports Microsoft.Office.Interop.Excel.XlWindowState
  11. Imports Microsoft.Office.Interop.Excel
  12. Public Class 採購單歷史檔案
  13. ReadOnly ds8 As New DataSet : Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
  14. Dim N1 As Integer : Dim 新項次 As String : Dim NUM1 As Integer : ReadOnly 對話框(0) As String : Dim 物料規格 As String
  15. ReadOnly QRCODE As DotNetBarcode = New DotNetBarcode
  16. Private Sub Set_清單()
  17. Dim ds As New DataSet : 明細_dgv.DataSource = Nothing : ds.Clear()
  18. 明細_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  19. 明細_dgv.ColumnHeadersHeight = 25
  20. 明細_dgv.AllowUserToAddRows = False
  21. If 小間距1_ch.Checked = False And 中間距1_ch.Checked = False And 大間距1_ch.Checked = True Then
  22. 明細_dgv.RowTemplate.Height = 75
  23. ElseIf 小間距1_ch.Checked = False And 中間距1_ch.Checked = True And 大間距1_ch.Checked = False Then
  24. 明細_dgv.RowTemplate.Height = 45
  25. ElseIf 小間距1_ch.Checked = True And 中間距1_ch.Checked = False And 大間距1_ch.Checked = False Then
  26. 明細_dgv.RowTemplate.Height = 25
  27. End If
  28. SQL_建築物料採購單一覽表_明細()
  29. da.Fill(ds) : 明細_dgv.DataSource = ds.Tables(0) : conn.Close()
  30. 明細_dgv.Columns(0).Visible = False : 明細_dgv.Columns(1).FillWeight = 80 : 明細_dgv.Columns(2).FillWeight = 80 : 明細_dgv.Columns(3).FillWeight = 250
  31. 明細_dgv.Columns(4).FillWeight = 245 : 明細_dgv.Columns(5).FillWeight = 80 : 明細_dgv.Columns(6).FillWeight = 80 : 明細_dgv.Columns(7).FillWeight = 80
  32. 明細_dgv.Columns(8).FillWeight = 80 : 明細_dgv.Columns(9).Visible = False : 明細_dgv.Columns(10).Visible = False : 明細_dgv.Columns(11).Visible = False
  33. 明細_dgv.Columns(12).Visible = False : 明細_dgv.Columns(13).Visible = False : 明細_dgv.Columns(14).Visible = False : 明細_dgv.Columns(15).Visible = False
  34. 明細_dgv.Columns(16).Visible = False : 明細_dgv.Columns(17).Visible = False : 明細_dgv.Columns(18).Visible = False : 明細_dgv.Columns(19).Visible = False
  35. 明細_dgv.Columns(20).Visible = False : 明細_dgv.Columns(21).Visible = False : 明細_dgv.Columns(22).Visible = False : 明細_dgv.Columns(23).Visible = False
  36. 明細_dgv.Columns(24).Visible = False : 明細_dgv.Columns(25).FillWeight = 80
  37. 明細_dgv.Columns(6).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(7).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(8).DefaultCellStyle.Format = "#,##0"
  38. 明細_dgv.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  39. 明細_dgv.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  40. 明細_dgv.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  41. 明細_dgv.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  42. If 低網速模式 = False Then
  43. 明細_dgv.Columns("Image").FillWeight = 80 : 明細_dgv.Columns("Image").Visible = True
  44. Dim mycol As DataGridViewImageColumn = 明細_dgv.Columns("Image")
  45. mycol.ImageLayout = DataGridViewImageCellLayout.Zoom
  46. Else
  47. If 明細_dgv.Columns.Count = 27 Then
  48. 明細_dgv.Columns("Image").Visible = False
  49. End If
  50. End If
  51. 新項次 = "00"
  52. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  53. NUM1 = Double.Parse(新項次) + 1
  54. If NUM1 < 10 Then : 新項次 = "0" & NUM1
  55. ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1
  56. End If
  57. 明細_dgv.Rows(i).Cells("" & 表頭(11) & "").Value = 新項次
  58. '-------------------------規格合併呈現----------------------------------------------------------------------------------------------------------------------------------------
  59. If i = 0 Then
  60. PA3 = 明細_dgv.Rows(i).Cells("規格庫抬頭指定").Value
  61. SQL_規格庫抬頭讀取()
  62. If dr.Read() Then
  63. AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8")
  64. End If
  65. conn.Close()
  66. Else
  67. If 明細_dgv.Rows(i).Cells("規格庫抬頭指定").Value.ToString <> 明細_dgv.Rows(i - 1).Cells("規格庫抬頭指定").Value.ToString Then
  68. AAA1 = "" : AAA2 = "" : AAA3 = "" : AAA4 = "" : AAA5 = "" : AAA6 = "" : AAA7 = "" : AAA8 = "" ' 不同的抬頭入資料前,先清除
  69. PA3 = 明細_dgv.Rows(i).Cells("規格庫抬頭指定").Value
  70. SQL_規格庫抬頭讀取()
  71. If dr.Read() Then
  72. AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8")
  73. End If
  74. conn.Close()
  75. End If
  76. End If
  77. Dim ZA1, ZA2, ZA3, ZA4, ZA5, ZA6, ZA7, ZA8 As String : 物料規格 = ""
  78. If 詳細資料2_ch.Checked = True Then
  79. If 明細_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then
  80. ZA1 = AAA1 & "=" & 明細_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  81. If 明細_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then : ZA2 = AAA2 & "=" & 明細_dgv.Rows(i).Cells("A2").Value
  82. If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  83. If 明細_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then : ZA3 = AAA3 & "=" & 明細_dgv.Rows(i).Cells("A3").Value
  84. If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  85. If 明細_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then : ZA4 = AAA4 & "=" & 明細_dgv.Rows(i).Cells("A4").Value
  86. If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  87. If 明細_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then : ZA5 = AAA5 & "=" & 明細_dgv.Rows(i).Cells("A5").Value
  88. If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  89. If 明細_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then : ZA6 = AAA6 & "=" & 明細_dgv.Rows(i).Cells("A6").Value
  90. If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  91. If 明細_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then : ZA7 = AAA7 & "=" & 明細_dgv.Rows(i).Cells("A7").Value
  92. If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  93. If 明細_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then : ZA8 = AAA8 & "=" & 明細_dgv.Rows(i).Cells("A8").Value
  94. If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  95. Else
  96. If 明細_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then : ZA1 = 明細_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  97. If 明細_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then
  98. ZA2 = 明細_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  99. If 明細_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then
  100. ZA3 = 明細_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  101. If 明細_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then
  102. ZA4 = 明細_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  103. If 明細_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then
  104. ZA5 = 明細_dgv.Rows(i).Cells("A5").Value : If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  105. If 明細_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then
  106. ZA6 = 明細_dgv.Rows(i).Cells("A6").Value : If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  107. If 明細_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then
  108. ZA7 = 明細_dgv.Rows(i).Cells("A7").Value : If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  109. If 明細_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then
  110. ZA8 = 明細_dgv.Rows(i).Cells("A8").Value : If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  111. End If
  112. 明細_dgv.Rows(i).Cells("" & 表頭(13) & "").Value = 物料規格
  113. Next i
  114. 總金額計算() : Set_清單_1()
  115. End Sub
  116. Private Sub Set_清單_1()
  117. Dim ds5 As New DataSet : 明細1_dgv.DataSource = Nothing : ds5.Clear()
  118. 明細1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  119. 明細1_dgv.ColumnHeadersHeight = 40
  120. 明細1_dgv.AllowUserToAddRows = False
  121. 明細1_dgv.RowTemplate.Height = 35
  122. SQL_建築物料採購單一覽表_明細()
  123. da.Fill(ds5) : 明細1_dgv.DataSource = ds5.Tables(0) : conn.Close()
  124. If 低網速模式 = False Then
  125. 明細1_dgv.Columns("Image").FillWeight = 80 : 明細1_dgv.Columns("Image").Visible = True
  126. Dim mycol As DataGridViewImageColumn = 明細1_dgv.Columns("Image")
  127. mycol.ImageLayout = DataGridViewImageCellLayout.Zoom
  128. Else
  129. If 明細1_dgv.Columns.Count = 27 Then
  130. 明細1_dgv.Columns("Image").Visible = False
  131. End If
  132. End If
  133. 新項次 = "00"
  134. For i As Integer = 0 To 明細1_dgv.Rows.Count - 1
  135. NUM1 = Double.Parse(新項次) + 1
  136. If NUM1 < 10 Then : 新項次 = "0" & NUM1
  137. ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1
  138. End If
  139. 明細1_dgv.Rows(i).Cells("" & 表頭(11) & "").Value = 新項次
  140. '-------------------------------------------------------------------------------------------------------------------------
  141. If i = 0 Then
  142. AAA1 = "" : AAA2 = "" : AAA3 = "" : AAA4 = "" : AAA5 = "" : AAA6 = "" : AAA7 = "" : AAA8 = ""
  143. PA3 = 明細1_dgv.Rows(i).Cells("規格庫抬頭指定").Value : PA20 = 系統語言_cb.Text
  144. SQL_規格庫抬頭讀取_列印用()
  145. If dr.Read() Then
  146. AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8")
  147. End If
  148. conn.Close()
  149. Else
  150. If 明細1_dgv.Rows(i).Cells("規格庫抬頭指定").Value.ToString <> 明細1_dgv.Rows(i - 1).Cells("規格庫抬頭指定").Value.ToString Then
  151. AAA1 = "" : AAA2 = "" : AAA3 = "" : AAA4 = "" : AAA5 = "" : AAA6 = "" : AAA7 = "" : AAA8 = ""
  152. PA3 = 明細1_dgv.Rows(i).Cells("規格庫抬頭指定").Value : PA20 = 系統語言_cb.Text
  153. SQL_規格庫抬頭讀取_列印用()
  154. If dr.Read() Then
  155. AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8")
  156. End If
  157. conn.Close()
  158. End If
  159. End If
  160. Dim ZA1, ZA2, ZA3, ZA4, ZA5, ZA6, ZA7, ZA8 As String : 物料規格 = ""
  161. If 詳細資料2_ch.Checked = True Then
  162. If 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then
  163. ZA1 = AAA1 & "=" & 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  164. If 明細1_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then : ZA2 = AAA2 & "=" & 明細1_dgv.Rows(i).Cells("A2").Value
  165. If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  166. If 明細1_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then : ZA3 = AAA3 & "=" & 明細1_dgv.Rows(i).Cells("A3").Value
  167. If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  168. If 明細1_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then : ZA4 = AAA4 & "=" & 明細1_dgv.Rows(i).Cells("A4").Value
  169. If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  170. If 明細1_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then : ZA5 = AAA5 & "=" & 明細1_dgv.Rows(i).Cells("A5").Value
  171. If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  172. If 明細1_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then : ZA6 = AAA6 & "=" & 明細1_dgv.Rows(i).Cells("A6").Value
  173. If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  174. If 明細1_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then : ZA7 = AAA7 & "=" & 明細1_dgv.Rows(i).Cells("A7").Value
  175. If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  176. If 明細1_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then : ZA8 = AAA8 & "=" & 明細1_dgv.Rows(i).Cells("A8").Value
  177. If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  178. Else
  179. If 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then : ZA1 = 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  180. If 明細1_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then
  181. ZA2 = 明細1_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  182. If 明細1_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then
  183. ZA3 = 明細1_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  184. If 明細1_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then
  185. ZA4 = 明細1_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  186. If 明細1_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then
  187. ZA5 = 明細1_dgv.Rows(i).Cells("A5").Value : If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  188. If 明細1_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then
  189. ZA6 = 明細1_dgv.Rows(i).Cells("A6").Value : If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  190. If 明細1_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then
  191. ZA7 = 明細1_dgv.Rows(i).Cells("A7").Value : If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  192. If 明細1_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then
  193. ZA8 = 明細1_dgv.Rows(i).Cells("A8").Value : If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  194. End If
  195. 明細1_dgv.Rows(i).Cells("" & 表頭(13) & "").Value = 物料規格
  196. Next i
  197. End Sub
  198. Private Sub Set_清單1()
  199. Dim ds1 As New DataSet : 已核准_dgv.DataSource = Nothing : ds1.Clear()
  200. 已核准_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  201. 已核准_dgv.ColumnHeadersHeight = 25
  202. 已核准_dgv.AllowUserToAddRows = False
  203. SQL_建築物料採購單一覽表_已核准()
  204. da.Fill(ds1) : 已核准_dgv.DataSource = ds1.Tables(0) : conn.Close()
  205. 已核准_dgv.Columns(0).FillWeight = 125 : 已核准_dgv.Columns(1).Visible = False : 已核准_dgv.Columns(2).Visible = False : 已核准_dgv.Columns(3).Visible = False
  206. 已核准_dgv.Columns(4).Visible = False : 已核准_dgv.Columns(5).Visible = False : 已核准_dgv.Columns(6).Visible = False : 已核准_dgv.Columns(7).Visible = False
  207. 已核准_dgv.Columns(8).Visible = False : 已核准_dgv.Columns(9).Visible = False : 已核准_dgv.Columns(10).Visible = False : 已核准_dgv.Columns(11).Visible = False
  208. 已核准_dgv.Columns(12).Visible = False : 已核准_dgv.Columns(13).Visible = False : 已核准_dgv.Columns(14).Visible = False : 已核准_dgv.Columns(15).Visible = False
  209. 已核准_dgv.Columns(16).Visible = False : 已核准_dgv.Columns(17).Visible = False : 已核准_dgv.Columns(18).Visible = False : 已核准_dgv.Columns(19).Visible = False
  210. End Sub
  211. Private Sub Set_清單2()
  212. Dim ds2 As New DataSet : 已作廢_dgv.DataSource = Nothing : ds2.Clear()
  213. 已作廢_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  214. 已作廢_dgv.ColumnHeadersHeight = 25
  215. 已作廢_dgv.AllowUserToAddRows = False
  216. SQL_建築物料採購單一覽表_已作廢()
  217. da.Fill(ds2) : 已作廢_dgv.DataSource = ds2.Tables(0) : conn.Close()
  218. 已作廢_dgv.Columns(0).FillWeight = 125 : 已作廢_dgv.Columns(1).Visible = False : 已作廢_dgv.Columns(2).Visible = False : 已作廢_dgv.Columns(3).Visible = False
  219. 已作廢_dgv.Columns(4).Visible = False : 已作廢_dgv.Columns(5).Visible = False : 已作廢_dgv.Columns(6).Visible = False : 已作廢_dgv.Columns(7).Visible = False
  220. 已作廢_dgv.Columns(8).Visible = False : 已作廢_dgv.Columns(9).Visible = False : 已作廢_dgv.Columns(10).Visible = False : 已作廢_dgv.Columns(11).Visible = False
  221. 已作廢_dgv.Columns(12).Visible = False : 已作廢_dgv.Columns(13).Visible = False : 已作廢_dgv.Columns(14).Visible = False : 已作廢_dgv.Columns(15).Visible = False
  222. 已作廢_dgv.Columns(16).Visible = False
  223. End Sub
  224. Private Sub ComboBox2下拉表單資料載入()
  225. SQL_供應商資料表_公司名_下拉用() : 廠商_cb.Items.Clear() : While (dr.Read()) : 廠商_cb.Items.Add(dr("公司名")) : End While : conn.Close()
  226. End Sub
  227. Private Sub 總金額計算()
  228. Dim FFGG As Integer = 0
  229. 總金額_tb.Text = "0"
  230. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  231. 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value = 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value * 明細_dgv.Rows(i).Cells("" & 表頭(15) & "").Value
  232. FFGG = Val(FFGG) + 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  233. Next i
  234. 折扣金額_tb.Text = Val(折扣比_tb.Text) * FFGG / 100
  235. If 稅金計算_ch.Checked = True Then
  236. If 折扣比_tb.Text = "0" Then
  237. 稅金金額_tb.Text = FFGG * Val(稅金比_tb.Text) / 100
  238. Else
  239. 稅金金額_tb.Text = (FFGG - 折扣金額_tb.Text) * Val(稅金比_tb.Text) / 100
  240. End If
  241. Else
  242. 稅金金額_tb.Text = "0"
  243. End If
  244. 總金額_tb.Text = FFGG - Val(折扣金額_tb.Text) + Val(稅金金額_tb.Text)
  245. 折扣金額_tb.Text = Strings.Format(Val(折扣金額_tb.Text), "#,##0") : 稅金金額_tb.Text = Strings.Format(Val(稅金金額_tb.Text), "#,##0")
  246. 總金額_tb.Text = Strings.Format(Val(總金額_tb.Text), "#,##0")
  247. End Sub
  248. Private Sub Set_語言()
  249. 語言_dgv.DataSource = Nothing : ds8.Clear()
  250. 語言_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  251. 語言_dgv.ColumnHeadersHeight = 25
  252. 語言_dgv.AllowUserToAddRows = False
  253. SQL_系統語言導入()
  254. da.Fill(ds8) : 語言_dgv.DataSource = ds8.Tables(0) : conn.Close()
  255. End Sub
  256. Private Sub 語言轉換讀取()
  257. Set_語言() : conn.Close()
  258. For i As Integer = 0 To 語言_dgv.Rows.Count - 1
  259. If 語言_dgv("控件", i).Value.ToString = "建築物料採購單一覽表" Then : Me.Text = 語言_dgv("內容", i).Value.ToString : End If
  260. If 語言_dgv("控件", i).Value.ToString = "已核准_lb" Then : 已核准_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  261. If 語言_dgv("控件", i).Value.ToString = "已作廢_lb" Then : 已作廢_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  262. If 語言_dgv("控件", i).Value.ToString = "總金額_lb" Then : 總金額_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  263. If 語言_dgv("控件", i).Value.ToString = "選擇公司_lb" Then : 選擇公司_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  264. If 語言_dgv("控件", i).Value.ToString = "圖片編碼_lb" Then : 圖片編碼_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  265. If 語言_dgv("控件", i).Value.ToString = "重新整理_tsm" Then : 重新整理_tsm.Text = 語言_dgv("內容", i).Value.ToString : End If
  266. If 語言_dgv("控件", i).Value.ToString = "驗證碼_lb" Then : 驗證碼_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  267. If 語言_dgv("控件", i).Value.ToString = "一級簽核_lb" Then : 一級簽核_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  268. If 語言_dgv("控件", i).Value.ToString = "二級簽核_lb" Then : 二級簽核_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  269. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_項次" Then : 表頭(11) = 語言_dgv("內容", i).Value.ToString : End If
  270. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_品名" Then : 表頭(12) = 語言_dgv("內容", i).Value.ToString : End If
  271. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_規格" Then : 表頭(13) = 語言_dgv("內容", i).Value.ToString : End If
  272. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_備註" Then : 表頭(14) = 語言_dgv("內容", i).Value.ToString : End If
  273. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_數量" Then : 表頭(15) = 語言_dgv("內容", i).Value.ToString : End If
  274. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_單位" Then : 表頭(16) = 語言_dgv("內容", i).Value.ToString : End If
  275. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_單價" Then : 表頭(26) = 語言_dgv("內容", i).Value.ToString : End If
  276. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_單號" Then : 表頭(18) = 語言_dgv("內容", i).Value.ToString : End If
  277. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_金額" Then : 表頭(27) = 語言_dgv("內容", i).Value.ToString : End If
  278. If 語言_dgv("控件", i).Value.ToString = "對話框1" Then : 對話框(0) = 語言_dgv("內容", i).Value.ToString : End If
  279. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_合約號" Then : 表頭(134) = 語言_dgv("內容", i).Value.ToString : End If
  280. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_申請人" Then : 表頭(19) = 語言_dgv("內容", i).Value.ToString : End If
  281. Next
  282. End Sub
  283. Private Sub 採購單歷史檔案_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  284. Me.MdiParent = GCM_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  285. H(208) = True : 介面 = "H208" : 語言轉換讀取()
  286. 地址_tb.Enabled = False : 電話_tb.Enabled = False : 郵件_tb.Enabled = False : 採購單號_tb.Enabled = False : 傳真_tb.Enabled = False : 供應商編碼_tb.Visible = False
  287. 折扣比_tb.Enabled = False : 稅金比_tb.Enabled = False : 驗證碼_tb.Enabled = False : 圖片編碼_tb.Enabled = False : 選擇公司_cb.Enabled = False : 折扣金額_tb.Enabled = False
  288. 稅金金額_tb.Enabled = False : 總金額_tb.Enabled = False : 核對員_tb.Visible = False : 核對日期_tb.Visible = False : 詢價員_tb.Visible = False : 尋價日期_tb.Visible = False
  289. 驗證碼1_tb.Visible = False : 廠商_cb.Enabled = False : QRCode_pb.Visible = False : 系統語言_cb.Text = "Indonesian"
  290. 小間距1_ch.Checked = False : 中間距1_ch.Checked = True : 大間距1_ch.Checked = False
  291. ComboBox2下拉表單資料載入() : Set_清單1() : Set_清單2()
  292. MyModule1.清單字體大小調整()
  293. 已核准_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  294. 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  295. End Sub
  296. Private Sub 採購單歷史檔案_SizeChanged(sender As Object, e As EventArgs) Handles MyBase.SizeChanged
  297. MyModule1.清單字體大小調整()
  298. 已核准_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  299. 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  300. End Sub
  301. Private Sub 採購單詢價_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
  302. H(208) = False
  303. End Sub
  304. Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
  305. 介面 = "H208" : 語言轉換讀取()
  306. Set_清單1() : Set_清單2() : Set_清單()
  307. End Sub
  308. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  309. timeNow = 0
  310. GCM_ERP_SYS.Timer1.Enabled = False
  311. GCM_ERP_SYS.Timer1.Enabled = True
  312. End Sub
  313. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  314. timeNow = 0
  315. GCM_ERP_SYS.Timer1.Enabled = False
  316. GCM_ERP_SYS.Timer1.Enabled = True
  317. End Sub
  318. Dim 已超出 As Boolean
  319. Private Sub 明細_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 明細_dgv.MouseUp
  320. 'If 明細_dgv.SelectedCells.Count = 1 Then : MsgBox(明細_dgv.SelectedCells(0).ColumnIndex & " " & 明細_dgv.SelectedCells(0).RowIndex) : End If
  321. If 明細_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
  322. If 明細_dgv.SelectedCells.Count > 0 Then
  323. If 明細_dgv.SelectedCells(0).ColumnIndex = 8 Then
  324. If 已超出 = False Then
  325. Dim x As Double = 0
  326. For i As Integer = 0 To 明細_dgv.SelectedCells.Count - 1
  327. Dim 變數 As String = "" : Dim 取變數 As String
  328. 取變數 = 明細_dgv.Rows(明細_dgv.SelectedCells.Item(i).RowIndex).Cells(明細_dgv.SelectedCells.Item(i).ColumnIndex).Value
  329. For ii As Integer = 1 To Len(取變數)
  330. If ii = 1 Then : 變數 = Strings.Left(取變數, ii) : Else : If Strings.Mid(取變數, ii, 1) <> "," Then : 變數 &= Strings.Mid(取變數, ii, 1) : End If : End If
  331. Next : x += Val(變數)
  332. Next i : GCM_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(x, "#,##0")
  333. Else : GCM_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0")
  334. End If
  335. Else : 已超出 = True : GCM_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0")
  336. End If
  337. End If
  338. End Sub
  339. Private Sub 明細_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 明細_dgv.CellEnter
  340. 總金額_tb.Text = "0"
  341. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  342. 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value = 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value * 明細_dgv.Rows(i).Cells("" & 表頭(15) & "").Value
  343. 總金額_tb.Text = Val(總金額_tb.Text) + 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  344. Next i
  345. 總金額_tb.Text = Strings.Format(Val(總金額_tb.Text), "#,##0")
  346. End Sub
  347. Private Sub 明細_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 明細_dgv.CellClick
  348. If e.RowIndex = -1 Then : Else
  349. PA1 = 明細_dgv.Rows(e.RowIndex).Cells("群組碼").Value : PA2 = 明細_dgv.Rows(e.RowIndex).Cells("料號原則").Value
  350. SQL_物料圖庫_圖檔讀取()
  351. While dr.Read() = True
  352. Dim unused As Byte() = New Byte(-1) {}
  353. Dim bytes As Byte() = DirectCast(dr.Item("圖檔"), Byte())
  354. Dim oStream As New MemoryStream(bytes)
  355. 物料圖檔_pb.Image = Bitmap.FromStream(oStream)
  356. End While
  357. conn.Close() : 物料圖檔_pb.SizeMode = 4
  358. End If
  359. End Sub
  360. Private Sub 已核准_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 已核准_dgv.CellClick
  361. If e.RowIndex = -1 Then : Else
  362. 採購單號_tb.Text = 已核准_dgv(0, e.RowIndex).Value.ToString : 折扣比_tb.Text = 已核准_dgv(13, e.RowIndex).Value.ToString : 稅金計算_ch.Checked = 已核准_dgv(14, e.RowIndex).Value
  363. 稅金比_tb.Text = 已核准_dgv(15, e.RowIndex).Value.ToString : 核對員_tb.Text = 已核准_dgv(4, e.RowIndex).Value.ToString : 核對日期_tb.Text = 已核准_dgv(5, e.RowIndex).Value.ToString
  364. 詢價員_tb.Text = 已核准_dgv(6, e.RowIndex).Value.ToString : 尋價日期_tb.Text = 已核准_dgv(7, e.RowIndex).Value.ToString : 驗證碼1_tb.Text = 已核准_dgv(11, e.RowIndex).Value.ToString
  365. 審核日期1_tb.Text = 已核准_dgv("一級核准核准日期", e.RowIndex).Value.ToString : 審核日期2_tb.Text = 已核准_dgv("核准日期", e.RowIndex).Value.ToString
  366. 採購人員_tb.Text = 已核准_dgv("採購員", e.RowIndex).Value.ToString : 採購日期_tb.Text = 已核准_dgv("採購日期", e.RowIndex).Value.ToString
  367. If Strings.Left(採購單號_tb.Text, 3) = "HXI" Then : 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL"
  368. ElseIf Strings.Left(採購單號_tb.Text, 3) = "PGS" Then : 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" : End If
  369. 供應商編碼_tb.Text = 已核准_dgv(1, e.RowIndex).Value.ToString : conn.Close()
  370. PA1 = 供應商編碼_tb.Text : SQL_建築物料採購單生成_供應商資料一()
  371. If dr.Read() Then : 廠商_cb.Text = dr("公司名") : conn.Close() : End If : conn.Close()
  372. 驗證碼_tb.Text = 已核准_dgv(11, e.RowIndex).Value.ToString : 圖片編碼_tb.Text = 已核准_dgv(10, e.RowIndex).Value.ToString
  373. 使用地點_tb.Text = 已核准_dgv(3, e.RowIndex).Value.ToString : 需求日期_dtp.Value = 已核准_dgv(2, e.RowIndex).Value
  374. PA1 = 已核准_dgv("一級核准簽名檔編號", e.RowIndex).Value.ToString : SQL_主管簽名檔管理_圖片流水號()
  375. 簽名檔1_pb.Image = Nothing
  376. While dr.Read() = True
  377. Dim unused As Byte() = New Byte(-1) {}
  378. Dim bytes As Byte() = DirectCast(dr.Item("簽名檔圖片"), Byte())
  379. Dim oStream As New MemoryStream(bytes)
  380. 簽名檔1_pb.Image = Bitmap.FromStream(oStream)
  381. End While
  382. conn.Close() : 簽名檔1_pb.SizeMode = 4
  383. Set_清單()
  384. QRCode_pb.Image = Nothing : QRCode2_pb.Image = Nothing
  385. QRCode_pb.Image = New Bitmap(QRCode_pb.Width, QRCode_pb.Height)
  386. QRCode2_pb.Image = New Bitmap(QRCode2_pb.Width, QRCode2_pb.Height)
  387. Dim GP As Graphics = Graphics.FromImage(QRCode_pb.Image)
  388. Dim GP2 As Graphics = Graphics.FromImage(QRCode2_pb.Image)
  389. QRCODE.Type = DotNetBarcode.Types.QRCode : QRCODE.QRQuitZone = 0 : QRCODE.QRWriteBar(驗證碼1_tb.Text, 0, 0, 14, GP)
  390. QRCODE.Type = DotNetBarcode.Types.QRCode : QRCODE.QRQuitZone = 0 : QRCODE.QRWriteBar(驗證碼1_tb.Text, 1, 1, 3.5, GP2)
  391. QRCode_pb.SizeMode = 4 : QRCode2_pb.SizeMode = 4
  392. End If
  393. End Sub
  394. Private Sub 已作廢_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 已作廢_dgv.CellClick
  395. If e.RowIndex = -1 Then : Else
  396. 採購單號_tb.Text = 已作廢_dgv(0, e.RowIndex).Value.ToString : 折扣比_tb.Text = 已作廢_dgv(13, e.RowIndex).Value.ToString : 稅金計算_ch.Checked = 已作廢_dgv(14, e.RowIndex).Value
  397. 稅金比_tb.Text = 已作廢_dgv(15, e.RowIndex).Value.ToString : 核對員_tb.Text = 已作廢_dgv(4, e.RowIndex).Value.ToString : 核對日期_tb.Text = 已作廢_dgv(5, e.RowIndex).Value.ToString
  398. 詢價員_tb.Text = 已作廢_dgv(6, e.RowIndex).Value.ToString : 尋價日期_tb.Text = 已作廢_dgv(7, e.RowIndex).Value.ToString
  399. If Strings.Left(採購單號_tb.Text, 3) = "HXI" Then : 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL"
  400. ElseIf Strings.Left(採購單號_tb.Text, 3) = "PGS" Then : 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" : End If
  401. 簽名檔1_pb.Image = Nothing
  402. 供應商編碼_tb.Text = 已作廢_dgv(1, e.RowIndex).Value.ToString : conn.Close()
  403. PA = 供應商編碼_tb.Text : SQL_建築物料採購單生成_供應商資料一()
  404. If dr.Read() Then : 廠商_cb.Text = dr("公司名") : conn.Close() : End If : conn.Close()
  405. 驗證碼_tb.Text = 已作廢_dgv(11, e.RowIndex).Value.ToString : 圖片編碼_tb.Text = 已作廢_dgv(10, e.RowIndex).Value.ToString
  406. 使用地點_tb.Text = 已作廢_dgv(3, e.RowIndex).Value.ToString : 需求日期_dtp.Value = 已作廢_dgv(2, e.RowIndex).Value
  407. Set_清單()
  408. End If
  409. End Sub
  410. Private Sub 廠商_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 廠商_cb.SelectedIndexChanged
  411. PA1 = 廠商_cb.Text : SQL_建築物料採購單生成_供應商資料二()
  412. If dr.Read() Then
  413. 供應商編碼_tb.Text = dr("供應商編碼") : 地址_tb.Text = dr("公司地址") : 電話_tb.Text = dr("公司電話1") : 郵件_tb.Text = dr("聯繫人1郵箱") : 傳真_tb.Text = dr("公司傳真1")
  414. End If
  415. conn.Close()
  416. End Sub
  417. Private Sub 圖片編碼_tb_TextChanged(sender As Object, e As EventArgs) Handles 圖片編碼_tb.TextChanged
  418. PA1 = 圖片編碼_tb.Text : SQL_主管簽名檔管理_圖片流水號()
  419. 簽名檔2_pb.Image = Nothing
  420. While dr.Read() = True
  421. Dim unused As Byte() = New Byte(-1) {}
  422. Dim bytes As Byte() = DirectCast(dr.Item("簽名檔圖片"), Byte())
  423. Dim oStream As New MemoryStream(bytes)
  424. 簽名檔2_pb.Image = Bitmap.FromStream(oStream)
  425. End While
  426. conn.Close() : 簽名檔2_pb.SizeMode = 4
  427. End Sub
  428. Private Sub 小間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 小間距1_ch.Click
  429. 小間距1_ch.Checked = True : 中間距1_ch.Checked = False : 大間距1_ch.Checked = False : MyModule1.間距設定存檔_1() : Set_清單()
  430. End Sub
  431. Private Sub 中間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 中間距1_ch.Click
  432. 小間距1_ch.Checked = False : 中間距1_ch.Checked = True : 大間距1_ch.Checked = False : MyModule1.間距設定存檔_2() : Set_清單()
  433. End Sub
  434. Private Sub 大間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 大間距1_ch.Click
  435. 小間距1_ch.Checked = False : 中間距1_ch.Checked = False : 大間距1_ch.Checked = True : MyModule1.間距設定存檔_3() : Set_清單()
  436. End Sub
  437. Private Sub 物料圖檔_pb_Click(sender As Object, e As EventArgs) Handles 物料圖檔_pb.Click
  438. If IsNothing(物料圖檔_pb.Image) = False Then
  439. 圖片傳遞 = 物料圖檔_pb.Image : 圖片放大視窗.ShowDialog()
  440. End If
  441. End Sub
  442. Private Sub 詳細資料2_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 詳細資料2_ch.Click
  443. If 詳細資料2_ch.Checked = True Then : 詳細資料2_ch.Checked = True : Else : 詳細資料2_ch.Checked = False : End If : Set_清單()
  444. End Sub
  445. Private Sub 確認列印_bt_Click_1(sender As Object, e As EventArgs) Handles 確認列印_bt.Click
  446. If 採購人員_tb.Text = "" Then
  447. SQL_物料採購單_首次列印() : 採購人員_tb.Text = gUserName : 採購日期_tb.Text = Today()
  448. End If
  449. xlApp = CType(CreateObject("Excel.Application"), Application)
  450. xlBook = xlApp.Workbooks.Add
  451. xlApp.DisplayAlerts = True
  452. xlBook.Activate()
  453. xlSheet = NewMethod(xlBook)
  454. xlSheet.Activate()
  455. xlApp.Visible = True
  456. xlApp.Application.WindowState = xlMaximized
  457. xlSheet.Cells(2, 1) = 選擇公司_cb.Text : xlSheet.Cells(3, 1) = "PURCHASE ORDER"
  458. xlSheet.Cells(5, 1) = "ORDER TO : " & 廠商_cb.Text : xlSheet.Cells(6, 1) = "ALAMAT : " & 地址_tb.Text : xlSheet.Cells(7, 1) = "Telp : " & 電話_tb.Text
  459. xlSheet.Cells(8, 1) = "Fax : " & 傳真_tb.Text : xlSheet.Cells(9, 1) = "Email : " & 郵件_tb.Text
  460. xlSheet.Cells(10, 1) = "No." : xlSheet.Cells(10, 2) = "Nama produk" : xlSheet.Cells(10, 3) = "Spesifikasi" : xlSheet.Cells(10, 4) = "Komentar" : xlSheet.Cells(10, 5) = "SATUAN"
  461. xlSheet.Cells(10, 6) = "QTY" : xlSheet.Cells(10, 7) = "UNIT PRICE" : xlSheet.Cells(10, 8) = "TOTAL PRICE"
  462. xlSheet.Cells(7, 5) = "PO NOMOR : " : xlSheet.Cells(7, 7) = 採購單號_tb.Text
  463. xlSheet.Cells(8, 5) = "TGL/BLN/THN : " : xlSheet.Cells(8, 7) = 需求日期_dtp.Value
  464. xlSheet.Cells(9, 5) = "TEMPAT PEMAKAIAN : " : xlSheet.Cells(9, 7) = 使用地點_tb.Text
  465. Dim GGHH As Integer = 0
  466. For i As Integer = 0 To 明細1_dgv.Rows.Count - 1
  467. xlSheet.Cells(i + 11, 1) = 明細1_dgv.Rows(i).Cells("" & 表頭(11) & "").Value : xlSheet.Cells(i + 11, 2) = 明細1_dgv.Rows(i).Cells("" & 表頭(12) & "").Value
  468. xlSheet.Cells(i + 11, 3) = 明細1_dgv.Rows(i).Cells("" & 表頭(13) & "").Value : xlSheet.Cells(i + 11, 4) = 明細1_dgv.Rows(i).Cells("" & 表頭(14) & "").Value
  469. xlSheet.Cells(i + 11, 5) = 明細1_dgv.Rows(i).Cells("" & 表頭(16) & "").Value : xlSheet.Cells(i + 11, 6) = 明細1_dgv.Rows(i).Cells("" & 表頭(15) & "").Value
  470. xlSheet.Cells(i + 11, 7) = 明細1_dgv.Rows(i).Cells("" & 表頭(26) & "").Value : xlSheet.Cells(i + 11, 8) = 明細1_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  471. GGHH += 明細1_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  472. N1 = i + 11
  473. Next i
  474. xlSheet.Cells(N1 + 2, 7) = "TOTAL :" : xlSheet.Cells(N1 + 2, 8) = GGHH
  475. xlSheet.Cells(N1 + 3, 7) = "DISC " & 折扣比_tb.Text & "% :" : xlSheet.Cells(N1 + 3, 8) = 折扣金額_tb.Text
  476. xlSheet.Cells(N1 + 4, 7) = "PPN " & 稅金比_tb.Text & "% :" : xlSheet.Cells(N1 + 4, 8) = 稅金金額_tb.Text
  477. xlSheet.Cells(N1 + 5, 7) = "GRAND TOTAL :" : xlSheet.Cells(N1 + 5, 8) = 總金額_tb.Text
  478. xlSheet.Cells(N1 + 6, 1) = "Bagian Pembelian Barang" : xlSheet.Cells(N1 + 8, 1) = 採購人員_tb.Text : xlSheet.Cells(N1 + 9, 1) = 採購日期_tb.Text
  479. xlSheet.Cells(N1 + 6, 3) = "Direktur Utama" : xlSheet.Cells(N1 + 9, 3) = 審核日期2_tb.Text
  480. xlSheet.Cells(N1 + 6, 4) = "Bagian Pemeriksa" : xlSheet.Cells(N1 + 9, 4) = 審核日期1_tb.Text
  481. xlSheet.Cells(N1 + 6, 6) = "Bagian Pengisian Harga" : xlSheet.Cells(N1 + 8, 6) = 詢價員_tb.Text : xlSheet.Cells(N1 + 9, 6) = 尋價日期_tb.Text
  482. xlSheet.Cells(N1 + 6, 8) = "Asisten Proyek" : xlSheet.Cells(N1 + 8, 8) = 核對員_tb.Text : xlSheet.Cells(N1 + 9, 8) = 核對日期_tb.Text
  483. AA(xlApp, xlSheet) : DD(xlApp, xlSheet) : EE(xlApp, xlSheet) : CC(xlApp, xlSheet)
  484. xlSheet.PageSetup.PrintArea = ""
  485. xlApp.Cells.Select()
  486. xlSheet.Range("B1").Select()
  487. xlApp.Application.WindowState = xlMinimized
  488. xlSheet.Cells.Select()
  489. xlApp.ActiveSheet.Protect(DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="0911274990")
  490. xlApp.ActiveSheet.EnableSelection = 1
  491. MsgBox(對話框(0))
  492. End Sub
  493. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  494. Return CType(xlBook.Worksheets.Add, Worksheet)
  495. End Function
  496. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  497. xlSheet.Cells.Select()
  498. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  499. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  500. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 24
  501. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 35 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 20
  502. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 15
  503. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 15 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 30
  504. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 5 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 35
  505. xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 5
  506. xlSheet.Rows("5:9").Select : myExcel.Selection.RowHeight = 20 : xlSheet.Rows("10:10").Select : myExcel.Selection.RowHeight = 20
  507. xlSheet.Rows("11:" & N1).Select : myExcel.Selection.RowHeight = 65 : xlSheet.Rows(N1 + 1 & ":" & N1 + 1).Select : myExcel.Selection.RowHeight = 5
  508. xlSheet.Rows(N1 + 2 & ":" & N1 + 5).Select : myExcel.Selection.RowHeight = 17 : xlSheet.Rows(N1 + 6 & ":" & N1 + 6).Select : myExcel.Selection.RowHeight = 35
  509. xlSheet.Rows(N1 + 7 & ":" & N1 + 9).Select : myExcel.Selection.RowHeight = 35
  510. xlSheet.Range("A2:H2").Select()
  511. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  512. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  513. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 26 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  514. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  515. xlSheet.Range("A3:H3").Select()
  516. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  517. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  518. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 16 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  519. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  520. xlSheet.Range("A10:H" & N1).Select()
  521. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  522. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  523. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  524. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  525. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  526. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  527. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  528. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 2).Select()
  529. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  530. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  531. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  532. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  533. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  534. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  535. xlSheet.Range("A" & N1 + 3 & ":H" & N1 + 3).Select()
  536. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  537. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  538. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  539. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  540. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  541. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  542. xlSheet.Range("A" & N1 + 4 & ":H" & N1 + 4).Select()
  543. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  544. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  545. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  546. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  547. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  548. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  549. xlSheet.Range("A" & N1 + 5 & ":H" & N1 + 5).Select()
  550. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  551. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  552. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  553. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  554. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  555. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  556. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 6).Select()
  557. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  558. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  559. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  560. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  561. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  562. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  563. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  564. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  565. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 6).Select()
  566. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  567. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  568. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  569. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  570. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  571. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  572. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  573. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  574. xlSheet.Range("D" & N1 + 6 & ":E" & N1 + 6).Select()
  575. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  576. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  577. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  578. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  579. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  580. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  581. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  582. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  583. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 6).Select()
  584. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  585. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  586. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  587. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  588. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  589. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  590. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  591. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  592. xlSheet.Range("H" & N1 + 6).Select()
  593. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  594. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  595. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  596. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  597. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  598. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  599. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  600. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  601. xlSheet.Range("A" & N1 + 7 & ":B" & N1 + 9).Select()
  602. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  603. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  604. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  605. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  606. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  607. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  608. xlSheet.Range("C" & N1 + 7 & ":C" & N1 + 9).Select()
  609. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  610. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  611. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  612. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  613. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  614. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  615. xlSheet.Range("D" & N1 + 7 & ":E" & N1 + 9).Select()
  616. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  617. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  618. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  619. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  620. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  621. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  622. xlSheet.Range("F" & N1 + 7 & ":G" & N1 + 9).Select()
  623. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  624. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  625. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  626. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  627. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  628. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  629. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  630. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  631. xlSheet.Range("H" & N1 + 7 & ":H" & N1 + 9).Select()
  632. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  633. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  634. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  635. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  636. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  637. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  638. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  639. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  640. xlSheet.Range("A10:A" & N1).Select()
  641. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  642. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  643. xlSheet.Range("B11:D" & N1).Select()
  644. With myExcel.Selection
  645. .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  646. .ReadingOrder = xlContext : .MergeCells = False : End With
  647. xlSheet.Range("E11:F" & N1).Select()
  648. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  649. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  650. xlSheet.Range("G11:H" & N1).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  651. xlSheet.Range("H" & N1 + 2).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  652. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).Select()
  653. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  654. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  655. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  656. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  657. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  658. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  659. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  660. myExcel.ActiveWindow.DisplayGridlines = False
  661. xlSheet.Range("A3:H3").Select()
  662. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  663. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  664. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  665. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  666. xlSheet.Range("G7:G9").Select()
  667. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  668. .ReadingOrder = xlContext : .MergeCells = False : End With
  669. xlSheet.Range("A10:H" & N1).Select()
  670. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  671. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  672. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  673. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  674. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  675. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  676. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  677. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).Select()
  678. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  679. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  680. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  681. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  682. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  683. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  684. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 9).Select()
  685. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  686. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  687. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  688. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  689. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  690. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  691. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 9).Select()
  692. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  693. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  694. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  695. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  696. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  697. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  698. xlSheet.Range("D" & N1 + 6 & ":E" & N1 + 9).Select()
  699. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  700. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  701. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  702. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  703. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  704. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  705. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 9).Select()
  706. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  707. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  708. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  709. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  710. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  711. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  712. xlSheet.Range("H" & N1 + 6 & ":H" & N1 + 9).Select()
  713. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  714. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  715. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  716. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  717. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  718. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  719. xlSheet.Rows("5:9").Select
  720. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  721. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  722. xlSheet.Rows("11:" & N1).Select
  723. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  724. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  725. xlSheet.Range("A10:H10").Select()
  726. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  727. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  728. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  729. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  730. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  731. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  732. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  733. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  734. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  735. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  736. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  737. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  738. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  739. xlSheet.Range("A11:H" & N1).Select()
  740. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  741. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  742. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  743. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  744. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  745. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  746. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  747. xlSheet.Range("B11:D" & N1).Select()
  748. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  749. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  750. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  751. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  752. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  753. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  754. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  755. xlSheet.Range("F11:F" & N1).Select()
  756. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  757. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  758. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  759. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  760. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  761. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  762. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  763. xlSheet.Range("H11:H" & N1).Select()
  764. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  765. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  766. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  767. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  768. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  769. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  770. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  771. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).Select()
  772. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  773. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  774. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  775. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  776. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  777. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  778. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).Select()
  779. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  780. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  781. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  782. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  783. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  784. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  785. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  786. xlSheet.Range("G" & N1 + 2 & ":G" & N1 + 5).Select()
  787. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  788. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  789. xlSheet.Range("F" & N1 + 8 & ":G" & N1 + 8).Select()
  790. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  791. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  792. xlSheet.Range("F" & N1 + 9 & ":G" & N1 + 9).Select()
  793. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  794. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  795. xlSheet.Range("A" & N1 + 8 & ":B" & N1 + 8).Select()
  796. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  797. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  798. xlSheet.Range("A" & N1 + 9 & ":B" & N1 + 9).Select()
  799. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  800. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  801. xlSheet.Range("C" & N1 + 9).Select()
  802. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  803. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  804. myExcel.Application.PrintCommunication = False
  805. With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "$1:$10" : .PrintTitleColumns = "" : End With
  806. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  807. With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "" : .RightFooter = ""
  808. .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
  809. .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
  810. .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
  811. .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = True : .CenterVertically = False : .Draft = False : .FirstPageNumber = xlAutomatic
  812. .BlackAndWhite = False : .Zoom = 60 : .OddAndEvenPagesHeaderFooter = False : .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True
  813. .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = ""
  814. .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = ""
  815. .FirstPage.CenterHeader.Text = "" : .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = ""
  816. .FirstPage.RightFooter.Text = ""
  817. End With
  818. myExcel.Application.PrintCommunication = True
  819. End Sub
  820. Private Sub CC(ByVal myExcel As Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  821. Clipboard.SetDataObject(簽名檔2_pb.Image)
  822. xlSheet.Range("C" & N1 + 8).Select()
  823. myExcel.ActiveSheet.Pictures.Paste.Select
  824. myExcel.Selection.ShapeRange.Height = 50
  825. myExcel.Selection.ShapeRange.IncrementLeft(2)
  826. myExcel.Selection.ShapeRange.IncrementTop(-23)
  827. End Sub
  828. Private Sub DD(ByVal myExcel As Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  829. Clipboard.SetDataObject(QRCode_pb.Image)
  830. xlSheet.Range("H5").Select()
  831. myExcel.ActiveSheet.Pictures.Paste.Select
  832. myExcel.Selection.ShapeRange.Height = 90
  833. myExcel.Selection.ShapeRange.IncrementLeft(70)
  834. myExcel.Selection.ShapeRange.IncrementTop(1)
  835. End Sub
  836. Private Sub EE(ByVal myExcel As Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  837. Clipboard.SetDataObject(簽名檔1_pb.Image)
  838. xlSheet.Range("D" & N1 + 8).Select()
  839. myExcel.ActiveSheet.Pictures.Paste.Select
  840. myExcel.Selection.ShapeRange.Height = 50
  841. myExcel.Selection.ShapeRange.IncrementLeft(2)
  842. myExcel.Selection.ShapeRange.IncrementTop(-23)
  843. End Sub
  844. '-----------------------------滑鼠右鍵--------------------------------------------------------------------------------------------------------------------------------------
  845. Private Sub 重新整理SegarkanToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新整理_tsm.Click
  846. Set_清單1() : Set_清單2()
  847. End Sub
  848. End Class