Geen omschrijving
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 138KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484
  1. Option Strict Off
  2. Imports System.IO
  3. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  4. Imports Microsoft.Office.Interop.Excel.Constants
  5. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  6. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  7. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  8. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  9. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  10. Imports Microsoft.Office.Interop.Excel.XlWindowState
  11. Imports Microsoft.Office.Interop.Excel
  12. Public Class 採購單詢價
  13. ReadOnly ds8 As New DataSet
  14. Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet : ReadOnly ds6 As New DataSet
  15. Dim 物料規格, 新項次 As String
  16. Dim NUM1, N1, N2 As Integer
  17. Dim yy As Boolean
  18. Dim RI As Integer = -1
  19. Dim SK As String = "要查找的 KEY"
  20. Dim Str As String = System.Windows.Forms.Application.StartupPath
  21. DIM 對話框(33) As String
  22. Private Sub Set_單價()
  23. Dim ds6 As New DataSet : 價錢_dgv.DataSource = Nothing : ds6.Clear()
  24. 價錢_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  25. 價錢_dgv.ColumnHeadersHeight = 25 : 價錢_dgv.AllowUserToAddRows = False
  26. If 日期_rb.Checked = False And 單價_rb.Checked = True Then : SQL_加權平均() : ElseIf 日期_rb.Checked = True And 單價_rb.Checked = False Then : SQL_最近日期() : End If
  27. da.Fill(ds6) : 價錢_dgv.DataSource = ds6.Tables(0) : conn.Close()
  28. End Sub
  29. Private Sub Set_請購單清單()
  30. Dim ds As New DataSet : 請購_dgv.DataSource = Nothing : ds.Clear()
  31. 請購_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  32. 請購_dgv.ColumnHeadersHeight = 40 : 請購_dgv.AllowUserToAddRows = False
  33. If 小間距1_ch.Checked = False And 中間距1_ch.Checked = False And 大間距1_ch.Checked = True Then : 請購_dgv.RowTemplate.Height = 75
  34. ElseIf 小間距1_ch.Checked = False And 中間距1_ch.Checked = True And 大間距1_ch.Checked = False Then : 請購_dgv.RowTemplate.Height = 45
  35. ElseIf 小間距1_ch.Checked = True And 中間距1_ch.Checked = False And 大間距1_ch.Checked = False Then : 請購_dgv.RowTemplate.Height = 25 : End If
  36. If ALL1_ch.Checked = True Then : SQL2 = ""
  37. ElseIf HX1_ch.Checked = True Then : SQL2 = " AND (請購單控制表.合約號 LIKE N'HX%') "
  38. ElseIf PGS1_ch.Checked = True Then : SQL2 = " AND (請購單控制表.合約號 LIKE N'PGS%') " : End If
  39. PA1 = 倉庫編號_tb.Text : SQL_採購單詢價_請購單清單()
  40. da.Fill(ds) : 請購_dgv.DataSource = ds.Tables(0) : conn.Close()
  41. 請購_dgv.Columns(0).FillWeight = 40 : 請購_dgv.Columns(1).FillWeight = 70 : 請購_dgv.Columns(2).FillWeight = 50
  42. 請購_dgv.Columns(3).FillWeight = 170 : 請購_dgv.Columns(4).FillWeight = 170
  43. 請購_dgv.Columns(5).Visible = False : 請購_dgv.Columns(6).Visible = False : 請購_dgv.Columns(7).Visible = False : 請購_dgv.Columns(8).Visible = False
  44. 請購_dgv.Columns(9).Visible = False : 請購_dgv.Columns(10).Visible = False : 請購_dgv.Columns(11).Visible = False : 請購_dgv.Columns(12).FillWeight = 70
  45. 請購_dgv.Columns(13).FillWeight = 45 : 請購_dgv.Columns(14).Visible = False : 請購_dgv.Columns(15).FillWeight = 70 : 請購_dgv.Columns(16).Visible = False
  46. 請購_dgv.Columns(17).FillWeight = 45 : 請購_dgv.Columns(18).Visible = False : 請購_dgv.Columns(19).Visible = False : 請購_dgv.Columns(20).Visible = False
  47. 請購_dgv.Columns(21).Visible = False : 請購_dgv.Columns(22).FillWeight = 70 : 請購_dgv.Columns(23).FillWeight = 70 : 請購_dgv.Columns(24).FillWeight = 55
  48. 請購_dgv.Columns(25).Visible = False : 請購_dgv.Columns(26).Visible = False : 請購_dgv.Columns(27).FillWeight = 40 : 請購_dgv.Columns(28).Visible = False
  49. 請購_dgv.Columns(29).FillWeight = 30
  50. If 低網速模式 = False Then
  51. 請購_dgv.Columns(30).FillWeight = 45 : 請購_dgv.Columns(30).Visible = True
  52. Dim mycol As DataGridViewImageColumn = 請購_dgv.Columns("Image")
  53. mycol.ImageLayout = DataGridViewImageCellLayout.Zoom
  54. Else : If 請購_dgv.Columns.Count = 31 Then : 請購_dgv.Columns(30).Visible = False : End If : End If
  55. 請購_dgv.Columns(表頭(15)).DefaultCellStyle.Format = "#,##0"
  56. 請購_dgv.Columns(表頭(15)).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  57. 請購_dgv.Columns(表頭(15)).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  58. 請購_dgv.Columns(0).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 請購_dgv.Columns(0).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  59. 請購_dgv.Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 請購_dgv.Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  60. 請購_dgv.Columns(12).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 請購_dgv.Columns(12).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  61. 請購_dgv.Columns(13).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 請購_dgv.Columns(13).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  62. 請購_dgv.Columns(15).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 請購_dgv.Columns(15).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  63. 請購_dgv.Columns(17).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 請購_dgv.Columns(17).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  64. 請購_dgv.Columns(18).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 請購_dgv.Columns(18).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  65. 請購_dgv.Columns(20).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 請購_dgv.Columns(20).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  66. 請購_dgv.Columns(22).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 請購_dgv.Columns(22).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  67. 請購_dgv.Columns(23).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 請購_dgv.Columns(23).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  68. 請購_dgv.Columns(24).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 請購_dgv.Columns(24).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  69. 請購_dgv.Columns(0).ReadOnly = True : 請購_dgv.Columns(1).ReadOnly = True : 請購_dgv.Columns(3).ReadOnly = True : 請購_dgv.Columns(4).ReadOnly = True
  70. 請購_dgv.Columns(12).ReadOnly = True : 請購_dgv.Columns(13).ReadOnly = True : 請購_dgv.Columns(15).ReadOnly = True : 請購_dgv.Columns(17).ReadOnly = True
  71. 請購_dgv.Columns(18).ReadOnly = True : 請購_dgv.Columns(20).ReadOnly = True : 請購_dgv.Columns(22).ReadOnly = True : 請購_dgv.Columns(23).ReadOnly = True
  72. 請購_dgv.Columns(24).ReadOnly = True
  73. Dim mycol2 As DataGridViewImageColumn = 請購_dgv.Columns("State") : mycol2.ImageLayout = DataGridViewImageCellLayout.Zoom
  74. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  75. If IsDBNull(請購_dgv.Rows(i).Cells("加急").Value) = True Then : 請購_dgv.Rows(i).Cells("加急").Value = False : End If
  76. If 請購_dgv.Rows(i).Cells("加急").Value = True Then
  77. 請購_dgv.Rows(i).Cells("State").Value = My.Resources.Fire : Else : 請購_dgv.Rows(i).Cells("State").Value = My.Resources.wait
  78. End If
  79. '-------------------------規格合併呈現----------------------------------------------------------------------------------------------------------------------------------------
  80. If i = 0 Then
  81. PA3 = 請購_dgv.Rows(i).Cells("規格庫抬頭指定").Value : SQL_規格庫抬頭讀取()
  82. If dr.Read() Then
  83. AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8")
  84. End If
  85. conn.Close()
  86. Else
  87. If 請購_dgv.Rows(i).Cells("規格庫抬頭指定").Value.ToString <> 請購_dgv.Rows(i - 1).Cells("規格庫抬頭指定").Value.ToString Then
  88. PA3 = 請購_dgv.Rows(i).Cells("規格庫抬頭指定").Value : SQL_規格庫抬頭讀取()
  89. If dr.Read() Then
  90. AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8")
  91. End If : conn.Close()
  92. End If
  93. End If
  94. Dim ZA1, ZA2, ZA3, ZA4, ZA5, ZA6, ZA7, ZA8 As String : 物料規格 = ""
  95. If 詳細資料2_ch.Checked = True Then
  96. If 請購_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then
  97. ZA1 = AAA1 & "=" & 請購_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  98. If 請購_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then : ZA2 = AAA2 & "=" & 請購_dgv.Rows(i).Cells("A2").Value
  99. If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  100. If 請購_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then : ZA3 = AAA3 & "=" & 請購_dgv.Rows(i).Cells("A3").Value
  101. If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  102. If 請購_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then : ZA4 = AAA4 & "=" & 請購_dgv.Rows(i).Cells("A4").Value
  103. If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  104. If 請購_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then : ZA5 = AAA5 & "=" & 請購_dgv.Rows(i).Cells("A5").Value
  105. If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  106. If 請購_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then : ZA6 = AAA6 & "=" & 請購_dgv.Rows(i).Cells("A6").Value
  107. If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  108. If 請購_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then : ZA7 = AAA7 & "=" & 請購_dgv.Rows(i).Cells("A7").Value
  109. If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  110. If 請購_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then : ZA8 = AAA8 & "=" & 請購_dgv.Rows(i).Cells("A8").Value
  111. If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  112. Else
  113. If 請購_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then : ZA1 = 請購_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  114. If 請購_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then
  115. ZA2 = 請購_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  116. If 請購_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then
  117. ZA3 = 請購_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  118. If 請購_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then
  119. ZA4 = 請購_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  120. If 請購_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then
  121. ZA5 = 請購_dgv.Rows(i).Cells("A5").Value : If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  122. If 請購_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then
  123. ZA6 = 請購_dgv.Rows(i).Cells("A6").Value : If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  124. If 請購_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then
  125. ZA7 = 請購_dgv.Rows(i).Cells("A7").Value : If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  126. If 請購_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then
  127. ZA8 = 請購_dgv.Rows(i).Cells("A8").Value : If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  128. End If
  129. 請購_dgv.Rows(i).Cells(表頭(13)).Value = 物料規格 : 請購_dgv.Rows(i).Cells(0).Value = i + 1 : 請購_dgv.Rows(i).Cells(27).Value = False
  130. Next
  131. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  132. If IsDBNull(請購_dgv.Rows(i).Cells(表頭(44)).Value) Then : 請購_dgv.Rows(i).Cells(表頭(44)).Value = False : End If
  133. Next
  134. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  135. If IsDBNull(請購_dgv.Rows(i).Cells(表頭(134)).Value) Then : 請購_dgv.Rows(i).Cells(表頭(134)).Value = " " : End If
  136. Next
  137. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  138. If 深色風格 = False Then
  139. If 請購_dgv(表頭(44), i).Value = True Then : 請購_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightGreen
  140. Else : 請購_dgv.Rows(i).DefaultCellStyle.BackColor = Color.White : End If
  141. If 請購_dgv.Rows(i).Cells("加急").Value = True Then : 請購_dgv.Rows(i).DefaultCellStyle.ForeColor = Color.Red : End If
  142. Else
  143. If 請購_dgv(表頭(44), i).Value = True Then : 請購_dgv.Rows(i).DefaultCellStyle.BackColor = Color.DarkGreen
  144. Else : 請購_dgv.Rows(i).DefaultCellStyle.BackColor = Color.DimGray : End If
  145. If 請購_dgv.Rows(i).Cells("加急").Value = True Then : 請購_dgv.Rows(i).DefaultCellStyle.ForeColor = Color.LightPink : End If
  146. End If
  147. Next
  148. End Sub
  149. Private Sub Set_清單2()
  150. Dim ds2 As New DataSet : 採購單_dgv.DataSource = Nothing : ds2.Clear()
  151. 採購單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  152. 採購單_dgv.ColumnHeadersHeight = 40 : 採購單_dgv.AllowUserToAddRows = False
  153. If ALL_ch.Checked = True Then : SQL2 = ""
  154. ElseIf PGS_ch.Checked = True Then : SQL2 = " AND (採購單號 LIKE N'PGS%') "
  155. ElseIf HX_ch.Checked = True Then : SQL2 = " AND (採購單號 LIKE N'HX%') " : End If
  156. SQL_採購單詢價_採購()
  157. da.Fill(ds2) : 採購單_dgv.DataSource = ds2.Tables(0) : conn.Close()
  158. 採購單_dgv.Columns(0).FillWeight = 125 : 採購單_dgv.Columns(1).Visible = False : 採購單_dgv.Columns(2).Visible = False : 採購單_dgv.Columns(3).Visible = False
  159. 採購單_dgv.Columns(4).Visible = False : 採購單_dgv.Columns(5).Visible = False : 採購單_dgv.Columns(6).Visible = False : 採購單_dgv.Columns(7).Visible = False
  160. 採購單_dgv.Columns(8).Visible = False : 採購單_dgv.Columns(9).Visible = False : 採購單_dgv.Columns(10).Visible = False : 採購單_dgv.Columns(11).Visible = False
  161. 採購單_dgv.Columns(12).Visible = False : 採購單_dgv.Columns(13).Visible = False : 採購單_dgv.Columns(14).Visible = False : 採購單_dgv.Columns(15).Visible = False
  162. End Sub
  163. Private Sub Set_採購單清單()
  164. Dim ds3 As New DataSet : 明細_dgv.DataSource = Nothing : ds3.Clear()
  165. 明細_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  166. 明細_dgv.ColumnHeadersHeight = 40 : 明細_dgv.AllowUserToAddRows = False
  167. If 小間距1_ch.Checked = False And 中間距1_ch.Checked = False And 大間距1_ch.Checked = True Then : 明細_dgv.RowTemplate.Height = 75
  168. ElseIf 小間距1_ch.Checked = False And 中間距1_ch.Checked = True And 大間距1_ch.Checked = False Then : 明細_dgv.RowTemplate.Height = 45
  169. ElseIf 小間距1_ch.Checked = True And 中間距1_ch.Checked = False And 大間距1_ch.Checked = False Then : 明細_dgv.RowTemplate.Height = 25 : End If
  170. PA2 = 採購單號_tb.Text : SQL_採購單詢價_明細()
  171. da.Fill(ds3) : 明細_dgv.DataSource = ds3.Tables(0) : conn.Close()
  172. 明細_dgv.Columns(0).Visible = False : 明細_dgv.Columns(1).FillWeight = 60 : 明細_dgv.Columns(2).FillWeight = 90 : 明細_dgv.Columns(3).FillWeight = 250
  173. 明細_dgv.Columns(5).FillWeight = 150 : 明細_dgv.Columns(6).FillWeight = 60 : 明細_dgv.Columns(7).FillWeight = 80 : 明細_dgv.Columns(8).FillWeight = 80
  174. 明細_dgv.Columns(4).FillWeight = 250
  175. 明細_dgv.Columns(9).FillWeight = 80 : 明細_dgv.Columns(10).Visible = False : 明細_dgv.Columns(11).Visible = False : 明細_dgv.Columns(12).Visible = False
  176. 明細_dgv.Columns(13).Visible = False : 明細_dgv.Columns(14).FillWeight = 80 : 明細_dgv.Columns(15).Visible = False : 明細_dgv.Columns(16).Visible = False
  177. 明細_dgv.Columns(17).Visible = False : 明細_dgv.Columns(18).Visible = False : 明細_dgv.Columns(19).Visible = False : 明細_dgv.Columns(20).Visible = False
  178. 明細_dgv.Columns(21).Visible = False : 明細_dgv.Columns(22).Visible = False : 明細_dgv.Columns(23).Visible = False : 明細_dgv.Columns(24).Visible = False
  179. 明細_dgv.Columns(25).FillWeight = 65 : 明細_dgv.Columns(26).FillWeight = 65 : 明細_dgv.Columns(27).FillWeight = 90 : 明細_dgv.Columns(表頭(88)).Visible = False
  180. 明細_dgv.Columns("OUP").FillWeight = 80 : 明細_dgv.Columns("Cancel order").Visible = False
  181. 明細_dgv.Columns(5).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(7).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(8).DefaultCellStyle.Format = "#,##0"
  182. 明細_dgv.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  183. 明細_dgv.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns("OUP").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  184. 明細_dgv.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns(5).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  185. 明細_dgv.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns("OUP").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  186. 明細_dgv.EditMode = DataGridViewEditMode.EditOnEnter : 明細_dgv.Columns(6).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(9).DefaultCellStyle.Format = "#,##0.00"
  187. 明細_dgv.Columns(1).ReadOnly = True : 明細_dgv.Columns(2).ReadOnly = True : 明細_dgv.Columns(3).ReadOnly = True
  188. 明細_dgv.Columns(表頭(16)).ReadOnly = True : 明細_dgv.Columns(表頭(27)).ReadOnly = True : 明細_dgv.Columns("OUP").ReadOnly = True
  189. If 低網速模式 = False Then
  190. 明細_dgv.Columns(28).FillWeight = 80 : 明細_dgv.Columns(28).Visible = True
  191. Dim mycol As DataGridViewImageColumn = 明細_dgv.Columns("Image")
  192. mycol.ImageLayout = DataGridViewImageCellLayout.Zoom
  193. Else : If 明細_dgv.Columns.Count = 29 Then : 明細_dgv.Columns(28).Visible = False : End If : End If
  194. 新項次 = "00"
  195. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  196. 明細_dgv.Rows(i).Cells("Cancel order").Value = False : 明細_dgv.Columns("OUP").DefaultCellStyle.Format = "#,0" : NUM1 = Double.Parse(新項次) + 1
  197. If NUM1 < 10 Then : 新項次 = "0" & NUM1 : ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1 : End If
  198. 明細_dgv.Rows(i).Cells(表頭(11)).Value = 新項次
  199. '-------------------------規格合併呈現----------------------------------------------------------------------------------------------------------------------------------------
  200. If i = 0 Then
  201. PA3 = 明細_dgv.Rows(i).Cells("規格庫抬頭指定").Value : SQL_規格庫抬頭讀取()
  202. If dr.Read() Then
  203. AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8")
  204. End If : conn.Close()
  205. Else
  206. If 明細_dgv.Rows(i).Cells("規格庫抬頭指定").Value.ToString <> 明細_dgv.Rows(i - 1).Cells("規格庫抬頭指定").Value.ToString Then
  207. PA3 = 明細_dgv.Rows(i).Cells("規格庫抬頭指定").Value : SQL_規格庫抬頭讀取()
  208. If dr.Read() Then
  209. AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8")
  210. End If : conn.Close()
  211. End If
  212. End If
  213. Dim ZA1, ZA2, ZA3, ZA4, ZA5, ZA6, ZA7, ZA8 As String : 物料規格 = ""
  214. If 詳細資料2_ch.Checked = True Then
  215. If 明細_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then
  216. ZA1 = AAA1 & "=" & 明細_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  217. If 明細_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then : ZA2 = AAA2 & "=" & 明細_dgv.Rows(i).Cells("A2").Value
  218. If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  219. If 明細_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then : ZA3 = AAA3 & "=" & 明細_dgv.Rows(i).Cells("A3").Value
  220. If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  221. If 明細_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then : ZA4 = AAA4 & "=" & 明細_dgv.Rows(i).Cells("A4").Value
  222. If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  223. If 明細_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then : ZA5 = AAA5 & "=" & 明細_dgv.Rows(i).Cells("A5").Value
  224. If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  225. If 明細_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then : ZA6 = AAA6 & "=" & 明細_dgv.Rows(i).Cells("A6").Value
  226. If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  227. If 明細_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then : ZA7 = AAA7 & "=" & 明細_dgv.Rows(i).Cells("A7").Value
  228. If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  229. If 明細_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then : ZA8 = AAA8 & "=" & 明細_dgv.Rows(i).Cells("A8").Value
  230. If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  231. Else
  232. If 明細_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then : ZA1 = 明細_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  233. If 明細_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then
  234. ZA2 = 明細_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  235. If 明細_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then
  236. ZA3 = 明細_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  237. If 明細_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then
  238. ZA4 = 明細_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  239. If 明細_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then
  240. ZA5 = 明細_dgv.Rows(i).Cells("A5").Value : If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  241. If 明細_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then
  242. ZA6 = 明細_dgv.Rows(i).Cells("A6").Value : If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  243. If 明細_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then
  244. ZA7 = 明細_dgv.Rows(i).Cells("A7").Value : If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  245. If 明細_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then
  246. ZA8 = 明細_dgv.Rows(i).Cells("A8").Value : If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  247. End If : 明細_dgv.Rows(i).Cells(表頭(13)).Value = 物料規格
  248. '--------------取得歷史單價------------------------------------------------------------------------------------------
  249. PA = 明細_dgv.Rows(i).Cells("料號").Value : Set_單價()
  250. 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
  251. Next i
  252. Set_採購單清單1()
  253. For i As Integer = 0 To 明細_dgv.Rows.Count - 1 : 明細_dgv(表頭(44), i).Value = False : Next i : 價格()
  254. End Sub
  255. Private Sub Set_採購單清單1()
  256. Dim ds1 As New DataSet : 明細1_dgv.DataSource = Nothing : ds1.Clear()
  257. 明細1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  258. 明細1_dgv.ColumnHeadersHeight = 40 : 明細1_dgv.AllowUserToAddRows = False : 明細1_dgv.RowTemplate.Height = 25
  259. PA2 = 採購單號_tb.Text : SQL_採購單詢價_明細()
  260. da.Fill(ds1) : 明細1_dgv.DataSource = ds1.Tables(0) : conn.Close()
  261. If 低網速模式 = False Then
  262. 明細1_dgv.Columns(25).FillWeight = 80 : 明細1_dgv.Columns(25).Visible = True
  263. Dim mycol As DataGridViewImageColumn = 明細1_dgv.Columns("Image")
  264. mycol.ImageLayout = DataGridViewImageCellLayout.Zoom
  265. Else : If 明細1_dgv.Columns.Count = 26 Then : 明細1_dgv.Columns(25).Visible = False : End If : End If
  266. 新項次 = "00"
  267. For i As Integer = 0 To 明細1_dgv.Rows.Count - 1
  268. NUM1 = Double.Parse(新項次) + 1
  269. If NUM1 < 10 Then : 新項次 = "0" & NUM1 : ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1 : End If
  270. 明細1_dgv.Rows(i).Cells(表頭(11)).Value = 新項次
  271. '-------------------------規格合併呈現----------------------------------------------------------------------------------------------------------------------------------------
  272. If i = 0 Then
  273. PA3 = 明細1_dgv.Rows(i).Cells("規格庫抬頭指定").Value : PA20 = 系統語言_cb.Text : SQL_規格庫抬頭讀取_列印用()
  274. If dr.Read() Then
  275. AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8")
  276. End If : conn.Close()
  277. Else
  278. If 明細1_dgv.Rows(i).Cells("規格庫抬頭指定").Value.ToString <> 明細1_dgv.Rows(i - 1).Cells("規格庫抬頭指定").Value.ToString Then
  279. PA3 = 明細1_dgv.Rows(i).Cells("規格庫抬頭指定").Value : PA20 = 系統語言_cb.Text : SQL_規格庫抬頭讀取_列印用()
  280. If dr.Read() Then
  281. AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8")
  282. End If : conn.Close()
  283. End If
  284. End If
  285. Dim ZA1, ZA2, ZA3, ZA4, ZA5, ZA6, ZA7, ZA8 As String : 物料規格 = ""
  286. If 詳細資料2_ch.Checked = True Then
  287. If 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then
  288. ZA1 = AAA1 & "=" & 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  289. If 明細1_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then : ZA2 = AAA2 & "=" & 明細1_dgv.Rows(i).Cells("A2").Value
  290. If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  291. If 明細1_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then : ZA3 = AAA3 & "=" & 明細1_dgv.Rows(i).Cells("A3").Value
  292. If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  293. If 明細1_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then : ZA4 = AAA4 & "=" & 明細1_dgv.Rows(i).Cells("A4").Value
  294. If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  295. If 明細1_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then : ZA5 = AAA5 & "=" & 明細1_dgv.Rows(i).Cells("A5").Value
  296. If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  297. If 明細1_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then : ZA6 = AAA6 & "=" & 明細1_dgv.Rows(i).Cells("A6").Value
  298. If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  299. If 明細1_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then : ZA7 = AAA7 & "=" & 明細1_dgv.Rows(i).Cells("A7").Value
  300. If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  301. If 明細1_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then : ZA8 = AAA8 & "=" & 明細1_dgv.Rows(i).Cells("A8").Value
  302. If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  303. Else
  304. If 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then : ZA1 = 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  305. If 明細1_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then
  306. ZA2 = 明細1_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
  307. If 明細1_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then
  308. ZA3 = 明細1_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
  309. If 明細1_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then
  310. ZA4 = 明細1_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
  311. If 明細1_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then
  312. ZA5 = 明細1_dgv.Rows(i).Cells("A5").Value : If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
  313. If 明細1_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then
  314. ZA6 = 明細1_dgv.Rows(i).Cells("A6").Value : If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
  315. If 明細1_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then
  316. ZA7 = 明細1_dgv.Rows(i).Cells("A7").Value : If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
  317. If 明細1_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then
  318. ZA8 = 明細1_dgv.Rows(i).Cells("A8").Value : If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If
  319. End If
  320. If 明細1_dgv.Rows(i).Cells("規格庫編號").Value = "SQLB03" Then
  321. If 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then
  322. ZA1 = AAA1 & "=" & 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  323. If 明細1_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then
  324. ZA2 = AAA2 & "=" & 明細1_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + " - " + ZA2 : End If : End If
  325. If 明細1_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then
  326. ZA3 = AAA3 & "=" & 明細1_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + " - " + ZA3 : End If : End If
  327. ElseIf 明細1_dgv.Rows(i).Cells("規格庫編號").Value = "SQLB04" Then
  328. If 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then
  329. ZA1 = AAA1 & "=" & 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  330. If 明細1_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then
  331. ZA2 = AAA2 & "=" & 明細1_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + " - " + ZA2 : End If : End If
  332. If 明細1_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then
  333. ZA3 = AAA3 & "=" & 明細1_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + " - " + ZA3 : End If : End If
  334. If 明細1_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then
  335. ZA4 = AAA4 & "=" & 明細1_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + " - " + ZA4 : End If : End If
  336. ElseIf 明細1_dgv.Rows(i).Cells("規格庫編號").Value = "SQLB05" Then
  337. If 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then
  338. ZA1 = AAA1 & "=" & 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  339. If 明細1_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then
  340. ZA2 = AAA2 & "=" & 明細1_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + " - " + ZA2 : End If : End If
  341. If 明細1_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then
  342. ZA3 = AAA3 & "=" & 明細1_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + " - " + ZA3 : End If : End If
  343. If 明細1_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then
  344. ZA4 = AAA4 & "=" & 明細1_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + " - " + ZA4 : End If : End If
  345. If 明細1_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then
  346. ZA5 = AAA5 & "=" & 明細1_dgv.Rows(i).Cells("A5").Value : If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + " - " + ZA5 : End If : End If
  347. ElseIf 明細1_dgv.Rows(i).Cells("規格庫編號").Value = "SQLB06" Then
  348. If 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then
  349. ZA1 = AAA1 & "=" & 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  350. If 明細1_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then
  351. ZA2 = AAA2 & "=" & 明細1_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + " - " + ZA2 : End If : End If
  352. If 明細1_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then
  353. ZA3 = AAA3 & "=" & 明細1_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + " - " + ZA3 : End If : End If
  354. If 明細1_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then
  355. ZA4 = AAA4 & "=" & 明細1_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + " - " + ZA4 : End If : End If
  356. If 明細1_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then
  357. ZA5 = AAA5 & "=" & 明細1_dgv.Rows(i).Cells("A5").Value : If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + " - " + ZA5 : End If : End If
  358. If 明細1_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then
  359. ZA6 = AAA6 & "=" & 明細1_dgv.Rows(i).Cells("A6").Value : If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + " - " + ZA6 : End If : End If
  360. ElseIf 明細1_dgv.Rows(i).Cells("規格庫編號").Value = "SQLB07" Then
  361. If 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then
  362. ZA1 = AAA1 & "=" & 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  363. If 明細1_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then
  364. ZA2 = AAA2 & "=" & 明細1_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + " - " + ZA2 : End If : End If
  365. If 明細1_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then
  366. ZA3 = AAA3 & "=" & 明細1_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + " - " + ZA3 : End If : End If
  367. If 明細1_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then
  368. ZA4 = AAA4 & "=" & 明細1_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + " - " + ZA4 : End If : End If
  369. If 明細1_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then
  370. ZA5 = AAA5 & "=" & 明細1_dgv.Rows(i).Cells("A5").Value : If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + " - " + ZA5 : End If : End If
  371. If 明細1_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then
  372. ZA6 = AAA6 & "=" & 明細1_dgv.Rows(i).Cells("A6").Value : If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + " - " + ZA6 : End If : End If
  373. If 明細1_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then
  374. ZA7 = AAA7 & "=" & 明細1_dgv.Rows(i).Cells("A7").Value : If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + " - " + ZA7 : End If : End If
  375. ElseIf 明細1_dgv.Rows(i).Cells("規格庫編號").Value = "SQLB08" Then
  376. If 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString <> "" Then
  377. ZA1 = AAA1 & "=" & 明細1_dgv.Rows(i).Cells(表頭(13)).Value.ToString : 物料規格 = ZA1 : End If
  378. If 明細1_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then
  379. ZA2 = AAA2 & "=" & 明細1_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + " - " + ZA2 : End If : End If
  380. If 明細1_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then
  381. ZA3 = AAA3 & "=" & 明細1_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + " - " + ZA3 : End If : End If
  382. If 明細1_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then
  383. ZA4 = AAA4 & "=" & 明細1_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + " - " + ZA4 : End If : End If
  384. If 明細1_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then
  385. ZA5 = AAA5 & "=" & 明細1_dgv.Rows(i).Cells("A5").Value : If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + " - " + ZA5 : End If : End If
  386. If 明細1_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then
  387. ZA6 = AAA6 & "=" & 明細1_dgv.Rows(i).Cells("A6").Value : If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + " - " + ZA6 : End If : End If
  388. If 明細1_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then
  389. ZA7 = AAA7 & "=" & 明細1_dgv.Rows(i).Cells("A7").Value : If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + " - " + ZA7 : End If : End If
  390. If 明細1_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then
  391. ZA8 = AAA8 & "=" & 明細1_dgv.Rows(i).Cells("A8").Value : If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + " - " + ZA8 : End If : End If
  392. End If
  393. 明細1_dgv.Rows(i).Cells(表頭(13)).Value = 物料規格
  394. Next i
  395. End Sub
  396. Private Sub 金額計算()
  397. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  398. 明細_dgv.Rows(i).Cells(表頭(27)).Value = 明細_dgv.Rows(i).Cells(表頭(26)).Value * 明細_dgv.Rows(i).Cells(表頭(15)).Value
  399. If 明細_dgv.Rows(i).Cells(表頭(27)).Value = "0" Then
  400. 明細_dgv.Rows(i).Cells(表頭(44)).Value = False
  401. Else : 明細_dgv.Rows(i).Cells(表頭(44)).Value = True : End If
  402. Next i
  403. End Sub
  404. Private Sub Set_料號比價()
  405. Dim ds1 As New DataSet : 料號_dgv.DataSource = Nothing : ds1.Clear()
  406. 料號_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  407. 料號_dgv.ColumnHeadersHeight = 25 : 料號_dgv.AllowUserToAddRows = False
  408. PA = 料號1_tb.Text : SQL_料號比對價格()
  409. da.Fill(ds1) : 料號_dgv.DataSource = ds1.Tables(0) : conn.Close()
  410. 料號_dgv.Columns("排序").Visible = False : 料號_dgv.Columns(3).DefaultCellStyle.Format = "#,##0.00" : 料號_dgv.Columns(3).FillWeight = 50
  411. End Sub
  412. Private Sub 語言轉換讀取()
  413. If 系統語言 = "繁體中文" Then : 語言 = "CH" : ElseIf 系統語言 = "English" Then : 語言 = "EN" : ElseIf 系統語言 = "Indonesian" Then : 語言 = "IN" : End If
  414. Me.Text = 系統語言字典("H001-190-" & 語言) : ToolTip1.ToolTipTitle = 系統語言字典("G000-108-" & 語言) : 請購單取消_bt.Text = 系統語言字典("H204-160-" & 語言)
  415. 文字_lb.Text = 系統語言字典("H204-100-" & 語言) : 文字2_lb.Text = 系統語言字典("H204-101-" & 語言) : 依據入庫單號全部選擇_bt.Text = 系統語言字典("H204-151-" & 語言)
  416. 日期_rb.Text = 系統語言字典("H204-102-" & 語言) : 未受理請購單_bt.Text = 系統語言字典("H204-103-" & 語言) : 指定倉庫_lb.Text = 系統語言字典("H204-152-" & 語言)
  417. 全部取消_bt.Text = 系統語言字典("H204-105-" & 語言) : 選擇公司_lb.Text = 系統語言字典("H204-156-" & 語言) : 未受理的請購單_tp.Text = 系統語言字典("H204-157-" & 語言)
  418. 詢價中的採購單_tp.Text = 系統語言字典("H204-158-" & 語言) : 單價_rb.Text = 系統語言字典("H204-155-" & 語言) : 全部選擇_bt.Text = 系統語言字典("H204-106-" & 語言)
  419. 表頭(19) = 系統語言字典("H204-107-" & 語言) : 表頭(134) = 系統語言字典("H204-108-" & 語言) : 表頭(27) = 系統語言字典("H204-109-" & 語言) : 表頭(77) = 系統語言字典("H204-110-" & 語言)
  420. 表頭(21) = 系統語言字典("H204-111-" & 語言) : 表頭(24) = 系統語言字典("H204-112-" & 語言) : 表頭(18) = 系統語言字典("H204-113-" & 語言) : 表頭(11) = 系統語言字典("H204-125-" & 語言)
  421. 表頭(26) = 系統語言字典("H204-114-" & 語言) : 表頭(62) = 系統語言字典("H204-115-" & 語言) : 表頭(30) = 系統語言字典("H204-116-" & 語言) : 表頭(88) = 系統語言字典("H204-117-" & 語言)
  422. 表頭(44) = 系統語言字典("H204-118-" & 語言) : 表頭(17) = 系統語言字典("H204-119-" & 語言) : 表頭(134) = 系統語言字典("H204-120-" & 語言) : 表頭(12) = 系統語言字典("H204-121-" & 語言)
  423. 表頭(13) = 系統語言字典("H204-122-" & 語言) : 表頭(14) = 系統語言字典("H204-123-" & 語言) : 表頭(16) = 系統語言字典("H204-124-" & 語言) : 表頭(15) = 系統語言字典("H204-126-" & 語言)
  424. 對話框(0) = 系統語言字典("H204-127-" & 語言) : 對話框(1) = 系統語言字典("H204-128-" & 語言) : 對話框(2) = 系統語言字典("H204-129-" & 語言) : 對話框(3) = 系統語言字典("H204-130-" & 語言)
  425. 對話框(4) = 系統語言字典("H204-131-" & 語言) : 對話框(5) = 系統語言字典("H204-132-" & 語言) : 對話框(6) = 系統語言字典("H204-133-" & 語言) : 對話框(7) = 系統語言字典("H204-134-" & 語言)
  426. 對話框(8) = 系統語言字典("H204-135-" & 語言) : 對話框(9) = 系統語言字典("H204-136-" & 語言) : 對話框(10) = 系統語言字典("H204-137-" & 語言) : 對話框(11) = 系統語言字典("H204-138-" & 語言)
  427. 對話框(12) = 系統語言字典("H204-139-" & 語言) : 對話框(13) = 系統語言字典("H204-140-" & 語言) : 對話框(14) = 系統語言字典("H204-141-" & 語言) : 對話框(15) = 系統語言字典("H204-142-" & 語言)
  428. 對話框(16) = 系統語言字典("H204-143-" & 語言) : 對話框(17) = 系統語言字典("H204-144-" & 語言) : 對話框(18) = 系統語言字典("H204-145-" & 語言) : 對話框(19) = 系統語言字典("H204-146-" & 語言)
  429. 對話框(20) = 系統語言字典("H204-147-" & 語言) : 對話框(21) = 系統語言字典("H204-148-" & 語言) : 對話框(22) = 系統語言字典("H204-149-" & 語言) : 對話框(23) = 系統語言字典("H204-150-" & 語言)
  430. 對話框(24) = 系統語言字典("G000-110-" & 語言) : 對話框(25) = 系統語言字典("G000-112-" & 語言) : 對話框(26) = 系統語言字典("H204-153-" & 語言) : 對話框(27) = 系統語言字典("H204-154-" & 語言)
  431. 對話框(33) = 系統語言字典("H204-165-" & 語言) : 對話框(28) = 系統語言字典("H204-159-" & 語言) : 對話框(30) = 系統語言字典("H204-161-" & 語言) : 對話框(31) = 系統語言字典("H204-162-" & 語言)
  432. 對話框(32) = 系統語言字典("H204-163-" & 語言)
  433. End Sub
  434. '-----------------------------觸碰說明--------------------------------------------------------------------------------------------------------------------------------------
  435. Private Sub 料號_bt_MouseEnter(sender As Object, e As EventArgs) Handles 料號_bt.MouseEnter
  436. ToolTip1.SetToolTip(Me.料號_bt, 對話框(26))
  437. End Sub
  438. Private Sub 列印成詢價單_bt_MouseEnter(sender As Object, e As EventArgs) Handles 列印成詢價單_bt.MouseEnter
  439. ToolTip1.SetToolTip(Me.列印成詢價單_bt, 對話框(23))
  440. End Sub
  441. Private Sub 存檔_bt_MouseEnter(sender As Object, e As EventArgs) Handles 存檔_bt.MouseEnter
  442. ToolTip1.SetToolTip(Me.存檔_bt, 對話框(24))
  443. End Sub
  444. Private Sub 刪除_bt_MouseEnter(sender As Object, e As EventArgs) Handles 刪除_bt.MouseEnter
  445. ToolTip1.SetToolTip(Me.刪除_bt, 對話框(25))
  446. End Sub
  447. Private Sub 生成採購單_bt_MouseEnter(sender As Object, e As EventArgs) Handles 生成採購單_bt.MouseEnter
  448. ToolTip1.SetToolTip(Me.生成採購單_bt, 對話框(28))
  449. End Sub
  450. Private Sub 退回請購單_bt_MouseEnter(sender As Object, e As EventArgs) Handles 退回請購單_bt.MouseEnter
  451. ToolTip1.SetToolTip(Me.退回請購單_bt, 對話框(27))
  452. End Sub
  453. Private Sub 價格()
  454. Dim 差異, 比對 As Double
  455. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  456. If 明細_dgv.Rows(i).Cells("OUP").Value = 0 And 明細_dgv.Rows(i).Cells(表頭(26)).Value = 0 Then
  457. ElseIf 明細_dgv.Rows(i).Cells(表頭(26)).Value = 0 And 明細_dgv.Rows(i).Cells("OUP").Value <> 0 Then
  458. If 深色風格 = False Then
  459. 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.Lavender
  460. Else
  461. 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.Navy
  462. End If
  463. ElseIf 明細_dgv.Rows(i).Cells("OUP").Value <> 0 And 明細_dgv.Rows(i).Cells(表頭(26)).Value <> 0 Then
  464. 差異 = 明細_dgv.Rows(i).Cells(表頭(26)).Value - 明細_dgv.Rows(i).Cells("OUP").Value
  465. 比對 = 差異 / 明細_dgv.Rows(i).Cells(表頭(26)).Value * 100
  466. If 比對 > 0 Then : 比對 *= 1 : ElseIf 比對 < 0 Then : 比對 *= -1 : End If
  467. If 深色風格 = False Then
  468. If 比對 < 比例1 Then
  469. ElseIf 比對 > 比例1 And 比對 < 比例2 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightGreen
  470. ElseIf 比對 > 比例2 And 比對 < 比例3 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightBlue
  471. ElseIf 比對 >= 比例3 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightPink : End If
  472. Else
  473. If 比對 < 比例1 Then
  474. ElseIf 比對 > 比例1 And 比對 < 比例2 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.DarkGreen
  475. ElseIf 比對 > 比例2 And 比對 < 比例3 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.DarkBlue
  476. ElseIf 比對 >= 比例3 Then : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.Purple : End If
  477. End If
  478. End If
  479. Next
  480. End Sub
  481. Private Sub 指定倉庫_cb_下拉表單資料載入()
  482. SQL_倉名_下拉清單() : 指定倉庫_cb.Items.Clear()
  483. While (dr.Read()) : 指定倉庫_cb.Items.Add(dr("倉名")) : End While : conn.Close()
  484. End Sub
  485. Private Sub 採購單詢價_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  486. Me.MdiParent = HX_PGS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  487. 風格() : H(204) = True : 介面 = "H204" : 語言轉換讀取() : 顯示說明(999, True)
  488. SQL_清單欄位查詢()
  489. If Acdr.Read() Then : 小間距1_ch.Checked = Acdr("L_1_1") : 中間距1_ch.Checked = Acdr("L_2_1") : 大間距1_ch.Checked = Acdr("L_3_1") : End If : Access1.Close()
  490. 未受理請購單_bt.Enabled = False : 生成採購單_bt.Enabled = False : 列印成詢價單_bt.Enabled = False : 文字2_lb.Visible = False
  491. 採購單_dgv.Visible = False : 明細_dgv.Visible = False : 刪除請購單上點選資料_bt.Enabled = False : 存檔_bt.Enabled = False : 刪除_bt.Enabled = False
  492. 需求日期_dtp.Format = DateTimePickerFormat.Custom : 需求日期_dtp.CustomFormat = " " : 系統語言_cb.Text = "Indonesian" : 退回請購單_bt.Enabled = False
  493. 單價_rb.Checked = True
  494. If 文字_lb.Visible = True Then : 文字2_lb.Visible = False : End If : Panel1.SendToBack()
  495. Label1.Text = 對話框(18) & 比例1 & 對話框(19) & 比例2 & 對話框(20) & 比例2 & 對話框(19) & 比例3 & 對話框(21) & 比例3
  496. End Sub
  497. Private Sub 採購單詢價_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
  498. 分流計算01.Enabled = True
  499. End Sub
  500. Private Sub 分流計算01_Tick(sender As Object, e As EventArgs) Handles 分流計算01.Tick
  501. 分流計算01.Enabled = False
  502. 指定倉庫_cb_下拉表單資料載入() : yy = True : Set_請購單清單() : Set_清單2() : Set_採購單清單() : yy = False : Set_單價()
  503. 採購單詢價_Size()
  504. If 待辦進入 <> "" Then : lastFoundRowIndex = -1 : lastFoundColIndex = -1
  505. 請購單號1_tb.Text = 待辦進入 : 查詢DGV中的關鍵字_自動(請購_dgv, 請購單號1_tb)
  506. lastFoundRowIndex = -1 : lastFoundColIndex = -1 : 請購單號1_tb.Text = "" : 待辦進入 = ""
  507. End If
  508. End Sub
  509. Private Sub 採購單詢價_SizeChanged(sender As Object, e As EventArgs) Handles MyBase.SizeChanged
  510. 採購單詢價_Size()
  511. End Sub
  512. Private Sub 採購單詢價_Size()
  513. MyMod.清單字體大小調整()
  514. 採購單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  515. 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  516. 請購_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  517. End Sub
  518. Private Sub 採購單詢價_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
  519. H(204) = False : MyMod.虛擬桌面開啟()
  520. End Sub
  521. Private Sub 系統說明_bt_Click(sender As Object, e As EventArgs) Handles 系統說明_bt.Click
  522. 介面 = "H204" : WEB說明頁面.Show()
  523. End Sub
  524. Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
  525. 介面 = "H204" : 語言轉換讀取() : Set_清單2() : Set_單價() : Set_請購單清單() : Set_採購單清單() : Set_料號比價()
  526. Label1.Text = 對話框(18) & 比例1 & 對話框(19) & 比例2 & 對話框(20) & 比例2 & 對話框(19) & 比例3 & 對話框(21) & 比例3
  527. End Sub
  528. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  529. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  530. End Sub
  531. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  532. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  533. End Sub
  534. Dim 已超出 As Boolean
  535. Private Sub 明細_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 明細_dgv.MouseUp
  536. 'If 明細_dgv.SelectedCells.Count = 1 Then : 通知訊息 = 明細_dgv.SelectedCells(0).ColumnIndex & " " & 明細_dgv.SelectedCells(0).RowIndex) : End If
  537. If 明細_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
  538. If 明細_dgv.SelectedCells.Count > 0 Then
  539. Set_料號比價()
  540. If 明細_dgv.SelectedCells(0).ColumnIndex = 8 Then
  541. If 已超出 = False Then : Dim x As Double = 0
  542. For i As Integer = 0 To 明細_dgv.SelectedCells.Count - 1
  543. Dim 變數 As String = "" : Dim 取變數 As String
  544. 取變數 = 明細_dgv.Rows(明細_dgv.SelectedCells.Item(i).RowIndex).Cells(明細_dgv.SelectedCells.Item(i).ColumnIndex).Value
  545. For ii As Integer = 1 To Len(取變數)
  546. If ii = 1 Then : 變數 = Strings.Left(取變數, ii) : Else : If Strings.Mid(取變數, ii, 1) <> "," Then : 變數 &= Strings.Mid(取變數, ii, 1) : End If : End If
  547. Next : x += Val(變數)
  548. Next i : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(x, "#,##0")
  549. Else : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0") : End If
  550. Else : 已超出 = True : HX_PGS_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0") : End If
  551. End If
  552. End Sub
  553. Private Sub 明細_dgv_CellEnter(sender As Object, e As DataGridViewCellEventArgs) Handles 明細_dgv.CellEnter
  554. '金額計算()
  555. 價格()
  556. End Sub
  557. Private Sub 明細_dgv_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles 明細_dgv.RowPostPaint
  558. 價格()
  559. End Sub
  560. Private Sub 明細_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 明細_dgv.CellClick
  561. If e.RowIndex = -1 Then : Else
  562. 採購單號_tb.Text = 明細_dgv("採購單號", e.RowIndex).Value.ToString : 項次_tb.Text = 明細_dgv("項次", e.RowIndex).Value.ToString
  563. 請購單號1_tb.Text = 明細_dgv(表頭(88), e.RowIndex).Value.ToString : 料號_tb.Text = 明細_dgv("料號", e.RowIndex).Value.ToString
  564. 料號1_tb.Text = 明細_dgv("料號", e.RowIndex).Value.ToString
  565. If 明細_dgv(表頭(44), e.RowIndex).Value = True Then : 明細_dgv(表頭(44), e.RowIndex).Value = False : Else : 明細_dgv(表頭(44), e.RowIndex).Value = True : End If
  566. PA1 = 明細_dgv.Rows(e.RowIndex).Cells("群組碼").Value : PA2 = 明細_dgv.Rows(e.RowIndex).Cells("料號原則").Value
  567. SQL_物料圖庫_圖檔讀取()
  568. While dr.Read() = True
  569. Dim unused As Byte() = New Byte(-1) {}
  570. Dim bytes As Byte() = DirectCast(dr.Item("圖檔"), Byte())
  571. Dim oStream As New MemoryStream(bytes)
  572. 物料圖_pb.Image = Bitmap.FromStream(oStream)
  573. End While : conn.Close() : 物料圖_pb.SizeMode = 4
  574. End If
  575. End Sub
  576. Private Sub 採購單_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 採購單_dgv.CellClick
  577. If e.RowIndex = -1 Then : Else
  578. 採購單號_tb.Text = 採購單_dgv(0, e.RowIndex).Value.ToString
  579. If Strings.Left(採購單號_tb.Text, 3) = "HXI" Then : 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL"
  580. ElseIf Strings.Left(採購單號_tb.Text, 3) = "PGS" Then : 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" : End If
  581. 詢價員_tb.Text = 採購單_dgv("詢價員", e.RowIndex).Value.ToString : 尋價日期_tb.Text = 採購單_dgv("尋價日期", e.RowIndex).Value.ToString
  582. 需求日期_dtp.Value = 採購單_dgv(2, e.RowIndex).Value : 指定倉庫_cb.Text = 採購單_dgv("使用地點", e.RowIndex).Value.ToString
  583. Set_採購單清單()
  584. End If : 生成採購單_bt.Enabled = False
  585. End Sub
  586. Private Sub 讀取最小需求日期()
  587. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  588. If 請購_dgv.Rows(i).Cells(27).Value = True Then
  589. If 請購_dgv.Rows(i).Cells(表頭(30)).Value <> "" Then
  590. If 需求日期_dtp.Text = "" Or 需求日期_dtp.Text = " " Then
  591. 需求日期_dtp.Format = DateTimePickerFormat.Short : 需求日期_dtp.Value = 請購_dgv.Rows(i).Cells(表頭(30)).Value
  592. ElseIf 需求日期_dtp.Text <> "" Then
  593. If 需求日期_dtp.Value = 請購_dgv.Rows(i).Cells(表頭(30)).Value Then
  594. ElseIf 需求日期_dtp.Value > 請購_dgv.Rows(i).Cells(表頭(30)).Value Then : 需求日期_dtp.Value = 請購_dgv.Rows(i).Cells(表頭(30)).Value : End If
  595. End If
  596. End If
  597. End If
  598. Next
  599. End Sub
  600. Private Sub 請購_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 請購_dgv.CellClick
  601. If e.RowIndex = -1 Then : Else
  602. 請購單號_tb.Text = 請購_dgv.Rows(e.RowIndex).Cells(1).Value.ToString
  603. 申請人_tb.Text = 請購_dgv.Rows(e.RowIndex).Cells(22).Value.ToString : 核准人_tb.Text = 請購_dgv.Rows(e.RowIndex).Cells(23).Value.ToString
  604. PA1 = 請購_dgv.Rows(e.RowIndex).Cells(表頭(62)).Value : PA2 = 請購_dgv.Rows(e.RowIndex).Cells("群組原則").Value
  605. SQL_物料圖庫_圖檔讀取()
  606. While dr.Read() = True
  607. Dim unused As Byte() = New Byte(-1) {}
  608. Dim bytes As Byte() = DirectCast(dr.Item("圖檔"), Byte())
  609. Dim oStream As New MemoryStream(bytes)
  610. 物料圖_pb.Image = Bitmap.FromStream(oStream)
  611. End While : conn.Close() : 物料圖_pb.SizeMode = 4
  612. If 倉庫編號_tb.Text = "" Then : MGB(對話框(2), 1) : Else
  613. 讀取最小需求日期()
  614. If 請購_dgv(表頭(44), e.RowIndex).Value = True Then : 請購_dgv(表頭(44), e.RowIndex).Value = False
  615. Else : 請購_dgv(表頭(44), e.RowIndex).Value = True : End If
  616. If 深色風格 = False Then
  617. If 請購_dgv(表頭(44), e.RowIndex).Value = True Then
  618. 請購_dgv.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.LightGreen
  619. Else
  620. 請購_dgv.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.White
  621. End If
  622. Else
  623. If 請購_dgv(表頭(44), e.RowIndex).Value = True Then
  624. 請購_dgv.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.DarkGreen
  625. Else
  626. 請購_dgv.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.DimGray
  627. End If
  628. End If
  629. PA = 請購_dgv(表頭(77), e.RowIndex).Value : SQL_物料規格表_查詢() '---查詢物規格表中是否有這個料號
  630. If dr.Read() Then : Else
  631. MGB(對話框(8) & vbCrLf & 對話框(9) & vbCrLf & 對話框(10), 2)
  632. If 訊息回應 = "YES" Then : MGB(對話框(11), 1) : Else
  633. SQL_請購單明細表_刪除一筆資料() '---刪除請購單上選中的資料
  634. 請購_dgv(表頭(44), e.RowIndex).Value = False : 請購_dgv.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.White
  635. MGB(對話框(12), 1) : Set_請購單清單()
  636. End If
  637. End If
  638. End If
  639. End If : 生成採購單_bt.Enabled = True
  640. End Sub
  641. Private Sub 請購_dgv_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles 請購_dgv.RowPostPaint
  642. Dim linePen As New Pen(Color.Blue, 2)
  643. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  644. If 深色風格 = False Then
  645. If 請購_dgv(表頭(44), i).Value = True Then
  646. 請購_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightGreen
  647. Else
  648. 請購_dgv.Rows(i).DefaultCellStyle.BackColor = Color.White
  649. End If
  650. If 請購_dgv.Rows(i).Cells("加急").Value = True Then : 請購_dgv.Rows(i).DefaultCellStyle.ForeColor = Color.Red : End If
  651. Else
  652. If 請購_dgv(表頭(44), i).Value = True Then
  653. 請購_dgv.Rows(i).DefaultCellStyle.BackColor = Color.DarkGreen
  654. Else
  655. 請購_dgv.Rows(i).DefaultCellStyle.BackColor = Color.DimGray
  656. End If
  657. If 請購_dgv.Rows(i).Cells("加急").Value = True Then : 請購_dgv.Rows(i).DefaultCellStyle.ForeColor = Color.LightPink : End If
  658. End If
  659. Next
  660. If e.RowIndex = 請購_dgv.Rows.Count - 1 Then : Exit Sub : Else
  661. If 請購_dgv(1, e.RowIndex).Value.ToString <> 請購_dgv(1, e.RowIndex + 1).Value.ToString Then
  662. Dim startX As Integer = IIf(請購_dgv.RowHeadersVisible, 請購_dgv.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  663. Dim endX As Integer = startX + 請購_dgv.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - 請購_dgv.HorizontalScrollingOffset
  664. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  665. End If
  666. End If
  667. End Sub
  668. Private Sub 物料圖_pb_Click(sender As Object, e As EventArgs) Handles 物料圖_pb.Click
  669. If IsNothing(物料圖_pb.Image) = False Then : 圖片傳遞 = 物料圖_pb.Image : 圖片放大視窗.ShowDialog() : End If
  670. End Sub
  671. Private Sub 指定倉庫_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 指定倉庫_cb.SelectedIndexChanged
  672. PA6 = 指定倉庫_cb.Text : SQL_指定倉儲_資料讀取()
  673. If dr.Read() Then : 倉庫級別_tb.Text = dr("倉級") : 倉庫編號_tb.Text = dr("倉名編號") : End If : conn.Close()
  674. Set_請購單清單()
  675. If 倉庫編號_tb.Text = "" Or 選擇公司_cb.Text = "" Then : 生成採購單_bt.Enabled = False : Else : 生成採購單_bt.Enabled = True : End If
  676. End Sub
  677. Private Sub 指定倉庫_cb_Click(sender As Object, e As EventArgs) Handles 指定倉庫_cb.Click
  678. CB選擇清單(指定倉庫_cb, 指定倉庫_cb.Text)
  679. End Sub
  680. Private Sub 選擇公司_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 選擇公司_cb.SelectedIndexChanged
  681. If 倉庫編號_tb.Text = "" Or 選擇公司_cb.Text = "" Then : 生成採購單_bt.Enabled = False : Else : 生成採購單_bt.Enabled = True : End If
  682. End Sub
  683. Private Sub 選擇公司_cb_Click(sender As Object, e As EventArgs) Handles 選擇公司_cb.Click
  684. CB選擇清單(選擇公司_cb, 選擇公司_cb.Text)
  685. End Sub
  686. Private Sub 需求日期_dtp_ValueChanged(sender As Object, e As EventArgs) Handles 需求日期_dtp.MouseDown
  687. 需求日期_dtp.Format = DateTimePickerFormat.Short
  688. End Sub
  689. Private Sub 小間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 小間距1_ch.Click
  690. 小間距1_ch.Checked = True : 中間距1_ch.Checked = False : 大間距1_ch.Checked = False : MyMod.間距設定存檔_1() : Set_請購單清單() : Set_採購單清單()
  691. End Sub
  692. Private Sub 中間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 中間距1_ch.Click
  693. 小間距1_ch.Checked = False : 中間距1_ch.Checked = True : 大間距1_ch.Checked = False : MyMod.間距設定存檔_2() : Set_請購單清單() : Set_採購單清單()
  694. End Sub
  695. Private Sub 大間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 大間距1_ch.Click
  696. 小間距1_ch.Checked = False : 中間距1_ch.Checked = False : 大間距1_ch.Checked = True : MyMod.間距設定存檔_3() : Set_請購單清單() : Set_採購單清單()
  697. End Sub
  698. Private Sub 全部選擇_bt_Click(sender As Object, e As EventArgs) Handles 全部選擇_bt.Click
  699. If 倉庫編號_tb.Text = "" Then : MGB(對話框(2), 1)
  700. Else : For i As Integer = 0 To 請購_dgv.Rows.Count - 1 : 請購_dgv.Rows(i).Cells(表頭(44)).Value = True : Next i : 讀取最小需求日期() : End If
  701. End Sub
  702. Private Sub 全部取消_bt_Click(sender As Object, e As EventArgs) Handles 全部取消_bt.Click
  703. If 倉庫編號_tb.Text = "" Then : MGB(對話框(2), 1)
  704. Else : For i As Integer = 0 To 請購_dgv.Rows.Count - 1 : 請購_dgv.Rows(i).Cells(表頭(44)).Value = False : Next i : 讀取最小需求日期() : End If
  705. End Sub
  706. Private Sub 依據入庫單號全部選擇_bt_Click(sender As Object, e As EventArgs) Handles 依據入庫單號全部選擇_bt.Click
  707. If 倉庫編號_tb.Text = "" Then : MGB(對話框(2), 1) : Else
  708. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  709. If 請購單號_tb.Text = 請購_dgv.Rows(i).Cells(1).Value.ToString Then : 請購_dgv.Rows(i).Cells(表頭(44)).Value = True : End If
  710. Next i : 讀取最小需求日期()
  711. End If
  712. End Sub
  713. Private Sub TC1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TC1.SelectedIndexChanged
  714. If TC1.SelectedIndex = 0 Then
  715. 未受理請購單_bt.Enabled = False : 詢價中的採購單_bt.Enabled = True
  716. 採購單_dgv.Visible = False : 明細_dgv.Visible = False : 請購_dgv.Visible = True : 文字_lb.Visible = True : 文字2_lb.Visible = False : 全部取消_bt.Enabled = True
  717. 刪除請購單上點選資料_bt.Enabled = False : 存檔_bt.Enabled = False : 刪除_bt.Enabled = False : 列印成詢價單_bt.Enabled = False : 全部選擇_bt.Enabled = True
  718. 退回請購單_bt.Enabled = False : 料號_bt.Enabled = False : 料號_dgv.Visible = False : 請購單取消_bt.Visible = True : HX1_ch.Visible = True : PGS1_ch.Visible = True
  719. ALL1_ch.Visible = True
  720. Else
  721. 未受理請購單_bt.Enabled = True : 詢價中的採購單_bt.Enabled = False
  722. 採購單_dgv.Visible = True : 明細_dgv.Visible = True : 請購_dgv.Visible = False : 文字2_lb.Visible = True : 文字_lb.Visible = False : 全部取消_bt.Enabled = False
  723. 刪除請購單上點選資料_bt.Enabled = True : 存檔_bt.Enabled = True : 刪除_bt.Enabled = True : 列印成詢價單_bt.Enabled = True : 全部選擇_bt.Enabled = False
  724. 退回請購單_bt.Enabled = True : 生成採購單_bt.Enabled = False : 料號_bt.Enabled = True : 請購單取消_bt.Visible = False : HX1_ch.Visible = False : PGS1_ch.Visible = False
  725. ALL1_ch.Visible = False
  726. End If
  727. End Sub
  728. Private Sub Set_日期格式轉換()
  729. DTP = Strings.Format(Today(), "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd") : DTP2 = Strings.Format(需求日期_dtp.Value, "yyyy/MM/dd")
  730. End Sub
  731. Private Sub Set_日期格式轉換1()
  732. DTP = Strings.Format(Today(), "yyyy/MM/dd") & "-" & Strings.Format(TimeOfDay(), "HH:mm:ss") : DTP1 = Strings.Format(Today(), "yyyyMMdd")
  733. End Sub
  734. Private Sub 確定新增()
  735. Set_日期格式轉換() : PA1 = 採購單號_tb.Text : PA2 = "" : PA3 = 指定倉庫_cb.Text : PA4 = "" : PA5 = "" : PA6 = "" : PA7 = "0" : BL1 = 0 : PA8 = "5"
  736. SQL_採購單控制表_新增() : conn.Close()
  737. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  738. 資料數 = 請購_dgv.Rows.Count : MyMod.進度條()
  739. If 請購_dgv.Rows(i).Cells(表頭(44)).Value = True Then
  740. PA9 = 請購_dgv.Rows(i).Cells(表頭(44)).Value : PA2 = 請購_dgv.Rows(i).Cells(表頭(88)).Value : PA3 = 請購_dgv.Rows(i).Cells("項次").Value
  741. PA4 = 請購_dgv.Rows(i).Cells(表頭(12)).Value : PA5 = 請購_dgv.Rows(i).Cells(表頭(13)).Value : PA6 = 請購_dgv.Rows(i).Cells(表頭(14)).Value
  742. NU1 = 請購_dgv.Rows(i).Cells(表頭(15)).Value : PA8 = 請購_dgv.Rows(i).Cells(表頭(16)).Value : PA10 = "0" '--單價還未帶出
  743. PA11 = 請購_dgv.Rows(i).Cells(表頭(62)).Value : PA12 = 請購_dgv.Rows(i).Cells("群組原則").Value : PA13 = 請購_dgv.Rows(i).Cells(表頭(77)).Value
  744. PA14 = 請購_dgv.Rows(i).Cells(表頭(134)).Value : PA15 = 請購_dgv.Rows(i).Cells(表頭(19)).Value
  745. SQL_請購單明細表_轉採修改() : SQL_採購單明細表_新增() : conn.Close()
  746. End If
  747. Next : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0 : MGB(對話框(1), 1)
  748. End Sub
  749. Private Sub 確定退回()
  750. Set_日期格式轉換()
  751. If 採購單號_tb.Text = "" Or 料號_tb.Text = "" Then : MGB(對話框(4), 1) : Else
  752. Dim FF As Integer
  753. For i As Integer = 0 To 明細_dgv.Rows.Count - 1 : If 明細_dgv.Rows(i).Cells(表頭(44)).Value = True Then : FF += 1 : End If : Next
  754. If 明細_dgv.Rows.Count = FF Then
  755. PA1 = 採購單號_tb.Text : SQL_採購單控制表_刪除() : conn.Close()
  756. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  757. If 明細_dgv.Rows(i).Cells(表頭(44)).Value = True Then
  758. PA2 = 明細_dgv.Rows(i).Cells(表頭(88)).Value : PA3 = 明細_dgv.Rows(i).Cells("項次").Value
  759. SQL_請購單明細表_退採修改() : SQL_採購單明細表_刪除() : conn.Close()
  760. End If
  761. Next : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0 : MGB(對話框(14), 1)
  762. ElseIf 明細_dgv.Rows.Count > FF Then
  763. PA1 = 採購單號_tb.Text
  764. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  765. If 明細_dgv.Rows(i).Cells(表頭(44)).Value = True Then
  766. PA2 = 明細_dgv.Rows(i).Cells(表頭(88)).Value : PA3 = 明細_dgv.Rows(i).Cells("項次").Value
  767. SQL_請購單明細表_退採修改() : SQL_採購單明細表_刪除() : conn.Close()
  768. End If
  769. Next : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0 : MGB(對話框(15), 1)
  770. End If
  771. End If
  772. End Sub
  773. Private Sub 退回請購單_bt_Click(sender As Object, e As EventArgs) Handles 退回請購單_bt.Click
  774. Dim FF As Boolean
  775. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  776. FF = 明細_dgv.Rows(i).Cells(表頭(44)).Value
  777. If FF = True Then : Exit For : End If
  778. Next
  779. If FF = True Then
  780. 確定退回() : Set_採購單清單() : Set_清單2() : Set_請購單清單()
  781. Else : MGB(對話框(16), 1) : End If
  782. End Sub
  783. Private Sub 新增採購單_()
  784. If 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL" Then : Set_日期格式轉換() : Dim NUM1 As Integer
  785. For i As Integer = 1 To 999 : NUM1 = 0 + i
  786. If NUM1 < 10 Then : 採購單號_tb.Text = "HXI-C-" & DTP1 & "-00" & NUM1
  787. ElseIf NUM1 > 9 And NUM1 < 100 Then : 採購單號_tb.Text = "HXI-C-" & DTP1 & "-0" & NUM1
  788. ElseIf NUM1 > 99 Then : 採購單號_tb.Text = "HXI-C-" & DTP1 & "-" & NUM1 : End If
  789. PA1 = 採購單號_tb.Text : SQL_採購單控制表_單號最後一筆() : If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  790. Next : 確定新增()
  791. ElseIf 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" Then : Set_日期格式轉換() : Dim NUM1 As Integer
  792. For i As Integer = 1 To 999 : NUM1 = 0 + i
  793. If NUM1 < 10 Then : 採購單號_tb.Text = "PGS-C-" & DTP1 & "-00" & NUM1
  794. ElseIf NUM1 > 9 And NUM1 < 100 Then : 採購單號_tb.Text = "PGS-C-" & DTP1 & "-0" & NUM1
  795. ElseIf NUM1 > 99 Then : 採購單號_tb.Text = "PGS-C-" & DTP1 & "-" & NUM1 : End If
  796. PA1 = 採購單號_tb.Text
  797. SQL_採購單控制表_單號最後一筆() : If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  798. Next : 確定新增()
  799. End If : 指定倉庫_cb_下拉表單資料載入() : Set_清單2() : Set_請購單清單()
  800. End Sub
  801. Private Sub 生成採購單_bt_Click(sender As Object, e As EventArgs) Handles 生成採購單_bt.Click
  802. Dim 判斷有選 As Boolean = False
  803. For i As Integer = 0 To 請購_dgv.Rows.Count - 1 : If 請購_dgv.Rows(i).Cells(表頭(44)).Value = True Then : 判斷有選 = True : Exit For : End If : Next
  804. If 判斷有選 = True Then
  805. If 採購單號_tb.Text <> "" Then
  806. MGB(對話框(17), 2)
  807. If 訊息回應 = "YES" Then : Set_日期格式轉換() : PA1 = 採購單號_tb.Text : 資料數 = 請購_dgv.Rows.Count
  808. For i As Integer = 0 To 請購_dgv.Rows.Count - 1 : MyMod.進度條()
  809. If 請購_dgv.Rows(i).Cells(表頭(44)).Value = True Then
  810. PA9 = 請購_dgv.Rows(i).Cells(表頭(44)).Value : PA2 = 請購_dgv.Rows(i).Cells(表頭(88)).Value : PA3 = 請購_dgv.Rows(i).Cells("項次").Value
  811. PA4 = 請購_dgv.Rows(i).Cells(表頭(12)).Value : PA5 = 請購_dgv.Rows(i).Cells(表頭(13)).Value : PA6 = 請購_dgv.Rows(i).Cells(表頭(14)).Value
  812. NU1 = 請購_dgv.Rows(i).Cells(表頭(15)).Value : PA8 = 請購_dgv.Rows(i).Cells(表頭(16)).Value : PA10 = "0" '--單價還未帶出
  813. PA11 = 請購_dgv.Rows(i).Cells(表頭(62)).Value : PA12 = 請購_dgv.Rows(i).Cells("群組原則").Value : PA13 = 請購_dgv.Rows(i).Cells(表頭(77)).Value
  814. PA14 = 請購_dgv.Rows(i).Cells(表頭(134)).Value : PA15 = 請購_dgv.Rows(i).Cells(表頭(19)).Value
  815. SQL_請購單明細表_轉採修改() : SQL_採購單明細表_新增() : conn.Close()
  816. End If
  817. Next : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  818. MGB(對話框(1), 1) : 指定倉庫_cb_下拉表單資料載入() : Set_清單2() : Set_請購單清單()
  819. Else : 新增採購單_() : End If
  820. Else : 新增採購單_() : End If
  821. Else : MGB(對話框(0), 1) : End If
  822. End Sub
  823. Private Sub 刪除請購單上點選資料_bt_Click(sender As Object, e As EventArgs) Handles 刪除請購單上點選資料_bt.Click
  824. If 請購單號1_tb.Text = "" Then : MGB(對話框(3), 1) : Else
  825. If 項次_tb.Text = "" Then : MGB(對話框(4), 1) : Else
  826. MGB(對話框(5), 2)
  827. If 訊息回應 = "YES" Then
  828. If 明細_dgv.Rows.Count <= 1 Then : 刪除() : Else
  829. PA2 = 請購單號1_tb.Text : PA3 = 項次_tb.Text : PA9 = "0" : PA1 = 料號_tb.Text : PA = 採購單號_tb.Text
  830. SQL_請購單明細表_轉採修改() : SQL_採購單詢價_採購明細刪除() : conn.Close() : Set_請購單清單() : Set_清單2() : Set_採購單清單()
  831. End If
  832. End If
  833. End If
  834. End If
  835. End Sub
  836. Private Sub 存檔()
  837. Set_日期格式轉換() : PA5 = 採購單號_tb.Text : 資料數 = 明細_dgv.Rows.Count
  838. For i As Integer = 0 To 明細_dgv.Rows.Count - 1 : MyMod.進度條()
  839. PA6 = 明細_dgv.Rows(i).Cells(表頭(14)).Value : PA7 = 明細_dgv.Rows(i).Cells(表頭(26)).Value
  840. PA8 = 明細_dgv.Rows(i).Cells(表頭(15)).Value : PA9 = 明細_dgv.Rows(i).Cells(表頭(16)).Value
  841. PA10 = 明細_dgv.Rows(i).Cells("項次").Value : PA4 = 明細_dgv.Rows(i).Cells(表頭(88)).Value
  842. SQL_採購單明細表_修改() : conn.Close()
  843. Next : Set_採購單清單() : MGB(對話框(6), 1) : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  844. End Sub
  845. Private Sub 存檔_bt_Click(sender As Object, e As EventArgs) Handles 存檔_bt.Click
  846. 存檔()
  847. End Sub
  848. Private Sub 刪除_bt_Click(sender As Object, e As EventArgs) Handles 刪除_bt.Click
  849. MGB(對話框(5), 2) : If 訊息回應 = "YES" Then : 刪除() : End If
  850. End Sub
  851. Private Sub 刪除()
  852. 資料數 = 明細_dgv.Rows.Count
  853. For i As Integer = 0 To 明細_dgv.Rows.Count - 1 : MyMod.進度條()
  854. PA2 = 明細_dgv.Rows(i).Cells(表頭(88)).Value : PA3 = 明細_dgv.Rows(i).Cells("項次").Value : PA9 = "0" : SQL_請購單明細表_轉採修改() : conn.Close()
  855. Next : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  856. PA = 採購單號_tb.Text : SQL_採購單詢價_控制刪除() : SQL_採購單詢價_明細刪除() : conn.Close() : Set_請購單清單() : Set_清單2() : Set_採購單清單()
  857. 採購單號_tb.Text = "" : 指定倉庫_cb_下拉表單資料載入()
  858. End Sub
  859. Private Sub 單價_rb_CheckedChanged(sender As Object, e As EventArgs) Handles 單價_rb.Click
  860. Set_單價()
  861. End Sub
  862. Private Sub 日期_rb_CheckedChanged(sender As Object, e As EventArgs) Handles 日期_rb.Click
  863. Set_單價()
  864. End Sub
  865. Private Sub 料號_bt_Click(sender As Object, e As EventArgs) Handles 料號_bt.Click
  866. Set_料號比價()
  867. If 料號1_tb.Text = "" Then : MGB(對話框(22), 1)
  868. Else : If 料號_dgv.Visible = True Then : 料號_dgv.Visible = False : Else : 料號_dgv.Visible = True : End If : End If
  869. End Sub
  870. Private Sub 詳細資料2_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 詳細資料2_ch.Click
  871. If 詳細資料2_ch.Checked = True Then : 詳細資料2_ch.Checked = True : Else : 詳細資料2_ch.Checked = False : End If : Set_請購單清單() : Set_採購單清單()
  872. End Sub
  873. Private Sub 請購單取消_bt_Click(sender As Object, e As EventArgs) Handles 請購單取消_bt.Click
  874. Set_日期格式轉換1()
  875. If 請購單號_tb.Text = "" Then : MGB(對話框(30), 1) : Else
  876. MGB(對話框(31), 2)
  877. If 訊息回應 = "YES" Then
  878. PA = InputBox(系統語言字典("H204-166-" & 語言))
  879. If PA = "" Then
  880. MGB(系統語言字典("H204-167-" & 語言), 1)
  881. Else
  882. LIN訊息通知("CC210", 申請人_tb.Text, 請購單號_tb.Text, PA) : LIN訊息通知("CC210", 核准人_tb.Text, 請購單號_tb.Text, PA)
  883. LIN訊息通知("CC210", "李協叡", 請購單號_tb.Text, PA)
  884. SQL_建築物料請購單核准_請購單退回(請購單號_tb.Text)
  885. MGB(對話框(32) & 請購單號_tb.Text & 對話框(33), 1) : 請購單號_tb.Text = "" : 申請人_tb.Text = "" : 核准人_tb.Text = ""
  886. End If
  887. End If : Set_請購單清單()
  888. End If
  889. End Sub
  890. Private Sub HX_ch_Click(sender As Object, e As EventArgs) Handles HX_ch.Click
  891. HX_ch.Checked = True : PGS_ch.Checked = False : ALL_ch.Checked = False : Set_清單2()
  892. End Sub
  893. Private Sub PGS_ch_Click(sender As Object, e As EventArgs) Handles PGS_ch.Click
  894. HX_ch.Checked = False : PGS_ch.Checked = True : ALL_ch.Checked = False : Set_清單2()
  895. End Sub
  896. Private Sub ALL_ch_Click(sender As Object, e As EventArgs) Handles ALL_ch.Click
  897. HX_ch.Checked = False : PGS_ch.Checked = False : ALL_ch.Checked = True : Set_清單2()
  898. End Sub
  899. Private Sub HX1_ch_Click(sender As Object, e As EventArgs) Handles HX1_ch.Click
  900. HX1_ch.Checked = True : PGS1_ch.Checked = False : ALL1_ch.Checked = False : Set_請購單清單()
  901. End Sub
  902. Private Sub PGS1_ch_Click(sender As Object, e As EventArgs) Handles PGS1_ch.Click
  903. HX1_ch.Checked = False : PGS1_ch.Checked = True : ALL1_ch.Checked = False : Set_請購單清單()
  904. End Sub
  905. Private Sub ALL1_ch_Click(sender As Object, e As EventArgs) Handles ALL1_ch.Click
  906. HX1_ch.Checked = False : PGS1_ch.Checked = False : ALL1_ch.Checked = True : Set_請購單清單()
  907. End Sub
  908. Private Sub 列印成詢價單_bt_Click(sender As Object, e As EventArgs) Handles 列印成詢價單_bt.Click
  909. Dim zz As Integer
  910. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  911. 明細_dgv.Rows(i).Cells(表頭(27)).Value = 明細_dgv.Rows(i).Cells(表頭(26)).Value * 明細_dgv.Rows(i).Cells(表頭(15)).Value
  912. zz = Val(zz) + 明細_dgv.Rows(i).Cells(表頭(27)).Value
  913. Next i
  914. If zz > 0 Then : 存檔()
  915. If 採購單號_tb.Text = "" Then : MGB(對話框(2), 1) : Else
  916. Dim ds6 As New DataSet : 請購資料_dgv.DataSource = Nothing : ds6.Clear()
  917. 請購資料_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  918. 請購資料_dgv.ColumnHeadersHeight = 25 : 請購資料_dgv.AllowUserToAddRows = False
  919. PA38 = 採購單號_tb.Text : SQL_採購資料() : da.Fill(ds6) : 請購資料_dgv.DataSource = ds6.Tables(0) : conn.Close()
  920. xlApp = CType(CreateObject("Excel.Application"), Application) : xlBook = xlApp.Workbooks.Add : xlApp.DisplayAlerts = True : xlBook.Activate()
  921. xlSheet = NewMethod(xlBook) : xlSheet.Activate() : xlApp.Visible = True : xlApp.Application.WindowState = xlMaximized
  922. xlSheet.Cells(3, 1) = "MINTA PESANAN HARGA"
  923. xlSheet.Cells(5, 1) = "ORDER TO : " : xlSheet.Cells(6, 1) = "ALAMAT : " : xlSheet.Cells(7, 1) = "Telp : "
  924. xlSheet.Cells(8, 1) = "Fax : " : xlSheet.Cells(9, 1) = "Email : "
  925. xlSheet.Cells(10, 1) = "No." : xlSheet.Cells(10, 2) = "Nama produk" : xlSheet.Cells(10, 3) = "Spesifikasi"
  926. xlSheet.Cells(10, 4) = "Komentar" : xlSheet.Cells(10, 5) = "SATUAN"
  927. xlSheet.Cells(10, 6) = "QTY" : xlSheet.Cells(10, 7) = "UNIT PRICE" : xlSheet.Cells(10, 8) = "TOTAL PRICE"
  928. xlSheet.Cells(5, 5) = "PO NOMOR 1 : "
  929. xlSheet.Cells(7, 5) = "PO NOMOR 2 : " : xlSheet.Cells(7, 7) = 採購單號_tb.Text
  930. xlSheet.Cells(8, 5) = "TGL/BLN/THN : " : xlSheet.Cells(8, 7) = 需求日期_dtp.Value
  931. xlSheet.Cells(9, 5) = "TEMPAT PEMAKAIAN : "
  932. Dim GGHH As Integer = 0 : N1 = 0 : N2 = 0
  933. For i As Integer = 0 To 明細1_dgv.Rows.Count - 1
  934. xlSheet.Cells(i + 11, 1) = 明細1_dgv.Rows(i).Cells(表頭(11)).Value : xlSheet.Cells(i + 11, 2) = 明細1_dgv.Rows(i).Cells(表頭(12)).Value
  935. xlSheet.Cells(i + 11, 3) = 明細1_dgv.Rows(i).Cells(表頭(13)).Value : xlSheet.Cells(i + 11, 4) = 明細1_dgv.Rows(i).Cells(表頭(14)).Value
  936. xlSheet.Cells(i + 11, 5) = 明細1_dgv.Rows(i).Cells(表頭(16)).Value : xlSheet.Cells(i + 11, 6) = 明細1_dgv.Rows(i).Cells(表頭(15)).Value
  937. xlSheet.Cells(i + 11, 7) = 明細1_dgv.Rows(i).Cells(表頭(26)).Value : xlSheet.Cells(i + 11, 8) = 明細1_dgv.Rows(i).Cells(表頭(27)).Value
  938. GGHH += 明細1_dgv.Rows(i).Cells(表頭(27)).Value
  939. N1 = i + 11
  940. Next i
  941. xlSheet.Cells(N1 + 2, 7) = "TOTAL :" : xlSheet.Cells(N1 + 2, 8) = GGHH
  942. xlSheet.Cells(N1 + 3, 7) = "DISC % :" : xlSheet.Cells(N1 + 3, 8) = ""
  943. xlSheet.Cells(N1 + 4, 7) = "PPN % :" : xlSheet.Cells(N1 + 4, 8) = ""
  944. xlSheet.Cells(N1 + 5, 7) = "GRAND TOTAL :" : xlSheet.Cells(N1 + 5, 8) = ""
  945. xlSheet.Cells(N1 + 6, 1) = "Bagian Pembelian Barang"
  946. xlSheet.Cells(N1 + 6, 3) = "Direktur Utama"
  947. xlSheet.Cells(N1 + 6, 4) = "Bagian Pemeriksa"
  948. xlSheet.Cells(N1 + 6, 6) = "Bagian Pengisian Harga" : xlSheet.Cells(N1 + 8, 6) = 詢價員_tb.Text : xlSheet.Cells(N1 + 9, 6) = 尋價日期_tb.Text
  949. xlSheet.Cells(N1 + 6, 8) = "Asisten Proyek" : xlSheet.Cells(N1 + 8, 8) = "" : xlSheet.Cells(N1 + 9, 8) = ""
  950. For i As Integer = 0 To 請購資料_dgv.Rows.Count - 1
  951. xlSheet.Cells(i + N1 + 12, 1) = 請購資料_dgv.Rows(i).Cells(0).Value
  952. If 系統語言 = "繁體中文" Then
  953. xlSheet.Cells(i + N1 + 12, 3) = 請購資料_dgv.Rows(i).Cells(2).Value
  954. Else
  955. xlSheet.Cells(i + N1 + 12, 3) = 請購資料_dgv.Rows(i).Cells(1).Value
  956. End If
  957. xlSheet.Cells(i + N1 + 12, 8) = 請購資料_dgv.Rows(i).Cells(3).Value : N2 += 1
  958. Next : AA(xlApp, xlSheet) : If Strings.Left(採購單號_tb.Text, 2) = "HX" Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If
  959. '-------------轉換成PDF---------------------------------------------------------------------
  960. Dim SERT As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
  961. xlBook.Sheets(1).ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, SERT & "\" & 採購單號_tb.Text & "_PO(採購單).pdf", XlFixedFormatQuality.xlQualityStandard, True)
  962. '-------------關閉EXCEL---------------------------------------------------------------------
  963. xlSheet.PageSetup.PrintArea = "" : xlApp.Cells.Select()
  964. xlApp.Application.WindowState = xlMinimized
  965. xlBook.Close(False)
  966. Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet)
  967. Runtime.InteropServices.Marshal.ReleaseComObject(xlBook)
  968. Runtime.InteropServices.Marshal.ReleaseComObject(xlApp)
  969. xlApp.Quit() : xlSheet = Nothing : xlBook = Nothing : xlApp = Nothing : GC.Collect()
  970. '-------------開啟PDF---------------------------------------------------------------------
  971. Dim pdfFilePath As String = SERT & "\" & 採購單號_tb.Text & "_PO(採購單).pdf"
  972. If IsChromeInstalled() Then
  973. Try
  974. Dim chromeProcess As New Process()
  975. chromeProcess.StartInfo.FileName = "chrome"
  976. chromeProcess.StartInfo.Arguments = """" & pdfFilePath & """"
  977. chromeProcess.Start()
  978. Catch ex As Exception
  979. End Try
  980. Else
  981. Try
  982. System.Diagnostics.Process.Start("""" & pdfFilePath & """")
  983. Catch ex As Exception
  984. End Try
  985. End If
  986. MGB(對話框(7), 1)
  987. End If
  988. Else : MGB(對話框(13), 1) : End If
  989. End Sub
  990. ' 檢查系統是否已安裝 Google Chrome
  991. Private Function IsChromeInstalled() As Boolean
  992. Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
  993. If key IsNot Nothing Then
  994. For Each subkeyName As String In key.GetSubKeyNames()
  995. Dim subkey As Microsoft.Win32.RegistryKey = key.OpenSubKey(subkeyName)
  996. Dim displayName As Object = subkey.GetValue("DisplayName")
  997. If displayName IsNot Nothing AndAlso displayName.ToString().Contains("Google Chrome") Then
  998. Return True
  999. End If
  1000. Next
  1001. End If
  1002. Return False
  1003. End Function
  1004. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  1005. Return CType(xlBook.Worksheets.Add, Worksheet)
  1006. End Function
  1007. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  1008. xlSheet.Cells.Select()
  1009. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  1010. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1011. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 24
  1012. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 30 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 20
  1013. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 15
  1014. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 15 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 30
  1015. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 90 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 2
  1016. xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 5
  1017. xlSheet.Rows("5:9").Select : myExcel.Selection.RowHeight = 20 : xlSheet.Rows("10:10").Select : myExcel.Selection.RowHeight = 20
  1018. xlSheet.Rows("11:" & N1).Select : myExcel.Selection.RowHeight = 65 : xlSheet.Rows(N1 + 1 & ":" & N1 + 1).Select : myExcel.Selection.RowHeight = 5
  1019. xlSheet.Rows(N1 + 2 & ":" & N1 + 5).Select : myExcel.Selection.RowHeight = 17 : xlSheet.Rows(N1 + 6 & ":" & N1 + 6).Select : myExcel.Selection.RowHeight = 35
  1020. xlSheet.Rows(N1 + 7 & ":" & N1 + 9).Select : myExcel.Selection.RowHeight = 35
  1021. xlSheet.Range("A2:H2").Select()
  1022. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1023. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1024. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 26 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  1025. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1026. xlSheet.Range("A3:H3").Select()
  1027. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1028. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1029. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 16 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  1030. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1031. xlSheet.Range("A10:H" & N1).Select()
  1032. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1033. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1034. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1035. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1036. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1037. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1038. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1039. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 2).Select()
  1040. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1041. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1042. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1043. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1044. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1045. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1046. xlSheet.Range("A" & N1 + 3 & ":H" & N1 + 3).Select()
  1047. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1048. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1049. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1050. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1051. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1052. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1053. xlSheet.Range("A" & N1 + 4 & ":H" & N1 + 4).Select()
  1054. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1055. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1056. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1057. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1058. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1059. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1060. xlSheet.Range("A" & N1 + 5 & ":H" & N1 + 5).Select()
  1061. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1062. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1063. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1064. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1065. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1066. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1067. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 6).Select()
  1068. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1069. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1070. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1071. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1072. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1073. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1074. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1075. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1076. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 6).Select()
  1077. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1078. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1079. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1080. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1081. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1082. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1083. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1084. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1085. xlSheet.Range("D" & N1 + 6 & ":E" & N1 + 6).Select()
  1086. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1087. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1088. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1089. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1090. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1091. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1092. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1093. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1094. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 6).Select()
  1095. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1096. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1097. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1098. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1099. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1100. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1101. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1102. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1103. xlSheet.Range("H" & N1 + 6).Select()
  1104. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1105. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1106. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1107. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1108. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1109. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1110. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1111. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1112. xlSheet.Range("A" & N1 + 7 & ":B" & N1 + 9).Select()
  1113. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1114. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1115. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1116. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1117. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1118. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1119. xlSheet.Range("C" & N1 + 7 & ":C" & N1 + 9).Select()
  1120. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1121. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1122. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1123. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1124. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1125. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1126. xlSheet.Range("D" & N1 + 7 & ":E" & N1 + 9).Select()
  1127. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1128. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1129. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1130. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1131. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1132. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1133. xlSheet.Range("F" & N1 + 7 & ":G" & N1 + 9).Select()
  1134. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1135. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1136. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1137. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1138. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1139. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1140. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1141. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1142. xlSheet.Range("H" & N1 + 7 & ":H" & N1 + 9).Select()
  1143. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1144. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1145. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1146. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1147. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1148. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1149. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1150. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1151. xlSheet.Range("A10:A" & N1).Select()
  1152. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1153. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1154. xlSheet.Range("B11:D" & N1).Select()
  1155. With myExcel.Selection
  1156. .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1157. .ReadingOrder = xlContext : .MergeCells = False : End With
  1158. xlSheet.Range("E11:F" & N1).Select()
  1159. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1160. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1161. xlSheet.Range("G11:H" & N1).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  1162. xlSheet.Range("H" & N1 + 2).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  1163. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).Select()
  1164. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1165. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1166. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1167. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1168. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1169. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1170. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1171. myExcel.ActiveWindow.DisplayGridlines = False
  1172. xlSheet.Range("A3:H3").Select()
  1173. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1174. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  1175. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1176. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1177. xlSheet.Range("G7:G9").Select()
  1178. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1179. .ReadingOrder = xlContext : .MergeCells = False : End With
  1180. xlSheet.Range("A10:H" & N1).Select()
  1181. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1182. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1183. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1184. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1185. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1186. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1187. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1188. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).Select()
  1189. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1190. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1191. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1192. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1193. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1194. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1195. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 9).Select()
  1196. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1197. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1198. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1199. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1200. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1201. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1202. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 9).Select()
  1203. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1204. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1205. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1206. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1207. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1208. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1209. xlSheet.Range("D" & N1 + 6 & ":E" & N1 + 9).Select()
  1210. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1211. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1212. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1213. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1214. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1215. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1216. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 9).Select()
  1217. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1218. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1219. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1220. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1221. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1222. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1223. xlSheet.Range("H" & N1 + 6 & ":H" & N1 + 9).Select()
  1224. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1225. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1226. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1227. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1228. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1229. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1230. xlSheet.Rows("5:9").Select
  1231. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  1232. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1233. xlSheet.Rows("11:" & N1).Select
  1234. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  1235. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1236. xlSheet.Range("A10:H10").Select()
  1237. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1238. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1239. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1240. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1241. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1242. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1243. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1244. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1245. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1246. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1247. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1248. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1249. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1250. xlSheet.Range("A11:H" & N1).Select()
  1251. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1252. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1253. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1254. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1255. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1256. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1257. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1258. xlSheet.Range("B11:D" & N1).Select()
  1259. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1260. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1261. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1262. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1263. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1264. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1265. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1266. xlSheet.Range("F11:F" & N1).Select()
  1267. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1268. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1269. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1270. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1271. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1272. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1273. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1274. xlSheet.Range("H11:H" & N1).Select()
  1275. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1276. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1277. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1278. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1279. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1280. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1281. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1282. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).Select()
  1283. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1284. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1285. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1286. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1287. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1288. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1289. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).Select()
  1290. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1291. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1292. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1293. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1294. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1295. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1296. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1297. xlSheet.Range("G" & N1 + 2 & ":G" & N1 + 5).Select()
  1298. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1299. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1300. xlSheet.Range("F" & N1 + 8 & ":G" & N1 + 8).Select()
  1301. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1302. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1303. xlSheet.Range("F" & N1 + 9 & ":G" & N1 + 9).Select()
  1304. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1305. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1306. xlSheet.Range("A" & N1 + 11 & ":H" & N1 + N2 + 11).Select()
  1307. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1308. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1309. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1310. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1311. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1312. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1313. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1314. If 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL" Then
  1315. myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename =
  1316. Str01 & "\HXBWLOG.png"
  1317. Else
  1318. myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename =
  1319. Str01 & "\PGSBWLOG.png"
  1320. End If
  1321. myExcel.Application.PrintCommunication = False
  1322. With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "$1:$10" : .PrintTitleColumns = "" : End With
  1323. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  1324. With myExcel.ActiveSheet.PageSetup : .LeftHeader = ""
  1325. .CenterHeader = "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "&G"
  1326. .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "第 &P 頁,共 &N 頁" : .RightFooter = ""
  1327. .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
  1328. .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
  1329. .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
  1330. .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = False : .CenterVertically = False : .Draft = False
  1331. .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = False : .OddAndEvenPagesHeaderFooter = False
  1332. .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = ""
  1333. .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" : .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = ""
  1334. .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = "" : .FirstPage.RightHeader.Text = ""
  1335. .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = ""
  1336. End With : myExcel.Application.PrintCommunication = True
  1337. End Sub
  1338. Private Sub CC(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Worksheet)
  1339. Clipboard.SetDataObject(合約報價單.PictureBox1.Image)
  1340. xlSheet.Range("A1").Select()
  1341. myExcel.ActiveSheet.Pictures.Paste.Select
  1342. myExcel.Selection.ShapeRange.Height = 93
  1343. myExcel.Selection.ShapeRange.IncrementLeft(50)
  1344. myExcel.Selection.ShapeRange.IncrementTop(0)
  1345. End Sub
  1346. Private Sub DD(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Worksheet)
  1347. Clipboard.SetDataObject(合約報價單.PictureBox2.Image)
  1348. xlSheet.Range("A1").Select()
  1349. myExcel.ActiveSheet.Pictures.Paste.Select
  1350. myExcel.Selection.ShapeRange.Height = 93
  1351. myExcel.Selection.ShapeRange.IncrementLeft(50)
  1352. myExcel.Selection.ShapeRange.IncrementTop(0)
  1353. End Sub
  1354. Private Sub 風格()
  1355. If 深色風格 = False Then
  1356. 未受理的請購單_tp.BackColor = SystemColors.Control : 詢價中的採購單_tp.BackColor = SystemColors.Control : Me.BackColor = SystemColors.Control
  1357. Label2.ForeColor = Color.Black : Label7.ForeColor = Color.Black : Label3.ForeColor = Color.Black : Label11.ForeColor = Color.Black
  1358. Label6.ForeColor = Color.Black : 文字2_lb.ForeColor = Color.Black : 詳細資料2_ch.ForeColor = Color.Black : Label1.ForeColor = Color.Black
  1359. 單價_rb.ForeColor = Color.Black : 日期_rb.ForeColor = Color.Black : Label8.ForeColor = Color.Black : 小間距1_ch.ForeColor = Color.Black
  1360. 中間距1_ch.ForeColor = Color.Black : 大間距1_ch.ForeColor = Color.Black : 文字_lb.ForeColor = Color.Black
  1361. 指定倉庫_lb.ForeColor = Color.Purple : 選擇公司_lb.ForeColor = Color.Blue
  1362. 依據入庫單號全部選擇_bt.BackColor = Color.White : 依據入庫單號全部選擇_bt.ForeColor = Color.Olive : 全部選擇_bt.BackColor = Color.White : 全部選擇_bt.ForeColor = Color.Olive
  1363. 全部取消_bt.BackColor = Color.White : 全部取消_bt.ForeColor = Color.Olive : 語轉扭_bt.BackColor = Color.White : 語轉扭_bt.ForeColor = Color.Black
  1364. 採購單號_tb.BackColor = Color.White : 採購單號_tb.ForeColor = Color.Black : 請購單號_tb.BackColor = Color.White : 請購單號_tb.ForeColor = Color.Black
  1365. 指定倉庫_cb.BackColor = Color.White : 指定倉庫_cb.ForeColor = Color.Black : 選擇公司_cb.BackColor = Color.White : 選擇公司_cb.ForeColor = Color.Black
  1366. HX_ch.BackColor = SystemColors.Control : HX_ch.ForeColor = Color.Black : PGS_ch.BackColor = SystemColors.Control : PGS_ch.ForeColor = Color.Black
  1367. ALL_ch.BackColor = SystemColors.Control : ALL_ch.ForeColor = Color.Black
  1368. 生成採購單_bt.BackColor = Color.White : 存檔_bt.BackColor = Color.White : 退回請購單_bt.BackColor = Color.White : 系統說明_bt.BackColor = Color.White
  1369. 列印成詢價單_bt.BackColor = Color.White : 料號_bt.BackColor = Color.White : 刪除_bt.BackColor = Color.White
  1370. 採購單_dgv.EnableHeadersVisualStyles = True : 採購單_dgv.BackgroundColor = Color.White : 採購單_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
  1371. 採購單_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightPink
  1372. 採購單_dgv.DefaultCellStyle.BackColor = Color.White : 採購單_dgv.DefaultCellStyle.ForeColor = Color.Black
  1373. 明細_dgv.EnableHeadersVisualStyles = True : 明細_dgv.BackgroundColor = Color.White : 明細_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
  1374. 明細_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightBlue
  1375. 明細_dgv.DefaultCellStyle.BackColor = Color.White : 明細_dgv.DefaultCellStyle.ForeColor = Color.Black
  1376. 料號_dgv.EnableHeadersVisualStyles = True : 料號_dgv.BackgroundColor = Color.White : 料號_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
  1377. 料號_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGray
  1378. 料號_dgv.DefaultCellStyle.BackColor = Color.White : 料號_dgv.DefaultCellStyle.ForeColor = Color.Black
  1379. 請購_dgv.EnableHeadersVisualStyles = True : 請購_dgv.BackgroundColor = Color.White : 請購_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
  1380. 請購_dgv.DefaultCellStyle.BackColor = Color.White : 請購_dgv.DefaultCellStyle.ForeColor = Color.Black
  1381. Else
  1382. 未受理的請購單_tp.BackColor = Color.Black : 詢價中的採購單_tp.BackColor = Color.Black : Me.BackColor = Color.Black
  1383. Label2.ForeColor = Color.White : Label7.ForeColor = Color.White : Label3.ForeColor = Color.White : Label11.ForeColor = Color.White
  1384. Label6.ForeColor = Color.White : 文字2_lb.ForeColor = Color.White : 詳細資料2_ch.ForeColor = Color.White : Label1.ForeColor = Color.White
  1385. 單價_rb.ForeColor = Color.White : 日期_rb.ForeColor = Color.White : Label8.ForeColor = Color.White : 小間距1_ch.ForeColor = Color.White
  1386. 中間距1_ch.ForeColor = Color.White : 大間距1_ch.ForeColor = Color.White : 文字_lb.ForeColor = Color.White
  1387. 指定倉庫_lb.ForeColor = Color.Fuchsia : 選擇公司_lb.ForeColor = Color.LightBlue
  1388. 依據入庫單號全部選擇_bt.BackColor = Color.DimGray : 依據入庫單號全部選擇_bt.ForeColor = Color.Yellow : 全部選擇_bt.BackColor = Color.DimGray : 全部選擇_bt.ForeColor = Color.Yellow
  1389. 全部取消_bt.BackColor = Color.DimGray : 全部取消_bt.ForeColor = Color.Yellow : 語轉扭_bt.BackColor = Color.DimGray : 語轉扭_bt.ForeColor = Color.White
  1390. 採購單號_tb.BackColor = Color.DimGray : 採購單號_tb.ForeColor = Color.White : 請購單號_tb.BackColor = Color.DimGray : 請購單號_tb.ForeColor = Color.White
  1391. 指定倉庫_cb.BackColor = Color.DimGray : 指定倉庫_cb.ForeColor = Color.White : 選擇公司_cb.BackColor = Color.DimGray : 選擇公司_cb.ForeColor = Color.White
  1392. HX_ch.BackColor = Color.Black : HX_ch.ForeColor = Color.White : PGS_ch.BackColor = Color.Black : PGS_ch.ForeColor = Color.White
  1393. ALL_ch.BackColor = Color.Black : ALL_ch.ForeColor = Color.White
  1394. 生成採購單_bt.BackColor = Color.DimGray : 存檔_bt.BackColor = Color.DimGray : 退回請購單_bt.BackColor = Color.DimGray : 系統說明_bt.BackColor = Color.DimGray
  1395. 列印成詢價單_bt.BackColor = Color.DimGray : 料號_bt.BackColor = Color.DimGray : 刪除_bt.BackColor = Color.DimGray
  1396. 採購單_dgv.EnableHeadersVisualStyles = False : 採購單_dgv.BackgroundColor = Color.DimGray : 採購單_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
  1397. 採購單_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 採購單_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray
  1398. 採購單_dgv.DefaultCellStyle.BackColor = Color.Black : 採購單_dgv.DefaultCellStyle.ForeColor = Color.White
  1399. 明細_dgv.EnableHeadersVisualStyles = False : 明細_dgv.BackgroundColor = Color.DimGray : 明細_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
  1400. 明細_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 明細_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray
  1401. 明細_dgv.DefaultCellStyle.BackColor = Color.Black : 明細_dgv.DefaultCellStyle.ForeColor = Color.White
  1402. 料號_dgv.EnableHeadersVisualStyles = False : 料號_dgv.BackgroundColor = Color.DimGray : 料號_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
  1403. 料號_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 料號_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray
  1404. 料號_dgv.DefaultCellStyle.BackColor = Color.Black : 料號_dgv.DefaultCellStyle.ForeColor = Color.White
  1405. 請購_dgv.EnableHeadersVisualStyles = False : 請購_dgv.BackgroundColor = Color.DimGray : 請購_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
  1406. 請購_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 請購_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray
  1407. 請購_dgv.DefaultCellStyle.BackColor = Color.DimGray : 請購_dgv.DefaultCellStyle.ForeColor = Color.White
  1408. End If
  1409. End Sub
  1410. End Class