설명 없음
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 77KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  1. Option Strict Off
  2. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  3. Imports Microsoft.Office.Interop.Excel.Constants
  4. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  5. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  6. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  7. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  8. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  9. Imports Microsoft.Office.Interop.Excel.XlWindowState
  10. Imports Microsoft.Office.Interop.Excel
  11. Public Class 樣品採購單編輯
  12. ReadOnly ds8 As New DataSet : Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
  13. Dim 新項次 As String : Dim NUM1 As Integer : Dim N1 As Integer
  14. Dim QQQ1 As String : Dim QQQ2 As String : Dim QQQ3 As String : Dim 採購選擇 As String : ReadOnly 對話框(7) As String
  15. Private Sub Set_明細清單()
  16. Dim ds As New DataSet : 明細_dgv.DataSource = Nothing : ds.Clear()
  17. 明細_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  18. 明細_dgv.ColumnHeadersHeight = 40
  19. 明細_dgv.AllowUserToAddRows = False
  20. If 小間距1_ch.Checked = False And 中間距1_ch.Checked = False And 大間距1_ch.Checked = True Then
  21. 明細_dgv.RowTemplate.Height = 75
  22. ElseIf 小間距1_ch.Checked = False And 中間距1_ch.Checked = True And 大間距1_ch.Checked = False Then
  23. 明細_dgv.RowTemplate.Height = 45
  24. ElseIf 小間距1_ch.Checked = True And 中間距1_ch.Checked = False And 大間距1_ch.Checked = False Then
  25. 明細_dgv.RowTemplate.Height = 25
  26. End If
  27. PA1 = QQQ1 : PA2 = 採購單號_tb.Text : SQL_行政物料採購單生成_明細()
  28. da.Fill(ds) : 明細_dgv.DataSource = ds.Tables(0) : conn.Close()
  29. 明細_dgv.Columns(0).Visible = False : 明細_dgv.Columns(1).FillWeight = 80 : 明細_dgv.Columns(2).FillWeight = 250 : 明細_dgv.Columns(3).FillWeight = 250
  30. 明細_dgv.Columns(4).FillWeight = 220 : 明細_dgv.Columns(5).FillWeight = 80 : 明細_dgv.Columns(6).FillWeight = 80 : 明細_dgv.Columns(7).FillWeight = 80
  31. 明細_dgv.Columns(8).FillWeight = 80 : 明細_dgv.Columns(9).FillWeight = 80 : 明細_dgv.Columns(10).Visible = False : 明細_dgv.Columns(11).Visible = False
  32. 明細_dgv.Columns(12).FillWeight = 90
  33. 明細_dgv.Columns(5).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(7).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(8).DefaultCellStyle.Format = "#,##0"
  34. 明細_dgv.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  35. 明細_dgv.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  36. 明細_dgv.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns(5).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  37. 明細_dgv.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  38. 明細_dgv.EditMode = DataGridViewEditMode.EditOnEnter
  39. 明細_dgv.Columns(1).ReadOnly = True : 明細_dgv.Columns(8).ReadOnly = True
  40. If 生成採購單_bt.Enabled = True Then
  41. 明細_dgv.Columns(12).Visible = False
  42. End If
  43. Dim FFGG As Integer = 0
  44. 總金額_tb.Text = "0"
  45. If 生成採購單_bt.Enabled = True And 修改的採購單存檔_bt.Enabled = False Then
  46. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  47. 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value = "0.0"
  48. 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value = 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value * 明細_dgv.Rows(i).Cells("" & 表頭(15) & "").Value
  49. FFGG = Val(FFGG) + 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  50. 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = False
  51. Next i
  52. ElseIf 生成採購單_bt.Enabled = False And 修改的採購單存檔_bt.Enabled = True Then
  53. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  54. 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value = 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value * 明細_dgv.Rows(i).Cells("" & 表頭(15) & "").Value
  55. FFGG = Val(FFGG) + 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  56. 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = True
  57. Next i
  58. End If
  59. 折扣金額_tb.Text = Val(折扣比_tb.Text) * FFGG / 100
  60. If 稅金計算_ch.Checked = True Then
  61. If 折扣比_tb.Text = "0" Then
  62. 稅金金額_tb.Text = FFGG * Val(稅金比_tb.Text) / 100
  63. Else
  64. 稅金金額_tb.Text = (FFGG - 折扣金額_tb.Text) * Val(稅金比_tb.Text) / 100
  65. End If
  66. Else
  67. 稅金金額_tb.Text = "0"
  68. End If
  69. 新項次 = "00"
  70. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  71. NUM1 = Double.Parse(新項次) + 1
  72. If NUM1 < 10 Then : 新項次 = "0" & NUM1
  73. ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1
  74. End If
  75. 明細_dgv.Rows(i).Cells("" & 表頭(11) & "").Value = 新項次
  76. Next i
  77. 總金額_tb.Text = FFGG - Val(折扣金額_tb.Text) + Val(稅金金額_tb.Text)
  78. 折扣金額_tb.Text = Strings.Format(Val(折扣金額_tb.Text), "#,##0") : 稅金金額_tb.Text = Strings.Format(Val(稅金金額_tb.Text), "#,##0")
  79. 總金額_tb.Text = Strings.Format(Val(總金額_tb.Text), "#,##0")
  80. '-------------------------------------------------
  81. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  82. If IsDBNull(明細_dgv.Rows(i).Cells("樣品請購單號").Value) Then
  83. 明細_dgv.Rows(i).Cells("樣品請購單號").Value = False
  84. End If
  85. Next
  86. End Sub
  87. Private Sub Set_清單1()
  88. Dim ds1 As New DataSet : 請購單_dgv.DataSource = Nothing : ds1.Clear()
  89. 請購單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  90. 請購單_dgv.ColumnHeadersHeight = 25
  91. 請購單_dgv.AllowUserToAddRows = False
  92. SQL_行政物料採購單生成_請購()
  93. da.Fill(ds1) : 請購單_dgv.DataSource = ds1.Tables(0) : conn.Close()
  94. 請購單_dgv.Columns(0).FillWeight = 125 : 請購單_dgv.Columns(1).Visible = False : 請購單_dgv.Columns(2).Visible = False : 請購單_dgv.Columns(3).Visible = False
  95. 請購單_dgv.Columns(4).Visible = False : 請購單_dgv.Columns(5).Visible = False : 請購單_dgv.Columns(6).Visible = False : 請購單_dgv.Columns(7).Visible = False
  96. End Sub
  97. Private Sub Set_清單2()
  98. Dim ds2 As New DataSet : 採購單_dgv.DataSource = Nothing : ds2.Clear()
  99. 採購單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  100. 採購單_dgv.ColumnHeadersHeight = 25
  101. 採購單_dgv.AllowUserToAddRows = False
  102. SQL_行政物料採購單生成_採購()
  103. da.Fill(ds2) : 採購單_dgv.DataSource = ds2.Tables(0) : conn.Close()
  104. 採購單_dgv.Columns(0).FillWeight = 125 : 採購單_dgv.Columns(1).Visible = False : 採購單_dgv.Columns(2).Visible = False : 採購單_dgv.Columns(3).Visible = False
  105. 採購單_dgv.Columns(4).Visible = False : 採購單_dgv.Columns(5).Visible = False : 採購單_dgv.Columns(6).Visible = False : 採購單_dgv.Columns(7).Visible = False
  106. 採購單_dgv.Columns(8).Visible = False : 採購單_dgv.Columns(9).Visible = False : 採購單_dgv.Columns(10).Visible = False : 採購單_dgv.Columns(11).Visible = False
  107. 採購單_dgv.Columns(12).Visible = False : 採購單_dgv.Columns(13).Visible = False : 採購單_dgv.Columns(14).Visible = False : 採購單_dgv.Columns(15).Visible = False
  108. End Sub
  109. Private Sub 總金額計算()
  110. Dim FFGG As Integer = 0
  111. 總金額_tb.Text = "0"
  112. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  113. 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value = 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value * 明細_dgv.Rows(i).Cells("" & 表頭(15) & "").Value
  114. FFGG = Val(FFGG) + 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  115. Next i
  116. 折扣金額_tb.Text = Val(折扣比_tb.Text) * FFGG / 100
  117. If 稅金計算_ch.Checked = True Then
  118. If 折扣比_tb.Text = "0" Then
  119. 稅金金額_tb.Text = FFGG * Val(稅金比_tb.Text) / 100
  120. Else
  121. 稅金金額_tb.Text = (FFGG - 折扣金額_tb.Text) * Val(稅金比_tb.Text) / 100
  122. End If
  123. Else
  124. 稅金金額_tb.Text = "0"
  125. End If
  126. 總金額_tb.Text = FFGG - Val(折扣金額_tb.Text) + Val(稅金金額_tb.Text)
  127. 折扣金額_tb.Text = Strings.Format(Val(折扣金額_tb.Text), "#,##0") : 稅金金額_tb.Text = Strings.Format(Val(稅金金額_tb.Text), "#,##0")
  128. 總金額_tb.Text = Strings.Format(Val(總金額_tb.Text), "#,##0")
  129. End Sub
  130. Private Sub 類別管理_cb_下拉表單資料載入()
  131. SQL_供應商類別_下拉清單() : 類別管理_cb.Items.Clear()
  132. While (dr.Read()) : 類別管理_cb.Items.Add(dr("類別")) : End While : conn.Close()
  133. End Sub
  134. Private Sub 廠商_cb_下拉表單資料載入()
  135. SQL_供應商資料表_公司名_下拉用() : 廠商_cb.Items.Clear() : While (dr.Read()) : 廠商_cb.Items.Add(dr("公司名")) : End While : conn.Close()
  136. End Sub
  137. Private Sub Set_語言()
  138. 語言_dgv.DataSource = Nothing : ds8.Clear()
  139. 語言_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  140. 語言_dgv.ColumnHeadersHeight = 25
  141. 語言_dgv.AllowUserToAddRows = False
  142. SQL_系統語言導入()
  143. da.Fill(ds8) : 語言_dgv.DataSource = ds8.Tables(0) : conn.Close()
  144. End Sub
  145. Private Sub 語言轉換讀取()
  146. Set_語言() : conn.Close()
  147. For i As Integer = 0 To 語言_dgv.Rows.Count - 1
  148. If 語言_dgv("控件", i).Value.ToString = "行政物料採購單生成" Then : Me.Text = 語言_dgv("內容", i).Value.ToString : End If
  149. If 語言_dgv("控件", i).Value.ToString = "簡稱_lb" Then : 簡稱_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  150. If 語言_dgv("控件", i).Value.ToString = "核准請購未生成_lb" Then : 核准請購未生成_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  151. If 語言_dgv("控件", i).Value.ToString = "已生未核准的採購單_lb" Then : 已生未核准的採購單_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  152. If 語言_dgv("控件", i).Value.ToString = "總金額_lb" Then : 總金額_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  153. If 語言_dgv("控件", i).Value.ToString = "選擇公司_lb" Then : 選擇公司_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  154. If 語言_dgv("控件", i).Value.ToString = "生成採購單_bt" Then : 生成採購單_bt.Text = 語言_dgv("內容", i).Value.ToString : End If
  155. If 語言_dgv("控件", i).Value.ToString = "列印成詢價單_bt" Then : 列印成詢價單_bt.Text = 語言_dgv("內容", i).Value.ToString : End If
  156. If 語言_dgv("控件", i).Value.ToString = "重新整理_tsm" Then : 重新整理_tsm.Text = 語言_dgv("內容", i).Value.ToString : End If
  157. If 語言_dgv("控件", i).Value.ToString = "生成新的採購訂單_tsm" Then : 生成採購單_bt.Text = 語言_dgv("內容", i).Value.ToString : End If
  158. If 語言_dgv("控件", i).Value.ToString = "修改的採購單存檔_tsm" Then : 修改的採購單存檔_bt.Text = 語言_dgv("內容", i).Value.ToString : End If
  159. If 語言_dgv("控件", i).Value.ToString = "全部選擇_tsm" Then : 全部選擇_bt.Text = 語言_dgv("內容", i).Value.ToString : End If
  160. If 語言_dgv("控件", i).Value.ToString = "全部取消_tsm" Then : 全部取消_bt.Text = 語言_dgv("內容", i).Value.ToString : End If
  161. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_項次" Then : 表頭(11) = 語言_dgv("內容", i).Value.ToString : End If
  162. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_品名" Then : 表頭(12) = 語言_dgv("內容", i).Value.ToString : End If
  163. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_規格" Then : 表頭(13) = 語言_dgv("內容", i).Value.ToString : End If
  164. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_備註" Then : 表頭(14) = 語言_dgv("內容", i).Value.ToString : End If
  165. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_數量" Then : 表頭(15) = 語言_dgv("內容", i).Value.ToString : End If
  166. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_單位" Then : 表頭(16) = 語言_dgv("內容", i).Value.ToString : End If
  167. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_單價" Then : 表頭(26) = 語言_dgv("內容", i).Value.ToString : End If
  168. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_單號" Then : 表頭(18) = 語言_dgv("內容", i).Value.ToString : End If
  169. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_金額" Then : 表頭(27) = 語言_dgv("內容", i).Value.ToString : End If
  170. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_已採購" Then : 表頭(28) = 語言_dgv("內容", i).Value.ToString : End If
  171. If 語言_dgv("控件", i).Value.ToString = "對話框1" Then : 對話框(0) = 語言_dgv("內容", i).Value.ToString : End If
  172. If 語言_dgv("控件", i).Value.ToString = "對話框2" Then : 對話框(1) = 語言_dgv("內容", i).Value.ToString : End If
  173. If 語言_dgv("控件", i).Value.ToString = "對話框3" Then : 對話框(2) = 語言_dgv("內容", i).Value.ToString : End If
  174. If 語言_dgv("控件", i).Value.ToString = "對話框4" Then : 對話框(3) = 語言_dgv("內容", i).Value.ToString : End If
  175. If 語言_dgv("控件", i).Value.ToString = "文字_lb" Then : 文字_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
  176. If 語言_dgv("控件", i).Value.ToString = "退回請購訂單_bt" Then : 退回請購訂單_bt.Text = 語言_dgv("內容", i).Value.ToString : End If
  177. If 語言_dgv("控件", i).Value.ToString = "對話框5" Then : 對話框(4) = 語言_dgv("內容", i).Value.ToString : End If
  178. If 語言_dgv("控件", i).Value.ToString = "對話框6" Then : 對話框(5) = 語言_dgv("內容", i).Value.ToString : End If
  179. If 語言_dgv("控件", i).Value.ToString = "對話框7" Then : 對話框(6) = 語言_dgv("內容", i).Value.ToString : End If
  180. If 語言_dgv("控件", i).Value.ToString = "對話框8" Then : 對話框(7) = 語言_dgv("內容", i).Value.ToString : End If
  181. If 語言_dgv("控件", i).Value.ToString = "清單_dgv_申請人" Then : 表頭(19) = 語言_dgv("內容", i).Value.ToString : End If
  182. Next
  183. End Sub
  184. Private Sub 樣品採購單編輯_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  185. Me.MdiParent = HX_PGS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  186. H(214) = True : 介面 = "H214" : 語言轉換讀取()
  187. 類別管理_cb_下拉表單資料載入()
  188. 地址_tb.Enabled = False : 電話_tb.Enabled = False : 郵件_tb.Enabled = False : 採購單號_tb.Enabled = False : 傳真_tb.Enabled = False : 供應商編碼_tb.Visible = False
  189. 修改的採購單存檔_bt.Enabled = True : 生成採購單_bt.Enabled = True : 核對員_tb.Visible = False : 核對日期_tb.Visible = False : 文字_lb.Visible = True
  190. 詢價員_tb.Visible = False : 尋價日期_tb.Visible = False : 折扣金額_tb.Enabled = False : 稅金金額_tb.Enabled = False : 總金額_tb.Enabled = False
  191. SQL_清單欄位查詢()
  192. If Acdr.Read() Then
  193. 小間距1_ch.Checked = Acdr("L_1_1") : 中間距1_ch.Checked = Acdr("L_2_1") : 大間距1_ch.Checked = Acdr("L_3_1")
  194. End If : Access1.Close()
  195. PA = "" : 廠商_cb_下拉表單資料載入() : Set_清單1() : Set_清單2()
  196. MyModule1.清單字體大小調整()
  197. 採購單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  198. 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  199. 採購單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  200. End Sub
  201. Private Sub 樣品採購單編輯_SizeChanged(sender As Object, e As EventArgs) Handles MyBase.SizeChanged
  202. MyModule1.清單字體大小調整()
  203. 採購單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  204. 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  205. 採購單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  206. End Sub
  207. Private Sub 採購單詢價_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
  208. H(214) = False : MyModule1.虛擬桌面開啟()
  209. End Sub
  210. Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
  211. 介面 = "H214" : 語言轉換讀取() : Set_清單2() : Set_清單1() : Set_明細清單()
  212. End Sub
  213. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  214. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  215. End Sub
  216. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  217. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  218. End Sub
  219. Dim 已超出 As Boolean
  220. Private Sub 明細_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 明細_dgv.MouseUp
  221. 'If 明細_dgv.SelectedCells.Count = 1 Then : MsgBox(明細_dgv.SelectedCells(0).ColumnIndex & " " & 明細_dgv.SelectedCells(0).RowIndex) : End If
  222. If 明細_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
  223. If 明細_dgv.SelectedCells.Count > 0 Then
  224. If 明細_dgv.SelectedCells(0).ColumnIndex = 8 Then
  225. If 已超出 = False Then
  226. Dim x As Double = 0
  227. For i As Integer = 0 To 明細_dgv.SelectedCells.Count - 1
  228. Dim 變數 As String = "" : Dim 取變數 As String
  229. 取變數 = 明細_dgv.Rows(明細_dgv.SelectedCells.Item(i).RowIndex).Cells(明細_dgv.SelectedCells.Item(i).ColumnIndex).Value
  230. For ii As Integer = 1 To Len(取變數)
  231. If ii = 1 Then : 變數 = Strings.Left(取變數, ii) : Else : If Strings.Mid(取變數, ii, 1) <> "," Then : 變數 &= Strings.Mid(取變數, ii, 1) : End If : End If
  232. Next : x += Val(變數)
  233. Next i : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(x, "#,##0")
  234. Else : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0")
  235. End If
  236. Else : 已超出 = True : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0")
  237. End If
  238. End If
  239. End Sub
  240. Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 明細_dgv.CellEndEdit
  241. 總金額計算()
  242. End Sub
  243. Private Sub DataGridView2_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 請購單_dgv.CellClick
  244. 生成採購單_bt.Enabled = True : 修改的採購單存檔_bt.Enabled = False : 選擇公司_cb.Enabled = True : 採購選擇 = "A" : 退回請購訂單_bt.Enabled = False : 列印成詢價單_bt.Enabled = False
  245. If e.RowIndex = -1 Then : Else
  246. QQQ1 = 請購單_dgv(0, e.RowIndex).Value.ToString
  247. QQQ2 = 請購單_dgv(3, e.RowIndex).Value.ToString
  248. QQQ3 = 請購單_dgv(4, e.RowIndex).Value.ToString
  249. 折扣比_tb.Text = "0" : 稅金計算_ch.Checked = True : 稅金比_tb.Text = "10" : 採購單號_tb.Text = ""
  250. End If : Set_明細清單()
  251. End Sub
  252. Private Sub DataGridView3_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 採購單_dgv.CellClick
  253. 生成採購單_bt.Enabled = False : 修改的採購單存檔_bt.Enabled = True : 選擇公司_cb.Enabled = False : 採購選擇 = "B" : 退回請購訂單_bt.Enabled = True :: 列印成詢價單_bt.Enabled = True
  254. If e.RowIndex = -1 Then : Else
  255. 類別管理_cb_下拉表單資料載入() : PA = "" : 廠商_cb_下拉表單資料載入()
  256. 採購單號_tb.Text = 採購單_dgv(0, e.RowIndex).Value.ToString : 折扣比_tb.Text = 採購單_dgv(13, e.RowIndex).Value.ToString : 稅金計算_ch.Checked = 採購單_dgv(14, e.RowIndex).Value
  257. 稅金比_tb.Text = 採購單_dgv(15, e.RowIndex).Value.ToString : 核對員_tb.Text = 採購單_dgv(4, e.RowIndex).Value.ToString : 核對日期_tb.Text = 採購單_dgv(5, e.RowIndex).Value.ToString
  258. 詢價員_tb.Text = 採購單_dgv(6, e.RowIndex).Value.ToString : 尋價日期_tb.Text = 採購單_dgv(7, e.RowIndex).Value.ToString
  259. If Strings.Left(採購單號_tb.Text, 3) = "HXI" Then : 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL"
  260. ElseIf Strings.Left(採購單號_tb.Text, 3) = "PGS" Then : 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" : End If
  261. 供應商編碼_tb.Text = 採購單_dgv(1, e.RowIndex).Value.ToString : conn.Close() : PA1 = 供應商編碼_tb.Text
  262. SQL_行政物料採購單生成_供應商資料一()
  263. If dr.Read() Then : 廠商_cb.Text = dr("公司名") : conn.Close() : End If : conn.Close()
  264. 使用地點_tb.Text = 採購單_dgv(3, e.RowIndex).Value.ToString : 需求日期_dtp.Value = 採購單_dgv(2, e.RowIndex).Value
  265. Set_明細清單()
  266. End If
  267. End Sub
  268. Private Sub Set_日期格式轉換()
  269. DTP = Strings.Format(Today(), "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd") : DTP2 = Strings.Format(需求日期_dtp.Value, "yyyy/MM/dd")
  270. End Sub
  271. Private Sub 類別管理_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 類別管理_cb.SelectedIndexChanged
  272. PA20 = 類別管理_cb.Text : SQL_供應商類別管理_查詢()
  273. If dr.Read() Then : 供應商簡稱_tb.Text = dr("編碼").ToString : Else : 供應商簡稱_tb.Text = "" : End If
  274. PA = 供應商簡稱_tb.Text : 廠商_cb_下拉表單資料載入()
  275. End Sub
  276. Private Sub 廠商_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 廠商_cb.SelectedIndexChanged
  277. PA1 = 廠商_cb.Text : SQL_建築物料採購單生成_供應商資料二()
  278. If dr.Read() Then
  279. 供應商編碼_tb.Text = dr("供應商編碼") : 地址_tb.Text = dr("公司地址") : 電話_tb.Text = dr("公司電話1") : 郵件_tb.Text = dr("聯繫人1郵箱")
  280. 傳真_tb.Text = dr("公司傳真1") : End If
  281. conn.Close()
  282. End Sub
  283. Private Sub TextBox9_TextChanged(sender As Object, e As EventArgs) Handles 折扣比_tb.TextChanged
  284. 總金額計算()
  285. End Sub
  286. Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles 稅金計算_ch.CheckedChanged
  287. 總金額計算()
  288. End Sub
  289. Private Sub TextBox12_TextChanged(sender As Object, e As EventArgs) Handles 稅金比_tb.TextChanged
  290. 總金額計算()
  291. End Sub
  292. Private Sub 確定新增()
  293. Set_日期格式轉換()
  294. If 採購單號_tb.Text = "" Or 供應商編碼_tb.Text = "" Or 明細_dgv.Rows.Count = 0 Then
  295. MsgBox(對話框(0))
  296. Else
  297. PA1 = 採購單號_tb.Text : PA2 = 供應商編碼_tb.Text : PA3 = 使用地點_tb.Text : PA4 = QQQ2
  298. PA5 = QQQ3 : PA6 = QQQ1 : PA7 = 折扣比_tb.Text : BL1 = 稅金計算_ch.Checked : PA8 = 稅金比_tb.Text
  299. SQL_樣品採購單控制表_新增() : SQL_樣品請購單控制表_轉採修改() : conn.Close()
  300. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  301. 資料數 = 明細_dgv.Rows.Count : MyModule1.進度條()
  302. If 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = True Then
  303. PA9 = 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value : PA2 = 明細_dgv.Rows(i).Cells("" & 表頭(18) & "").Value : PA3 = 明細_dgv.Rows(i).Cells("" & 表頭(11) & "").Value
  304. PA4 = 明細_dgv.Rows(i).Cells("" & 表頭(12) & "").Value : PA5 = 明細_dgv.Rows(i).Cells("" & 表頭(13) & "").Value : PA6 = 明細_dgv.Rows(i).Cells("" & 表頭(14) & "").Value
  305. NU1 = 明細_dgv.Rows(i).Cells("" & 表頭(15) & "").Value : PA8 = 明細_dgv.Rows(i).Cells("" & 表頭(16) & "").Value : PA10 = 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value
  306. PA11 = 明細_dgv.Rows(i).Cells("" & 表頭(19) & "").Value
  307. SQL_樣品請購單明細表_轉採修改() : SQL_樣品採購單明細表_新增() : conn.Close()
  308. End If
  309. Next
  310. Set_清單1() : Set_清單2() : MsgBox(對話框(1)) : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  311. End If
  312. End Sub
  313. Private Sub 確定退回()
  314. Set_日期格式轉換()
  315. If 採購單號_tb.Text = "" Or 供應商編碼_tb.Text = "" Or 明細_dgv.Rows.Count = 0 Then
  316. MsgBox(對話框(4))
  317. Else
  318. Dim GG As Integer
  319. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  320. If 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = False Then
  321. GG += 1
  322. End If
  323. Next
  324. If 明細_dgv.Rows.Count = GG Then
  325. PA1 = 採購單號_tb.Text : PA2 = 供應商編碼_tb.Text : PA3 = 使用地點_tb.Text : PA4 = QQQ2
  326. PA5 = QQQ3 : PA6 = QQQ1 : PA7 = 折扣比_tb.Text : BL1 = 稅金計算_ch.Checked : PA8 = 稅金比_tb.Text
  327. SQL_樣品採購單控制表_刪除() : SQL_樣品請購單控制表_退採修改() : conn.Close()
  328. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  329. 資料數 = 明細_dgv.Rows.Count : MyModule1.進度條()
  330. If 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = False Then
  331. PA9 = 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value : PA2 = 明細_dgv.Rows(i).Cells("樣品請購單號").Value : PA3 = 明細_dgv.Rows(i).Cells("" & 表頭(11) & "").Value
  332. PA4 = 明細_dgv.Rows(i).Cells("" & 表頭(12) & "").Value : PA5 = 明細_dgv.Rows(i).Cells("" & 表頭(13) & "").Value : PA6 = 明細_dgv.Rows(i).Cells("" & 表頭(14) & "").Value
  333. NU1 = 明細_dgv.Rows(i).Cells("" & 表頭(15) & "").Value : PA8 = 明細_dgv.Rows(i).Cells("" & 表頭(16) & "").Value : PA10 = 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value
  334. SQL_樣品請購單明細表_轉採修改() : SQL_樣品採購單明細表_刪除1() : conn.Close()
  335. End If
  336. Next
  337. Set_清單1() : Set_清單2() : MsgBox(對話框(6)) : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  338. ElseIf 明細_dgv.Rows.Count > GG Then
  339. PA1 = 採購單號_tb.Text
  340. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  341. 資料數 = 明細_dgv.Rows.Count : MyModule1.進度條()
  342. If 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = False Then
  343. PA9 = 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value : PA2 = 明細_dgv.Rows(i).Cells("樣品請購單號").Value : PA3 = 明細_dgv.Rows(i).Cells("" & 表頭(11) & "").Value
  344. PA4 = 明細_dgv.Rows(i).Cells("" & 表頭(12) & "").Value : PA5 = 明細_dgv.Rows(i).Cells("" & 表頭(13) & "").Value : PA6 = 明細_dgv.Rows(i).Cells("" & 表頭(14) & "").Value
  345. NU1 = 明細_dgv.Rows(i).Cells("" & 表頭(15) & "").Value : PA8 = 明細_dgv.Rows(i).Cells("" & 表頭(16) & "").Value : PA10 = 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value
  346. SQL_樣品請購單明細表_轉採修改() : SQL_樣品採購單明細表_刪除1() : conn.Close()
  347. End If
  348. Next
  349. Set_清單1() : Set_清單2() : MsgBox(對話框(7)) : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  350. ElseIf 明細_dgv.Rows.Count < GG Then
  351. MsgBox(對話框(4))
  352. End If
  353. End If
  354. End Sub
  355. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles 退回請購訂單_bt.Click
  356. Dim FF As Boolean
  357. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  358. FF = 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value
  359. If FF = False Then
  360. Exit For
  361. End If
  362. Next
  363. If FF = False Then
  364. 確定退回() : Set_明細清單()
  365. Else
  366. MsgBox(對話框(5))
  367. End If
  368. End Sub
  369. Private Sub 小間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 小間距1_ch.Click
  370. 小間距1_ch.Checked = True : 中間距1_ch.Checked = False : 大間距1_ch.Checked = False : MyModule1.間距設定存檔_1() : Set_明細清單()
  371. End Sub
  372. Private Sub 中間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 中間距1_ch.Click
  373. 小間距1_ch.Checked = False : 中間距1_ch.Checked = True : 大間距1_ch.Checked = False : MyModule1.間距設定存檔_2() : Set_明細清單()
  374. End Sub
  375. Private Sub 大間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 大間距1_ch.Click
  376. 小間距1_ch.Checked = False : 中間距1_ch.Checked = False : 大間距1_ch.Checked = True : MyModule1.間距設定存檔_3() : Set_明細清單()
  377. End Sub
  378. Private Sub 列印成詢價單_bt_Click(sender As Object, e As EventArgs) Handles 列印成詢價單_bt.Click
  379. If 採購單號_tb.Text = "" Then
  380. MsgBox(對話框(2))
  381. Else
  382. xlApp = CType(CreateObject("Excel.Application"), Application)
  383. xlBook = xlApp.Workbooks.Add
  384. xlApp.DisplayAlerts = True
  385. xlBook.Activate()
  386. xlSheet = NewMethod(xlBook)
  387. xlSheet.Activate()
  388. xlApp.Visible = True
  389. xlApp.Application.WindowState = xlMaximized
  390. xlSheet.Cells(2, 1) = 選擇公司_cb.Text : xlSheet.Cells(3, 1) = "MINTA PESANAN HARGA"
  391. xlSheet.Cells(5, 1) = "ORDER TO : " & 廠商_cb.Text : xlSheet.Cells(6, 1) = "ALAMAT : " & 地址_tb.Text : xlSheet.Cells(7, 1) = "Telp : " & 電話_tb.Text
  392. xlSheet.Cells(8, 1) = "Fax : " & 傳真_tb.Text : xlSheet.Cells(9, 1) = "Email : " & 郵件_tb.Text
  393. 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"
  394. xlSheet.Cells(10, 6) = "QTY" : xlSheet.Cells(10, 7) = "UNIT PRICE" : xlSheet.Cells(10, 8) = "TOTAL PRICE"
  395. xlSheet.Cells(7, 5) = "PO NOMOR : " : xlSheet.Cells(7, 7) = 採購單號_tb.Text
  396. xlSheet.Cells(8, 5) = "TGL/BLN/THN : " : xlSheet.Cells(8, 7) = 需求日期_dtp.Value
  397. xlSheet.Cells(9, 5) = "TEMPAT PEMAKAIAN : " : xlSheet.Cells(9, 7) = 使用地點_tb.Text
  398. Dim GGHH As Integer = 0
  399. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  400. xlSheet.Cells(i + 11, 1) = 明細_dgv.Rows(i).Cells("" & 表頭(11) & "").Value : xlSheet.Cells(i + 11, 2) = 明細_dgv.Rows(i).Cells("" & 表頭(12) & "").Value
  401. xlSheet.Cells(i + 11, 3) = 明細_dgv.Rows(i).Cells("" & 表頭(13) & "").Value : xlSheet.Cells(i + 11, 4) = 明細_dgv.Rows(i).Cells("" & 表頭(14) & "").Value
  402. xlSheet.Cells(i + 11, 5) = 明細_dgv.Rows(i).Cells("" & 表頭(16) & "").Value : xlSheet.Cells(i + 11, 6) = 明細_dgv.Rows(i).Cells("" & 表頭(15) & "").Value
  403. xlSheet.Cells(i + 11, 7) = 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value : xlSheet.Cells(i + 11, 8) = 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  404. GGHH += 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  405. N1 = i + 11
  406. Next i
  407. xlSheet.Cells(N1 + 2, 7) = "TOTAL :" : xlSheet.Cells(N1 + 2, 8) = GGHH
  408. xlSheet.Cells(N1 + 3, 7) = "DISC " & 折扣比_tb.Text & "% :" : xlSheet.Cells(N1 + 3, 8) = 折扣金額_tb.Text
  409. xlSheet.Cells(N1 + 4, 7) = "PPN " & 稅金比_tb.Text & "% :" : xlSheet.Cells(N1 + 4, 8) = 稅金金額_tb.Text
  410. xlSheet.Cells(N1 + 5, 7) = "GRAND TOTAL :" : xlSheet.Cells(N1 + 5, 8) = 總金額_tb.Text
  411. xlSheet.Cells(N1 + 6, 1) = "Bagian Pembelian Barang"
  412. xlSheet.Cells(N1 + 6, 3) = "Direktur Utama"
  413. xlSheet.Cells(N1 + 6, 4) = "Bagian Pemeriksa"
  414. xlSheet.Cells(N1 + 6, 6) = "Bagian Pengisian Harga" : xlSheet.Cells(N1 + 8, 6) = 詢價員_tb.Text : xlSheet.Cells(N1 + 9, 6) = 尋價日期_tb.Text
  415. xlSheet.Cells(N1 + 6, 8) = "Asisten Proyek" : xlSheet.Cells(N1 + 8, 8) = 核對員_tb.Text : xlSheet.Cells(N1 + 9, 8) = 核對日期_tb.Text
  416. AA(xlApp, xlSheet)
  417. xlSheet.PageSetup.PrintArea = ""
  418. xlApp.Cells.Select()
  419. xlSheet.Range("B1").Select()
  420. xlApp.Application.WindowState = xlMinimized
  421. xlSheet.Cells.Select()
  422. xlApp.ActiveSheet.Protect(DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="0911274990")
  423. xlApp.ActiveSheet.EnableSelection = 1
  424. MsgBox(對話框(3))
  425. End If
  426. End Sub
  427. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  428. Return CType(xlBook.Worksheets.Add, Worksheet)
  429. End Function
  430. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  431. xlSheet.Cells.Select()
  432. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  433. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  434. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 24
  435. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 30 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 20
  436. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 15
  437. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 15 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 30
  438. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 5 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 35
  439. xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 5
  440. xlSheet.Rows("5:9").Select : myExcel.Selection.RowHeight = 20 : xlSheet.Rows("10:10").Select : myExcel.Selection.RowHeight = 20
  441. xlSheet.Rows("11:" & N1).Select : myExcel.Selection.RowHeight = 65 : xlSheet.Rows(N1 + 1 & ":" & N1 + 1).Select : myExcel.Selection.RowHeight = 5
  442. xlSheet.Rows(N1 + 2 & ":" & N1 + 5).Select : myExcel.Selection.RowHeight = 17 : xlSheet.Rows(N1 + 6 & ":" & N1 + 6).Select : myExcel.Selection.RowHeight = 35
  443. xlSheet.Rows(N1 + 7 & ":" & N1 + 9).Select : myExcel.Selection.RowHeight = 35
  444. xlSheet.Range("A2:H2").Select()
  445. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  446. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  447. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 26 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  448. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  449. xlSheet.Range("A3:H3").Select()
  450. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  451. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  452. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 16 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  453. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  454. xlSheet.Range("A10:H" & N1).Select()
  455. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  456. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  457. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  458. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  459. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  460. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  461. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  462. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 2).Select()
  463. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  464. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  465. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  466. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  467. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  468. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  469. xlSheet.Range("A" & N1 + 3 & ":H" & N1 + 3).Select()
  470. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  471. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  472. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  473. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  474. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  475. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  476. xlSheet.Range("A" & N1 + 4 & ":H" & N1 + 4).Select()
  477. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  478. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  479. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  480. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  481. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  482. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  483. xlSheet.Range("A" & N1 + 5 & ":H" & N1 + 5).Select()
  484. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  485. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  486. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  487. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  488. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  489. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  490. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 6).Select()
  491. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  492. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  493. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  494. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  495. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  496. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  497. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  498. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  499. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 6).Select()
  500. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  501. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  502. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  503. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  504. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  505. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  506. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  507. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  508. xlSheet.Range("D" & N1 + 6 & ":E" & N1 + 6).Select()
  509. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  510. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  511. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  512. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  513. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  514. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  515. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  516. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  517. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 6).Select()
  518. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  519. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  520. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  521. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  522. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  523. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  524. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  525. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  526. xlSheet.Range("H" & N1 + 6).Select()
  527. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  528. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  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 + 7 & ":B" & N1 + 9).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("C" & N1 + 7 & ":C" & N1 + 9).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("D" & N1 + 7 & ":E" & N1 + 9).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("F" & N1 + 7 & ":G" & N1 + 9).Select()
  557. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  558. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  559. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  560. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  561. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  562. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  563. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  564. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  565. xlSheet.Range("H" & N1 + 7 & ":H" & N1 + 9).Select()
  566. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  567. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  568. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  569. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  570. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  571. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  572. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  573. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  574. xlSheet.Range("A10:A" & N1).Select()
  575. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  576. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  577. xlSheet.Range("B11:D" & N1).Select()
  578. With myExcel.Selection
  579. .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  580. .ReadingOrder = xlContext : .MergeCells = False : End With
  581. xlSheet.Range("E11:F" & N1).Select()
  582. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  583. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  584. xlSheet.Range("G11:H" & N1).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  585. xlSheet.Range("H" & N1 + 2).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  586. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).Select()
  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
  593. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  594. myExcel.ActiveWindow.DisplayGridlines = False
  595. xlSheet.Range("A3:H3").Select()
  596. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  597. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  598. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  599. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  600. xlSheet.Range("G7:G9").Select()
  601. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  602. .ReadingOrder = xlContext : .MergeCells = False : End With
  603. xlSheet.Range("A10:H" & N1).Select()
  604. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  605. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  606. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  607. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  608. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  609. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  610. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  611. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).Select()
  612. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  613. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  614. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  615. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  616. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  617. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  618. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 9).Select()
  619. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  620. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  621. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  622. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  623. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  624. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  625. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 9).Select()
  626. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  627. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  628. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  629. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  630. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  631. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  632. xlSheet.Range("D" & N1 + 6 & ":E" & 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 = xlMedium : End With
  635. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  636. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  637. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  638. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  639. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 9).Select()
  640. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  641. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  642. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  643. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  644. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  645. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  646. xlSheet.Range("H" & N1 + 6 & ":H" & N1 + 9).Select()
  647. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  648. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  649. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  650. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  651. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  652. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  653. xlSheet.Rows("5:9").Select
  654. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  655. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  656. xlSheet.Rows("11:" & N1).Select
  657. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  658. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  659. xlSheet.Range("A10:H10").Select()
  660. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  661. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  662. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  663. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  664. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  665. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  666. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  667. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  668. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  669. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  670. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  671. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  672. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  673. xlSheet.Range("A11:H" & N1).Select()
  674. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  675. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  676. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  677. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  678. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  679. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  680. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  681. xlSheet.Range("B11:D" & N1).Select()
  682. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  683. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  684. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  685. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  686. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  687. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  688. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  689. xlSheet.Range("F11:F" & N1).Select()
  690. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  691. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  692. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  693. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  694. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  695. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  696. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  697. xlSheet.Range("H11:H" & N1).Select()
  698. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  699. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  700. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  701. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  702. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  703. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  704. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  705. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).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. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  712. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).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. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  720. xlSheet.Range("G" & N1 + 2 & ":G" & N1 + 5).Select()
  721. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  722. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  723. xlSheet.Range("F" & N1 + 8 & ":G" & N1 + 8).Select()
  724. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  725. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  726. xlSheet.Range("F" & N1 + 9 & ":G" & N1 + 9).Select()
  727. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  728. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  729. myExcel.Application.PrintCommunication = False
  730. With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "$1:$10" : .PrintTitleColumns = "" : End With
  731. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  732. With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "" : .RightFooter = ""
  733. .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
  734. .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
  735. .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
  736. .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = True : .CenterVertically = False : .Draft = False : .FirstPageNumber = xlAutomatic
  737. .BlackAndWhite = False : .Zoom = 60 : .OddAndEvenPagesHeaderFooter = False : .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True
  738. .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = ""
  739. .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = ""
  740. .FirstPage.CenterHeader.Text = "" : .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = ""
  741. .FirstPage.RightFooter.Text = ""
  742. End With
  743. myExcel.Application.PrintCommunication = True
  744. End Sub
  745. '-----------------------------滑鼠右鍵--------------------------------------------------------------------------------------------------------------------------------------
  746. Private Sub 重新整理ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新整理_tsm.Click
  747. Set_清單1() : Set_清單2()
  748. End Sub
  749. Private Sub 全部取消_bt_Click(sender As Object, e As EventArgs) Handles 全部取消_bt.Click
  750. For i As Integer = 0 To 明細_dgv.Rows.Count - 1 : 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = False : Next i
  751. End Sub
  752. Private Sub 全部選擇_bt_Click(sender As Object, e As EventArgs) Handles 全部選擇_bt.Click
  753. For i As Integer = 0 To 明細_dgv.Rows.Count - 1 : 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = True : Next i
  754. End Sub
  755. Private Sub 修改的採購單存檔_bt_Click(sender As Object, e As EventArgs) Handles 修改的採購單存檔_bt.Click
  756. Set_日期格式轉換()
  757. PA1 = 供應商編碼_tb.Text : PA2 = 使用地點_tb.Text : PA3 = 折扣比_tb.Text : BL1 = 稅金計算_ch.Checked : PA4 = 稅金比_tb.Text : PA5 = 採購單號_tb.Text
  758. SQL_樣品採購單控制表_修改() : conn.Close()
  759. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  760. 資料數 = 明細_dgv.Rows.Count : MyModule1.進度條()
  761. PA6 = 明細_dgv.Rows(i).Cells("" & 表頭(14) & "").Value : PA7 = 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value
  762. PA8 = 明細_dgv.Rows(i).Cells("" & 表頭(15) & "").Value : PA9 = 明細_dgv.Rows(i).Cells("" & 表頭(16) & "").Value
  763. PA11 = 明細_dgv.Rows(i).Cells("" & 表頭(12) & "").Value : PA12 = 明細_dgv.Rows(i).Cells("" & 表頭(13) & "").Value
  764. PA10 = 明細_dgv.Rows(i).Cells("項次").Value
  765. SQL_樣品採購單明細表_修改() : conn.Close()
  766. Next
  767. Set_清單1() : Set_清單2() : MsgBox(對話框(2)) : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  768. End Sub
  769. Private Sub 生成新的採購訂單_bt_Click(sender As Object, e As EventArgs) Handles 生成採購單_bt.Click
  770. Dim BB As Boolean
  771. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  772. BB = 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value
  773. If BB = True Then
  774. Exit For
  775. End If
  776. Next
  777. If BB = True Then
  778. If 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL" Then
  779. Set_日期格式轉換() : Dim NUM1 As Integer
  780. For i As Integer = 1 To 999
  781. NUM1 = 0 + i
  782. If NUM1 < 10 Then : 採購單號_tb.Text = "HXI-" & DTP1 & "-00" & NUM1
  783. ElseIf NUM1 > 9 And NUM1 < 100 Then : 採購單號_tb.Text = "HXI-" & DTP1 & "-0" & NUM1
  784. ElseIf NUM1 > 99 Then : 採購單號_tb.Text = "HXI-" & DTP1 & "-" & NUM1
  785. End If
  786. SQL_樣品採購單控制表_單號最後一筆() : If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  787. Next
  788. 確定新增() : Set_明細清單()
  789. ElseIf 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" Then
  790. Set_日期格式轉換() : Dim NUM1 As Integer
  791. For i As Integer = 1 To 999
  792. NUM1 = 0 + i
  793. If NUM1 < 10 Then : 採購單號_tb.Text = "PGS-" & DTP1 & "-00" & NUM1
  794. ElseIf NUM1 > 9 And NUM1 < 100 Then : 採購單號_tb.Text = "PGS-" & DTP1 & "-0" & NUM1
  795. ElseIf NUM1 > 99 Then : 採購單號_tb.Text = "PGS-" & DTP1 & "-" & NUM1
  796. End If
  797. conn.Close()
  798. SQL_樣品採購單控制表_單號最後一筆() : If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  799. Next
  800. 確定新增() : Set_明細清單()
  801. End If
  802. Else
  803. MsgBox(對話框(5))
  804. End If
  805. End Sub
  806. End Class