Açıklama Yok
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 41KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. Option Strict Off
  2. Imports System.Data.SqlClient
  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. Imports System.Threading
  13. Public Class 樣品物料調料單申請
  14. Dim conn As New SqlConnection
  15. Dim da As New SqlDataAdapter
  16. Dim cmd As New SqlCommand
  17. Dim ds As New DataSet : Dim ds1 As New DataSet : Dim ds2 As New DataSet
  18. Dim dr As SqlDataReader
  19. Dim DTP As String : Dim DTP1 As String : Dim 新項次 As String : Dim NUM1 As Integer
  20. Dim xlApp As Application
  21. Dim xlBook As Workbook
  22. Dim xlSheet As Worksheet
  23. Dim 位置1 As String : Dim N1 As Integer
  24. Private Sub Set_清單()
  25. 調料單_dgv.DataSource = Nothing : ds.Clear()
  26. 調料單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  27. 調料單_dgv.ColumnHeadersHeight = 25
  28. 調料單_dgv.AllowUserToAddRows = False
  29. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  30. If PA = "" Then
  31. SQL1 = "SELECT 樣品物料調料單抬頭.調料單號, 供應商清單.廠商, 樣品物料調料單抬頭.客戶, 樣品物料調料單抬頭.SHOW年,
  32. 樣品物料調料單抬頭.SHOW月, 樣品物料調料單抬頭.日期, 樣品物料調料單抬頭.發件人, 樣品物料調料單抬頭.收件人,
  33. 樣品物料調料單抬頭.制表人, 樣品物料調料單抬頭.核准簽名, 樣品物料調料單抬頭.供應商編號
  34. FROM 樣品物料調料單抬頭 INNER JOIN
  35. 供應商清單 ON 樣品物料調料單抬頭.供應商編號 = 供應商清單.供應商編碼
  36. WHERE (樣品物料調料單抬頭.核准簽名 LIKE '')
  37. ORDER BY 樣品物料調料單抬頭.SHOW年, 樣品物料調料單抬頭.SHOW月"
  38. Else
  39. SQL1 = "SELECT 樣品物料調料單抬頭.調料單號, 供應商清單.廠商, 樣品物料調料單抬頭.客戶, 樣品物料調料單抬頭.SHOW年,
  40. 樣品物料調料單抬頭.SHOW月, 樣品物料調料單抬頭.日期, 樣品物料調料單抬頭.發件人, 樣品物料調料單抬頭.收件人,
  41. 樣品物料調料單抬頭.制表人, 樣品物料調料單抬頭.核准簽名, 樣品物料調料單抬頭.供應商編號
  42. FROM 樣品物料調料單抬頭 INNER JOIN
  43. 供應商清單 ON 樣品物料調料單抬頭.供應商編號 = 供應商清單.供應商編碼
  44. WHERE (樣品物料調料單抬頭.核准簽名 LIKE '') AND ((樣品物料調料單抬頭.調料單號 LIKE N'%" & PA & "%') OR (供應商清單.廠商 LIKE N'%" & PA & "%') OR
  45. (樣品物料調料單抬頭.客戶 LIKE N'%" & PA & "%') OR
  46. (樣品物料調料單抬頭.SHOW年 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.SHOW月 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.日期 LIKE N'%" & PA & "%') OR
  47. (樣品物料調料單抬頭.發件人 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.收件人 LIKE N'%" & PA & "%') OR (樣品物料調料單抬頭.制表人 LIKE N'%" & PA & "%'))
  48. ORDER BY 樣品物料調料單抬頭.SHOW年, 樣品物料調料單抬頭.SHOW月"
  49. End If
  50. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds) : 調料單_dgv.DataSource = ds.Tables(0) : conn.Close() : Set_grid()
  51. End Sub
  52. Private Sub Set_grid()
  53. 調料單_dgv.Columns(0).Width = 110 : 調料單_dgv.Columns(1).Width = 130 : 調料單_dgv.Columns(2).Width = 130 : 調料單_dgv.Columns(3).Width = 70 : 調料單_dgv.Columns(4).Width = 70
  54. 調料單_dgv.Columns(5).Visible = False : 調料單_dgv.Columns(6).Visible = False : 調料單_dgv.Columns(7).Visible = False : 調料單_dgv.Columns(8).Visible = False
  55. 調料單_dgv.Columns(9).Visible = False : 調料單_dgv.Columns(10).Visible = False
  56. End Sub
  57. Private Sub Set_使用者清單()
  58. DataGridView2.DataSource = Nothing : ds1.Clear()
  59. DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  60. DataGridView2.ColumnHeadersHeight = 25
  61. DataGridView2.AllowUserToAddRows = False
  62. DataGridView2.RowTemplate.Height = 35
  63. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  64. SQL1 = "SELECT 調料單號, 項次, 名稱, 規格, 顏色, 單位, 數量, 單價, 數量 * 單價 AS 金額, 備註 FROM 樣品物料調料單明細 WHERE 調料單號 LIKE N'" & TextBox1.Text & "' ORDER BY 項次"
  65. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close() : Set_grid1()
  66. End Sub
  67. Private Sub Set_grid1()
  68. DataGridView2.Columns(0).Visible = False : DataGridView2.Columns(1).Width = 80 : DataGridView2.Columns(2).Width = 200 : DataGridView2.Columns(3).Width = 200
  69. DataGridView2.Columns(4).Width = 200
  70. DataGridView2.Columns(5).Width = 80 : DataGridView2.Columns(6).Width = 80 : DataGridView2.Columns(7).Width = 80 : DataGridView2.Columns(8).Width = 80 : DataGridView2.Columns(9).Width = 305
  71. DataGridView2.Columns(8).DefaultCellStyle.Format = "#,##0.00" : DataGridView2.Columns(6).DefaultCellStyle.Format = "#,##0.00" : DataGridView2.Columns(7).DefaultCellStyle.Format = "#,##0.00"
  72. DataGridView2.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView2.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  73. DataGridView2.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  74. DataGridView2.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView2.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  75. DataGridView2.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  76. DataGridView2.EditMode = DataGridViewEditMode.EditOnEnter
  77. TextBox5.Text = "0.00"
  78. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  79. TextBox5.Text = Val(TextBox5.Text) + DataGridView2.Rows(i).Cells("金額").Value
  80. Next i
  81. TextBox5.Text = Strings.Format(Val(TextBox5.Text), "#,##0.00")
  82. End Sub
  83. Private Sub ComboBox1下拉表單資料載入()
  84. conn.Close()
  85. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  86. SQL1 = "SELECT 廠商, 供應商編碼 FROM 供應商清單 WHERE 公司傳真3 LIKE '" & 廠商類別_cb.Text & "' AND 停用 = 0 ORDER BY 廠商"
  87. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  88. 供應商_cb.Items.Clear() : 供應商編碼_cb.Items.Clear()
  89. While (dr.Read()) : 供應商_cb.Items.Add(dr("廠商")) : 供應商編碼_cb.Items.Add(dr("供應商編碼")) : End While : conn.Close()
  90. End Sub
  91. Private Sub ComboBox下拉表單資料載入()
  92. conn.Close()
  93. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  94. SQL1 = "SELECT 廠商, 供應商編碼 FROM 供應商清單 WHERE 停用 = 0 ORDER BY 廠商"
  95. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  96. 供應商_cb.Items.Clear() : 供應商編碼_cb.Items.Clear()
  97. While (dr.Read()) : 供應商_cb.Items.Add(dr("廠商")) : 供應商編碼_cb.Items.Add(dr("供應商編碼")) : End While : conn.Close()
  98. End Sub
  99. Private Sub ComboBox3下拉表單資料載入()
  100. conn.Close()
  101. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  102. SQL1 = "SELECT 姓名 FROM 使用者權限管理表 WHERE (CC49 = 0) ORDER BY 姓名"
  103. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  104. ComboBox3.Items.Clear() : ComboBox4.Items.Clear()
  105. While (dr.Read()) : ComboBox3.Items.Add(dr("姓名")) : ComboBox4.Items.Add(dr("姓名")) : End While : conn.Close()
  106. End Sub
  107. Private Sub ComboBox5下拉表單資料載入()
  108. conn.Close()
  109. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  110. SQL1 = "SELECT 年份 FROM 年份清單 ORDER BY 年份"
  111. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  112. ComboBox5.Items.Clear() : While (dr.Read()) : ComboBox5.Items.Add(dr("年份")) : End While : conn.Close()
  113. End Sub
  114. Private Sub ComboBox7下拉表單資料載入()
  115. conn.Close()
  116. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  117. SQL1 = "SELECT 客戶簡稱 FROM 客戶控制表 ORDER BY 客戶簡稱"
  118. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  119. ComboBox7.Items.Clear() : While (dr.Read()) : ComboBox7.Items.Add(dr("客戶簡稱")) : End While : conn.Close()
  120. End Sub
  121. Private Sub ComboBox18下拉表單資料載入()
  122. conn.Close()
  123. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  124. SQL1 = "SELECT 公司傳真3 AS 類別 FROM 供應商清單 GROUP BY 公司傳真3 ORDER BY 公司傳真3"
  125. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  126. 廠商類別_cb.Items.Clear() : While (dr.Read()) : 廠商類別_cb.Items.Add(dr("類別")) : End While : conn.Close()
  127. End Sub
  128. Private Sub Set_日期格式轉換()
  129. DTP = Strings.Format(DateTimePicker1.Value, "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd")
  130. End Sub
  131. Private Sub 樣品物料調料單_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  132. Me.MdiParent = WINPROFIT_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  133. Set_清單() : ComboBox18下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox5下拉表單資料載入() : ComboBox7下拉表單資料載入()
  134. Button2.Enabled = False : Button6.Enabled = False : Button15.Enabled = False : Button3.Enabled = False : Button4.Enabled = False : Button5.Enabled = False
  135. TextBox1.Enabled = False : TextBox6.Enabled = False
  136. End Sub
  137. Private Sub 樣品物料調料單_Unload(sender As Object, e As EventArgs) Handles MyBase.Closing
  138. If Button2.Enabled = True Then
  139. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  140. SQL1 = "DELETE FROM 樣品物料調料單抬頭 WHERE (調料單號 LIKE N'" & TextBox1.Text & "')"
  141. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  142. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  143. SQL1 = "DELETE FROM 樣品物料調料單明細 WHERE (調料單號 LIKE N'" & TextBox1.Text & "')"
  144. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  145. End If
  146. End Sub
  147. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 調料單_dgv.CellClick
  148. If e.RowIndex = -1 Then : Else
  149. ComboBox下拉表單資料載入()
  150. TextBox1.Text = 調料單_dgv.Rows(e.RowIndex).Cells("調料單號").Value.ToString : Button3.Enabled = True : Button5.Enabled = True
  151. 供應商編碼_cb.Text = 調料單_dgv.Rows(e.RowIndex).Cells("供應商編號").Value : ComboBox3.Text = 調料單_dgv.Rows(e.RowIndex).Cells("發件人").Value
  152. ComboBox4.Text = 調料單_dgv.Rows(e.RowIndex).Cells("收件人").Value : DateTimePicker1.Value = 調料單_dgv.Rows(e.RowIndex).Cells("日期").Value
  153. TextBox7.Text = 調料單_dgv.Rows(e.RowIndex).Cells("制表人").Value : ComboBox7.Text = 調料單_dgv.Rows(e.RowIndex).Cells("客戶").Value
  154. ComboBox5.Text = 調料單_dgv.Rows(e.RowIndex).Cells("SHOW年").Value : ComboBox6.Text = 調料單_dgv.Rows(e.RowIndex).Cells("SHOW月").Value
  155. Set_使用者清單()
  156. End If
  157. End Sub
  158. Private Sub DataGridView2_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView2.CellClick
  159. If e.RowIndex = -1 Then : Else
  160. TextBox6.Text = DataGridView2.Rows(e.RowIndex).Cells("項次").Value
  161. End If
  162. End Sub
  163. Private Sub DataGridView2_CellContentClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView2.CellEndEdit
  164. TextBox5.Text = "0.00"
  165. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  166. DataGridView2.Rows(i).Cells("金額").Value = Val(DataGridView2.Rows(i).Cells("數量").Value) * Val(DataGridView2.Rows(i).Cells("單價").Value)
  167. TextBox5.Text = Val(TextBox5.Text) + DataGridView2.Rows(i).Cells("金額").Value
  168. Next i
  169. TextBox5.Text = Strings.Format(Val(TextBox5.Text), "#,##0.00")
  170. End Sub
  171. Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
  172. If Label62.Visible = True Then : Label62.Visible = False : Else : Label62.Visible = True : End If
  173. End Sub
  174. Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 供應商_cb.SelectedIndexChanged
  175. 供應商編碼_cb.SelectedIndex = 供應商_cb.SelectedIndex
  176. End Sub
  177. Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 供應商編碼_cb.SelectedIndexChanged
  178. 供應商_cb.SelectedIndex = 供應商編碼_cb.SelectedIndex
  179. conn.Close()
  180. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  181. SQL1 = "SELECT 公司名, 公司電話1, 聯繫人1 FROM 供應商清單 WHERE (供應商編碼 LIKE '" & 供應商編碼_cb.Text & "') ORDER BY 廠商"
  182. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  183. If dr.Read() Then : TextBox2.Text = dr("公司名") : TextBox3.Text = dr("聯繫人1") : TextBox4.Text = dr("公司電話1") : End If
  184. conn.Close()
  185. End Sub
  186. Private Sub ComboBox18_SelectedIndexChanged_1(sender As Object, e As EventArgs) Handles 廠商類別_cb.SelectedIndexChanged
  187. ComboBox1下拉表單資料載入()
  188. End Sub
  189. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  190. Timer1.Enabled = True : 調料單_dgv.Enabled = False
  191. Button1.Enabled = False : Button2.Enabled = True : Button6.Enabled = True : Button15.Enabled = True
  192. Set_日期格式轉換() : Dim NUM1 As Integer
  193. For i As Integer = 1 To 999
  194. NUM1 = 0 + i
  195. If NUM1 < 10 Then : TextBox1.Text = "L-" & DTP1 & "-00" & NUM1
  196. ElseIf NUM1 > 9 And NUM1 < 100 Then : TextBox1.Text = "L-" & DTP1 & "-0" & NUM1
  197. ElseIf NUM1 > 99 Then : TextBox1.Text = "L-" & DTP1 & "-" & NUM1
  198. End If
  199. conn.Close()
  200. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  201. SQL1 = "SELECT TOP (1) 調料單號 FROM 樣品物料調料單抬頭 WHERE ( 調料單號 LIKE N'" & TextBox1.Text & "')"
  202. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  203. If dr.Read() Then
  204. Else
  205. i = 999
  206. conn.Close()
  207. End If
  208. conn.Close()
  209. Next
  210. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  211. SQL1 = "INSERT INTO 樣品物料調料單抬頭 (調料單號, 日期, 發件人, 收件人, 客戶, 制表人, 核准簽名, 供應商編號, SHOW年, SHOW月) " &
  212. "VALUES (N'" & TextBox1.Text & "',N'" & DTP & "',N'',N'',N'',N'',N'',N'',N'',N'')"
  213. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery()
  214. DataGridView2.DataSource = Nothing : ds1.Clear()
  215. conn.Close()
  216. End Sub
  217. Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
  218. Dim aa As MsgBoxResult
  219. aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
  220. If aa = MsgBoxResult.Ok Then
  221. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  222. SQL1 = "DELETE FROM 樣品物料調料單抬頭 WHERE (調料單號 LIKE N'" & TextBox1.Text & "')"
  223. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  224. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  225. SQL1 = "DELETE FROM 樣品物料調料單明細 WHERE (調料單號 LIKE N'" & TextBox1.Text & "')"
  226. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  227. TextBox1.Text = "" : TextBox2.Text = "" : TextBox3.Text = "" : TextBox4.Text = ""
  228. ComboBox18下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox5下拉表單資料載入() : ComboBox7下拉表單資料載入()
  229. DataGridView2.DataSource = Nothing : ds1.Clear()
  230. Set_清單()
  231. End If
  232. End Sub
  233. Private Sub 存檔1()
  234. Set_日期格式轉換()
  235. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  236. SQL1 = "UPDATE 樣品物料調料單抬頭 SET 日期 = N'" & DTP & "', 發件人 = N'" & ComboBox3.Text & "', 收件人 = N'" & ComboBox4.Text & "', 客戶 = N'" & ComboBox7.Text &
  237. "', 制表人 = N'" & gUserName & "', 供應商編號 = N'" & 供應商編碼_cb.Text & "', SHOW年 = N'" & ComboBox5.Text & "', SHOW月 = N'" & ComboBox6.Text &
  238. "' WHERE (調料單號 LIKE N'" & TextBox1.Text & "')"
  239. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  240. End Sub
  241. Private Sub 存檔()
  242. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  243. 資料數 = DataGridView2.Rows.Count : MyModule1.進度條()
  244. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  245. SQL1 = "UPDATE 樣品物料調料單明細 SET 名稱 = N'" & DataGridView2.Rows(i).Cells("名稱").Value & "', 規格 = N'" & DataGridView2.Rows(i).Cells("規格").Value &
  246. "', 顏色 = N'" & DataGridView2.Rows(i).Cells("顏色").Value & "', 單位 = N'" & DataGridView2.Rows(i).Cells("單位").Value & "', 數量 = N'" & DataGridView2.Rows(i).Cells("數量").Value &
  247. "', 單價 = N'" & DataGridView2.Rows(i).Cells("單價").Value & "', 備註 = N'" & DataGridView2.Rows(i).Cells("備註").Value &
  248. "' WHERE (調料單號 LIKE N'" & TextBox1.Text & "' AND 項次 LIKE N'" & DataGridView2.Rows(i).Cells("項次").Value & "')"
  249. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  250. Next : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  251. End Sub
  252. Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
  253. 存檔()
  254. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  255. SQL1 = "SELECT TOP(1) 項次 FROM 樣品物料調料單明細 WHERE 調料單號 LIKE N'" & TextBox1.Text & "' ORDER BY 項次 DESC"
  256. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  257. If dr.Read() Then : 新項次 = dr("項次") : Else : 新項次 = "00" : End If : conn.Close()
  258. NUM1 = Double.Parse(新項次) + 1
  259. If NUM1 < 10 Then : 新項次 = "0" & NUM1
  260. ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1
  261. End If
  262. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  263. SQL1 = "INSERT INTO 樣品物料調料單明細 (調料單號, 項次, 名稱, 規格, 顏色, 單位, 數量, 單價, 備註) " &
  264. "VALUES (N'" & TextBox1.Text & "',N'" & 新項次 & "',N'',N'',N'',N'',N'0',N'0',N'')"
  265. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery()
  266. Set_使用者清單()
  267. End Sub
  268. Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
  269. If TextBox6.Text = "" Then
  270. MsgBox("未選擇需要刪除的資料")
  271. Else
  272. 存檔()
  273. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  274. SQL1 = "DELETE FROM 樣品物料調料單明細 WHERE (調料單號 LIKE N'" & TextBox1.Text & "' AND 項次 LIKE N'" & TextBox6.Text & "')"
  275. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  276. Set_使用者清單()
  277. Dim NUM1 As Integer = 0
  278. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  279. NUM1 = NUM1 + 1 : If NUM1 < 10 Then : 新項次 = "0" & NUM1 : ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1 : End If
  280. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  281. SQL1 = "UPDATE 樣品物料調料單明細 SET 項次 = N'" & 新項次 & "' WHERE (調料單號 LIKE N'" & TextBox1.Text & "' AND 項次 LIKE N'" & DataGridView2.Rows(i).Cells("項次").Value & "')"
  282. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery()
  283. conn.Close()
  284. Next
  285. Set_使用者清單()
  286. End If
  287. End Sub
  288. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  289. 調料單_dgv.Enabled = True
  290. If 供應商_cb.Text = "" Or ComboBox3.Text = "" Or ComboBox4.Text = "" Or ComboBox5.Text = "" Or ComboBox6.Text = "" Or ComboBox7.Text = "" Then
  291. MsgBox("所有的下拉清單都要選擇,請重新確定資料是否正確。")
  292. Else
  293. If TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Then
  294. MsgBox("供應商資料內容有缺失,請先完善供應商資料。")
  295. Else
  296. Timer1.Enabled = False : Label62.Visible = False
  297. Button1.Enabled = True : Button2.Enabled = False : Button6.Enabled = False : Button15.Enabled = False
  298. 存檔1() : 存檔() : TextBox7.Text = gUserName
  299. MsgBox("申請完成,請通知主管核準。") : Set_清單()
  300. End If
  301. End If
  302. End Sub
  303. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  304. Button3.Enabled = False : Button4.Enabled = True : Button6.Enabled = True : Button15.Enabled = True : Timer1.Enabled = True
  305. 調料單_dgv.Enabled = False
  306. End Sub
  307. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  308. If 供應商_cb.Text = "" Or ComboBox3.Text = "" Or ComboBox4.Text = "" Or ComboBox5.Text = "" Or ComboBox6.Text = "" Or ComboBox7.Text = "" Then
  309. MsgBox("所有的下拉清單都要選擇,請重新確定資料是否正確。")
  310. Else
  311. If TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Then
  312. MsgBox("供應商資料內容有缺失,請先完善供應商資料。")
  313. Else
  314. 調料單_dgv.Enabled = True
  315. Timer1.Enabled = False : Label62.Visible = False
  316. Button3.Enabled = True : Button4.Enabled = False : Button6.Enabled = False : Button15.Enabled = False
  317. 存檔1() : 存檔() : TextBox7.Text = gUserName
  318. MsgBox("申請完成,請通知主管核準。") : Set_清單()
  319. End If
  320. End If
  321. End Sub
  322. Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
  323. xlApp = CType(CreateObject("Excel.Application"), Application)
  324. xlBook = xlApp.Workbooks.Add
  325. xlApp.DisplayAlerts = True
  326. xlBook.Activate()
  327. xlSheet = NewMethod(xlBook)
  328. xlSheet.Activate()
  329. xlApp.Visible = True
  330. xlApp.Application.WindowState = xlMaximized
  331. xlSheet.Cells(1, 1) = "森康鞋業有限公司
  332. SenKang Footwear Ltd."
  333. xlSheet.Cells(3, 1) = "廣東東莞市厚街鎮湖景大道南150米 TEL:0769-38851258 FAX:0769-38851259" : xlSheet.Cells(6, 1) = "MATERIALS REQUEST FORM" : xlSheet.Cells(7, 1) = " 物料调料单"
  334. xlSheet.Cells(8, 1) = "Purchase NO#" : xlSheet.Cells(8, 3) = TextBox1.Text : xlSheet.Cells(10, 1) = "TO:" : xlSheet.Cells(10, 2) = TextBox2.Text
  335. xlSheet.Cells(11, 1) = "ATTN:" : xlSheet.Cells(11, 2) = TextBox3.Text : xlSheet.Cells(12, 1) = "TEL:" : xlSheet.Cells(12, 2) = TextBox4.Text
  336. xlSheet.Cells(10, 10) = "DATE:" : xlSheet.Cells(10, 11) = DateTimePicker1.Value : xlSheet.Cells(11, 10) = "FROM:" : xlSheet.Cells(11, 11) = ComboBox3.Text
  337. xlSheet.Cells(12, 10) = "EXT:" : xlSheet.Cells(12, 11) = ComboBox4.Text : xlSheet.Cells(14, 1) = "PLS ALWAYS REFER TO OUR PO#请于送货单上注明我们的订单号码"
  338. xlSheet.Cells(16, 1) = "Item" : xlSheet.Cells(16, 2) = "Description" : xlSheet.Cells(16, 4) = "Spec" : xlSheet.Cells(16, 6) = "Color" : xlSheet.Cells(16, 7) = "Unit"
  339. xlSheet.Cells(16, 8) = "Q'TY" : xlSheet.Cells(16, 9) = "Unit Price" : xlSheet.Cells(16, 10) = "Amount" : xlSheet.Cells(16, 11) = "Remark" : xlSheet.Cells(17, 1) = "项次"
  340. xlSheet.Cells(17, 2) = "名称" : xlSheet.Cells(17, 4) = "規格" : xlSheet.Cells(17, 6) = "颜色" : xlSheet.Cells(17, 7) = "单位" : xlSheet.Cells(17, 8) = "数量"
  341. xlSheet.Cells(17, 9) = "单价" : xlSheet.Cells(17, 10) = "金额" : xlSheet.Cells(17, 11) = "备注"
  342. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  343. xlSheet.Cells(i + 18, 1) = DataGridView2.Rows(i).Cells("項次").Value : xlSheet.Cells(i + 18, 2) = DataGridView2.Rows(i).Cells("名稱").Value
  344. xlSheet.Cells(i + 18, 4) = DataGridView2.Rows(i).Cells("規格").Value : xlSheet.Cells(i + 18, 6) = DataGridView2.Rows(i).Cells("顏色").Value
  345. xlSheet.Cells(i + 18, 7) = DataGridView2.Rows(i).Cells("單位").Value : xlSheet.Cells(i + 18, 8) = DataGridView2.Rows(i).Cells("數量").Value
  346. xlSheet.Cells(i + 18, 9) = DataGridView2.Rows(i).Cells("單價").Value : xlSheet.Cells(i + 18, 10) = DataGridView2.Rows(i).Cells("金額").Value
  347. xlSheet.Cells(i + 18, 11) = DataGridView2.Rows(i).Cells("備註").Value
  348. With xlApp.Selection
  349. .Font.Bold = True
  350. End With
  351. N1 = i + 18
  352. Next i
  353. xlSheet.Cells(N1 + 1, 6) = "TOTAL:" : xlSheet.Cells(N1 + 1, 8) = "=SUM(H18:H" & N1 & ")" : xlSheet.Cells(N1 + 1, 10) = "=SUM(J18:J" & N1 & ")" : xlSheet.Cells(N1 + 2, 4) = "'AMOUNT金额(大写):"
  354. xlSheet.Cells(N1 + 2, 8) = "=J" & N1 + 1 : xlSheet.Cells(N1 + 3, 3) = "FOR" : xlSheet.Cells(N1 + 3, 4) = ComboBox7.Text : xlSheet.Cells(N1 + 3, 7) = ComboBox5.Text : xlSheet.Cells(N1 + 3, 9) = "SHOW"
  355. xlSheet.Cells(N1 + 3, 8) = ComboBox6.Text : xlSheet.Cells(N1 + 5, 1) = "样品请寄:廣東東莞市厚街鎮湖景大道南150米森康鞋業有限公司 人名 電話 收。"
  356. xlSheet.Cells(N1 + 7, 1) = "IMPORTANT: **请回复交期并提供物料报价" : xlSheet.Cells(N1 + 11, 3) = "驗證碼" : xlSheet.Cells(N1 + 11, 4) = "" : xlSheet.Cells(N1 + 12, 3) = "核准:"
  357. xlSheet.Cells(N1 + 12, 10) = "制表人:" : xlSheet.Cells(N1 + 12, 11) = TextBox7.Text
  358. AA(xlApp, xlSheet)
  359. xlSheet.PageSetup.PrintArea = ""
  360. xlApp.Cells.Select()
  361. xlSheet.Range("B1").Select()
  362. xlApp.Application.WindowState = xlMinimized
  363. xlApp.ActiveSheet.Protect(DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="0911274990")
  364. xlApp.ActiveSheet.EnableSelection = 1
  365. MsgBox("列印完成")
  366. End Sub
  367. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  368. Return CType(xlBook.Worksheets.Add, Worksheet)
  369. End Function
  370. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  371. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 5.86 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 8
  372. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 30 : xlSheet.Columns("D:E").Select : myExcel.Selection.ColumnWidth = 10
  373. xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 20 : xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 6.47
  374. xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("I:I").Select : myExcel.Selection.ColumnWidth = 12
  375. xlSheet.Columns("J:J").Select : myExcel.Selection.ColumnWidth = 12 : xlSheet.Columns("K:K").Select : myExcel.Selection.ColumnWidth = 25.14
  376. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 86 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 8.25
  377. xlSheet.Rows("4:5").Select : myExcel.Selection.RowHeight = 8.25 : xlSheet.Rows("9:9").Select : myExcel.Selection.RowHeight = 8.25
  378. xlSheet.Rows("13:13").Select : myExcel.Selection.RowHeight = 8.25 : xlSheet.Rows("14:14").Select : myExcel.Selection.RowHeight = 25
  379. xlSheet.Rows("15:15").Select : myExcel.Selection.RowHeight = 8.25
  380. xlSheet.Range("A1:K1").Select() : myExcel.Selection.Merge
  381. With myExcel.Selection.Font : .Name = "新細明體" : .Size = 28 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  382. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontMinor : End With
  383. xlSheet.Range("A3:K3").Select() : myExcel.Selection.Merge : myExcel.Selection.Font.Bold = True
  384. xlSheet.Range("A6:K6").Select() : myExcel.Selection.Merge : myExcel.Selection.Font.Bold = True
  385. xlSheet.Range("A7:K7").Select() : myExcel.Selection.Merge : myExcel.Selection.Font.Bold = True
  386. xlSheet.Range("B10:I10").Select() : myExcel.Selection.Merge
  387. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  388. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  389. xlSheet.Range("B11:I11").Select() : myExcel.Selection.Merge
  390. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  391. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  392. xlSheet.Range("B12:I12").Select() : myExcel.Selection.Merge
  393. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  394. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  395. xlSheet.Range("K10").Select()
  396. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  397. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  398. xlSheet.Rows("14:14").Select : myExcel.Selection.Font.Bold = True
  399. xlSheet.Range("B16:C16").Select() : myExcel.Selection.Merge : xlSheet.Range("D16:E16").Select() : myExcel.Selection.Merge
  400. xlSheet.Range("B17:C17").Select() : myExcel.Selection.Merge : xlSheet.Range("D17:E17").Select() : myExcel.Selection.Merge
  401. xlSheet.Range("A16:K17").Select() : myExcel.Selection.Font.Bold = True
  402. xlSheet.Rows("8:8").Select : myExcel.Selection.Font.Bold = True
  403. 位置1 = "18:" & N1 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 35.25
  404. 位置1 = N1 + 5 & ":" & N1 + 5 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 35.25 : 位置1 = N1 + 1 & ":" & N1 + 3 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 20
  405. 位置1 = N1 + 4 & ":" & N1 + 4 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 8.5 : 位置1 = N1 + 6 & ":" & N1 + 6 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 8.5
  406. 位置1 = N1 + 8 & ":" & N1 + 10 : xlSheet.Range(位置1).Select() : myExcel.Selection.RowHeight = 8.5
  407. For i As Integer = 18 To N1
  408. xlSheet.Range("B" & i & ":C" & i & "").Select() : myExcel.Selection.Merge : xlSheet.Range("D" & i & ":E" & i & "").Select() : myExcel.Selection.Merge
  409. xlSheet.Range("H" & i & ":J" & i & "").Select() : myExcel.Selection.Style = "Comma"
  410. Next i
  411. xlSheet.Rows("18:" & N1 + 2).Select
  412. With myExcel.Selection.Font : .Name = "新細明體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  413. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontMinor : End With
  414. xlSheet.Range("C" & N1 + 3).Select()
  415. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  416. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  417. xlSheet.Range("D" & N1 + 3 & ":F" & N1 + 3).Select() : myExcel.Selection.Merge
  418. xlSheet.Range("A" & N1 + 5 & ":K" & N1 + 5).Select() : myExcel.Selection.Merge
  419. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  420. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  421. xlSheet.Range("A16:K" & N1).Select()
  422. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  423. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  424. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  425. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  426. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  427. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  428. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  429. xlSheet.Range("A4:K4").Select()
  430. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  431. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  432. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  433. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  434. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  435. xlSheet.Range("A9:K9").Select()
  436. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  437. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  438. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  439. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  440. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  441. xlSheet.Range("A12:K12").Select()
  442. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  443. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  444. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  445. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  446. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  447. xlSheet.Range("D" & N1 + 2 & ":G" & N1 + 2).Select() : myExcel.Selection.Merge
  448. xlSheet.Range("H" & N1 + 2 & ":J" & N1 + 2).Select() : myExcel.Selection.Merge
  449. xlSheet.Range("H" & N1 + 2 & ":J" & N1 + 2).Select() : myExcel.Selection.NumberFormatLocal = "[DBNum2][$-zh-CN]G/通用格式"
  450. myExcel.ActiveWindow.Zoom = 80 : myExcel.ActiveWindow.DisplayGridlines = False
  451. xlSheet.Range("C" & N1 + 11).Select()
  452. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  453. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  454. xlSheet.Range("C" & N1 + 12).Select()
  455. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  456. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  457. xlSheet.Range("A" & N1 + 5 & ":K" & N1 + 5).Select()
  458. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  459. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  460. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  461. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  462. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  463. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  464. xlSheet.Range("A7:K7").Select()
  465. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  466. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  467. xlSheet.Range("A6:K6").Select()
  468. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  469. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  470. xlSheet.Range("A3:K3").Select()
  471. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  472. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  473. xlSheet.Range("A1:K1").Select()
  474. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  475. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  476. xlSheet.Range("N12").Select()
  477. xlSheet.Range("B18:C" & N1).Select()
  478. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  479. .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  480. xlSheet.Range("D18:F" & N1).Select()
  481. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  482. .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  483. End Sub
  484. End Class