Nessuna descrizione
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 140KB

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