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

採購單編輯.vb 102KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142
  1. Option Strict Off
  2. Imports System.IO
  3. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  4. Imports Microsoft.Office.Interop.Excel.Constants
  5. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  6. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  7. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  8. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  9. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  10. Imports Microsoft.Office.Interop.Excel.XlWindowState
  11. Imports Microsoft.Office.Interop.Excel
  12. Imports System.Windows.Forms.DataVisualization.Charting
  13. Public Class 採購單編輯
  14. ReadOnly ds8 As New DataSet
  15. Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
  16. Dim QQQ1, QQQ2, QQQ3, 新項次, 物料規格, 採購選擇, 對話框(15) As String
  17. Dim NUM1, NA1, N1, N2 As Integer
  18. Dim 可繪圖 As Boolean
  19. Private Sub Set_明細清單()
  20. Dim ds As New DataSet : 明細_dgv.DataSource = Nothing : ds.Clear()
  21. 明細_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  22. 明細_dgv.ColumnHeadersHeight = 40
  23. 明細_dgv.AllowUserToAddRows = False
  24. If 小間距_ch.Checked = False And 中間距_ch.Checked = False And 大間距_ch.Checked = True Then
  25. 明細_dgv.RowTemplate.Height = 65
  26. ElseIf 小間距_ch.Checked = False And 中間距_ch.Checked = True And 大間距_ch.Checked = False Then
  27. 明細_dgv.RowTemplate.Height = 45
  28. ElseIf 小間距_ch.Checked = True And 中間距_ch.Checked = False And 大間距_ch.Checked = False Then
  29. 明細_dgv.RowTemplate.Height = 25
  30. End If
  31. PA20 = 採購選擇 : If PA20 = "" Then : PA20 = "B" : End If
  32. PA1 = QQQ1 : PA2 = 採購單號_tb.Text : SQL_建築物料採購單生成_明細()
  33. da.Fill(ds) : 明細_dgv.DataSource = ds.Tables(0) : conn.Close()
  34. 明細_dgv.Columns(0).Visible = False : 明細_dgv.Columns(1).FillWeight = 52 : 明細_dgv.Columns(3).FillWeight = 243 : 明細_dgv.Columns(4).FillWeight = 230
  35. 明細_dgv.Columns(5).FillWeight = 145 : 明細_dgv.Columns(6).FillWeight = 80 : 明細_dgv.Columns(7).FillWeight = 80 : 明細_dgv.Columns(8).FillWeight = 80
  36. 明細_dgv.Columns(9).FillWeight = 80 : 明細_dgv.Columns(10).Visible = False : 明細_dgv.Columns(11).Visible = False : 明細_dgv.Columns(12).Visible = False
  37. 明細_dgv.Columns(13).Visible = False : 明細_dgv.Columns(14).Visible = False : 明細_dgv.Columns(15).Visible = False : 明細_dgv.Columns(16).FillWeight = 95
  38. 明細_dgv.Columns(17).Visible = False : 明細_dgv.Columns(18).Visible = False : 明細_dgv.Columns(19).Visible = False : 明細_dgv.Columns(20).Visible = False
  39. 明細_dgv.Columns(21).Visible = False : 明細_dgv.Columns(22).Visible = False : 明細_dgv.Columns(23).Visible = False : 明細_dgv.Columns(24).Visible = False
  40. 明細_dgv.Columns(25).Visible = False : 明細_dgv.Columns(26).FillWeight = 40 : 明細_dgv.Columns("KEY").Visible = False : 明細_dgv.Columns("OUP").FillWeight = 80
  41. 明細_dgv.Columns(2).FillWeight = 86 : 明細_dgv.Columns(27).FillWeight = 80 : 明細_dgv.Columns("SP%").FillWeight = 80
  42. 明細_dgv.Columns(6).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(8).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(9).DefaultCellStyle.Format = "#,##0"
  43. 明細_dgv.Columns("OUP").DefaultCellStyle.Format = "#,##0"
  44. 明細_dgv.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  45. 明細_dgv.Columns(9).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns("OUP").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  46. 明細_dgv.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  47. 明細_dgv.Columns(9).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns("OUP").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  48. 明細_dgv.EditMode = DataGridViewEditMode.EditOnEnter
  49. 明細_dgv.Columns(1).ReadOnly = True : 明細_dgv.Columns(3).ReadOnly = True : 明細_dgv.Columns(4).ReadOnly = True : 明細_dgv.Columns(16).ReadOnly = True
  50. 明細_dgv.Columns(表頭(16)).ReadOnly = True : 明細_dgv.Columns(表頭(27)).ReadOnly = True : 明細_dgv.Columns("OUP").ReadOnly = True : 明細_dgv.Columns("SP%").ReadOnly = True
  51. If 低網速模式 = False Then
  52. 明細_dgv.Columns(29).FillWeight = 80 : 明細_dgv.Columns("Image").Visible = True
  53. Dim mycol As DataGridViewImageColumn = 明細_dgv.Columns("Image")
  54. mycol.ImageLayout = DataGridViewImageCellLayout.Zoom
  55. Else
  56. If 明細_dgv.Columns.Count = 30 Then
  57. 明細_dgv.Columns("Image").Visible = False
  58. End If
  59. End If
  60. 新項次 = "00"
  61. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  62. 明細_dgv.Columns("OUP").DefaultCellStyle.Format = "#,0"
  63. NUM1 = Double.Parse(新項次) + 1
  64. If NUM1 < 10 Then : 新項次 = "0" & NUM1
  65. ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1
  66. End If
  67. 明細_dgv.Rows(i).Cells(表頭(11)).Value = 新項次
  68. '-------------------------規格合併呈現----------------------------------------------------------------------------------------------------------------------------------------
  69. If i = 0 Then
  70. AAA1 = "" : AAA2 = "" : AAA3 = "" : AAA4 = "" : AAA5 = "" : AAA6 = "" : AAA7 = "" : AAA8 = "" : PA3 = 明細_dgv.Rows(i).Cells("規格庫抬頭指定").Value
  71. SQL_規格庫抬頭讀取()
  72. If dr.Read() Then : AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8") : End If
  73. conn.Close()
  74. Else
  75. If 明細_dgv.Rows(i).Cells("規格庫抬頭指定").Value.ToString <> 明細_dgv.Rows(i - 1).Cells("規格庫抬頭指定").Value.ToString Then
  76. AAA1 = "" : AAA2 = "" : AAA3 = "" : AAA4 = "" : AAA5 = "" : AAA6 = "" : AAA7 = "" : AAA8 = "" : PA3 = 明細_dgv.Rows(i).Cells("規格庫抬頭指定").Value : SQL_規格庫抬頭讀取()
  77. If dr.Read() Then : AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8") : End If
  78. conn.Close()
  79. End If
  80. End If
  81. Dim ZA1, ZA2, ZA3, ZA4, ZA5, ZA6, ZA7, ZA8 As String : 物料規格 = ""
  82. If 詳細資料2_ch.Checked = True Then
  83. If 明細_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then
  84. ZA1 = AAA1 & "=" & 明細_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  85. If 明細_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then : ZA2 = AAA2 & "=" & 明細_dgv.Rows(i).Cells("A2").Value
  86. If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  87. If 明細_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then : ZA3 = AAA3 & "=" & 明細_dgv.Rows(i).Cells("A3").Value
  88. If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  89. If 明細_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then : ZA4 = AAA4 & "=" & 明細_dgv.Rows(i).Cells("A4").Value
  90. If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  91. If 明細_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then : ZA5 = AAA5 & "=" & 明細_dgv.Rows(i).Cells("A5").Value
  92. If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  93. If 明細_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then : ZA6 = AAA6 & "=" & 明細_dgv.Rows(i).Cells("A6").Value
  94. If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  95. If 明細_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then : ZA7 = AAA7 & "=" & 明細_dgv.Rows(i).Cells("A7").Value
  96. If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  97. If 明細_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then : ZA8 = AAA8 & "=" & 明細_dgv.Rows(i).Cells("A8").Value
  98. If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  99. Else
  100. If 明細_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then : ZA1 = 明細_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  101. If 明細_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then
  102. ZA2 = 明細_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  103. If 明細_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then
  104. ZA3 = 明細_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  105. If 明細_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then
  106. ZA4 = 明細_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  107. If 明細_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then
  108. ZA5 = 明細_dgv.Rows(i).Cells("A5").Value : If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  109. If 明細_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then
  110. ZA6 = 明細_dgv.Rows(i).Cells("A6").Value : If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  111. If 明細_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then
  112. ZA7 = 明細_dgv.Rows(i).Cells("A7").Value : If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  113. If 明細_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then
  114. ZA8 = 明細_dgv.Rows(i).Cells("A8").Value : If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  115. End If
  116. 明細_dgv.Rows(i).Cells(表頭(13)).Value = 物料規格
  117. '-------------------------歷史單價----------------------------------------------------------------------------------------------------------------------------------------
  118. PA = 明細_dgv.Rows(i).Cells("料號").Value : Set_單價()
  119. If 價錢_dgv.Rows.Count = 0 Then : 明細_dgv.Rows(i).Cells("OUP").Value = 0 : Else : 明細_dgv.Rows(i).Cells("OUP").Value = 價錢_dgv.Rows(0).Cells("單價").Value : End If
  120. Next i
  121. Dim FFGG As Long = 0
  122. 總金額_tb.Text = "0"
  123. If 採購選擇 = "A" Then
  124. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  125. 明細_dgv.Rows(i).Cells(表頭(26)).Value = "0.0"
  126. 明細_dgv.Rows(i).Cells(表頭(27)).Value = 明細_dgv.Rows(i).Cells(表頭(26)).Value * 明細_dgv.Rows(i).Cells(表頭(15)).Value
  127. FFGG = CLng(FFGG) + 明細_dgv.Rows(i).Cells(表頭(27)).Value : 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = False
  128. Next i
  129. ElseIf 採購選擇 = "B" Then
  130. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  131. 明細_dgv.Rows(i).Cells(表頭(27)).Value = 明細_dgv.Rows(i).Cells(表頭(26)).Value * 明細_dgv.Rows(i).Cells(表頭(15)).Value
  132. FFGG = CLng(FFGG) + 明細_dgv.Rows(i).Cells(表頭(27)).Value : 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = True
  133. Next i
  134. End If
  135. 折扣金額_tb.Text = CLng(折扣比_tb.Text) * FFGG / 100
  136. If 稅金計算_ch.Checked = True Then
  137. If 折扣比_tb.Text = "0" Then : 稅金金額_tb.Text = FFGG * CLng(稅金比_tb.Text) / 100 : Else : 稅金金額_tb.Text = (FFGG - 折扣金額_tb.Text) * CLng(稅金比_tb.Text) / 100 : End If
  138. Else : 稅金金額_tb.Text = "0" : End If
  139. 總金額_tb.Text = FFGG - CLng(折扣金額_tb.Text) + CLng(稅金金額_tb.Text)
  140. 折扣金額_tb.Text = Strings.Format(CLng(折扣金額_tb.Text), "#,##0") : 稅金金額_tb.Text = Strings.Format(CLng(稅金金額_tb.Text), "#,##0")
  141. 總金額_tb.Text = Strings.Format(CLng(總金額_tb.Text), "#,##0")
  142. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  143. If 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = True Then
  144. 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = False
  145. End If
  146. For II As Integer = 0 To 最新單價_dgv.Rows.Count - 1
  147. If 明細_dgv.Rows(i).Cells("料號").Value.ToString = 最新單價_dgv.Rows(II).Cells("料號").Value.ToString And CLng(明細_dgv.Rows(i).Cells(表頭(26)).Value.ToString) = 0 Then
  148. 明細_dgv.Rows(i).Cells(表頭(26)).Value = 最新單價_dgv.Rows(II).Cells("單價").Value.ToString : Exit For
  149. End If
  150. Next
  151. Next : 價格()
  152. End Sub
  153. Private Sub Set_清單1()
  154. Dim ds1 As New DataSet : 請購單_dgv.DataSource = Nothing : ds1.Clear()
  155. 請購單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  156. 請購單_dgv.ColumnHeadersHeight = 25
  157. 請購單_dgv.AllowUserToAddRows = False
  158. SQL_建築物料採購單生成_請購()
  159. da.Fill(ds1) : 請購單_dgv.DataSource = ds1.Tables(0) : conn.Close()
  160. 請購單_dgv.Columns(0).FillWeight = 125 : 請購單_dgv.Columns(1).Visible = False : 請購單_dgv.Columns(2).Visible = False : 請購單_dgv.Columns(3).Visible = False
  161. 請購單_dgv.Columns(4).Visible = False : 請購單_dgv.Columns(5).Visible = False : 請購單_dgv.Columns(6).Visible = False : 請購單_dgv.Columns(7).Visible = False
  162. 請購單_dgv.Columns(8).Visible = False : 請購單_dgv.Columns(9).Visible = False
  163. End Sub
  164. Private Sub Set_清單2()
  165. Dim ds2 As New DataSet : 採購單_dgv.DataSource = Nothing : ds2.Clear()
  166. 採購單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  167. 採購單_dgv.ColumnHeadersHeight = 25
  168. 採購單_dgv.AllowUserToAddRows = False
  169. SQL_建築物料採購單生成_採購()
  170. da.Fill(ds2) : 採購單_dgv.DataSource = ds2.Tables(0) : conn.Close()
  171. For i As Integer = 0 To 18 : 採購單_dgv.Columns(i).Visible = False : Next
  172. 採購單_dgv.Columns(17).Visible = True
  173. For i As Integer = 0 To 採購單_dgv.Rows.Count - 1
  174. If 採購單_dgv.Rows(i).Cells("合約號").Value.ToString <> "" Then
  175. 採購單_dgv.Rows(i).Cells("NO.").Value = Strings.Mid(採購單_dgv.Rows(i).Cells(0).Value.ToString, 9, 6) & " _ " & 採購單_dgv.Rows(i).Cells("合約號").Value.ToString.ToUpper()
  176. Else
  177. 採購單_dgv.Rows(i).Cells("NO.").Value = 採購單_dgv.Rows(i).Cells(0).Value.ToString
  178. End If
  179. Next
  180. End Sub
  181. Private Sub Set_清單3()
  182. Dim ds1 As New DataSet : 最新單價_dgv.DataSource = Nothing : ds1.Clear()
  183. 最新單價_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  184. 最新單價_dgv.ColumnHeadersHeight = 25
  185. 最新單價_dgv.AllowUserToAddRows = False
  186. PA14 = 供應商編碼_tb.Text : SQL_物料最新單價查詢()
  187. da.Fill(ds1) : 最新單價_dgv.DataSource = ds1.Tables(0) : conn.Close()
  188. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  189. For II As Integer = 0 To 最新單價_dgv.Rows.Count - 1
  190. If 明細_dgv.Rows(i).Cells("料號").Value.ToString = 最新單價_dgv.Rows(II).Cells("料號").Value.ToString And CLng(明細_dgv.Rows(i).Cells(表頭(26)).Value.ToString) = 0 Then
  191. 明細_dgv.Rows(i).Cells(表頭(26)).Value = 最新單價_dgv.Rows(II).Cells("單價").Value.ToString : Exit For
  192. End If
  193. Next
  194. Next
  195. End Sub
  196. Private Sub 總金額計算()
  197. Dim FFGG As Long = 0
  198. 總金額_tb.Text = "0"
  199. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  200. 明細_dgv.Rows(i).Cells(表頭(27)).Value = 明細_dgv.Rows(i).Cells(表頭(26)).Value * 明細_dgv.Rows(i).Cells(表頭(15)).Value
  201. If 明細_dgv.Rows(i).Cells(表頭(27)).Value = "0" Then
  202. 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = False
  203. Else
  204. 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = True
  205. End If
  206. FFGG = CLng(FFGG) + 明細_dgv.Rows(i).Cells(表頭(27)).Value
  207. If 明細_dgv(表頭(28), i).Value = True Then
  208. 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightGreen
  209. Else
  210. 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.White
  211. End If
  212. Next i
  213. If 折扣比_tb.Text = "" Then : 折扣比_tb.Text = "0" : End If
  214. 折扣金額_tb.Text = CLng(折扣比_tb.Text) * FFGG / 100
  215. If 稅金計算_ch.Checked = True Then
  216. If 折扣比_tb.Text = "0" Then
  217. 稅金金額_tb.Text = FFGG * CLng(稅金比_tb.Text) / 100
  218. Else
  219. 稅金金額_tb.Text = (FFGG - 折扣金額_tb.Text) * CLng(稅金比_tb.Text) / 100
  220. End If
  221. Else
  222. 稅金金額_tb.Text = "0"
  223. End If
  224. 總金額_tb.Text = FFGG - CLng(折扣金額_tb.Text) + CLng(稅金金額_tb.Text)
  225. 折扣金額_tb.Text = Strings.Format(CLng(折扣金額_tb.Text), "#,##0") : 稅金金額_tb.Text = Strings.Format(CLng(稅金金額_tb.Text), "#,##0")
  226. 總金額_tb.Text = Strings.Format(CLng(總金額_tb.Text), "#,##0")
  227. End Sub
  228. Private Sub Set_單價()
  229. Dim ds6 As New DataSet : 價錢_dgv.DataSource = Nothing : ds6.Clear()
  230. 價錢_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  231. 價錢_dgv.ColumnHeadersHeight = 25
  232. 價錢_dgv.AllowUserToAddRows = False
  233. If 日期_rb.Checked = False And 單價_rb.Checked = True Then
  234. SQL_加權平均()
  235. ElseIf 日期_rb.Checked = True And 單價_rb.Checked = False Then
  236. SQL_最近日期()
  237. End If
  238. da.Fill(ds6) : 價錢_dgv.DataSource = ds6.Tables(0) : conn.Close()
  239. End Sub
  240. Private Sub Set_料號比價()
  241. Dim ds1 As New DataSet
  242. 料號_dgv.DataSource = Nothing : ds1.Clear()
  243. 料號_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  244. 料號_dgv.ColumnHeadersHeight = 25
  245. 料號_dgv.AllowUserToAddRows = False
  246. PA = 料號1_tb.Text : SQL_料號比對價格()
  247. da.Fill(ds1) : 料號_dgv.DataSource = ds1.Tables(0) : conn.Close()
  248. 料號_dgv.Columns("排序").Visible = False : 料號_dgv.Columns(3).DefaultCellStyle.Format = "#,##0.00" : 料號_dgv.Columns(3).FillWeight = 50
  249. End Sub
  250. Private Sub 語言轉換讀取()
  251. If 系統語言 = "繁體中文" Then : 語言 = "CH" : ElseIf 系統語言 = "English" Then : 語言 = "EN" : ElseIf 系統語言 = "Indonesian" Then : 語言 = "IN" : End If
  252. 核准請購未生成_lb.Text = 系統語言字典("H205-100-" & 語言) : 文字_lb.Text = 系統語言字典("H205-101-" & 語言) : 日期_rb.Text = 系統語言字典("H205-102-" & 語言)
  253. 全部取消_bt.Text = 系統語言字典("H205-103-" & 語言) : 全部選擇_bt.Text = 系統語言字典("H205-104-" & 語言) : 重新整理_tsm.Text = 系統語言字典("H205-105-" & 語言)
  254. 核准請購未生成_lb.Text = 系統語言字典("H205-106-" & 語言) : 表頭(28) = 系統語言字典("H205-107-" & 語言) : 表頭(19) = 系統語言字典("H205-108-" & 語言)
  255. 表頭(134) = 系統語言字典("H205-109-" & 語言) : 表頭(27) = 系統語言字典("H205-110-" & 語言) : 表頭(12) = 系統語言字典("H205-111-" & 語言)
  256. 表頭(24) = 系統語言字典("H205-112-" & 語言) : 表頭(13) = 系統語言字典("H205-113-" & 語言) : 表頭(14) = 系統語言字典("H205-114-" & 語言)
  257. 表頭(16) = 系統語言字典("H205-115-" & 語言) : 表頭(18) = 系統語言字典("H205-116-" & 語言) : 表頭(26) = 系統語言字典("H205-117-" & 語言)
  258. 表頭(11) = 系統語言字典("H205-118-" & 語言) : 表頭(15) = 系統語言字典("H205-119-" & 語言) : 單價_rb.Text = 系統語言字典("H205-120-" & 語言)
  259. 對話框(0) = 系統語言字典("H205-121-" & 語言) : 對話框(9) = 系統語言字典("H205-122-" & 語言) : 對話框(10) = 系統語言字典("H205-123-" & 語言)
  260. 對話框(1) = 系統語言字典("H205-124-" & 語言) : 對話框(2) = 系統語言字典("H205-125-" & 語言) : 對話框(3) = 系統語言字典("H205-126-" & 語言)
  261. 對話框(4) = 系統語言字典("H205-127-" & 語言) : 對話框(5) = 系統語言字典("H205-128-" & 語言) : 對話框(6) = 系統語言字典("H205-129-" & 語言)
  262. 對話框(7) = 系統語言字典("H205-130-" & 語言) : 對話框(8) = 系統語言字典("H205-131-" & 語言) : 選擇公司_lb.Text = 系統語言字典("H205-132-" & 語言)
  263. 總金額_lb.Text = 系統語言字典("H205-133-" & 語言) : 簡稱_lb.Text = 系統語言字典("H205-134-" & 語言) : ToolTip1.ToolTipTitle = 系統語言字典("G000-108-" & 語言)
  264. Me.Text = 系統語言字典("H001-171-" & 語言) : 對話框(15) = 系統語言字典("H205-135-" & 語言) : 對話框(11) = 系統語言字典("H205-136-" & 語言)
  265. 對話框(12) = 系統語言字典("G000-110-" & 語言) : 對話框(13) = 系統語言字典("G000-114-" & 語言) : 對話框(14) = 系統語言字典("H205-137-" & 語言)
  266. End Sub
  267. Private Sub 清空供應商_bt_MouseEnter(sender As Object, e As EventArgs) Handles 清空供應商_bt.MouseEnter
  268. ToolTip1.SetToolTip(Me.清空供應商_bt, 對話框(11))
  269. End Sub
  270. Private Sub 生成採購單_bt_MouseEnter(sender As Object, e As EventArgs) Handles 生成採購單_bt.MouseEnter
  271. ToolTip1.SetToolTip(Me.生成採購單_bt, 對話框(12))
  272. End Sub
  273. Private Sub 列印成詢價單_bt_MouseEnter(sender As Object, e As EventArgs) Handles 列印成詢價單_bt.MouseEnter
  274. ToolTip1.SetToolTip(Me.列印成詢價單_bt, 對話框(13))
  275. End Sub
  276. Private Sub 料號_bt_MouseEnter(sender As Object, e As EventArgs) Handles 分析工具_bt.MouseEnter
  277. ToolTip1.SetToolTip(Me.分析工具_bt, 對話框(14))
  278. End Sub
  279. Private Sub 類別管理_cb_下拉表單資料載入()
  280. SQL_供應商類別_下拉清單() : 類別管理_cb.Items.Clear() : 類別管理_cb.Items.Add("")
  281. While (dr.Read()) : 類別管理_cb.Items.Add(dr("類別")) : End While : conn.Close()
  282. End Sub
  283. Private Sub 廠商_cb_下拉表單資料載入()
  284. SQL_供應商資料表_公司名_下拉用() : 廠商_cb.Items.Clear() : 廠商_cb.Items.Add("") : While (dr.Read()) : 廠商_cb.Items.Add(dr("公司名")) : End While : conn.Close()
  285. End Sub
  286. Private Sub 廠商清空()
  287. 供應商編碼_tb.Text = "" : 地址_tb.Text = "" : 電話_tb.Text = "" : 郵件_tb.Text = "" : 傳真_tb.Text = "" : 類別管理_cb_下拉表單資料載入() : 廠商_cb_下拉表單資料載入()
  288. End Sub
  289. Private Sub 採購單編輯_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  290. Me.MdiParent = HX_PGS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  291. 風格() : H(205) = True : 介面 = "H205" : 語言轉換讀取() : 顯示說明(999, True)
  292. 單價_rb.Checked = True : Panel3.SendToBack()
  293. SQL_清單欄位查詢()
  294. If Acdr.Read() Then
  295. 小間距_ch.Checked = Acdr("L_1_1") : 中間距_ch.Checked = Acdr("L_2_1") : 大間距_ch.Checked = Acdr("L_3_1")
  296. End If : Access1.Close()
  297. Label4.Text = 對話框(6) & 比例1 & 對話框(7) & 比例2 & 對話框(8) & 比例2 & 對話框(7) & 比例3 & 對話框(9) & 比例3
  298. 類別管理_cb_下拉表單資料載入() : Set_清單1() : Set_清單2() : 首次開啟 = False
  299. MyMod.清單字體大小調整()
  300. 採購單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  301. 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  302. 料號_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  303. End Sub
  304. Private Sub 採購單編輯_SizeChanged(sender As Object, e As EventArgs) Handles MyBase.SizeChanged
  305. MyMod.清單字體大小調整()
  306. 採購單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  307. 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  308. 料號_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  309. End Sub
  310. Private Sub 採購單編輯_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
  311. H(205) = False : MyMod.虛擬桌面開啟()
  312. End Sub
  313. Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
  314. 介面 = "H205" : 語言轉換讀取()
  315. 類別管理_cb_下拉表單資料載入() : Set_清單1() : Set_清單2() : Set_單價() : Set_明細清單() : Set_料號比價()
  316. Label4.Text = 對話框(6) & 比例1 & 對話框(7) & 比例2 & 對話框(8) & 比例2 & 對話框(7) & 比例3 & 對話框(9) & 比例3
  317. End Sub
  318. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  319. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  320. End Sub
  321. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  322. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  323. End Sub
  324. Private Sub 價格()
  325. Dim 差異, 比對 As Double
  326. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  327. If 明細_dgv.Rows(i).Cells("OUP").Value = 0 And 明細_dgv.Rows(i).Cells(表頭(26)).Value = 0 Then
  328. If 深色風格 = False Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.Lavender
  329. Else : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.Navy : End If
  330. 明細_dgv.Rows(i).Cells("SP%").Value = "0 % →"
  331. ElseIf 明細_dgv.Rows(i).Cells(表頭(26)).Value = 0 And 明細_dgv.Rows(i).Cells("OUP").Value <> 0 Then
  332. If 深色風格 = False Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.Lavender
  333. Else : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.Navy : End If
  334. 明細_dgv.Rows(i).Cells("SP%").Value = "0 % →"
  335. ElseIf 明細_dgv.Rows(i).Cells("OUP").Value <> 0 And 明細_dgv.Rows(i).Cells(表頭(26)).Value <> 0 Then
  336. 差異 = 明細_dgv.Rows(i).Cells(表頭(26)).Value - 明細_dgv.Rows(i).Cells("OUP").Value : 比對 = 差異 / 明細_dgv.Rows(i).Cells(表頭(26)).Value * 100
  337. If 比對 > 0 Then : 明細_dgv.Rows(i).Cells("SP%").Value = CInt(比對) & " % ↗" : 比對 *= 1
  338. ElseIf 比對 < 0 Then : 明細_dgv.Rows(i).Cells("SP%").Value = CInt(比對) & " % ↘" : 比對 *= -1
  339. ElseIf 比對 = 0 Then : 明細_dgv.Rows(i).Cells("SP%").Value = CInt(比對) & " % →" : End If
  340. If 深色風格 = False Then
  341. If 比對 < 比例1 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.White
  342. ElseIf 比對 > 比例1 And 比對 < 比例2 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightGreen
  343. ElseIf 比對 > 比例2 And 比對 < 比例3 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightBlue
  344. ElseIf 比對 >= 比例3 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightPink : End If
  345. Else
  346. If 比對 < 比例1 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.DimGray
  347. ElseIf 比對 > 比例1 And 比對 < 比例2 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.DarkGreen
  348. ElseIf 比對 > 比例2 And 比對 < 比例3 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.DarkBlue
  349. ElseIf 比對 >= 比例3 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.Purple : End If
  350. End If
  351. End If
  352. Next
  353. End Sub
  354. Private Sub 單價_rb_CheckedChanged(sender As Object, e As EventArgs) Handles 單價_rb.Click
  355. If 首次開啟 = False Then : Set_明細清單() : End If
  356. End Sub
  357. Private Sub 日期_rb_CheckedChanged(sender As Object, e As EventArgs) Handles 日期_rb.Click
  358. Set_明細清單()
  359. End Sub
  360. Dim 已超出 As Boolean
  361. Private Sub 明細_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 明細_dgv.MouseUp
  362. 'If 明細_dgv.SelectedCells.Count = 1 Then : 通知訊息 = 明細_dgv.SelectedCells(0).ColumnIndex & " " & 明細_dgv.SelectedCells(0).RowIndex) : End If
  363. If 明細_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
  364. If 明細_dgv.SelectedCells.Count > 0 Then
  365. If 明細_dgv.SelectedCells(0).ColumnIndex = 9 Then
  366. If 已超出 = False Then
  367. Dim x As Double = 0
  368. For i As Integer = 0 To 明細_dgv.SelectedCells.Count - 1
  369. Dim 變數 As String = "" : Dim 取變數 As String
  370. 取變數 = 明細_dgv.Rows(明細_dgv.SelectedCells.Item(i).RowIndex).Cells(明細_dgv.SelectedCells.Item(i).ColumnIndex).Value
  371. For ii As Integer = 1 To Len(取變數)
  372. If ii = 1 Then : 變數 = Strings.Left(取變數, ii) : Else : If Strings.Mid(取變數, ii, 1) <> "," Then : 變數 &= Strings.Mid(取變數, ii, 1) : End If : End If
  373. Next : x += CLng(變數)
  374. Next i : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(x, "#,##0")
  375. Else : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0") : End If
  376. Else : 已超出 = True : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0") : End If
  377. End If
  378. End Sub
  379. Private Sub 明細_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 明細_dgv.CellClick
  380. If e.RowIndex = -1 Then : Else
  381. 物料圖2_pb.Image = Nothing : 物料圖1_pb.Image = Nothing
  382. PA2 = 明細_dgv.Rows(e.RowIndex).Cells("料號原則").Value : SQL_物料圖庫_圖檔讀取一()
  383. While dr.Read() = True
  384. Dim unused As Byte() = New Byte(-1) {}
  385. Dim bytes As Byte() = DirectCast(dr.Item("圖檔"), Byte())
  386. Dim oStream As New MemoryStream(bytes)
  387. 物料圖1_pb.Image = Bitmap.FromStream(oStream)
  388. End While
  389. conn.Close() : 物料圖1_pb.SizeMode = 4
  390. 料號1_tb.Text = 明細_dgv("料號", e.RowIndex).Value.ToString
  391. 品名_tb.Text = 明細_dgv(表頭(12), e.RowIndex).Value.ToString
  392. If 歷史單價_P.Visible = True Then : Set_料號比價() : 繪圖() : 料號_dgv.Sort(料號_dgv.Columns("排序"), System.ComponentModel.ListSortDirection.Descending) : End If
  393. End If
  394. 價格()
  395. End Sub
  396. Private Sub 明細_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 明細_dgv.CellEnter
  397. 總金額計算() : 價格()
  398. End Sub
  399. Private Sub 請購單_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 請購單_dgv.CellClick
  400. 選擇公司_cb.Enabled = True : 採購選擇 = "A"
  401. If e.RowIndex = -1 Then : Else
  402. QQQ1 = 請購單_dgv(0, e.RowIndex).Value.ToString : QQQ2 = 請購單_dgv(3, e.RowIndex).Value.ToString : QQQ3 = 請購單_dgv(4, e.RowIndex).Value.ToString
  403. If 請購單_dgv.Rows(e.RowIndex).Cells("用途").Value.ToString = "" Then : 使用地點_tb.Text = "" : Else
  404. 使用地點_tb.Text = 請購單_dgv.Rows(e.RowIndex).Cells("用途").Value.ToString & "-" & 請購單_dgv.Rows(e.RowIndex).Cells("倉名").Value
  405. End If
  406. 折扣比_tb.Text = "0" : 稅金計算_ch.Checked = True : 稅金比_tb.Text = "10" : 採購單號_tb.Text = ""
  407. End If : Set_明細清單()
  408. End Sub
  409. Private Sub 採購單_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 採購單_dgv.CellClick
  410. PA = "" : 廠商清空()
  411. 選擇公司_cb.Enabled = False : 採購選擇 = "B"
  412. If e.RowIndex = -1 Then : Else
  413. 採購單號_tb.Text = 採購單_dgv(0, e.RowIndex).Value.ToString : 折扣比_tb.Text = 採購單_dgv(13, e.RowIndex).Value.ToString : 稅金計算_ch.Checked = 採購單_dgv(14, e.RowIndex).Value
  414. 稅金比_tb.Text = 採購單_dgv(15, e.RowIndex).Value.ToString : 核對員_tb.Text = 採購單_dgv(4, e.RowIndex).Value.ToString : 核對日期_tb.Text = 採購單_dgv(5, e.RowIndex).Value.ToString
  415. 詢價員_tb.Text = 採購單_dgv(6, e.RowIndex).Value.ToString : 尋價日期_tb.Text = 採購單_dgv(7, e.RowIndex).Value.ToString : 手動號碼_tb.Text = 採購單_dgv(18, e.RowIndex).Value.ToString
  416. If Strings.Left(採購單號_tb.Text, 3) = "HXI" Then
  417. 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL"
  418. ElseIf Strings.Left(採購單號_tb.Text, 3) = "PGS" Then
  419. 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" : End If
  420. 供應商編碼_tb.Text = 採購單_dgv(1, e.RowIndex).Value.ToString : conn.Close() : PA1 = 供應商編碼_tb.Text
  421. SQL_建築物料採購單生成_供應商資料一()
  422. If dr.Read() Then : 廠商_cb.Text = dr("公司名") : conn.Close() : Else : 廠商_cb.Text = "" : End If : conn.Close()
  423. 使用地點_tb.Text = 採購單_dgv(3, e.RowIndex).Value.ToString : 需求日期_dtp.Value = 採購單_dgv(2, e.RowIndex).Value
  424. Set_明細清單() : 歷史單價_P.Visible = False
  425. End If
  426. End Sub
  427. Private Sub Set_日期格式轉換()
  428. DTP = Strings.Format(Today(), "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd") : DTP2 = Strings.Format(需求日期_dtp.Value, "yyyy/MM/dd")
  429. End Sub
  430. Private Sub 類別管理_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 類別管理_cb.SelectedIndexChanged
  431. PA20 = 類別管理_cb.Text : SQL_供應商類別管理_查詢()
  432. If dr.Read() Then : 供應商簡稱_tb.Text = dr("編碼").ToString : Else : 供應商簡稱_tb.Text = "" : End If
  433. PA = 供應商簡稱_tb.Text : 廠商_cb_下拉表單資料載入()
  434. End Sub
  435. Private Sub 廠商_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 廠商_cb.SelectedIndexChanged
  436. PA1 = 廠商_cb.Text : SQL_建築物料採購單生成_供應商資料二()
  437. If dr.Read() Then
  438. 地址_tb.Text = dr("公司地址") : 電話_tb.Text = dr("公司電話1") : 郵件_tb.Text = dr("聯繫人1郵箱")
  439. 傳真_tb.Text = dr("公司傳真1") : 供應商編碼_tb.Text = dr("供應商編碼")
  440. End If : conn.Close()
  441. End Sub
  442. Private Sub 供應商編碼_tb_TextChanged(sender As Object, e As EventArgs) Handles 供應商編碼_tb.TextChanged
  443. Set_清單3()
  444. End Sub
  445. Private Sub 清空供應商_bt_Click(sender As Object, e As EventArgs) Handles 清空供應商_bt.Click
  446. If 採購單號_tb.Text = "" Then : Else
  447. SQL_採購單供應商_清空() : 廠商_cb.Text = "" : 地址_tb.Text = "" : 電話_tb.Text = "" : 郵件_tb.Text = "" : 傳真_tb.Text = "" : 供應商編碼_tb.Text = "" : MGB(對話框(15), 1)
  448. End If
  449. End Sub
  450. Private Sub 折扣比_tb_TextChanged(sender As Object, e As EventArgs) Handles 折扣比_tb.TextChanged
  451. 總金額計算()
  452. End Sub
  453. Private Sub 稅金計算_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 稅金計算_ch.CheckedChanged
  454. 總金額計算()
  455. End Sub
  456. Private Sub 稅金比_tb_TextChanged(sender As Object, e As EventArgs) Handles 稅金比_tb.TextChanged
  457. 總金額計算()
  458. End Sub
  459. Private Sub 全部選擇_bt_Click(sender As Object, e As EventArgs) Handles 全部選擇_bt.Click
  460. For i As Integer = 0 To 明細_dgv.Rows.Count - 1 : 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = True : Next i
  461. End Sub
  462. Private Sub 全部取消_bt_Click(sender As Object, e As EventArgs) Handles 全部取消_bt.Click
  463. For i As Integer = 0 To 明細_dgv.Rows.Count - 1 : 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = False : Next i
  464. End Sub
  465. Private Sub 生成採購單_bt_Click(sender As Object, e As EventArgs) Handles 生成採購單_bt.Click
  466. If 手動號碼_tb.Text = "" Then : MGB(系統語言字典("H206-143-" & 語言), 1) : Else
  467. If 採購選擇 = "A" Then : 生成新的採購訂單() : ElseIf 採購選擇 = "B" Then : 修改的採購單存檔() : End If
  468. End If
  469. End Sub
  470. Private Sub 生成新的採購訂單()
  471. If 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL" Then
  472. Set_日期格式轉換() : Dim NUM1 As Integer
  473. For i As Integer = 1 To 999
  474. NUM1 = 0 + i
  475. If NUM1 < 10 Then : 採購單號_tb.Text = "HXI-C-" & DTP1 & "-00" & NUM1
  476. ElseIf NUM1 > 9 And NUM1 < 100 Then : 採購單號_tb.Text = "HXI-C-" & DTP1 & "-0" & NUM1
  477. ElseIf NUM1 > 99 Then : 採購單號_tb.Text = "HXI-C-" & DTP1 & "-" & NUM1
  478. End If
  479. PA1 = 採購單號_tb.Text
  480. SQL_採購單控制表_單號最後一筆() : If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  481. Next
  482. 確定新增()
  483. ElseIf 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" Then
  484. Set_日期格式轉換() : Dim NUM1 As Integer
  485. For i As Integer = 1 To 999
  486. NUM1 = 0 + i
  487. If NUM1 < 10 Then : 採購單號_tb.Text = "PGS-C-" & DTP1 & "-00" & NUM1
  488. ElseIf NUM1 > 9 And NUM1 < 100 Then : 採購單號_tb.Text = "PGS-C-" & DTP1 & "-0" & NUM1
  489. ElseIf NUM1 > 99 Then : 採購單號_tb.Text = "PGS-C-" & DTP1 & "-" & NUM1
  490. End If
  491. PA1 = 採購單號_tb.Text
  492. SQL_採購單控制表_單號最後一筆() : If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  493. Next
  494. 確定新增()
  495. End If
  496. End Sub
  497. Private Sub 修改的採購單存檔()
  498. If 廠商_cb.Text = "" Then : MGB(對話框(5), 1) : Else : Set_日期格式轉換()
  499. PA1 = 供應商編碼_tb.Text : PA2 = 使用地點_tb.Text : PA3 = 折扣比_tb.Text : BL1 = 稅金計算_ch.Checked : PA4 = 稅金比_tb.Text : PA5 = 採購單號_tb.Text
  500. PA39 = 手動號碼_tb.Text : SQL_採購單控制表_編輯() : conn.Close()
  501. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  502. 資料數 = 明細_dgv.Rows.Count : MyMod.進度條()
  503. PA6 = 明細_dgv.Rows(i).Cells(表頭(14)).Value : PA7 = 明細_dgv.Rows(i).Cells(表頭(26)).Value
  504. PA8 = 明細_dgv.Rows(i).Cells(表頭(15)).Value : PA9 = 明細_dgv.Rows(i).Cells(表頭(16)).Value
  505. PA10 = 明細_dgv.Rows(i).Cells("項次").Value : PA4 = 明細_dgv.Rows(i).Cells("KEY").Value
  506. SQL_採購單明細表_修改() : conn.Close()
  507. Next
  508. Set_清單1() : Set_清單2() : MGB(對話框(4), 1) : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  509. End If
  510. End Sub
  511. Private Sub 確定新增()
  512. Set_日期格式轉換()
  513. If 採購單號_tb.Text = "" Or 供應商編碼_tb.Text = "" Or 明細_dgv.Rows.Count = 0 Then : MGB(對話框(0), 1) : Else
  514. PA1 = 採購單號_tb.Text : PA2 = 供應商編碼_tb.Text : PA3 = 使用地點_tb.Text : PA4 = QQQ2
  515. PA5 = QQQ3 : PA6 = QQQ1 : PA7 = 折扣比_tb.Text : BL1 = 稅金計算_ch.Checked : PA8 = 稅金比_tb.Text
  516. SQL_採購單控制表_新增() : SQL_請購單控制表_轉採修改() : conn.Close()
  517. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  518. 資料數 = 明細_dgv.Rows.Count : MyMod.進度條()
  519. If 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value = True Then
  520. PA9 = 明細_dgv.Rows(i).Cells("" & 表頭(28) & "").Value : PA2 = 明細_dgv.Rows(i).Cells(表頭(18)).Value : PA3 = 明細_dgv.Rows(i).Cells("項次").Value
  521. PA4 = 明細_dgv.Rows(i).Cells(表頭(12)).Value : PA5 = 明細_dgv.Rows(i).Cells(表頭(13)).Value : PA6 = 明細_dgv.Rows(i).Cells(表頭(14)).Value
  522. NU1 = 明細_dgv.Rows(i).Cells(表頭(15)).Value : PA8 = 明細_dgv.Rows(i).Cells(表頭(16)).Value : PA10 = 明細_dgv.Rows(i).Cells(表頭(26)).Value
  523. PA11 = 明細_dgv.Rows(i).Cells("群組碼").Value : PA12 = 明細_dgv.Rows(i).Cells("料號原則").Value : PA13 = 明細_dgv.Rows(i).Cells("料號").Value
  524. SQL_請購單明細表_轉採修改() : SQL_採購單明細表_新增() : conn.Close()
  525. End If
  526. Next
  527. Set_清單1() : Set_清單2() : MGB(對話框(1), 1) : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  528. End If
  529. End Sub
  530. Private Sub 料號_bt_Click(sender As Object, e As EventArgs) Handles 分析工具_bt.Click
  531. Set_料號比價()
  532. If 料號1_tb.Text = "" Then : MGB(對話框(10), 1) : Else
  533. If 歷史單價_P.Visible = True Then : 歷史單價_P.Visible = False
  534. Else : 歷史單價_P.Visible = True : 繪圖() : 料號_dgv.Sort(料號_dgv.Columns("排序"), System.ComponentModel.ListSortDirection.Descending) : End If
  535. End If
  536. End Sub
  537. Private Sub 繪圖()
  538. Chart1.Series.Clear() : Chart1.ChartAreas(0).AxisX.Minimum = 0
  539. If 品名_tb.Text <> "" Then
  540. If 折線圖_ch.Checked = True Then
  541. Chart1.Series.Add(品名_tb.Text & "_1") : Chart1.Series(品名_tb.Text & "_1").ChartType = SeriesChartType.Line : Chart1.Series(品名_tb.Text & "_1").IsVisibleInLegend = False
  542. End If
  543. If 長條圖_ch.Checked = True Then
  544. Chart1.Series.Add(品名_tb.Text) : Chart1.Series(品名_tb.Text).ChartType = SeriesChartType.Column
  545. End If
  546. For i As Integer = 0 To 料號_dgv.Rows.Count - 1
  547. Chart1.Series(品名_tb.Text).Points.AddXY(料號_dgv.Rows(i).Cells(表頭(134)).Value.ToString, 料號_dgv.Rows(i).Cells(表頭(26)).Value.ToString)
  548. Next
  549. End If
  550. End Sub
  551. Private Sub 小間距_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 小間距_ch.Click
  552. 小間距_ch.Checked = True : 中間距_ch.Checked = False : 大間距_ch.Checked = False : MyMod.間距設定存檔_1() : Set_明細清單()
  553. End Sub
  554. Private Sub 中間距_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 中間距_ch.Click
  555. 小間距_ch.Checked = False : 中間距_ch.Checked = True : 大間距_ch.Checked = False : MyMod.間距設定存檔_2() : Set_明細清單()
  556. End Sub
  557. Private Sub 類別管理_cb_Click(sender As Object, e As EventArgs) Handles 類別管理_cb.Click
  558. CB選擇清單(類別管理_cb, 類別管理_cb.Text)
  559. End Sub
  560. Private Sub 廠商_cb_Click(sender As Object, e As EventArgs) Handles 廠商_cb.Click
  561. CB選擇清單(廠商_cb, 廠商_cb.Text)
  562. End Sub
  563. Private Sub 選擇公司_cb_Click(sender As Object, e As EventArgs) Handles 選擇公司_cb.Click
  564. CB選擇清單(選擇公司_cb, 選擇公司_cb.Text)
  565. End Sub
  566. Private Sub 大間距_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 大間距_ch.Click
  567. 小間距_ch.Checked = False : 中間距_ch.Checked = False : 大間距_ch.Checked = True : MyMod.間距設定存檔_3() : Set_明細清單()
  568. End Sub
  569. Private Sub 物料圖1_pb_Click(sender As Object, e As EventArgs) Handles 物料圖1_pb.Click
  570. If IsNothing(物料圖1_pb.Image) = False Then : 圖片傳遞 = 物料圖1_pb.Image : 圖片放大視窗.ShowDialog() : End If
  571. End Sub
  572. Private Sub 詳細資料2_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 詳細資料2_ch.Click
  573. If 詳細資料2_ch.Checked = True Then : 詳細資料2_ch.Checked = True : Else : 詳細資料2_ch.Checked = False : End If : Set_明細清單()
  574. End Sub
  575. Private Sub 列印成詢價單_bt_Click(sender As Object, e As EventArgs) Handles 列印成詢價單_bt.Click
  576. If 採購單號_tb.Text = "" Then : MGB(對話框(2), 1) : Else
  577. Dim ds6 As New DataSet : 請購資料_dgv.DataSource = Nothing : ds6.Clear()
  578. 請購資料_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  579. 請購資料_dgv.ColumnHeadersHeight = 25 : 請購資料_dgv.AllowUserToAddRows = False
  580. PA38 = 採購單號_tb.Text : SQL_採購資料() : da.Fill(ds6) : 請購資料_dgv.DataSource = ds6.Tables(0) : conn.Close()
  581. xlApp = CType(CreateObject("Excel.Application"), Application) : xlBook = xlApp.Workbooks.Add : xlApp.DisplayAlerts = True : xlBook.Activate()
  582. xlSheet = NewMethod(xlBook) : xlSheet.Activate() : xlApp.Visible = True : xlApp.Application.WindowState = xlMaximized
  583. 'xlSheet.Cells(2, 1) = 選擇公司_cb.Text
  584. xlSheet.Cells(3, 1) = "MINTA PESANAN HARGA"
  585. xlSheet.Cells(5, 1) = "ORDER TO : " & 廠商_cb.Text : xlSheet.Cells(6, 1) = "ALAMAT : " & 地址_tb.Text : xlSheet.Cells(7, 1) = "Telp : " & 電話_tb.Text
  586. xlSheet.Cells(8, 1) = "Fax : " & 傳真_tb.Text : xlSheet.Cells(9, 1) = "Email : " & 郵件_tb.Text
  587. 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"
  588. xlSheet.Cells(10, 6) = "QTY" : xlSheet.Cells(10, 7) = "UNIT PRICE" : xlSheet.Cells(10, 8) = "TOTAL PRICE"
  589. xlSheet.Cells(5, 5) = "PO NOMOR 1 : " : xlSheet.Cells(5, 7) = 手動號碼_tb.Text
  590. xlSheet.Cells(7, 5) = "PO NOMOR 2 : " : xlSheet.Cells(7, 7) = 採購單號_tb.Text
  591. xlSheet.Cells(8, 5) = "TGL/BLN/THN : " : xlSheet.Cells(8, 7) = 需求日期_dtp.Value
  592. xlSheet.Cells(9, 5) = "TEMPAT PEMAKAIAN : " : xlSheet.Cells(9, 7) = 使用地點_tb.Text
  593. Dim GGHH As Long = 0
  594. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  595. xlSheet.Cells(i + 11, 1) = 明細_dgv.Rows(i).Cells(表頭(11)).Value : xlSheet.Cells(i + 11, 2) = 明細_dgv.Rows(i).Cells(表頭(12)).Value
  596. xlSheet.Cells(i + 11, 3) = 明細_dgv.Rows(i).Cells(表頭(13)).Value : xlSheet.Cells(i + 11, 4) = 明細_dgv.Rows(i).Cells(表頭(14)).Value
  597. xlSheet.Cells(i + 11, 5) = 明細_dgv.Rows(i).Cells(表頭(16)).Value : xlSheet.Cells(i + 11, 6) = 明細_dgv.Rows(i).Cells(表頭(15)).Value
  598. xlSheet.Cells(i + 11, 7) = 明細_dgv.Rows(i).Cells(表頭(26)).Value : xlSheet.Cells(i + 11, 8) = 明細_dgv.Rows(i).Cells(表頭(27)).Value
  599. GGHH += 明細_dgv.Rows(i).Cells(表頭(27)).Value : N1 = i + 11
  600. Next i
  601. xlSheet.Cells(N1 + 2, 7) = "TOTAL :" : xlSheet.Cells(N1 + 2, 8) = GGHH
  602. xlSheet.Cells(N1 + 3, 7) = "DISC " & 折扣比_tb.Text & "% :" : xlSheet.Cells(N1 + 3, 8) = 折扣金額_tb.Text
  603. xlSheet.Cells(N1 + 4, 7) = "PPN " & 稅金比_tb.Text & "% :" : xlSheet.Cells(N1 + 4, 8) = 稅金金額_tb.Text
  604. xlSheet.Cells(N1 + 5, 7) = "GRAND TOTAL :" : xlSheet.Cells(N1 + 5, 8) = 總金額_tb.Text
  605. xlSheet.Cells(N1 + 6, 1) = "Bagian Pembelian Barang"
  606. xlSheet.Cells(N1 + 6, 3) = "Direktur Utama"
  607. xlSheet.Cells(N1 + 6, 4) = "Bagian Pemeriksa"
  608. xlSheet.Cells(N1 + 6, 6) = "Bagian Pengisian Harga" : xlSheet.Cells(N1 + 8, 6) = 詢價員_tb.Text : xlSheet.Cells(N1 + 9, 6) = 尋價日期_tb.Text
  609. xlSheet.Cells(N1 + 6, 8) = "Asisten Proyek" : xlSheet.Cells(N1 + 8, 8) = 核對員_tb.Text : xlSheet.Cells(N1 + 9, 8) = 核對日期_tb.Text
  610. For i As Integer = 0 To 請購資料_dgv.Rows.Count - 1
  611. xlSheet.Cells(i + N1 + 12, 1) = 請購資料_dgv.Rows(i).Cells(0).Value
  612. If 系統語言 = "繁體中文" Then
  613. xlSheet.Cells(i + N1 + 12, 3) = 請購資料_dgv.Rows(i).Cells(2).Value
  614. Else
  615. xlSheet.Cells(i + N1 + 12, 3) = 請購資料_dgv.Rows(i).Cells(1).Value
  616. End If
  617. xlSheet.Cells(i + N1 + 12, 8) = 請購資料_dgv.Rows(i).Cells(3).Value : N2 += 1
  618. Next : AA(xlApp, xlSheet) : FF(xlApp, xlSheet)
  619. If Strings.Left(採購單號_tb.Text, 2) = "HX" Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If
  620. '-------------轉換成PDF---------------------------------------------------------------------
  621. Dim SERT As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
  622. xlBook.Sheets(1).ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, SERT & "\" & 採購單號_tb.Text & "_PO(採購單).pdf", XlFixedFormatQuality.xlQualityStandard, True)
  623. '-------------關閉EXCEL---------------------------------------------------------------------
  624. xlSheet.PageSetup.PrintArea = "" : xlApp.Cells.Select()
  625. xlApp.Application.WindowState = xlMinimized
  626. xlBook.Close(False)
  627. Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet)
  628. Runtime.InteropServices.Marshal.ReleaseComObject(xlBook)
  629. Runtime.InteropServices.Marshal.ReleaseComObject(xlApp)
  630. xlApp.Quit() : xlSheet = Nothing : xlBook = Nothing : xlApp = Nothing : GC.Collect()
  631. '-------------開啟PDF---------------------------------------------------------------------
  632. Dim pdfFilePath As String = SERT & "\" & 採購單號_tb.Text & "_PO(採購單).pdf"
  633. If IsChromeInstalled() Then
  634. Try
  635. Dim chromeProcess As New Process()
  636. chromeProcess.StartInfo.FileName = "chrome"
  637. chromeProcess.StartInfo.Arguments = """" & pdfFilePath & """"
  638. chromeProcess.Start()
  639. Catch ex As Exception
  640. End Try
  641. Else
  642. Try
  643. System.Diagnostics.Process.Start("""" & pdfFilePath & """")
  644. Catch ex As Exception
  645. End Try
  646. End If
  647. MGB(對話框(3), 1)
  648. End If
  649. End Sub
  650. ' 檢查系統是否已安裝 Google Chrome
  651. Private Function IsChromeInstalled() As Boolean
  652. Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
  653. If key IsNot Nothing Then
  654. For Each subkeyName As String In key.GetSubKeyNames()
  655. Dim subkey As Microsoft.Win32.RegistryKey = key.OpenSubKey(subkeyName)
  656. Dim displayName As Object = subkey.GetValue("DisplayName")
  657. If displayName IsNot Nothing AndAlso displayName.ToString().Contains("Google Chrome") Then
  658. Return True
  659. End If
  660. Next
  661. End If
  662. Return False
  663. End Function
  664. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  665. Return CType(xlBook.Worksheets.Add, Worksheet)
  666. End Function
  667. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  668. xlSheet.Cells.Select()
  669. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  670. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  671. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 24
  672. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 30 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 20
  673. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 15
  674. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 15 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 30
  675. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 90 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 5
  676. xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 5
  677. xlSheet.Rows("5:9").Select : myExcel.Selection.RowHeight = 20 : xlSheet.Rows("10:10").Select : myExcel.Selection.RowHeight = 20
  678. xlSheet.Rows("11:" & N1).Select : myExcel.Selection.RowHeight = 65 : xlSheet.Rows(N1 + 1 & ":" & N1 + 1).Select : myExcel.Selection.RowHeight = 5
  679. xlSheet.Rows(N1 + 2 & ":" & N1 + 5).Select : myExcel.Selection.RowHeight = 17 : xlSheet.Rows(N1 + 6 & ":" & N1 + 6).Select : myExcel.Selection.RowHeight = 35
  680. xlSheet.Rows(N1 + 7 & ":" & N1 + 9).Select : myExcel.Selection.RowHeight = 35
  681. xlSheet.Range("A2:H2").Select()
  682. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  683. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  684. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 26 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  685. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  686. xlSheet.Range("A3:H3").Select()
  687. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  688. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  689. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 16 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  690. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  691. xlSheet.Range("A10:H" & N1).Select()
  692. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  693. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  694. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  695. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  696. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  697. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  698. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  699. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 2).Select()
  700. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  701. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  702. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  703. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  704. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  705. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  706. xlSheet.Range("A" & N1 + 3 & ":H" & N1 + 3).Select()
  707. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  708. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  709. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  710. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  711. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  712. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  713. xlSheet.Range("A" & N1 + 4 & ":H" & N1 + 4).Select()
  714. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  715. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  716. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  717. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  718. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  719. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  720. xlSheet.Range("A" & N1 + 5 & ":H" & N1 + 5).Select()
  721. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  722. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  723. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  724. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  725. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  726. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  727. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 6).Select()
  728. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  729. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  730. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  731. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  732. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  733. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  734. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  735. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  736. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 6).Select()
  737. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  738. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  739. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  740. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  741. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  742. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  743. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  744. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  745. xlSheet.Range("D" & N1 + 6 & ":E" & N1 + 6).Select()
  746. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  747. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  748. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  749. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  750. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  751. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  752. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  753. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  754. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 6).Select()
  755. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  756. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  757. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  758. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  759. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  760. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  761. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  762. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  763. xlSheet.Range("H" & N1 + 6).Select()
  764. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  765. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  766. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  767. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  768. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  769. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  770. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  771. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  772. xlSheet.Range("A" & N1 + 7 & ":B" & N1 + 9).Select()
  773. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  774. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  775. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  776. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  777. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  778. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  779. xlSheet.Range("C" & N1 + 7 & ":C" & N1 + 9).Select()
  780. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  781. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  782. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  783. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  784. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  785. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  786. xlSheet.Range("D" & N1 + 7 & ":E" & N1 + 9).Select()
  787. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  788. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  789. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  790. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  791. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  792. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  793. xlSheet.Range("F" & N1 + 7 & ":G" & N1 + 9).Select()
  794. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  795. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  796. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  797. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  798. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  799. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  800. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  801. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  802. xlSheet.Range("H" & N1 + 7 & ":H" & N1 + 9).Select()
  803. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  804. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  805. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  806. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  807. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  808. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  809. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  810. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  811. xlSheet.Range("A10:A" & N1).Select()
  812. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  813. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  814. xlSheet.Range("B11:D" & N1).Select()
  815. With myExcel.Selection
  816. .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  817. .ReadingOrder = xlContext : .MergeCells = False : End With
  818. xlSheet.Range("E11:F" & N1).Select()
  819. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  820. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  821. xlSheet.Range("G11:H" & N1).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  822. xlSheet.Range("H" & N1 + 2).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  823. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).Select()
  824. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  825. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  826. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  827. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  828. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  829. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  830. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  831. myExcel.ActiveWindow.DisplayGridlines = False
  832. xlSheet.Range("A3:H3").Select()
  833. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  834. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  835. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  836. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  837. xlSheet.Range("G7:G9").Select()
  838. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  839. .ReadingOrder = xlContext : .MergeCells = False : End With
  840. xlSheet.Range("A10:H" & N1).Select()
  841. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  842. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  843. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  844. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  845. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  846. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  847. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  848. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).Select()
  849. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  850. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  851. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  852. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  853. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  854. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  855. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 9).Select()
  856. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  857. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  858. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  859. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  860. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  861. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  862. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 9).Select()
  863. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  864. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  865. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  866. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  867. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  868. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  869. xlSheet.Range("D" & N1 + 6 & ":E" & N1 + 9).Select()
  870. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  871. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  872. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  873. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  874. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  875. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  876. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 9).Select()
  877. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  878. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  879. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  880. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  881. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  882. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  883. xlSheet.Range("H" & N1 + 6 & ":H" & N1 + 9).Select()
  884. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  885. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  886. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  887. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  888. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  889. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  890. xlSheet.Rows("5:9").Select
  891. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  892. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  893. xlSheet.Rows("11:" & N1).Select
  894. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  895. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  896. xlSheet.Range("A10:H10").Select()
  897. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  898. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  899. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  900. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  901. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  902. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  903. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  904. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  905. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  906. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  907. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  908. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  909. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  910. xlSheet.Range("A11:H" & N1).Select()
  911. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  912. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  913. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  914. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  915. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  916. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  917. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  918. xlSheet.Range("B11:D" & N1).Select()
  919. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  920. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  921. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  922. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  923. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  924. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  925. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  926. xlSheet.Range("F11:F" & N1).Select()
  927. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  928. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  929. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  930. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  931. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  932. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  933. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  934. xlSheet.Range("H11:H" & N1).Select()
  935. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  936. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  937. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  938. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  939. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  940. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  941. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  942. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).Select()
  943. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  944. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  945. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  946. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  947. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  948. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  949. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).Select()
  950. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  951. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  952. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  953. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  954. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  955. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  956. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  957. xlSheet.Range("G" & N1 + 2 & ":G" & N1 + 5).Select()
  958. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  959. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  960. xlSheet.Range("F" & N1 + 8 & ":G" & N1 + 8).Select()
  961. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  962. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  963. xlSheet.Range("F" & N1 + 9 & ":G" & N1 + 9).Select()
  964. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  965. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  966. xlSheet.Range("A" & N1 + 11 & ":H" & N1 + N2 + 11).Select()
  967. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  968. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  969. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  970. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  971. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  972. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  973. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  974. End Sub
  975. Private Sub CC(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Worksheet)
  976. Clipboard.SetDataObject(合約報價單.PictureBox1.Image)
  977. xlSheet.Range("A1").Select()
  978. myExcel.ActiveSheet.Pictures.Paste.Select
  979. myExcel.Selection.ShapeRange.Height = 93
  980. myExcel.Selection.ShapeRange.IncrementLeft(50)
  981. myExcel.Selection.ShapeRange.IncrementTop(0)
  982. End Sub
  983. Private Sub DD(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Worksheet)
  984. Clipboard.SetDataObject(合約報價單.PictureBox2.Image)
  985. xlSheet.Range("A1").Select()
  986. myExcel.ActiveSheet.Pictures.Paste.Select
  987. myExcel.Selection.ShapeRange.Height = 93
  988. myExcel.Selection.ShapeRange.IncrementLeft(50)
  989. myExcel.Selection.ShapeRange.IncrementTop(0)
  990. End Sub
  991. Private Sub FF(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  992. If 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL" Then
  993. myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename =
  994. Str01 & "\HXBWLOG.png"
  995. Else
  996. myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename =
  997. Str01 & "\PGSBWLOG.png"
  998. End If
  999. myExcel.Application.PrintCommunication = False
  1000. With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "$1:$10" : .PrintTitleColumns = "" : End With
  1001. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  1002. With myExcel.ActiveSheet.PageSetup : .LeftHeader = ""
  1003. .CenterHeader = "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "&G"
  1004. .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "第 &P 頁,共 &N 頁" : .RightFooter = ""
  1005. .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
  1006. .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
  1007. .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
  1008. .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = False : .CenterVertically = False : .Draft = False
  1009. .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = False : .OddAndEvenPagesHeaderFooter = False
  1010. .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = ""
  1011. .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" : .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = ""
  1012. .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = "" : .FirstPage.RightHeader.Text = ""
  1013. .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = ""
  1014. End With : myExcel.Application.PrintCommunication = True
  1015. End Sub
  1016. '-----------------------------滑鼠右鍵--------------------------------------------------------------------------------------------------------------------------------------
  1017. Private Sub 重新整理ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新整理_tsm.Click
  1018. Set_清單1() : Set_清單2()
  1019. End Sub
  1020. Private Sub 風格()
  1021. If 深色風格 = False Then
  1022. Me.BackColor = SystemColors.Control : SplitContainer1.BackColor = SystemColors.Control
  1023. 選擇公司_lb.ForeColor = Color.Blue : 文字_lb.ForeColor = Color.Purple
  1024. 已生未核准的採購單_lb.ForeColor = Color.Black : 簡稱_lb.ForeColor = Color.Black : Label1.ForeColor = Color.Black : Label2.ForeColor = Color.Black
  1025. Label3.ForeColor = Color.Black : Label6.ForeColor = Color.Black : Label12.ForeColor = Color.Black : Label11.ForeColor = Color.Black
  1026. Label8.ForeColor = Color.Black : Label5.ForeColor = Color.Black : Label7.ForeColor = Color.Black : 總金額_lb.ForeColor = Color.Black
  1027. Label4.ForeColor = Color.Black : 小間距_ch.ForeColor = Color.Black : 中間距_ch.ForeColor = Color.Black : 大間距_ch.ForeColor = Color.Black
  1028. 詳細資料2_ch.ForeColor = Color.Black : 稅金計算_ch.ForeColor = Color.Black : 單價_rb.ForeColor = Color.Black : 日期_rb.ForeColor = Color.Black
  1029. 長條圖_ch.ForeColor = Color.Black : 折線圖_ch.ForeColor = Color.Black : Label9.ForeColor = Color.Black
  1030. 全部選擇_bt.BackColor = Color.White : 全部選擇_bt.ForeColor = Color.Olive : 全部取消_bt.BackColor = Color.White : 全部取消_bt.ForeColor = Color.Olive
  1031. 語轉扭_bt.BackColor = Color.White : 語轉扭_bt.ForeColor = Color.Black
  1032. 供應商簡稱_tb.BackColor = Color.White : 供應商簡稱_tb.ForeColor = Color.Black : 地址_tb.BackColor = Color.White : 地址_tb.ForeColor = Color.Black
  1033. 電話_tb.BackColor = Color.White : 電話_tb.ForeColor = Color.Black : 採購單號_tb.BackColor = Color.White : 採購單號_tb.ForeColor = Color.Black
  1034. 折扣比_tb.BackColor = Color.White : 折扣比_tb.ForeColor = Color.Black : 折扣金額_tb.BackColor = Color.White : 折扣金額_tb.ForeColor = Color.Black
  1035. 傳真_tb.BackColor = Color.White : 傳真_tb.ForeColor = Color.Black : 稅金比_tb.BackColor = Color.White : 稅金比_tb.ForeColor = Color.Black
  1036. 稅金金額_tb.BackColor = Color.White : 稅金金額_tb.ForeColor = Color.Black : 郵件_tb.BackColor = Color.White : 郵件_tb.ForeColor = Color.Black
  1037. 使用地點_tb.BackColor = Color.White : 使用地點_tb.ForeColor = Color.Black : 總金額_tb.BackColor = Color.White : 總金額_tb.ForeColor = Color.Black
  1038. 選擇公司_cb.BackColor = Color.White : 選擇公司_cb.ForeColor = Color.Black : 類別管理_cb.BackColor = Color.White : 類別管理_cb.ForeColor = Color.Black
  1039. 廠商_cb.BackColor = Color.White : 廠商_cb.ForeColor = Color.Black : 手動號碼_tb.BackColor = Color.White : 手動號碼_tb.ForeColor = Color.Black
  1040. 清空供應商_bt.BackColor = Color.White : 生成採購單_bt.BackColor = Color.White : 列印成詢價單_bt.BackColor = Color.White : 分析工具_bt.BackColor = Color.White
  1041. 採購單_dgv.EnableHeadersVisualStyles = True : 採購單_dgv.BackgroundColor = Color.White : 採購單_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
  1042. 採購單_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightPink
  1043. 採購單_dgv.DefaultCellStyle.BackColor = Color.White : 採購單_dgv.DefaultCellStyle.ForeColor = Color.Black
  1044. 明細_dgv.EnableHeadersVisualStyles = True : 明細_dgv.BackgroundColor = Color.White : 明細_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
  1045. 明細_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightBlue
  1046. 明細_dgv.DefaultCellStyle.BackColor = Color.White : 明細_dgv.DefaultCellStyle.ForeColor = Color.Black
  1047. 料號_dgv.EnableHeadersVisualStyles = True : 料號_dgv.BackgroundColor = Color.White : 料號_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
  1048. 料號_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGray
  1049. 料號_dgv.DefaultCellStyle.BackColor = Color.White : 料號_dgv.DefaultCellStyle.ForeColor = Color.Black
  1050. Else
  1051. Me.BackColor = Color.Black : SplitContainer1.BackColor = Color.Black
  1052. 選擇公司_lb.ForeColor = Color.LightBlue : 文字_lb.ForeColor = Color.Violet
  1053. 已生未核准的採購單_lb.ForeColor = Color.White : 簡稱_lb.ForeColor = Color.White : Label1.ForeColor = Color.White : Label2.ForeColor = Color.White
  1054. Label3.ForeColor = Color.White : Label6.ForeColor = Color.White : Label12.ForeColor = Color.White : Label11.ForeColor = Color.White
  1055. Label8.ForeColor = Color.White : Label5.ForeColor = Color.White : Label7.ForeColor = Color.White : 總金額_lb.ForeColor = Color.White
  1056. Label4.ForeColor = Color.White : 小間距_ch.ForeColor = Color.White : 中間距_ch.ForeColor = Color.White : 大間距_ch.ForeColor = Color.White
  1057. 詳細資料2_ch.ForeColor = Color.White : 稅金計算_ch.ForeColor = Color.White : 單價_rb.ForeColor = Color.White : 日期_rb.ForeColor = Color.White
  1058. 長條圖_ch.ForeColor = Color.White : 折線圖_ch.ForeColor = Color.White : Label9.ForeColor = Color.Black
  1059. 全部選擇_bt.BackColor = Color.DimGray : 全部選擇_bt.ForeColor = Color.Yellow : 全部取消_bt.BackColor = Color.DimGray : 全部取消_bt.ForeColor = Color.Yellow
  1060. 語轉扭_bt.BackColor = Color.DimGray : 語轉扭_bt.ForeColor = Color.White
  1061. 供應商簡稱_tb.BackColor = Color.DimGray : 供應商簡稱_tb.ForeColor = Color.White : 地址_tb.BackColor = Color.DimGray : 地址_tb.ForeColor = Color.White
  1062. 電話_tb.BackColor = Color.DimGray : 電話_tb.ForeColor = Color.White : 採購單號_tb.BackColor = Color.DimGray : 採購單號_tb.ForeColor = Color.White
  1063. 折扣比_tb.BackColor = Color.DimGray : 折扣比_tb.ForeColor = Color.White : 折扣金額_tb.BackColor = Color.DimGray : 折扣金額_tb.ForeColor = Color.White
  1064. 傳真_tb.BackColor = Color.DimGray : 傳真_tb.ForeColor = Color.White : 稅金比_tb.BackColor = Color.DimGray : 稅金比_tb.ForeColor = Color.White
  1065. 稅金金額_tb.BackColor = Color.DimGray : 稅金金額_tb.ForeColor = Color.White : 郵件_tb.BackColor = Color.DimGray : 郵件_tb.ForeColor = Color.White
  1066. 使用地點_tb.BackColor = Color.DimGray : 使用地點_tb.ForeColor = Color.White : 總金額_tb.BackColor = Color.DimGray : 總金額_tb.ForeColor = Color.White
  1067. 選擇公司_cb.BackColor = Color.DimGray : 選擇公司_cb.ForeColor = Color.White : 類別管理_cb.BackColor = Color.DimGray : 類別管理_cb.ForeColor = Color.White
  1068. 廠商_cb.BackColor = Color.DimGray : 廠商_cb.ForeColor = Color.White : 手動號碼_tb.BackColor = Color.DimGray : 手動號碼_tb.ForeColor = Color.White
  1069. 清空供應商_bt.BackColor = Color.DimGray : 生成採購單_bt.BackColor = Color.DimGray : 列印成詢價單_bt.BackColor = Color.DimGray : 分析工具_bt.BackColor = Color.DimGray
  1070. 採購單_dgv.EnableHeadersVisualStyles = False : 採購單_dgv.BackgroundColor = Color.DimGray : 採購單_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
  1071. 採購單_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 採購單_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray
  1072. 採購單_dgv.DefaultCellStyle.BackColor = Color.Black : 採購單_dgv.DefaultCellStyle.ForeColor = Color.White
  1073. 明細_dgv.EnableHeadersVisualStyles = False : 明細_dgv.BackgroundColor = Color.DimGray : 明細_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
  1074. 明細_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 明細_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray
  1075. 明細_dgv.DefaultCellStyle.BackColor = Color.Black : 明細_dgv.DefaultCellStyle.ForeColor = Color.White
  1076. 料號_dgv.EnableHeadersVisualStyles = False : 料號_dgv.BackgroundColor = Color.DimGray : 料號_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
  1077. 料號_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 料號_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray
  1078. 料號_dgv.DefaultCellStyle.BackColor = Color.Black : 料號_dgv.DefaultCellStyle.ForeColor = Color.White
  1079. End If
  1080. End Sub
  1081. End Class