No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

採購單歷史檔案.vb 83KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902
  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 = HX_PGS_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. SQL_清單欄位查詢()
  291. If Acdr.Read() Then
  292. 小間距1_ch.Checked = Acdr("L_1_1") : 中間距1_ch.Checked = Acdr("L_2_1") : 大間距1_ch.Checked = Acdr("L_3_1")
  293. End If : Access1.Close()
  294. ComboBox2下拉表單資料載入() : Set_清單1() : Set_清單2()
  295. MyModule1.清單字體大小調整()
  296. 已核准_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  297. 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  298. End Sub
  299. Private Sub 採購單歷史檔案_SizeChanged(sender As Object, e As EventArgs) Handles MyBase.SizeChanged
  300. MyModule1.清單字體大小調整()
  301. 已核准_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  302. 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  303. End Sub
  304. Private Sub 採購單詢價_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
  305. H(208) = False : MyModule1.虛擬桌面開啟()
  306. End Sub
  307. Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
  308. 介面 = "H208" : 語言轉換讀取()
  309. Set_清單1() : Set_清單2() : Set_清單()
  310. End Sub
  311. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  312. timeNow = 0
  313. HX_PGS_ERP_SYS.Timer1.Enabled = False
  314. HX_PGS_ERP_SYS.Timer1.Enabled = True
  315. End Sub
  316. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  317. timeNow = 0
  318. HX_PGS_ERP_SYS.Timer1.Enabled = False
  319. HX_PGS_ERP_SYS.Timer1.Enabled = True
  320. End Sub
  321. Dim 已超出 As Boolean
  322. Private Sub 明細_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 明細_dgv.MouseUp
  323. 'If 明細_dgv.SelectedCells.Count = 1 Then : MsgBox(明細_dgv.SelectedCells(0).ColumnIndex & " " & 明細_dgv.SelectedCells(0).RowIndex) : End If
  324. If 明細_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
  325. If 明細_dgv.SelectedCells.Count > 0 Then
  326. If 明細_dgv.SelectedCells(0).ColumnIndex = 8 Then
  327. If 已超出 = False Then
  328. Dim x As Double = 0
  329. For i As Integer = 0 To 明細_dgv.SelectedCells.Count - 1
  330. Dim 變數 As String = "" : Dim 取變數 As String
  331. 取變數 = 明細_dgv.Rows(明細_dgv.SelectedCells.Item(i).RowIndex).Cells(明細_dgv.SelectedCells.Item(i).ColumnIndex).Value
  332. For ii As Integer = 1 To Len(取變數)
  333. If ii = 1 Then : 變數 = Strings.Left(取變數, ii) : Else : If Strings.Mid(取變數, ii, 1) <> "," Then : 變數 &= Strings.Mid(取變數, ii, 1) : End If : End If
  334. Next : x += Val(變數)
  335. Next i : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(x, "#,##0")
  336. Else : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0")
  337. End If
  338. Else : 已超出 = True : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0")
  339. End If
  340. End If
  341. End Sub
  342. Private Sub 明細_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 明細_dgv.CellEnter
  343. 總金額_tb.Text = "0"
  344. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  345. 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value = 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value * 明細_dgv.Rows(i).Cells("" & 表頭(15) & "").Value
  346. 總金額_tb.Text = Val(總金額_tb.Text) + 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  347. Next i
  348. 總金額_tb.Text = Strings.Format(Val(總金額_tb.Text), "#,##0")
  349. End Sub
  350. Private Sub 明細_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 明細_dgv.CellClick
  351. If e.RowIndex = -1 Then : Else
  352. PA1 = 明細_dgv.Rows(e.RowIndex).Cells("群組碼").Value : PA2 = 明細_dgv.Rows(e.RowIndex).Cells("料號原則").Value
  353. SQL_物料圖庫_圖檔讀取()
  354. While dr.Read() = True
  355. Dim unused As Byte() = New Byte(-1) {}
  356. Dim bytes As Byte() = DirectCast(dr.Item("圖檔"), Byte())
  357. Dim oStream As New MemoryStream(bytes)
  358. 物料圖檔_pb.Image = Bitmap.FromStream(oStream)
  359. End While
  360. conn.Close() : 物料圖檔_pb.SizeMode = 4
  361. End If
  362. End Sub
  363. Private Sub 已核准_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 已核准_dgv.CellClick
  364. If e.RowIndex = -1 Then : Else
  365. 採購單號_tb.Text = 已核准_dgv(0, e.RowIndex).Value.ToString : 折扣比_tb.Text = 已核准_dgv(13, e.RowIndex).Value.ToString : 稅金計算_ch.Checked = 已核准_dgv(14, e.RowIndex).Value
  366. 稅金比_tb.Text = 已核准_dgv(15, e.RowIndex).Value.ToString : 核對員_tb.Text = 已核准_dgv(4, e.RowIndex).Value.ToString : 核對日期_tb.Text = 已核准_dgv(5, e.RowIndex).Value.ToString
  367. 詢價員_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
  368. 審核日期1_tb.Text = 已核准_dgv("一級核准核准日期", e.RowIndex).Value.ToString : 審核日期2_tb.Text = 已核准_dgv("核准日期", e.RowIndex).Value.ToString
  369. 採購人員_tb.Text = 已核准_dgv("採購員", e.RowIndex).Value.ToString : 採購日期_tb.Text = 已核准_dgv("採購日期", e.RowIndex).Value.ToString
  370. If Strings.Left(採購單號_tb.Text, 3) = "HXI" Then : 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL"
  371. ElseIf Strings.Left(採購單號_tb.Text, 3) = "PGS" Then : 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" : End If
  372. 供應商編碼_tb.Text = 已核准_dgv(1, e.RowIndex).Value.ToString : conn.Close()
  373. PA1 = 供應商編碼_tb.Text : SQL_建築物料採購單生成_供應商資料一()
  374. If dr.Read() Then : 廠商_cb.Text = dr("公司名") : conn.Close() : End If : conn.Close()
  375. 驗證碼_tb.Text = 已核准_dgv(11, e.RowIndex).Value.ToString : 圖片編碼_tb.Text = 已核准_dgv(10, e.RowIndex).Value.ToString
  376. 使用地點_tb.Text = 已核准_dgv(3, e.RowIndex).Value.ToString : 需求日期_dtp.Value = 已核准_dgv(2, e.RowIndex).Value
  377. PA1 = 已核准_dgv("一級核准簽名檔編號", e.RowIndex).Value.ToString : SQL_主管簽名檔管理_圖片流水號()
  378. 簽名檔1_pb.Image = Nothing
  379. While dr.Read() = True
  380. Dim unused As Byte() = New Byte(-1) {}
  381. Dim bytes As Byte() = DirectCast(dr.Item("簽名檔圖片"), Byte())
  382. Dim oStream As New MemoryStream(bytes)
  383. 簽名檔1_pb.Image = Bitmap.FromStream(oStream)
  384. End While
  385. conn.Close() : 簽名檔1_pb.SizeMode = 4
  386. Set_清單()
  387. QRCode_pb.Image = Nothing : QRCode2_pb.Image = Nothing
  388. QRCode_pb.Image = New Bitmap(QRCode_pb.Width, QRCode_pb.Height)
  389. QRCode2_pb.Image = New Bitmap(QRCode2_pb.Width, QRCode2_pb.Height)
  390. Dim GP As Graphics = Graphics.FromImage(QRCode_pb.Image)
  391. Dim GP2 As Graphics = Graphics.FromImage(QRCode2_pb.Image)
  392. QRCODE.Type = DotNetBarcode.Types.QRCode : QRCODE.QRQuitZone = 0 : QRCODE.QRWriteBar(驗證碼1_tb.Text, 0, 0, 14, GP)
  393. QRCODE.Type = DotNetBarcode.Types.QRCode : QRCODE.QRQuitZone = 0 : QRCODE.QRWriteBar(驗證碼1_tb.Text, 1, 1, 3.5, GP2)
  394. QRCode_pb.SizeMode = 4 : QRCode2_pb.SizeMode = 4
  395. End If
  396. End Sub
  397. Private Sub 已作廢_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 已作廢_dgv.CellClick
  398. If e.RowIndex = -1 Then : Else
  399. 採購單號_tb.Text = 已作廢_dgv(0, e.RowIndex).Value.ToString : 折扣比_tb.Text = 已作廢_dgv(13, e.RowIndex).Value.ToString : 稅金計算_ch.Checked = 已作廢_dgv(14, e.RowIndex).Value
  400. 稅金比_tb.Text = 已作廢_dgv(15, e.RowIndex).Value.ToString : 核對員_tb.Text = 已作廢_dgv(4, e.RowIndex).Value.ToString : 核對日期_tb.Text = 已作廢_dgv(5, e.RowIndex).Value.ToString
  401. 詢價員_tb.Text = 已作廢_dgv(6, e.RowIndex).Value.ToString : 尋價日期_tb.Text = 已作廢_dgv(7, e.RowIndex).Value.ToString
  402. If Strings.Left(採購單號_tb.Text, 3) = "HXI" Then : 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL"
  403. ElseIf Strings.Left(採購單號_tb.Text, 3) = "PGS" Then : 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" : End If
  404. 簽名檔1_pb.Image = Nothing
  405. 供應商編碼_tb.Text = 已作廢_dgv(1, e.RowIndex).Value.ToString : conn.Close()
  406. PA = 供應商編碼_tb.Text : SQL_建築物料採購單生成_供應商資料一()
  407. If dr.Read() Then : 廠商_cb.Text = dr("公司名") : conn.Close() : End If : conn.Close()
  408. 驗證碼_tb.Text = 已作廢_dgv(11, e.RowIndex).Value.ToString : 圖片編碼_tb.Text = 已作廢_dgv(10, e.RowIndex).Value.ToString
  409. 使用地點_tb.Text = 已作廢_dgv(3, e.RowIndex).Value.ToString : 需求日期_dtp.Value = 已作廢_dgv(2, e.RowIndex).Value
  410. Set_清單()
  411. End If
  412. End Sub
  413. Private Sub 廠商_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 廠商_cb.SelectedIndexChanged
  414. PA1 = 廠商_cb.Text : SQL_建築物料採購單生成_供應商資料二()
  415. If dr.Read() Then
  416. 供應商編碼_tb.Text = dr("供應商編碼") : 地址_tb.Text = dr("公司地址") : 電話_tb.Text = dr("公司電話1") : 郵件_tb.Text = dr("聯繫人1郵箱") : 傳真_tb.Text = dr("公司傳真1")
  417. End If
  418. conn.Close()
  419. End Sub
  420. Private Sub 圖片編碼_tb_TextChanged(sender As Object, e As EventArgs) Handles 圖片編碼_tb.TextChanged
  421. PA1 = 圖片編碼_tb.Text : SQL_主管簽名檔管理_圖片流水號()
  422. 簽名檔2_pb.Image = Nothing
  423. While dr.Read() = True
  424. Dim unused As Byte() = New Byte(-1) {}
  425. Dim bytes As Byte() = DirectCast(dr.Item("簽名檔圖片"), Byte())
  426. Dim oStream As New MemoryStream(bytes)
  427. 簽名檔2_pb.Image = Bitmap.FromStream(oStream)
  428. End While
  429. conn.Close() : 簽名檔2_pb.SizeMode = 4
  430. End Sub
  431. Private Sub 小間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 小間距1_ch.Click
  432. 小間距1_ch.Checked = True : 中間距1_ch.Checked = False : 大間距1_ch.Checked = False : MyModule1.間距設定存檔_1() : 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 = True : 大間距1_ch.Checked = False : MyModule1.間距設定存檔_2() : Set_清單()
  436. End Sub
  437. Private Sub 大間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 大間距1_ch.Click
  438. 小間距1_ch.Checked = False : 中間距1_ch.Checked = False : 大間距1_ch.Checked = True : MyModule1.間距設定存檔_3() : Set_清單()
  439. End Sub
  440. Private Sub 物料圖檔_pb_Click(sender As Object, e As EventArgs) Handles 物料圖檔_pb.Click
  441. If IsNothing(物料圖檔_pb.Image) = False Then : 圖片傳遞 = 物料圖檔_pb.Image : 圖片放大視窗.ShowDialog() : End If
  442. End Sub
  443. Private Sub 詳細資料2_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 詳細資料2_ch.Click
  444. If 詳細資料2_ch.Checked = True Then : 詳細資料2_ch.Checked = True : Else : 詳細資料2_ch.Checked = False : End If : Set_清單()
  445. End Sub
  446. Private Sub 確認列印_bt_Click_1(sender As Object, e As EventArgs) Handles 確認列印_bt.Click
  447. If 採購人員_tb.Text = "" Then
  448. SQL_物料採購單_首次列印() : 採購人員_tb.Text = gUserName : 採購日期_tb.Text = Today()
  449. End If
  450. xlApp = CType(CreateObject("Excel.Application"), Application)
  451. xlBook = xlApp.Workbooks.Add
  452. xlApp.DisplayAlerts = True
  453. xlBook.Activate()
  454. xlSheet = NewMethod(xlBook)
  455. xlSheet.Activate()
  456. xlApp.Visible = True
  457. xlApp.Application.WindowState = xlMaximized
  458. xlSheet.Cells(2, 1) = 選擇公司_cb.Text : xlSheet.Cells(3, 1) = "PURCHASE ORDER"
  459. xlSheet.Cells(5, 1) = "ORDER TO : " & 廠商_cb.Text : xlSheet.Cells(6, 1) = "ALAMAT : " & 地址_tb.Text : xlSheet.Cells(7, 1) = "Telp : " & 電話_tb.Text
  460. xlSheet.Cells(8, 1) = "Fax : " & 傳真_tb.Text : xlSheet.Cells(9, 1) = "Email : " & 郵件_tb.Text
  461. 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"
  462. xlSheet.Cells(10, 6) = "QTY" : xlSheet.Cells(10, 7) = "UNIT PRICE" : xlSheet.Cells(10, 8) = "TOTAL PRICE"
  463. xlSheet.Cells(7, 5) = "PO NOMOR : " : xlSheet.Cells(7, 7) = 採購單號_tb.Text
  464. xlSheet.Cells(8, 5) = "TGL/BLN/THN : " : xlSheet.Cells(8, 7) = 需求日期_dtp.Value
  465. xlSheet.Cells(9, 5) = "TEMPAT PEMAKAIAN : " : xlSheet.Cells(9, 7) = 使用地點_tb.Text
  466. Dim GGHH As Integer = 0
  467. For i As Integer = 0 To 明細1_dgv.Rows.Count - 1
  468. xlSheet.Cells(i + 11, 1) = 明細1_dgv.Rows(i).Cells("" & 表頭(11) & "").Value : xlSheet.Cells(i + 11, 2) = 明細1_dgv.Rows(i).Cells("" & 表頭(12) & "").Value
  469. xlSheet.Cells(i + 11, 3) = 明細1_dgv.Rows(i).Cells("" & 表頭(13) & "").Value : xlSheet.Cells(i + 11, 4) = 明細1_dgv.Rows(i).Cells("" & 表頭(14) & "").Value
  470. xlSheet.Cells(i + 11, 5) = 明細1_dgv.Rows(i).Cells("" & 表頭(16) & "").Value : xlSheet.Cells(i + 11, 6) = 明細1_dgv.Rows(i).Cells("" & 表頭(15) & "").Value
  471. xlSheet.Cells(i + 11, 7) = 明細1_dgv.Rows(i).Cells("" & 表頭(26) & "").Value : xlSheet.Cells(i + 11, 8) = 明細1_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  472. GGHH += 明細1_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  473. N1 = i + 11
  474. Next i
  475. xlSheet.Cells(N1 + 2, 7) = "TOTAL :" : xlSheet.Cells(N1 + 2, 8) = GGHH
  476. xlSheet.Cells(N1 + 3, 7) = "DISC " & 折扣比_tb.Text & "% :" : xlSheet.Cells(N1 + 3, 8) = 折扣金額_tb.Text
  477. xlSheet.Cells(N1 + 4, 7) = "PPN " & 稅金比_tb.Text & "% :" : xlSheet.Cells(N1 + 4, 8) = 稅金金額_tb.Text
  478. xlSheet.Cells(N1 + 5, 7) = "GRAND TOTAL :" : xlSheet.Cells(N1 + 5, 8) = 總金額_tb.Text
  479. xlSheet.Cells(N1 + 6, 1) = "Bagian Pembelian Barang" : xlSheet.Cells(N1 + 8, 1) = 採購人員_tb.Text : xlSheet.Cells(N1 + 9, 1) = 採購日期_tb.Text
  480. xlSheet.Cells(N1 + 6, 3) = "Direktur Utama" : xlSheet.Cells(N1 + 9, 3) = 審核日期2_tb.Text
  481. xlSheet.Cells(N1 + 6, 4) = "Bagian Pemeriksa" : xlSheet.Cells(N1 + 9, 4) = 審核日期1_tb.Text
  482. xlSheet.Cells(N1 + 6, 6) = "Bagian Pengisian Harga" : xlSheet.Cells(N1 + 8, 6) = 詢價員_tb.Text : xlSheet.Cells(N1 + 9, 6) = 尋價日期_tb.Text
  483. xlSheet.Cells(N1 + 6, 8) = "Asisten Proyek" : xlSheet.Cells(N1 + 8, 8) = 核對員_tb.Text : xlSheet.Cells(N1 + 9, 8) = 核對日期_tb.Text
  484. AA(xlApp, xlSheet) : DD(xlApp, xlSheet) : EE(xlApp, xlSheet) : CC(xlApp, xlSheet)
  485. xlSheet.PageSetup.PrintArea = ""
  486. xlApp.Cells.Select()
  487. xlSheet.Range("B1").Select()
  488. xlApp.Application.WindowState = xlMinimized
  489. xlSheet.Cells.Select()
  490. xlApp.ActiveSheet.Protect(DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="0911274990")
  491. xlApp.ActiveSheet.EnableSelection = 1
  492. MsgBox(對話框(0))
  493. End Sub
  494. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  495. Return CType(xlBook.Worksheets.Add, Worksheet)
  496. End Function
  497. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  498. xlSheet.Cells.Select()
  499. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  500. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  501. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 24
  502. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 35 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 20
  503. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 15
  504. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 15 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 30
  505. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 5 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 35
  506. xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 5
  507. xlSheet.Rows("5:9").Select : myExcel.Selection.RowHeight = 20 : xlSheet.Rows("10:10").Select : myExcel.Selection.RowHeight = 20
  508. xlSheet.Rows("11:" & N1).Select : myExcel.Selection.RowHeight = 65 : xlSheet.Rows(N1 + 1 & ":" & N1 + 1).Select : myExcel.Selection.RowHeight = 5
  509. xlSheet.Rows(N1 + 2 & ":" & N1 + 5).Select : myExcel.Selection.RowHeight = 17 : xlSheet.Rows(N1 + 6 & ":" & N1 + 6).Select : myExcel.Selection.RowHeight = 35
  510. xlSheet.Rows(N1 + 7 & ":" & N1 + 9).Select : myExcel.Selection.RowHeight = 35
  511. xlSheet.Range("A2:H2").Select()
  512. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  513. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  514. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 26 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  515. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  516. xlSheet.Range("A3:H3").Select()
  517. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  518. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  519. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 16 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  520. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  521. xlSheet.Range("A10:H" & N1).Select()
  522. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  523. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  524. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  525. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  526. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  527. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  528. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  529. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 2).Select()
  530. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  531. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  532. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  533. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  534. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  535. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  536. xlSheet.Range("A" & N1 + 3 & ":H" & N1 + 3).Select()
  537. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  538. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  539. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  540. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  541. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  542. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  543. xlSheet.Range("A" & N1 + 4 & ":H" & N1 + 4).Select()
  544. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  545. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  546. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  547. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  548. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  549. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  550. xlSheet.Range("A" & N1 + 5 & ":H" & N1 + 5).Select()
  551. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  552. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  553. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  554. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  555. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  556. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  557. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 6).Select()
  558. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  559. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  560. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  561. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  562. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  563. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  564. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  565. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  566. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 6).Select()
  567. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  568. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  569. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  570. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  571. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  572. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  573. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  574. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  575. xlSheet.Range("D" & N1 + 6 & ":E" & N1 + 6).Select()
  576. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  577. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  578. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  579. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  580. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  581. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  582. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  583. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  584. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 6).Select()
  585. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  586. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  587. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  588. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  589. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  590. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  591. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  592. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  593. xlSheet.Range("H" & N1 + 6).Select()
  594. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  595. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  596. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  597. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  598. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  599. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  600. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  601. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  602. xlSheet.Range("A" & N1 + 7 & ":B" & N1 + 9).Select()
  603. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  604. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  605. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  606. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  607. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  608. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  609. xlSheet.Range("C" & N1 + 7 & ":C" & N1 + 9).Select()
  610. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  611. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  612. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  613. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  614. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  615. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  616. xlSheet.Range("D" & N1 + 7 & ":E" & N1 + 9).Select()
  617. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  618. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  619. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  620. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  621. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  622. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  623. xlSheet.Range("F" & N1 + 7 & ":G" & N1 + 9).Select()
  624. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  625. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  626. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  627. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  628. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  629. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  630. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  631. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  632. xlSheet.Range("H" & N1 + 7 & ":H" & N1 + 9).Select()
  633. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  634. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  635. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  636. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  637. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  638. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  639. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  640. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  641. xlSheet.Range("A10:A" & N1).Select()
  642. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  643. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  644. xlSheet.Range("B11:D" & N1).Select()
  645. With myExcel.Selection
  646. .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  647. .ReadingOrder = xlContext : .MergeCells = False : End With
  648. xlSheet.Range("E11:F" & N1).Select()
  649. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  650. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  651. xlSheet.Range("G11:H" & N1).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  652. xlSheet.Range("H" & N1 + 2).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  653. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).Select()
  654. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  655. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  656. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  657. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  658. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  659. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  660. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  661. myExcel.ActiveWindow.DisplayGridlines = False
  662. xlSheet.Range("A3:H3").Select()
  663. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  664. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  665. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  666. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  667. xlSheet.Range("G7:G9").Select()
  668. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  669. .ReadingOrder = xlContext : .MergeCells = False : End With
  670. xlSheet.Range("A10:H" & N1).Select()
  671. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  672. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  673. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  674. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  675. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  676. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  677. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  678. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).Select()
  679. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  680. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  681. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  682. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  683. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  684. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  685. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 9).Select()
  686. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  687. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  688. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  689. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  690. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  691. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  692. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 9).Select()
  693. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  694. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  695. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  696. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  697. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  698. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  699. xlSheet.Range("D" & N1 + 6 & ":E" & N1 + 9).Select()
  700. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  701. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  702. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  703. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  704. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  705. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  706. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 9).Select()
  707. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  708. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  709. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  710. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  711. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  712. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  713. xlSheet.Range("H" & N1 + 6 & ":H" & N1 + 9).Select()
  714. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  715. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  716. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  717. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  718. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  719. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  720. xlSheet.Rows("5:9").Select
  721. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  722. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  723. xlSheet.Rows("11:" & N1).Select
  724. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  725. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  726. xlSheet.Range("A10:H10").Select()
  727. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  728. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  729. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  730. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  731. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  732. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  733. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  734. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  735. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  736. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  737. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  738. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  739. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  740. xlSheet.Range("A11:H" & N1).Select()
  741. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  742. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  743. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  744. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  745. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  746. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  747. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  748. xlSheet.Range("B11:D" & N1).Select()
  749. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  750. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  751. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  752. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  753. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  754. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  755. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  756. xlSheet.Range("F11:F" & N1).Select()
  757. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  758. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  759. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  760. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  761. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  762. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  763. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  764. xlSheet.Range("H11:H" & N1).Select()
  765. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  766. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  767. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  768. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  769. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  770. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  771. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  772. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).Select()
  773. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  774. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  775. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  776. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  777. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  778. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  779. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).Select()
  780. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  781. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  782. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  783. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  784. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  785. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  786. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  787. xlSheet.Range("G" & N1 + 2 & ":G" & N1 + 5).Select()
  788. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  789. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  790. xlSheet.Range("F" & N1 + 8 & ":G" & N1 + 8).Select()
  791. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  792. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  793. xlSheet.Range("F" & N1 + 9 & ":G" & N1 + 9).Select()
  794. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  795. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  796. xlSheet.Range("A" & N1 + 8 & ":B" & N1 + 8).Select()
  797. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  798. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  799. xlSheet.Range("A" & N1 + 9 & ":B" & N1 + 9).Select()
  800. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  801. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  802. xlSheet.Range("C" & N1 + 9).Select()
  803. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  804. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  805. myExcel.Application.PrintCommunication = False
  806. With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "$1:$10" : .PrintTitleColumns = "" : End With
  807. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  808. With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "" : .RightFooter = ""
  809. .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
  810. .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
  811. .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
  812. .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = True : .CenterVertically = False : .Draft = False : .FirstPageNumber = xlAutomatic
  813. .BlackAndWhite = False : .Zoom = 60 : .OddAndEvenPagesHeaderFooter = False : .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True
  814. .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = ""
  815. .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = ""
  816. .FirstPage.CenterHeader.Text = "" : .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = ""
  817. .FirstPage.RightFooter.Text = ""
  818. End With
  819. myExcel.Application.PrintCommunication = True
  820. End Sub
  821. Private Sub CC(ByVal myExcel As Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  822. Clipboard.SetDataObject(簽名檔2_pb.Image)
  823. xlSheet.Range("C" & N1 + 8).Select()
  824. myExcel.ActiveSheet.Pictures.Paste.Select
  825. myExcel.Selection.ShapeRange.Height = 50
  826. myExcel.Selection.ShapeRange.IncrementLeft(2)
  827. myExcel.Selection.ShapeRange.IncrementTop(-23)
  828. End Sub
  829. Private Sub DD(ByVal myExcel As Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  830. Clipboard.SetDataObject(QRCode_pb.Image)
  831. xlSheet.Range("H5").Select()
  832. myExcel.ActiveSheet.Pictures.Paste.Select
  833. myExcel.Selection.ShapeRange.Height = 90
  834. myExcel.Selection.ShapeRange.IncrementLeft(70)
  835. myExcel.Selection.ShapeRange.IncrementTop(1)
  836. End Sub
  837. Private Sub EE(ByVal myExcel As Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  838. Clipboard.SetDataObject(簽名檔1_pb.Image)
  839. xlSheet.Range("D" & N1 + 8).Select()
  840. myExcel.ActiveSheet.Pictures.Paste.Select
  841. myExcel.Selection.ShapeRange.Height = 50
  842. myExcel.Selection.ShapeRange.IncrementLeft(2)
  843. myExcel.Selection.ShapeRange.IncrementTop(-23)
  844. End Sub
  845. '-----------------------------滑鼠右鍵--------------------------------------------------------------------------------------------------------------------------------------
  846. Private Sub 重新整理SegarkanToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新整理_tsm.Click
  847. Set_清單1() : Set_清單2()
  848. End Sub
  849. End Class