暫無描述
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 125KB

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