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

採購單詢價.vb 125KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449
  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 = GCM_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  553. H(204) = True : 介面 = "H204" : 語言轉換讀取()
  554. 小間距1_ch.Checked = False : 中間距1_ch.Checked = True : 大間距1_ch.Checked = False
  555. 未受理請購單_bt.Enabled = False : 生成採購單_bt.Enabled = False : 列印成詢價單_bt.Enabled = False : 文字2_lb.Visible = False
  556. 採購單_dgv.Visible = False : 明細_dgv.Visible = False : 刪除請購單上點選資料_bt.Enabled = False : 存檔_bt.Enabled = False : 刪除_bt.Enabled = False
  557. 需求日期_dtp.Format = DateTimePickerFormat.Custom : 需求日期_dtp.CustomFormat = " " : 系統語言_cb.Text = "Indonesian" : 退回請購單_bt.Enabled = False
  558. 單價_rb.Checked = True
  559. If 文字_lb.Visible = True Then
  560. 文字2_lb.Visible = False
  561. End If
  562. 料號_bt.Visible = False : 料號_dgv.Visible = False : 料號1_tb.Visible = False
  563. Label1.Text = 對話框(18) & 比例1 & 對話框(19) & 比例2 & 對話框(20) & 比例2 & 對話框(19) & 比例3 & 對話框(21) & 比例3
  564. 指定倉庫_cb_下拉表單資料載入() : yy = True : Set_請購單清單() : Set_清單2() : Set_採購單清單() : yy = False : Set_單價()
  565. MyModule1.清單字體大小調整()
  566. 採購單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  567. 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  568. 請購_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  569. End Sub
  570. Private Sub 採購單詢價_SizeChanged(sender As Object, e As EventArgs) Handles MyBase.SizeChanged
  571. MyModule1.清單字體大小調整()
  572. 採購單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  573. 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  574. 請購_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  575. End Sub
  576. Private Sub 採購單詢價_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
  577. H(204) = False
  578. End Sub
  579. Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
  580. 介面 = "H204" : 語言轉換讀取()
  581. Set_清單2() : Set_單價() : Set_請購單清單() : Set_採購單清單() : Set_料號比價()
  582. Label1.Text = 對話框(18) & 比例1 & 對話框(19) & 比例2 & 對話框(20) & 比例2 & 對話框(19) & 比例3 & 對話框(21) & 比例3
  583. End Sub
  584. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  585. timeNow = 0
  586. GCM_ERP_SYS.Timer1.Enabled = False
  587. GCM_ERP_SYS.Timer1.Enabled = True
  588. End Sub
  589. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  590. timeNow = 0
  591. GCM_ERP_SYS.Timer1.Enabled = False
  592. GCM_ERP_SYS.Timer1.Enabled = True
  593. End Sub
  594. Dim 已超出 As Boolean
  595. Private Sub 明細_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 明細_dgv.MouseUp
  596. 'If 明細_dgv.SelectedCells.Count = 1 Then : MsgBox(明細_dgv.SelectedCells(0).ColumnIndex & " " & 明細_dgv.SelectedCells(0).RowIndex) : End If
  597. If 明細_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
  598. If 明細_dgv.SelectedCells.Count > 0 Then
  599. If 明細_dgv.SelectedCells(0).ColumnIndex = 8 Then
  600. If 已超出 = False Then
  601. Dim x As Double = 0
  602. For i As Integer = 0 To 明細_dgv.SelectedCells.Count - 1
  603. Dim 變數 As String = "" : Dim 取變數 As String
  604. 取變數 = 明細_dgv.Rows(明細_dgv.SelectedCells.Item(i).RowIndex).Cells(明細_dgv.SelectedCells.Item(i).ColumnIndex).Value
  605. For ii As Integer = 1 To Len(取變數)
  606. If ii = 1 Then : 變數 = Strings.Left(取變數, ii) : Else : If Strings.Mid(取變數, ii, 1) <> "," Then : 變數 &= Strings.Mid(取變數, ii, 1) : End If : End If
  607. Next : x += Val(變數)
  608. Next i : GCM_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(x, "#,##0")
  609. Else : GCM_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0")
  610. End If
  611. Else : 已超出 = True : GCM_ERP_SYS.合計_TSSL.Text = "Total : " & Strings.Format(0, "#,##0")
  612. End If
  613. End If
  614. End Sub
  615. Private Sub 明細_dgv_CellEnter(sender As Object, e As DataGridViewCellEventArgs) Handles 明細_dgv.CellEnter
  616. 金額計算() : 價格()
  617. End Sub
  618. Private Sub 明細_dgv_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles 明細_dgv.RowPostPaint
  619. 價格()
  620. End Sub
  621. Private Sub 明細_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 明細_dgv.CellClick
  622. If e.RowIndex = -1 Then : Else
  623. 採購單號_tb.Text = 明細_dgv("採購單號", e.RowIndex).Value.ToString : 項次_tb.Text = 明細_dgv("項次", e.RowIndex).Value.ToString
  624. 請購單號1_tb.Text = 明細_dgv(表頭(88), e.RowIndex).Value.ToString : 料號_tb.Text = 明細_dgv("料號", e.RowIndex).Value.ToString
  625. 料號1_tb.Text = 明細_dgv("料號", e.RowIndex).Value.ToString
  626. PA1 = 明細_dgv.Rows(e.RowIndex).Cells("群組碼").Value : PA2 = 明細_dgv.Rows(e.RowIndex).Cells("料號原則").Value
  627. SQL_物料圖庫_圖檔讀取()
  628. While dr.Read() = True
  629. Dim unused As Byte() = New Byte(-1) {}
  630. Dim bytes As Byte() = DirectCast(dr.Item("圖檔"), Byte())
  631. Dim oStream As New MemoryStream(bytes)
  632. 物料圖_pb.Image = Bitmap.FromStream(oStream)
  633. End While
  634. conn.Close() : 物料圖_pb.SizeMode = 4
  635. End If
  636. End Sub
  637. Private Sub 採購單_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 採購單_dgv.CellClick
  638. If e.RowIndex = -1 Then : Else
  639. 採購單號_tb.Text = 採購單_dgv(0, e.RowIndex).Value.ToString
  640. If Strings.Left(採購單號_tb.Text, 3) = "HXI" Then
  641. 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL"
  642. ElseIf Strings.Left(採購單號_tb.Text, 3) = "PGS" Then
  643. 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" : End If
  644. 詢價員_tb.Text = 採購單_dgv("詢價員", e.RowIndex).Value.ToString : 尋價日期_tb.Text = 採購單_dgv("尋價日期", e.RowIndex).Value.ToString
  645. 需求日期_dtp.Value = 採購單_dgv(2, e.RowIndex).Value : 指定倉庫_cb.Text = 採購單_dgv("使用地點", e.RowIndex).Value.ToString
  646. Set_採購單清單()
  647. End If
  648. 生成採購單_bt.Enabled = False
  649. End Sub
  650. Private Sub 讀取最小需求日期()
  651. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  652. If 請購_dgv.Rows(i).Cells(27).Value = True Then
  653. If 請購_dgv.Rows(i).Cells(表頭(30)).Value <> "" Then
  654. If 需求日期_dtp.Text = "" Or 需求日期_dtp.Text = " " Then
  655. 需求日期_dtp.Format = DateTimePickerFormat.Short
  656. 需求日期_dtp.Value = 請購_dgv.Rows(i).Cells(表頭(30)).Value
  657. ElseIf 需求日期_dtp.Text <> "" Then
  658. If 需求日期_dtp.Value = 請購_dgv.Rows(i).Cells(表頭(30)).Value Then
  659. ElseIf 需求日期_dtp.Value > 請購_dgv.Rows(i).Cells(表頭(30)).Value Then
  660. 需求日期_dtp.Value = 請購_dgv.Rows(i).Cells(表頭(30)).Value
  661. End If
  662. End If
  663. End If
  664. End If
  665. Next
  666. End Sub
  667. Private Sub 請購_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 請購_dgv.CellClick
  668. If e.RowIndex = -1 Then : Else
  669. 請購單號_tb.Text = 請購_dgv.Rows(e.RowIndex).Cells(1).Value.ToString
  670. PA1 = 請購_dgv.Rows(e.RowIndex).Cells(表頭(62)).Value : PA2 = 請購_dgv.Rows(e.RowIndex).Cells("群組原則").Value
  671. SQL_物料圖庫_圖檔讀取()
  672. While dr.Read() = True
  673. Dim unused As Byte() = New Byte(-1) {}
  674. Dim bytes As Byte() = DirectCast(dr.Item("圖檔"), Byte())
  675. Dim oStream As New MemoryStream(bytes)
  676. 物料圖_pb.Image = Bitmap.FromStream(oStream)
  677. End While
  678. conn.Close() : 物料圖_pb.SizeMode = 4
  679. If 倉庫編號_tb.Text = "" Then
  680. MsgBox(對話框(2))
  681. Else
  682. 讀取最小需求日期()
  683. If 請購_dgv("" & (表頭(44)) & "", e.RowIndex).Value = True Then
  684. 請購_dgv("" & (表頭(44)) & "", e.RowIndex).Value = False
  685. Else
  686. 請購_dgv("" & (表頭(44)) & "", e.RowIndex).Value = True
  687. End If
  688. If 請購_dgv("" & (表頭(44)) & "", e.RowIndex).Value = True Then
  689. 請購_dgv.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.LightGreen
  690. Else
  691. 請購_dgv.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.White
  692. End If
  693. PA = 請購_dgv("" & (表頭(77)) & "", e.RowIndex).Value
  694. SQL_物料規格表_查詢() '---查詢物規格表中是否有這個料號
  695. If dr.Read() Then
  696. Else
  697. Dim aa1 As MsgBoxResult = MsgBox(對話框(8) & vbCrLf & 對話框(9) & vbCrLf & 對話框(10), MsgBoxStyle.OkCancel)
  698. If aa1 = MsgBoxResult.Ok Then
  699. MsgBox(對話框(11))
  700. Else
  701. SQL_請購單明細表_刪除一筆資料() '---刪除請購單上選中的資料
  702. 請購_dgv("" & (表頭(44)) & "", e.RowIndex).Value = False
  703. 請購_dgv.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.White
  704. MsgBox(對話框(12))
  705. Set_請購單清單()
  706. End If
  707. End If
  708. End If
  709. End If
  710. 生成採購單_bt.Enabled = True
  711. End Sub
  712. Private Sub 請購_dgv_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles 請購_dgv.RowPostPaint
  713. Dim linePen As New Pen(Color.Blue, 2)
  714. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  715. If 請購_dgv("" & (表頭(44)) & "", i).Value = True Then
  716. 請購_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightGreen
  717. Else
  718. 請購_dgv.Rows(i).DefaultCellStyle.BackColor = Color.White
  719. End If
  720. Next
  721. If e.RowIndex = 請購_dgv.Rows.Count - 1 Then : Exit Sub : Else
  722. If 請購_dgv(1, e.RowIndex).Value.ToString <> 請購_dgv(1, e.RowIndex + 1).Value.ToString Then
  723. Dim startX As Integer = IIf(請購_dgv.RowHeadersVisible, 請購_dgv.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  724. Dim endX As Integer = startX + 請購_dgv.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - 請購_dgv.HorizontalScrollingOffset
  725. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  726. End If
  727. End If
  728. End Sub
  729. Private Sub 物料圖_pb_Click(sender As Object, e As EventArgs) Handles 物料圖_pb.Click
  730. If IsNothing(物料圖_pb.Image) = False Then
  731. 圖片傳遞 = 物料圖_pb.Image : 圖片放大視窗.ShowDialog()
  732. End If
  733. End Sub
  734. Private Sub 指定倉庫_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 指定倉庫_cb.SelectedIndexChanged
  735. PA6 = 指定倉庫_cb.Text : SQL_指定倉儲_資料讀取()
  736. If dr.Read() Then : 倉庫級別_tb.Text = dr("倉級") : 倉庫編號_tb.Text = dr("倉名編號") : End If : conn.Close()
  737. Set_請購單清單()
  738. If 倉庫編號_tb.Text = "" Or 選擇公司_cb.Text = "" Then
  739. 生成採購單_bt.Enabled = False
  740. Else
  741. 生成採購單_bt.Enabled = True
  742. End If
  743. End Sub
  744. Private Sub 選擇公司_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 選擇公司_cb.SelectedIndexChanged
  745. If 倉庫編號_tb.Text = "" Or 選擇公司_cb.Text = "" Then
  746. 生成採購單_bt.Enabled = False
  747. Else
  748. 生成採購單_bt.Enabled = True
  749. End If
  750. End Sub
  751. Private Sub 需求日期_dtp_ValueChanged(sender As Object, e As EventArgs) Handles 需求日期_dtp.MouseDown
  752. 需求日期_dtp.Format = DateTimePickerFormat.Short
  753. End Sub
  754. Private Sub 小間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 小間距1_ch.Click
  755. 小間距1_ch.Checked = True : 中間距1_ch.Checked = False : 大間距1_ch.Checked = False : MyModule1.間距設定存檔_1() : Set_請購單清單() : Set_採購單清單()
  756. End Sub
  757. Private Sub 中間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 中間距1_ch.Click
  758. 小間距1_ch.Checked = False : 中間距1_ch.Checked = True : 大間距1_ch.Checked = False : MyModule1.間距設定存檔_2() : Set_請購單清單() : Set_採購單清單()
  759. End Sub
  760. Private Sub 大間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 大間距1_ch.Click
  761. 小間距1_ch.Checked = False : 中間距1_ch.Checked = False : 大間距1_ch.Checked = True : MyModule1.間距設定存檔_3() : Set_請購單清單() : Set_採購單清單()
  762. End Sub
  763. Private Sub 全部選擇_bt_Click(sender As Object, e As EventArgs) Handles 全部選擇_bt.Click
  764. If 倉庫編號_tb.Text = "" Then
  765. MsgBox(對話框(2))
  766. Else
  767. For i As Integer = 0 To 請購_dgv.Rows.Count - 1 : 請購_dgv.Rows(i).Cells(表頭(44)).Value = True : Next i
  768. 讀取最小需求日期()
  769. End If
  770. End Sub
  771. Private Sub 全部取消_bt_Click(sender As Object, e As EventArgs) Handles 全部取消_bt.Click
  772. If 倉庫編號_tb.Text = "" Then
  773. MsgBox(對話框(2))
  774. Else
  775. For i As Integer = 0 To 請購_dgv.Rows.Count - 1 : 請購_dgv.Rows(i).Cells(表頭(44)).Value = False : Next i
  776. 讀取最小需求日期()
  777. End If
  778. End Sub
  779. Private Sub 依據入庫單號全部選擇_bt_Click(sender As Object, e As EventArgs) Handles 依據入庫單號全部選擇_bt.Click
  780. If 倉庫編號_tb.Text = "" Then
  781. MsgBox(對話框(2))
  782. Else
  783. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  784. If 請購單號_tb.Text = 請購_dgv.Rows(i).Cells(1).Value.ToString Then
  785. 請購_dgv.Rows(i).Cells(表頭(44)).Value = True
  786. End If
  787. Next i
  788. 讀取最小需求日期()
  789. End If
  790. End Sub
  791. Private Sub 未受理請購單_bt_Click(sender As Object, e As EventArgs) Handles 未受理請購單_bt.Click
  792. 未受理請購單_bt.Enabled = False : 詢價中的採購單_bt.Enabled = True
  793. 採購單_dgv.Visible = False : 明細_dgv.Visible = False : 請購_dgv.Visible = True : 文字_lb.Visible = True : 文字2_lb.Visible = False
  794. 刪除請購單上點選資料_bt.Enabled = False : 存檔_bt.Enabled = False : 刪除_bt.Enabled = False : 列印成詢價單_bt.Enabled = False
  795. 退回請購單_bt.Enabled = False : 料號_bt.Visible = False : 料號_dgv.Visible = False : 料號1_tb.Visible = False
  796. End Sub
  797. Private Sub 未指定廠商採購單_bt_Click(sender As Object, e As EventArgs) Handles 詢價中的採購單_bt.Click
  798. 未受理請購單_bt.Enabled = True : 詢價中的採購單_bt.Enabled = False
  799. 採購單_dgv.Visible = True : 明細_dgv.Visible = True : 請購_dgv.Visible = False : 文字2_lb.Visible = True : 文字_lb.Visible = False : 全部取消_bt.Enabled = False
  800. 刪除請購單上點選資料_bt.Enabled = True : 存檔_bt.Enabled = True : 刪除_bt.Enabled = True : 列印成詢價單_bt.Enabled = True : 全部選擇_bt.Enabled = False
  801. 退回請購單_bt.Enabled = True : 生成採購單_bt.Enabled = False : 料號_bt.Visible = True : 料號1_tb.Visible = True
  802. End Sub
  803. Private Sub Set_日期格式轉換()
  804. DTP = Strings.Format(Today(), "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd") : DTP2 = Strings.Format(需求日期_dtp.Value, "yyyy/MM/dd")
  805. End Sub
  806. Private Sub 確定新增()
  807. Set_日期格式轉換()
  808. PA1 = 採購單號_tb.Text : PA2 = "" : PA3 = 指定倉庫_cb.Text : PA4 = "" : PA5 = "" : PA6 = "" : PA7 = "0" : BL1 = 0 : PA8 = "5"
  809. SQL_採購單控制表_新增() : conn.Close()
  810. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  811. 資料數 = 請購_dgv.Rows.Count : MyModule1.進度條()
  812. If 請購_dgv.Rows(i).Cells(表頭(44)).Value = True Then
  813. PA9 = 請購_dgv.Rows(i).Cells(表頭(44)).Value : PA2 = 請購_dgv.Rows(i).Cells(表頭(88)).Value : PA3 = 請購_dgv.Rows(i).Cells("項次").Value
  814. PA4 = 請購_dgv.Rows(i).Cells(表頭(12)).Value : PA5 = 請購_dgv.Rows(i).Cells(表頭(13)).Value : PA6 = 請購_dgv.Rows(i).Cells(表頭(14)).Value
  815. NU1 = 請購_dgv.Rows(i).Cells(表頭(15)).Value : PA8 = 請購_dgv.Rows(i).Cells(表頭(16)).Value : PA10 = "0" '--單價還未帶出
  816. PA11 = 請購_dgv.Rows(i).Cells(表頭(62)).Value : PA12 = 請購_dgv.Rows(i).Cells("群組原則").Value : PA13 = 請購_dgv.Rows(i).Cells(表頭(77)).Value
  817. PA14 = 請購_dgv.Rows(i).Cells(表頭(134)).Value : PA15 = 請購_dgv.Rows(i).Cells(表頭(19)).Value
  818. SQL_請購單明細表_轉採修改() : SQL_採購單明細表_新增() : conn.Close()
  819. End If
  820. Next : GCM_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  821. MsgBox(對話框(1))
  822. End Sub
  823. Private Sub 確定退回()
  824. Set_日期格式轉換()
  825. If 採購單號_tb.Text = "" Or 料號_tb.Text = "" Then
  826. MsgBox(對話框(4))
  827. Else
  828. Dim FF As Integer
  829. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  830. If 明細_dgv.Rows(i).Cells("Cancel order").Value = True Then
  831. FF += 1
  832. End If
  833. Next
  834. If 明細_dgv.Rows.Count = FF Then
  835. PA1 = 採購單號_tb.Text
  836. SQL_採購單控制表_刪除() : conn.Close()
  837. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  838. If 明細_dgv.Rows(i).Cells("Cancel order").Value = True Then
  839. PA2 = 明細_dgv.Rows(i).Cells(表頭(88)).Value : PA3 = 明細_dgv.Rows(i).Cells("項次").Value
  840. SQL_請購單明細表_退採修改() : SQL_採購單明細表_刪除() : conn.Close()
  841. End If
  842. Next
  843. GCM_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  844. Set_請購單清單() : Set_採購單清單() : Set_清單2() : MsgBox(對話框(14))
  845. ElseIf 明細_dgv.Rows.Count > FF Then
  846. PA1 = 採購單號_tb.Text
  847. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  848. If 明細_dgv.Rows(i).Cells("Cancel order").Value = True Then
  849. PA2 = 明細_dgv.Rows(i).Cells(表頭(88)).Value : PA3 = 明細_dgv.Rows(i).Cells("項次").Value
  850. SQL_請購單明細表_退採修改() : SQL_採購單明細表_刪除() : conn.Close()
  851. End If
  852. Next
  853. GCM_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  854. Set_請購單清單() : Set_採購單清單() : Set_清單2() : MsgBox(對話框(15))
  855. End If
  856. End If
  857. End Sub
  858. Private Sub 退回請購單_bt_Click(sender As Object, e As EventArgs) Handles 退回請購單_bt.Click
  859. Dim FF As Boolean
  860. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  861. FF = 明細_dgv.Rows(i).Cells("Cancel order").Value
  862. If FF = True Then
  863. Exit For
  864. End If
  865. Next
  866. If FF = True Then
  867. 確定退回() : Set_採購單清單() : Set_清單2() : Set_請購單清單()
  868. Else
  869. MsgBox(對話框(16))
  870. End If
  871. End Sub
  872. Private Sub 新增採購單_()
  873. If 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL" Then
  874. Set_日期格式轉換() : Dim NUM1 As Integer
  875. For i As Integer = 1 To 999
  876. NUM1 = 0 + i
  877. If NUM1 < 10 Then : 採購單號_tb.Text = "HXI-C-" & DTP1 & "-00" & NUM1
  878. ElseIf NUM1 > 9 And NUM1 < 100 Then : 採購單號_tb.Text = "HXI-C-" & DTP1 & "-0" & NUM1
  879. ElseIf NUM1 > 99 Then : 採購單號_tb.Text = "HXI-C-" & DTP1 & "-" & NUM1
  880. End If
  881. PA1 = 採購單號_tb.Text
  882. SQL_採購單控制表_單號最後一筆() : If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  883. Next
  884. 確定新增()
  885. ElseIf 選擇公司_cb.Text = "PT PUNCAK GEMILANG SEMESTA" Then
  886. Set_日期格式轉換() : Dim NUM1 As Integer
  887. For i As Integer = 1 To 999
  888. NUM1 = 0 + i
  889. If NUM1 < 10 Then : 採購單號_tb.Text = "PGS-C-" & DTP1 & "-00" & NUM1
  890. ElseIf NUM1 > 9 And NUM1 < 100 Then : 採購單號_tb.Text = "PGS-C-" & DTP1 & "-0" & NUM1
  891. ElseIf NUM1 > 99 Then : 採購單號_tb.Text = "PGS-C-" & DTP1 & "-" & NUM1
  892. End If
  893. PA1 = 採購單號_tb.Text
  894. SQL_採購單控制表_單號最後一筆() : If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  895. Next
  896. 確定新增()
  897. End If
  898. 指定倉庫_cb_下拉表單資料載入() : Set_清單2() : Set_請購單清單()
  899. End Sub
  900. Private Sub 生成採購單_bt_Click(sender As Object, e As EventArgs) Handles 生成採購單_bt.Click
  901. Dim 判斷有選 As Boolean = False
  902. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  903. If 請購_dgv.Rows(i).Cells(表頭(44)).Value = True Then
  904. 判斷有選 = True : Exit For
  905. End If
  906. Next
  907. If 判斷有選 = True Then
  908. If 採購單號_tb.Text <> "" Then
  909. Dim aa1 As MsgBoxResult = MsgBox(對話框(17), MsgBoxStyle.OkCancel)
  910. If aa1 = MsgBoxResult.Ok Then
  911. Set_日期格式轉換()
  912. PA1 = 採購單號_tb.Text
  913. For i As Integer = 0 To 請購_dgv.Rows.Count - 1
  914. 資料數 = 請購_dgv.Rows.Count : MyModule1.進度條()
  915. If 請購_dgv.Rows(i).Cells(表頭(44)).Value = True Then
  916. PA9 = 請購_dgv.Rows(i).Cells(表頭(44)).Value : PA2 = 請購_dgv.Rows(i).Cells(表頭(88)).Value : PA3 = 請購_dgv.Rows(i).Cells("項次").Value
  917. PA4 = 請購_dgv.Rows(i).Cells(表頭(12)).Value : PA5 = 請購_dgv.Rows(i).Cells(表頭(13)).Value : PA6 = 請購_dgv.Rows(i).Cells(表頭(14)).Value
  918. NU1 = 請購_dgv.Rows(i).Cells(表頭(15)).Value : PA8 = 請購_dgv.Rows(i).Cells(表頭(16)).Value : PA10 = "0" '--單價還未帶出
  919. PA11 = 請購_dgv.Rows(i).Cells(表頭(62)).Value : PA12 = 請購_dgv.Rows(i).Cells("群組原則").Value : PA13 = 請購_dgv.Rows(i).Cells(表頭(77)).Value
  920. PA14 = 請購_dgv.Rows(i).Cells(表頭(134)).Value : PA15 = 請購_dgv.Rows(i).Cells(表頭(19)).Value
  921. SQL_請購單明細表_轉採修改() : SQL_採購單明細表_新增() : conn.Close()
  922. End If
  923. Next : GCM_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  924. MsgBox(對話框(1))
  925. 指定倉庫_cb_下拉表單資料載入() : Set_清單2() : Set_請購單清單()
  926. Else
  927. 新增採購單_()
  928. End If
  929. Else
  930. 新增採購單_()
  931. End If
  932. Else
  933. MsgBox(對話框(0))
  934. End If
  935. End Sub
  936. Private Sub 刪除請購單上點選資料_bt_Click(sender As Object, e As EventArgs) Handles 刪除請購單上點選資料_bt.Click
  937. If 請購單號1_tb.Text = "" Then
  938. MsgBox(對話框(3))
  939. Else
  940. If 項次_tb.Text = "" Then
  941. MsgBox(對話框(4))
  942. Else
  943. Dim aa1 As MsgBoxResult
  944. aa1 = MsgBox(對話框(5), MsgBoxStyle.OkCancel)
  945. If aa1 = MsgBoxResult.Ok Then
  946. If 明細_dgv.Rows.Count <= 1 Then
  947. 刪除()
  948. Else
  949. PA2 = 請購單號1_tb.Text : PA3 = 項次_tb.Text : PA9 = "0" : PA1 = 料號_tb.Text : PA = 採購單號_tb.Text
  950. SQL_請購單明細表_轉採修改() : SQL_採購單詢價_採購明細刪除() : conn.Close()
  951. Set_請購單清單() : Set_清單2() : Set_採購單清單()
  952. End If
  953. End If
  954. End If
  955. End If
  956. End Sub
  957. Private Sub 存檔()
  958. Set_日期格式轉換()
  959. PA5 = 採購單號_tb.Text
  960. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  961. 資料數 = 明細_dgv.Rows.Count : MyModule1.進度條()
  962. PA6 = 明細_dgv.Rows(i).Cells("" & 表頭(14) & "").Value : PA7 = 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value
  963. PA8 = 明細_dgv.Rows(i).Cells("" & 表頭(15) & "").Value : PA9 = 明細_dgv.Rows(i).Cells("" & 表頭(16) & "").Value
  964. PA10 = 明細_dgv.Rows(i).Cells("項次").Value : PA4 = 明細_dgv.Rows(i).Cells("" & 表頭(88) & "").Value
  965. SQL_採購單明細表_修改() : conn.Close()
  966. Next
  967. Set_採購單清單() : MsgBox(對話框(6)) : GCM_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  968. End Sub
  969. Private Sub 存檔_bt_Click(sender As Object, e As EventArgs) Handles 存檔_bt.Click
  970. 存檔()
  971. End Sub
  972. Private Sub 刪除_bt_Click(sender As Object, e As EventArgs) Handles 刪除_bt.Click
  973. Dim aa1 As MsgBoxResult = MsgBox(對話框(5), MsgBoxStyle.OkCancel)
  974. If aa1 = MsgBoxResult.Ok Then
  975. 刪除()
  976. End If
  977. End Sub
  978. Private Sub 刪除()
  979. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  980. 資料數 = 明細_dgv.Rows.Count : MyModule1.進度條()
  981. PA2 = 明細_dgv.Rows(i).Cells("" & 表頭(88) & "").Value : PA3 = 明細_dgv.Rows(i).Cells("項次").Value : PA9 = "0"
  982. SQL_請購單明細表_轉採修改() : conn.Close()
  983. Next : GCM_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  984. PA = 採購單號_tb.Text
  985. SQL_採購單詢價_控制刪除() : SQL_採購單詢價_明細刪除() : conn.Close()
  986. Set_請購單清單() : Set_清單2() : 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 日期_rb_CheckedChanged(sender As Object, e As EventArgs) Handles 日期_rb.Click
  992. Set_單價()
  993. End Sub
  994. Private Sub 料號_bt_Click(sender As Object, e As EventArgs) Handles 料號_bt.Click
  995. Set_料號比價()
  996. If 料號1_tb.Text = "" Then
  997. MsgBox(對話框(22))
  998. Else
  999. If 料號_dgv.Visible = True Then
  1000. 料號_dgv.Visible = False
  1001. Else
  1002. 料號_dgv.Visible = True
  1003. End If
  1004. End If
  1005. End Sub
  1006. Private Sub 詳細資料2_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 詳細資料2_ch.Click
  1007. If 詳細資料2_ch.Checked = True Then : 詳細資料2_ch.Checked = True : Else : 詳細資料2_ch.Checked = False : End If : Set_請購單清單() : Set_採購單清單()
  1008. End Sub
  1009. Private Sub 列印成詢價單_bt_Click(sender As Object, e As EventArgs) Handles 列印成詢價單_bt.Click
  1010. Dim zz As Integer
  1011. For i As Integer = 0 To 明細_dgv.Rows.Count - 1
  1012. '明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value = "0.0"
  1013. 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value = 明細_dgv.Rows(i).Cells("" & 表頭(26) & "").Value * 明細_dgv.Rows(i).Cells("" & 表頭(15) & "").Value
  1014. zz = Val(zz) + 明細_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  1015. Next i
  1016. If zz > 0 Then
  1017. 存檔()
  1018. If 採購單號_tb.Text = "" Then
  1019. MsgBox(對話框(2))
  1020. Else
  1021. xlApp = CType(CreateObject("Excel.Application"), Application)
  1022. xlBook = xlApp.Workbooks.Add
  1023. xlApp.DisplayAlerts = True
  1024. xlBook.Activate()
  1025. xlSheet = NewMethod(xlBook)
  1026. xlSheet.Activate()
  1027. xlApp.Visible = True
  1028. xlApp.Application.WindowState = xlMaximized
  1029. xlSheet.Cells(2, 1) = 選擇公司_cb.Text : xlSheet.Cells(3, 1) = "MINTA PESANAN HARGA"
  1030. xlSheet.Cells(5, 1) = "ORDER TO : " : xlSheet.Cells(6, 1) = "ALAMAT : " : xlSheet.Cells(7, 1) = "Telp : "
  1031. xlSheet.Cells(8, 1) = "Fax : " : xlSheet.Cells(9, 1) = "Email : "
  1032. 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"
  1033. xlSheet.Cells(10, 6) = "QTY" : xlSheet.Cells(10, 7) = "UNIT PRICE" : xlSheet.Cells(10, 8) = "TOTAL PRICE"
  1034. xlSheet.Cells(7, 5) = "PO NOMOR : " : xlSheet.Cells(7, 7) = 採購單號_tb.Text
  1035. xlSheet.Cells(8, 5) = "TGL/BLN/THN : " : xlSheet.Cells(8, 7) = 需求日期_dtp.Value
  1036. xlSheet.Cells(9, 5) = "TEMPAT PEMAKAIAN : "
  1037. Dim GGHH As Integer = 0
  1038. For i As Integer = 0 To 明細1_dgv.Rows.Count - 1
  1039. xlSheet.Cells(i + 11, 1) = 明細1_dgv.Rows(i).Cells("" & 表頭(11) & "").Value : xlSheet.Cells(i + 11, 2) = 明細1_dgv.Rows(i).Cells("" & 表頭(12) & "").Value
  1040. xlSheet.Cells(i + 11, 3) = 明細1_dgv.Rows(i).Cells("" & 表頭(13) & "").Value : xlSheet.Cells(i + 11, 4) = 明細1_dgv.Rows(i).Cells("" & 表頭(14) & "").Value
  1041. xlSheet.Cells(i + 11, 5) = 明細1_dgv.Rows(i).Cells("" & 表頭(16) & "").Value : xlSheet.Cells(i + 11, 6) = 明細1_dgv.Rows(i).Cells("" & 表頭(15) & "").Value
  1042. xlSheet.Cells(i + 11, 7) = 明細1_dgv.Rows(i).Cells("" & 表頭(26) & "").Value : xlSheet.Cells(i + 11, 8) = 明細1_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  1043. GGHH += 明細1_dgv.Rows(i).Cells("" & 表頭(27) & "").Value
  1044. N1 = i + 11
  1045. Next i
  1046. xlSheet.Cells(N1 + 2, 7) = "TOTAL :" : xlSheet.Cells(N1 + 2, 8) = GGHH
  1047. xlSheet.Cells(N1 + 3, 7) = "DISC % :" : xlSheet.Cells(N1 + 3, 8) = ""
  1048. xlSheet.Cells(N1 + 4, 7) = "PPN % :" : xlSheet.Cells(N1 + 4, 8) = ""
  1049. xlSheet.Cells(N1 + 5, 7) = "GRAND TOTAL :" : xlSheet.Cells(N1 + 5, 8) = ""
  1050. xlSheet.Cells(N1 + 6, 1) = "Bagian Pembelian Barang"
  1051. xlSheet.Cells(N1 + 6, 3) = "Direktur Utama"
  1052. xlSheet.Cells(N1 + 6, 4) = "Bagian Pemeriksa"
  1053. xlSheet.Cells(N1 + 6, 6) = "Bagian Pengisian Harga" : xlSheet.Cells(N1 + 8, 6) = 詢價員_tb.Text : xlSheet.Cells(N1 + 9, 6) = 尋價日期_tb.Text
  1054. xlSheet.Cells(N1 + 6, 8) = "Asisten Proyek" : xlSheet.Cells(N1 + 8, 8) = "" : xlSheet.Cells(N1 + 9, 8) = ""
  1055. AA(xlApp, xlSheet)
  1056. xlSheet.PageSetup.PrintArea = ""
  1057. xlApp.Cells.Select()
  1058. xlSheet.Range("B1").Select()
  1059. xlApp.Application.WindowState = xlMinimized
  1060. xlSheet.Cells.Select()
  1061. xlApp.ActiveSheet.Protect(DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="0911274990")
  1062. xlApp.ActiveSheet.EnableSelection = 1
  1063. MsgBox(對話框(7))
  1064. End If
  1065. Else
  1066. MsgBox(對話框(13))
  1067. End If
  1068. End Sub
  1069. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  1070. Return CType(xlBook.Worksheets.Add, Worksheet)
  1071. End Function
  1072. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  1073. xlSheet.Cells.Select()
  1074. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  1075. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1076. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 24
  1077. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 30 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 20
  1078. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 15
  1079. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 15 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 30
  1080. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 5 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 35
  1081. xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 25 : xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 5
  1082. xlSheet.Rows("5:9").Select : myExcel.Selection.RowHeight = 20 : xlSheet.Rows("10:10").Select : myExcel.Selection.RowHeight = 20
  1083. xlSheet.Rows("11:" & N1).Select : myExcel.Selection.RowHeight = 65 : xlSheet.Rows(N1 + 1 & ":" & N1 + 1).Select : myExcel.Selection.RowHeight = 5
  1084. xlSheet.Rows(N1 + 2 & ":" & N1 + 5).Select : myExcel.Selection.RowHeight = 17 : xlSheet.Rows(N1 + 6 & ":" & N1 + 6).Select : myExcel.Selection.RowHeight = 35
  1085. xlSheet.Rows(N1 + 7 & ":" & N1 + 9).Select : myExcel.Selection.RowHeight = 35
  1086. xlSheet.Range("A2:H2").Select()
  1087. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1088. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1089. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 26 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  1090. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1091. xlSheet.Range("A3:H3").Select()
  1092. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1093. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1094. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 16 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  1095. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1096. xlSheet.Range("A10:H" & N1).Select()
  1097. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1098. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1099. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1100. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1101. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1102. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1103. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1104. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 2).Select()
  1105. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1106. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1107. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1108. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1109. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1110. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1111. xlSheet.Range("A" & N1 + 3 & ":H" & N1 + 3).Select()
  1112. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1113. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1114. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1115. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1116. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1117. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1118. xlSheet.Range("A" & N1 + 4 & ":H" & N1 + 4).Select()
  1119. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1120. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1121. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1122. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1123. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1124. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1125. xlSheet.Range("A" & N1 + 5 & ":H" & N1 + 5).Select()
  1126. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1127. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1128. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1129. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1130. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1131. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1132. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 6).Select()
  1133. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1134. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1135. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1136. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1137. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1138. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1139. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1140. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1141. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 6).Select()
  1142. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1143. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1144. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1145. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1146. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1147. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1148. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1149. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1150. xlSheet.Range("D" & N1 + 6 & ":E" & N1 + 6).Select()
  1151. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1152. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1153. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1154. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1155. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1156. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1157. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1158. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1159. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 6).Select()
  1160. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1161. .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1162. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1163. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1164. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1165. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1166. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1167. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1168. xlSheet.Range("H" & N1 + 6).Select()
  1169. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1170. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1171. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1172. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1173. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1174. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1175. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1176. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1177. xlSheet.Range("A" & N1 + 7 & ":B" & N1 + 9).Select()
  1178. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1179. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1180. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1181. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1182. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1183. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1184. xlSheet.Range("C" & N1 + 7 & ":C" & N1 + 9).Select()
  1185. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1186. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1187. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1188. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1189. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1190. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1191. xlSheet.Range("D" & N1 + 7 & ":E" & N1 + 9).Select()
  1192. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1193. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1194. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1195. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1196. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1197. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1198. xlSheet.Range("F" & N1 + 7 & ":G" & N1 + 9).Select()
  1199. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1200. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1201. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1202. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1203. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1204. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1205. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1206. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1207. xlSheet.Range("H" & N1 + 7 & ":H" & N1 + 9).Select()
  1208. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1209. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1210. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1211. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1212. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1213. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1214. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1215. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1216. xlSheet.Range("A10:A" & N1).Select()
  1217. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1218. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1219. xlSheet.Range("B11:D" & N1).Select()
  1220. With myExcel.Selection
  1221. .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1222. .ReadingOrder = xlContext : .MergeCells = False : End With
  1223. xlSheet.Range("E11:F" & N1).Select()
  1224. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1225. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1226. xlSheet.Range("G11:H" & N1).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  1227. xlSheet.Range("H" & N1 + 2).Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  1228. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).Select()
  1229. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1230. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1231. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1232. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1233. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1234. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1235. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1236. myExcel.ActiveWindow.DisplayGridlines = False
  1237. xlSheet.Range("A3:H3").Select()
  1238. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1239. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  1240. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1241. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1242. xlSheet.Range("G7:G9").Select()
  1243. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1244. .ReadingOrder = xlContext : .MergeCells = False : End With
  1245. xlSheet.Range("A10:H" & N1).Select()
  1246. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1247. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1248. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1249. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1250. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1251. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1252. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1253. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).Select()
  1254. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1255. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1256. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1257. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1258. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1259. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1260. xlSheet.Range("A" & N1 + 6 & ":B" & N1 + 9).Select()
  1261. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1262. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1263. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1264. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1265. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1266. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1267. xlSheet.Range("C" & N1 + 6 & ":C" & N1 + 9).Select()
  1268. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1269. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1270. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1271. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1272. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1273. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1274. xlSheet.Range("D" & N1 + 6 & ":E" & N1 + 9).Select()
  1275. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1276. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1277. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1278. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1279. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1280. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1281. xlSheet.Range("F" & N1 + 6 & ":G" & N1 + 9).Select()
  1282. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1283. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1284. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1285. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1286. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1287. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1288. xlSheet.Range("H" & N1 + 6 & ":H" & N1 + 9).Select()
  1289. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1290. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1291. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1292. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1293. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1294. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1295. xlSheet.Rows("5:9").Select
  1296. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  1297. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1298. xlSheet.Rows("11:" & N1).Select
  1299. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  1300. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1301. xlSheet.Range("A10:H10").Select()
  1302. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1303. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1304. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1305. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1306. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1307. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1308. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1309. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1310. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1311. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1312. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1313. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1314. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1315. xlSheet.Range("A11:H" & N1).Select()
  1316. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1317. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1318. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1319. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1320. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1321. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1322. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1323. xlSheet.Range("B11:D" & N1).Select()
  1324. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1325. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1326. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1327. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1328. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1329. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1330. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1331. xlSheet.Range("F11:F" & N1).Select()
  1332. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1333. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1334. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1335. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1336. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1337. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1338. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1339. xlSheet.Range("H11:H" & N1).Select()
  1340. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1341. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1342. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1343. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1344. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1345. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1346. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1347. xlSheet.Range("A" & N1 + 2 & ":H" & N1 + 5).Select()
  1348. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1349. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1350. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1351. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1352. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1353. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1354. xlSheet.Range("H" & N1 + 2 & ":H" & N1 + 5).Select()
  1355. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1356. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1357. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1358. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1359. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1360. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1361. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  1362. xlSheet.Range("G" & N1 + 2 & ":G" & N1 + 5).Select()
  1363. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1364. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1365. xlSheet.Range("F" & N1 + 8 & ":G" & N1 + 8).Select()
  1366. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1367. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1368. xlSheet.Range("F" & N1 + 9 & ":G" & N1 + 9).Select()
  1369. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1370. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1371. myExcel.Application.PrintCommunication = False
  1372. With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "$1:$10" : .PrintTitleColumns = "" : End With
  1373. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  1374. With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "" : .RightFooter = ""
  1375. .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
  1376. .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
  1377. .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
  1378. .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = True : .CenterVertically = False : .Draft = False : .FirstPageNumber = xlAutomatic
  1379. .BlackAndWhite = False : .Zoom = 60 : .OddAndEvenPagesHeaderFooter = False : .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True
  1380. .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = ""
  1381. .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = ""
  1382. .FirstPage.CenterHeader.Text = "" : .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = ""
  1383. .FirstPage.RightFooter.Text = ""
  1384. End With
  1385. myExcel.Application.PrintCommunication = True
  1386. End Sub
  1387. End Class