Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

合約請款單.vb 162KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603
  1. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  2. Imports Microsoft.Office.Interop.Excel.Constants
  3. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  4. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  5. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  6. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  7. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  8. Imports Microsoft.Office.Interop.Excel.XlWindowState
  9. Imports Microsoft.Office.Interop.Excel
  10. Public Class 合約請款單
  11. ReadOnly ds1, ds2, ds6, ds7, ds8, ds9, ds10, ds11, ds15 As New DataSet
  12. Dim ESTR As String
  13. Dim EDR As Integer = 0
  14. Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
  15. Dim OldX, OldY As Long
  16. Dim drag, 放大 As Boolean
  17. Private Sub Set_合約清單()
  18. 合約_dgv.DataSource = Nothing : ds6.Clear()
  19. 合約_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  20. 合約_dgv.ColumnHeadersHeight = 25 : 合約_dgv.AllowUserToAddRows = False
  21. PA46 = 合約編號1_cb.Text : PA47 = 工程期1_ch.Text
  22. SQL_合約清單_請款用()
  23. da.Fill(ds6) : 合約_dgv.DataSource = ds6.Tables(0) : conn.Close()
  24. 合約_dgv.Columns(0).FillWeight = 160 : 合約_dgv.Columns(1).Visible = False : 合約_dgv.Columns(2).Visible = False : 合約_dgv.Columns(3).Visible = False
  25. 合約_dgv.Columns(4).Visible = False : 合約_dgv.Columns(5).Visible = False : 合約_dgv.Columns(6).Visible = False : 合約_dgv.Columns(7).Visible = False
  26. 合約_dgv.Columns(8).Visible = False : 合約_dgv.Columns(9).Visible = False : 合約_dgv.Columns(10).Visible = False : 合約_dgv.Columns(11).Visible = False
  27. 合約_dgv.Columns(12).Visible = False : 合約_dgv.Columns(13).Visible = False : 合約_dgv.Columns(14).Visible = False : 合約_dgv.Columns(15).Visible = False
  28. 合約_dgv.Columns(16).Visible = False : 合約_dgv.Columns(17).Visible = False : 合約_dgv.Columns(18).Visible = False : 合約_dgv.Columns(19).Visible = False
  29. 合約_dgv.Columns(20).Visible = False : 合約_dgv.Columns(21).Visible = False : 合約_dgv.Columns(22).Visible = False : 合約_dgv.Columns(23).Visible = False
  30. 合約_dgv.Columns(24).FillWeight = 100 : 合約_dgv.Columns(25).Visible = False : 合約_dgv.Columns(26).Visible = False : 合約_dgv.Columns(27).Visible = False
  31. 合約_dgv.Columns(28).Visible = False : 合約_dgv.Columns(29).Visible = False : 合約_dgv.Columns(30).Visible = False : 合約_dgv.Columns("工程名稱_中").FillWeight = 300
  32. If 放大 = True Then
  33. 合約_dgv.Columns("工程名稱_中").Visible = True
  34. Else
  35. 合約_dgv.Columns("工程名稱_中").Visible = False
  36. End If
  37. End Sub
  38. Private Sub Set_附錄清單()
  39. 合約附錄_dgv.DataSource = Nothing : ds1.Clear()
  40. 合約附錄_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  41. 合約附錄_dgv.ColumnHeadersHeight = 25 : 合約附錄_dgv.AllowUserToAddRows = False
  42. SQL_附錄合約_清單查詢1()
  43. da.Fill(ds1) : 合約附錄_dgv.DataSource = ds1.Tables(0) : conn.Close()
  44. 合約附錄_dgv.Columns(0).Visible = False : 合約附錄_dgv.Columns(1).FillWeight = 160 : 合約附錄_dgv.Columns(2).Visible = False : 合約附錄_dgv.Columns(3).Visible = False
  45. 合約附錄_dgv.Columns(4).Visible = False : 合約附錄_dgv.Columns(5).Visible = False : 合約附錄_dgv.Columns(6).Visible = False : 合約附錄_dgv.Columns(7).FillWeight = 70
  46. End Sub
  47. Private Sub Set_合約報價總表()
  48. 幣別 = " (RP)"
  49. 報價總表_dgv.DataSource = Nothing : ds15.Clear()
  50. 報價總表_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  51. 報價總表_dgv.ColumnHeadersHeight = 40 : 報價總表_dgv.AllowUserToAddRows = False : 報價總表_dgv.RowTemplate.Height = 45
  52. 報價總表_dgv.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True
  53. SQL_合約報價總表()
  54. da.Fill(ds15) : 報價總表_dgv.DataSource = ds15.Tables(0) : conn.Close()
  55. 報價總表_dgv.Columns(0).Visible = False : 報價總表_dgv.Columns(8).Visible = False : 報價總表_dgv.Columns(9).Visible = False
  56. 報價總表_dgv.Columns(0).FillWeight = 50 : 報價總表_dgv.Columns(1).FillWeight = 50 : 報價總表_dgv.Columns(2).FillWeight = 210
  57. 報價總表_dgv.Columns(3).FillWeight = 50 : 報價總表_dgv.Columns(4).FillWeight = 50 : 報價總表_dgv.Columns(5).FillWeight = 80
  58. 報價總表_dgv.Columns(6).FillWeight = 80 : 報價總表_dgv.Columns(7).FillWeight = 90
  59. For i As Integer = 4 To 6 : 報價總表_dgv.Columns(i).DefaultCellStyle.Format = "#,##0" : Next
  60. For i As Integer = 4 To 6 : 報價總表_dgv.Columns(i).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : Next
  61. For i As Integer = 0 To 7 : 報價總表_dgv.Columns(i).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter : Next
  62. 報價總表_dgv.Columns(1).ReadOnly = True : 報價總表_dgv.Columns(2).ReadOnly = True : 報價總表_dgv.Columns(6).ReadOnly = True
  63. 報價總表_dgv.EditMode = DataGridViewEditMode.EditOnEnter
  64. End Sub
  65. Private Sub Set_請款清單()
  66. 請款單_dgv.DataSource = Nothing : ds2.Clear()
  67. 請款單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  68. 請款單_dgv.ColumnHeadersHeight = 25 : 請款單_dgv.AllowUserToAddRows = False
  69. SQL_請款單_清單查詢()
  70. da.Fill(ds2) : 請款單_dgv.DataSource = ds2.Tables(0) : conn.Close()
  71. 請款單_dgv.Columns(0).Visible = False : 請款單_dgv.Columns(1).FillWeight = 50 : 請款單_dgv.Columns(2).Visible = False : 請款單_dgv.Columns(3).FillWeight = 50
  72. 請款單_dgv.Columns(4).FillWeight = 100 : 請款單_dgv.Columns(5).FillWeight = 50 : 請款單_dgv.Columns(6).Visible = False : 請款單_dgv.Columns(7).Visible = False
  73. 請款單_dgv.Columns(8).FillWeight = 100 : 請款單_dgv.Columns(9).FillWeight = 80
  74. 請款單_dgv.Columns(3).DefaultCellStyle.Format = "#,##0" : 請款單_dgv.Columns(4).DefaultCellStyle.Format = "#,##0"
  75. 請款單_dgv.Columns(5).DefaultCellStyle.Format = "#,##0" : 請款單_dgv.Columns(8).DefaultCellStyle.Format = "#,##0"
  76. 請款單_dgv.Columns(3).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  77. 請款單_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  78. 請款單_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  79. 請款單_dgv.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  80. End Sub
  81. Private Sub Set_合約明細1()
  82. 第1期_dgv.DataSource = Nothing : ds7.Clear()
  83. 第1期_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  84. 第1期_dgv.ColumnHeadersHeight = 25 : 第1期_dgv.AllowUserToAddRows = False
  85. SQL_合約明細讀取()
  86. da.Fill(ds7) : 第1期_dgv.DataSource = ds7.Tables(0) : conn.Close()
  87. 第1期_dgv.Columns(0).Visible = False : 第1期_dgv.Columns(1).Visible = False : 第1期_dgv.Columns(2).FillWeight = 20 : 第1期_dgv.Columns(3).FillWeight = 140
  88. 第1期_dgv.Columns(4).FillWeight = 20 : 第1期_dgv.Columns(5).FillWeight = 50
  89. 第1期_dgv.Columns(2).ReadOnly = True : 第1期_dgv.Columns(5).ReadOnly = True
  90. 第1期_dgv.EditMode = DataGridViewEditMode.EditOnEnter
  91. 第1期_dgv.Columns(2).DefaultCellStyle.Format = "#,##0" : 第1期_dgv.Columns(4).DefaultCellStyle.Format = "#,##0.00" : 第1期_dgv.Columns(5).DefaultCellStyle.Format = "#,##0"
  92. 第1期_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 第1期_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  93. End Sub
  94. Private Sub Set_合約明細2()
  95. 第2期_dgv.DataSource = Nothing : ds8.Clear()
  96. 第2期_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  97. 第2期_dgv.ColumnHeadersHeight = 25 : 第2期_dgv.AllowUserToAddRows = False
  98. SQL_合約明細讀取()
  99. da.Fill(ds8) : 第2期_dgv.DataSource = ds8.Tables(0) : conn.Close()
  100. 第2期_dgv.Columns(0).Visible = False : 第2期_dgv.Columns(1).Visible = False : 第2期_dgv.Columns(2).FillWeight = 20 : 第2期_dgv.Columns(3).FillWeight = 140
  101. 第2期_dgv.Columns(4).FillWeight = 20 : 第2期_dgv.Columns(5).FillWeight = 50
  102. 第2期_dgv.Columns(2).ReadOnly = True : 第2期_dgv.Columns(5).ReadOnly = True
  103. 第2期_dgv.EditMode = DataGridViewEditMode.EditOnEnter
  104. 第2期_dgv.Columns(2).DefaultCellStyle.Format = "#,##0" : 第2期_dgv.Columns(4).DefaultCellStyle.Format = "#,##0.00" : 第2期_dgv.Columns(5).DefaultCellStyle.Format = "#,##0"
  105. 第2期_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 第2期_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  106. End Sub
  107. Private Sub Set_合約明細3()
  108. 第3期_dgv.DataSource = Nothing : ds9.Clear()
  109. 第3期_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  110. 第3期_dgv.ColumnHeadersHeight = 25
  111. 第3期_dgv.AllowUserToAddRows = False
  112. SQL_合約明細讀取()
  113. da.Fill(ds9) : 第3期_dgv.DataSource = ds9.Tables(0) : conn.Close()
  114. 第3期_dgv.Columns(0).Visible = False : 第3期_dgv.Columns(1).Visible = False : 第3期_dgv.Columns(2).FillWeight = 20 : 第3期_dgv.Columns(3).FillWeight = 140
  115. 第3期_dgv.Columns(4).FillWeight = 20 : 第3期_dgv.Columns(5).FillWeight = 50
  116. 第3期_dgv.Columns(2).ReadOnly = True : 第3期_dgv.Columns(5).ReadOnly = True
  117. 第3期_dgv.EditMode = DataGridViewEditMode.EditOnEnter
  118. 第3期_dgv.Columns(2).DefaultCellStyle.Format = "#,##0" : 第3期_dgv.Columns(4).DefaultCellStyle.Format = "#,##0.00" : 第3期_dgv.Columns(5).DefaultCellStyle.Format = "#,##0"
  119. 第3期_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 第3期_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  120. End Sub
  121. Private Sub Set_合約明細4()
  122. 第4期_dgv.DataSource = Nothing : ds10.Clear()
  123. 第4期_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  124. 第4期_dgv.ColumnHeadersHeight = 25 : 第4期_dgv.AllowUserToAddRows = False
  125. SQL_合約明細讀取()
  126. da.Fill(ds10) : 第4期_dgv.DataSource = ds10.Tables(0) : conn.Close()
  127. 第4期_dgv.Columns(0).Visible = False : 第4期_dgv.Columns(1).Visible = False : 第4期_dgv.Columns(2).FillWeight = 20 : 第4期_dgv.Columns(3).FillWeight = 140
  128. 第4期_dgv.Columns(4).FillWeight = 20 : 第4期_dgv.Columns(5).FillWeight = 50
  129. 第4期_dgv.Columns(2).ReadOnly = True : 第4期_dgv.Columns(5).ReadOnly = True
  130. 第4期_dgv.EditMode = DataGridViewEditMode.EditOnEnter
  131. 第4期_dgv.Columns(2).DefaultCellStyle.Format = "#,##0" : 第4期_dgv.Columns(4).DefaultCellStyle.Format = "#,##0.00" : 第4期_dgv.Columns(5).DefaultCellStyle.Format = "#,##0"
  132. 第4期_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 第4期_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  133. End Sub
  134. Private Sub Set_合約明細5()
  135. 第5期_dgv.DataSource = Nothing : ds11.Clear()
  136. 第5期_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  137. 第5期_dgv.ColumnHeadersHeight = 25 : 第5期_dgv.AllowUserToAddRows = False
  138. SQL_合約明細讀取()
  139. da.Fill(ds11) : 第5期_dgv.DataSource = ds11.Tables(0) : conn.Close()
  140. 第5期_dgv.Columns(0).Visible = False : 第5期_dgv.Columns(1).Visible = False : 第5期_dgv.Columns(2).FillWeight = 20 : 第5期_dgv.Columns(3).FillWeight = 140
  141. 第5期_dgv.Columns(4).FillWeight = 20 : 第5期_dgv.Columns(5).FillWeight = 50
  142. 第5期_dgv.Columns(2).ReadOnly = True : 第5期_dgv.Columns(5).ReadOnly = True
  143. 第5期_dgv.Columns(2).DefaultCellStyle.Format = "#,##0" : 第5期_dgv.Columns(4).DefaultCellStyle.Format = "#,##0.00" : 第5期_dgv.Columns(5).DefaultCellStyle.Format = "#,##0"
  144. 第5期_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 第5期_dgv.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  145. End Sub
  146. Private Sub 甲方條件下拉清單讀取()
  147. SQL合約條件讀取() : 合約編號1_cb.Items.Clear() : 合約編號1_cb.Items.Add("") : While (dr.Read()) : 合約編號1_cb.Items.Add(dr("約號甲方")) : End While : conn.Close()
  148. End Sub
  149. Private Sub 合約請款單_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  150. Me.MdiParent = GCM_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  151. 工程款1_nud.Value = 30 : 工程款2_nud.Value = 40 : 工程款3_nud.Value = 20 : 工程款4_nud.Value = 5 : 工程款5_nud.Value = 5 : 視窗2_pl.Visible = False : 報告移交單_ch.Enabled = False
  152. SOP3_P.Image = My.Resources._1_124 : SOP4_P.Image = My.Resources._1_124 : SOP5_P.Image = My.Resources._1_124 : SOP6_P.Image = My.Resources._1_124 : SOP7_P.Image = My.Resources._1_124
  153. SOP3_P.SizeMode = 4 : SOP4_P.SizeMode = 4 : SOP5_P.SizeMode = 4 : SOP6_P.SizeMode = 4 : SOP7_P.SizeMode = 4
  154. 甲方條件下拉清單讀取() : Set_合約清單() : 合約報價單_Siz()
  155. 報告移交_bt.Visible = False
  156. End Sub
  157. Private Sub 合約請款單_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
  158. End Sub
  159. Private Sub 合約報價單_Siz()
  160. MyModule1.清單字體大小調整()
  161. 合約_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", 7.6)
  162. 合約附錄_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  163. 請款單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  164. 第1期_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  165. 第2期_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  166. 第3期_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  167. 第4期_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  168. 第5期_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
  169. End Sub
  170. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  171. timeNow = 0 : GCM_ERP_SYS.Timer1.Enabled = False : GCM_ERP_SYS.Timer1.Enabled = True
  172. End Sub
  173. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  174. timeNow = 0 : GCM_ERP_SYS.Timer1.Enabled = False : GCM_ERP_SYS.Timer1.Enabled = True
  175. End Sub
  176. Private Sub 請款計算()
  177. BNUD1.Value = 金額1_und.Value : BNUD2.Value = 金額2_und.Value : BNUD3.Value = 金額3_und.Value : BNUD4.Value = 金額4_und.Value : BNUD5.Value = 金額5_und.Value
  178. ANUD4.Value = 0 : For i As Integer = 0 To 請款單_dgv.Rows.Count - 1 : ANUD4.Value += 請款單_dgv("請款總額", i).Value.ToString : Next
  179. ANUD1.Value = NUD3.Value : ANUD3.Value = NUD5.Value : ANUD2.Value = ANUD1.Value + ANUD3.Value : ANUD5.Value = ANUD2.Value - ANUD4.Value
  180. '----收款累加---------------
  181. Dim 已收款 As Long = 0
  182. For DD As Integer = 0 To 1
  183. For i As Integer = 0 To 請款單_dgv.Rows.Count - 1 : 已收款 += 請款單_dgv("請款總額", i).Value : Next
  184. If 已收款 = 0 Then : Else
  185. If 已收款 = BNUD1.Value Then : BNUD1.Value = 0 : Exit For : ElseIf 已收款 < BNUD1.Value Then : BNUD1.Value = BNUD1.Value - 已收款 : Exit For
  186. ElseIf 已收款 > BNUD1.Value Then : 已收款 -= BNUD1.Value : BNUD1.Value = 0 : End If
  187. If 已收款 = BNUD2.Value Then : BNUD2.Value = 0 : Exit For : ElseIf 已收款 < BNUD2.Value Then : BNUD2.Value = BNUD2.Value - 已收款 : Exit For
  188. ElseIf 已收款 > BNUD2.Value Then : 已收款 -= BNUD2.Value : BNUD2.Value = 0 : End If
  189. If 已收款 = BNUD3.Value Then : BNUD3.Value = 0 : Exit For : ElseIf 已收款 < BNUD3.Value Then : BNUD3.Value = BNUD3.Value - 已收款 : Exit For
  190. ElseIf 已收款 > BNUD3.Value Then : 已收款 -= BNUD3.Value : BNUD3.Value = 0 : End If
  191. If 已收款 = BNUD4.Value Then : BNUD4.Value = 0 : Exit For : ElseIf 已收款 < BNUD4.Value Then : BNUD4.Value = BNUD4.Value - 已收款 : Exit For
  192. ElseIf 已收款 > BNUD4.Value Then : 已收款 -= BNUD4.Value : BNUD4.Value = 0 : End If
  193. If 已收款 = BNUD5.Value Then : BNUD5.Value = 0 : Exit For : ElseIf 已收款 < BNUD5.Value Then : BNUD5.Value = BNUD5.Value - 已收款 : Exit For
  194. ElseIf 已收款 > BNUD5.Value Then : BNUD5.Value = 0 : End If
  195. End If
  196. Next
  197. 'My.Resources._1_123 綠色 My.Resources._1_124 紅色 My.Resources._1_125 橘色
  198. If 工程款1_nud.Value > 0 And BNUD1.Value > 0 Then : SOP3_P.Image = My.Resources._1_125 : ElseIf 工程款1_nud.Value > 0 And BNUD1.Value = 0 Then : SOP3_P.Image = My.Resources._1_123
  199. ElseIf 工程款1_nud.Value = 0 And BNUD1.Value = 0 Then : SOP3_P.Image = My.Resources._1_124 : End If : SOP3_P.SizeMode = 4
  200. If 工程款2_nud.Value > 0 And BNUD2.Value > 0 Then : SOP4_P.Image = My.Resources._1_125 : ElseIf 工程款2_nud.Value > 0 And BNUD2.Value = 0 Then : SOP4_P.Image = My.Resources._1_123
  201. ElseIf 工程款2_nud.Value = 0 And BNUD2.Value = 0 Then : SOP4_P.Image = My.Resources._1_124 : End If : SOP4_P.SizeMode = 4
  202. If 工程款3_nud.Value > 0 And BNUD3.Value > 0 Then : SOP5_P.Image = My.Resources._1_125 : ElseIf 工程款3_nud.Value > 0 And BNUD3.Value = 0 Then : SOP5_P.Image = My.Resources._1_123
  203. ElseIf 工程款3_nud.Value = 0 And BNUD3.Value = 0 Then : SOP5_P.Image = My.Resources._1_124 : End If : SOP5_P.SizeMode = 4
  204. If 工程款4_nud.Value > 0 And BNUD4.Value > 0 Then : SOP6_P.Image = My.Resources._1_125 : ElseIf 工程款4_nud.Value > 0 And BNUD4.Value = 0 Then : SOP6_P.Image = My.Resources._1_123
  205. ElseIf 工程款4_nud.Value = 0 And BNUD4.Value = 0 Then : SOP6_P.Image = My.Resources._1_124 : End If : SOP6_P.SizeMode = 4
  206. If 工程款5_nud.Value > 0 And BNUD5.Value > 0 Then : SOP7_P.Image = My.Resources._1_125 : ElseIf 工程款5_nud.Value > 0 And BNUD5.Value = 0 Then : SOP7_P.Image = My.Resources._1_123
  207. ElseIf 工程款5_nud.Value = 0 And BNUD5.Value = 0 Then : SOP7_P.Image = My.Resources._1_124 : End If : SOP7_P.SizeMode = 4
  208. PA = 合約編號_tb.Text : PA1 = ANUD3.Value : PA2 = ANUD2.Value : PA3 = ANUD4.Value : PA4 = ANUD5.Value : PA5 = BNUD1.Value : PA6 = BNUD2.Value
  209. PA7 = BNUD3.Value : PA8 = BNUD4.Value : PA9 = BNUD5.Value : SQL_控制表_請款修改()
  210. End Sub
  211. Private Sub 合約_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 合約_dgv.CellClick
  212. If e.RowIndex = -1 Then : Else
  213. 請款單號_tb.Text = "" : 請款期數_cb.Text = "" : 比例_nud.Value = 0 : 稅金_nud.Value = 0 : 請款金額_nud.Value = 0 : 請款總額_nud.Value = 0 : 付款期限_cb.Text = ""
  214. 報告移交計算()
  215. If 放大 = True Then : 縮放2_bt.PerformClick() : End If : 合約編號_tb.Text = 合約_dgv("合約編號", e.RowIndex).Value.ToString : PA = 合約編號_tb.Text : Set_合約報價總表()
  216. If 報價總表_dgv.Rows.Count > 0 Then
  217. For i As Integer = 0 To 報價總表_dgv.Rows.Count - 1
  218. If 報價總表_dgv.Rows(i).Cells("DESCRIPTION").Value.ToString = "稅金 10% Tax" Then : 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. "
  219. ElseIf 報價總表_dgv.Rows(i).Cells("DESCRIPTION").Value.ToString = "稅金 11% Tax" Then : 稅額顯示_lb.Text = "PPN 11%稅額 = Rp. "
  220. ElseIf 報價總表_dgv.Rows(i).Cells("DESCRIPTION").Value.ToString = "稅金 5% Tax" Then : 稅額顯示_lb.Text = "PPN 5%稅額 = Rp. "
  221. ElseIf 報價總表_dgv.Rows(i).Cells("DESCRIPTION").Value.ToString = "稅金 0% Tax" Then : 稅額顯示_lb.Text = "PPN 0%稅額 = Rp. "
  222. End If
  223. If 報價總表_dgv.Rows(i).Cells("DESCRIPTION").Value.ToString = "總計 Grand Total" Then : NUD3.Value = 報價總表_dgv.Rows(i).Cells("AMOUNT (RP)").Value : End If
  224. Next
  225. Else : 稅額顯示_lb.Text = "PPN 5%稅額 = Rp. " : End If
  226. B09_tb.Text = 合約_dgv("客戶地址", e.RowIndex).Value.ToString() : B24_tb.Text = "" : B25_tb.Text = "" : B26_tb.Text = ""
  227. If 合約_dgv("驗收完成日期", e.RowIndex).Value.ToString() <> "" Then
  228. DTP1.Value = 合約_dgv("驗收完成日期", e.RowIndex).Value.ToString() : B44_tb.Text = 合約_dgv.Rows(e.RowIndex).Cells("保固期限").Value.ToString
  229. Dim 保固日 As String = Strings.Format(DTP1.Value.AddMonths(CInt(合約_dgv.Rows(e.RowIndex).Cells("保固期限").Value.ToString)))
  230. B24_tb.Text = Strings.Right(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 2)
  231. B26_tb.Text = Strings.Left(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 4)
  232. If Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "01" Then : B25_tb.Text = "Jan"
  233. ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "02" Then : B25_tb.Text = "Feb"
  234. ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "03" Then : B25_tb.Text = "Ber"
  235. ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "04" Then : B25_tb.Text = "Apr"
  236. ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "05" Then : B25_tb.Text = "Mun"
  237. ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "06" Then : B25_tb.Text = "Jun"
  238. ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "07" Then : B25_tb.Text = "Jul"
  239. ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "08" Then : B25_tb.Text = "Agu"
  240. ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "09" Then : B25_tb.Text = "Sep"
  241. ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "10" Then : B25_tb.Text = "Okt"
  242. ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "11" Then : B25_tb.Text = "Nov"
  243. ElseIf Strings.Mid(Strings.Format(合約_dgv("驗收完成日期", e.RowIndex).Value.ToString()), 6, 2) = "12" Then : B25_tb.Text = "Des" : End If
  244. B27_tb.Text = Strings.Right(保固日, 2) : B29_tb.Text = Strings.Left(保固日, 4)
  245. If Strings.Mid(保固日, 6, 2) = "01" Then : B28_tb.Text = "Jan" : ElseIf Strings.Mid(保固日, 6, 2) = "02" Then : B28_tb.Text = "Feb"
  246. ElseIf Strings.Mid(保固日, 6, 2) = "03" Then : B28_tb.Text = "Ber" : ElseIf Strings.Mid(保固日, 6, 2) = "04" Then : B28_tb.Text = "Apr"
  247. ElseIf Strings.Mid(保固日, 6, 2) = "05" Then : B28_tb.Text = "Mun" : ElseIf Strings.Mid(保固日, 6, 2) = "06" Then : B28_tb.Text = "Jun"
  248. ElseIf Strings.Mid(保固日, 6, 2) = "07" Then : B28_tb.Text = "Jul" : ElseIf Strings.Mid(保固日, 6, 2) = "08" Then : B28_tb.Text = "Agu"
  249. ElseIf Strings.Mid(保固日, 6, 2) = "09" Then : B28_tb.Text = "Sep" : ElseIf Strings.Mid(保固日, 6, 2) = "10" Then : B28_tb.Text = "Okt"
  250. ElseIf Strings.Mid(保固日, 6, 2) = "11" Then : B28_tb.Text = "Nov" : ElseIf Strings.Mid(保固日, 6, 2) = "12" Then : B28_tb.Text = "Des" : End If
  251. End If
  252. 甲方_tb.Text = 合約_dgv("約號甲方", e.RowIndex).Value.ToString
  253. 客戶名稱_tb.Text = 合約_dgv("客戶名稱", e.RowIndex).Value.ToString : 工程名稱_英_tb.Text = 合約_dgv("工程名稱_英", e.RowIndex).Value.ToString
  254. 工程名稱_中_tb.Text = 合約_dgv("工程名稱_中", e.RowIndex).Value.ToString : 工程款1_nud.Value = 合約_dgv("第一期比例", e.RowIndex).Value
  255. 工程款2_nud.Value = 合約_dgv("第二期比例", e.RowIndex).Value : 工程款3_nud.Value = 合約_dgv("第三期比例", e.RowIndex).Value
  256. 工程款4_nud.Value = 合約_dgv("第四期比例", e.RowIndex).Value : 工程款5_nud.Value = 合約_dgv("第五期比例", e.RowIndex).Value
  257. CH2.Checked = True : NUD3.Value = 合約_dgv("工程總價", e.RowIndex).Value
  258. NUD3.Value = 合約_dgv("工程總價", e.RowIndex).Value : NUD6.Value = 0
  259. PA1 = "1" : Set_合約明細1() : PA1 = "2" : Set_合約明細2() : PA1 = "3" : Set_合約明細3() : PA1 = "4" : Set_合約明細4() : PA1 = "5" : Set_合約明細5()
  260. Set_附錄清單()
  261. If 合約附錄_dgv.Rows.Count > 0 Then
  262. NUD4.Value = 合約附錄_dgv("原金額", 0).Value : NUD5.Value = 合約附錄_dgv("追加減", 0).Value : 附錄編號_tb.Text = 合約附錄_dgv("附錄編號", 0).Value.ToString
  263. Else : NUD4.Value = 0 : NUD5.Value = 0 : 附錄編號_tb.Text = "" : End If
  264. Set_請款清單() : 請款計算() : NUD3.Value += 1 : NUD3.Value -= 1
  265. End If
  266. End Sub
  267. Private Sub 合約附錄_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 合約附錄_dgv.CellClick
  268. NUD4.Value = 合約附錄_dgv("原金額", e.RowIndex).Value : NUD5.Value = 合約附錄_dgv("追加減", e.RowIndex).Value
  269. 附錄編號_tb.Text = 合約附錄_dgv("附錄編號", e.RowIndex).Value.ToString : 請款計算()
  270. End Sub
  271. Private Sub 請款單_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 請款單_dgv.CellClick
  272. 請款單號_tb.Text = 請款單_dgv("請款編號", e.RowIndex).Value.ToString : 請款期數_cb.Text = 請款單_dgv("期數", e.RowIndex).Value.ToString
  273. 請款內容_tb.Text = 請款單_dgv("請款內容", e.RowIndex).Value.ToString : 比例_nud.Value = 請款單_dgv("比例", e.RowIndex).Value
  274. 請款金額_nud.Value = 請款單_dgv("請款金額", e.RowIndex).Value : 稅金_nud.Value = 請款單_dgv("稅金", e.RowIndex).Value
  275. 付款期限_cb.Text = 請款單_dgv("付款期限", e.RowIndex).Value.ToString : 申請日期_dtp.Value = 請款單_dgv("申請時間", e.RowIndex).Value
  276. 其他意見_tb.Text = 請款單_dgv("審批意見", e.RowIndex).Value.ToString : 請款總額_nud.Value = 請款單_dgv("請款總額", e.RowIndex).Value
  277. 報告移交計算()
  278. End Sub
  279. Private Sub 第1期_dgv_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles 第1期_dgv.CellEnter
  280. If Not IsNumeric(第1期_dgv.Rows(e.RowIndex).Cells("比例").Value) Then
  281. If 系統語言 = "繁體中文" Then : MsgBox("欄位輸入必須為數值!!") : Else : MsgBox("Field input must be numeric!!") : End If
  282. 第1期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第1期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0"
  283. Else
  284. Dim nn As Integer
  285. For i As Integer = 0 To 第1期_dgv.Rows.Count - 1 : nn += 第1期_dgv.Rows(i).Cells("比例").Value : Next
  286. If nn > 工程款1_nud.Value Then
  287. Dim SS As String
  288. If 系統語言 = "繁體中文" Then : SS = "第一期的細項比例不可大於 " : Else : SS = "The proportion of the details of the first phase cannot be greater than " : End If
  289. MsgBox(SS & Strings.Format(工程款1_nud.Value, "#,##0.00") & " % !!")
  290. 第1期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第1期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0"
  291. Else
  292. For i As Integer = 0 To 第1期_dgv.Rows.Count - 1
  293. 第1期_dgv.Rows(i).Cells("金額").Value = 第1期_dgv.Rows(i).Cells("比例").Value * 金額1_und.Value / 工程款1_nud.Value
  294. Next i
  295. End If
  296. End If
  297. End Sub
  298. Private Sub 第2期_dgv_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles 第2期_dgv.CellEnter
  299. If Not IsNumeric(第2期_dgv.Rows(e.RowIndex).Cells("比例").Value) Then
  300. If 系統語言 = "繁體中文" Then : MsgBox("欄位輸入必須為數值!!") : Else : MsgBox("Field input must be numeric!!") : End If
  301. 第2期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第2期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0"
  302. Else
  303. Dim nn As Integer
  304. For i As Integer = 0 To 第2期_dgv.Rows.Count - 1 : nn += 第2期_dgv.Rows(i).Cells("比例").Value : Next
  305. If nn > 工程款2_nud.Value Then
  306. Dim SS As String
  307. If 系統語言 = "繁體中文" Then : SS = "第二期的細項比例不可大於 " : Else : SS = "The proportion of the details of the second phase cannot be greater than " : End If
  308. MsgBox(SS & Strings.Format(工程款2_nud.Value, "#,##0.00") & " % !!")
  309. 第2期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第2期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0"
  310. Else
  311. For i As Integer = 0 To 第2期_dgv.Rows.Count - 1
  312. 第2期_dgv.Rows(i).Cells("金額").Value = 第2期_dgv.Rows(i).Cells("比例").Value * 金額2_und.Value / 工程款2_nud.Value
  313. Next i
  314. End If
  315. End If
  316. End Sub
  317. Private Sub 第3期_dgv_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles 第3期_dgv.CellEnter
  318. If Not IsNumeric(第3期_dgv.Rows(e.RowIndex).Cells("比例").Value) Then
  319. If 系統語言 = "繁體中文" Then : MsgBox("欄位輸入必須為數值!!") : Else : MsgBox("Field input must be numeric!!") : End If
  320. 第3期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第3期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0"
  321. Else
  322. Dim nn As Integer
  323. For i As Integer = 0 To 第3期_dgv.Rows.Count - 1 : nn += 第3期_dgv.Rows(i).Cells("比例").Value : Next
  324. If nn > 工程款3_nud.Value Then
  325. Dim SS As String
  326. If 系統語言 = "繁體中文" Then : SS = "第三期的細項比例不可大於 " : Else : SS = "The proportion of the details of the third period cannot be greater than " : End If
  327. MsgBox(SS & Strings.Format(工程款3_nud.Value, "#,##0.00") & " % !!")
  328. 第3期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第3期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0"
  329. Else
  330. For i As Integer = 0 To 第3期_dgv.Rows.Count - 1
  331. 第3期_dgv.Rows(i).Cells("金額").Value = 第3期_dgv.Rows(i).Cells("比例").Value * 金額3_und.Value / 工程款3_nud.Value
  332. Next i
  333. End If
  334. End If
  335. End Sub
  336. Private Sub 第4期_dgv_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles 第4期_dgv.CellEnter
  337. If Not IsNumeric(第4期_dgv.Rows(e.RowIndex).Cells("比例").Value) Then
  338. If 系統語言 = "繁體中文" Then : MsgBox("欄位輸入必須為數值!!") : Else : MsgBox("Field input must be numeric!!") : End If
  339. 第4期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第4期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0"
  340. Else
  341. Dim nn As Integer
  342. For i As Integer = 0 To 第4期_dgv.Rows.Count - 1 : nn += 第4期_dgv.Rows(i).Cells("比例").Value : Next
  343. If nn > 工程款4_nud.Value Then
  344. Dim SS As String
  345. If 系統語言 = "繁體中文" Then : SS = "第四期的細項比例不可大於 " : Else : SS = "The proportion of the details of the fourth phase cannot be greater than " : End If
  346. MsgBox(SS & Strings.Format(工程款4_nud.Value, "#,##0.00") & " % !!")
  347. 第4期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第4期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0"
  348. Else
  349. For i As Integer = 0 To 第4期_dgv.Rows.Count - 1
  350. 第4期_dgv.Rows(i).Cells("金額").Value = 第4期_dgv.Rows(i).Cells("比例").Value * 金額4_und.Value / 工程款4_nud.Value
  351. Next i
  352. End If
  353. End If
  354. End Sub
  355. Private Sub 第5期_dgv_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles 第5期_dgv.CellEnter
  356. If Not IsNumeric(第5期_dgv.Rows(e.RowIndex).Cells("比例").Value) Then
  357. If 系統語言 = "繁體中文" Then : MsgBox("欄位輸入必須為數值!!") : Else : MsgBox("Field input must be numeric!!") : End If
  358. 第5期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第5期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0"
  359. Else
  360. Dim nn As Integer
  361. For i As Integer = 0 To 第5期_dgv.Rows.Count - 1 : nn += 第5期_dgv.Rows(i).Cells("比例").Value : Next
  362. If nn > 工程款5_nud.Value Then
  363. Dim SS As String
  364. If 系統語言 = "繁體中文" Then : SS = "第五期的細項比例不可大於 " : Else : SS = "The proportion of the details of the fifth period cannot be greater than " : End If
  365. MsgBox(SS & Strings.Format(工程款5_nud.Value, "#,##0.00") & " % !!")
  366. 第5期_dgv.Rows(e.RowIndex).Cells("比例").Value = "0" : 第5期_dgv.Rows(e.RowIndex).Cells("金額").Value = "0"
  367. Else
  368. For i As Integer = 0 To 第5期_dgv.Rows.Count - 1
  369. 第5期_dgv.Rows(i).Cells("金額").Value = 第5期_dgv.Rows(i).Cells("比例").Value * 金額5_und.Value / 工程款5_nud.Value
  370. Next i
  371. End If
  372. End If
  373. End Sub
  374. Private Sub 第1期_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 第1期_dgv.CellClick
  375. If e.RowIndex = -1 Then : Else : 明細選項_bt.Text = 第1期_dgv("細項", e.RowIndex).Value.ToString : 明細選項_bt.Text = Strings.Format(Val(明細選項_bt.Text), "#,##0") : End If
  376. End Sub
  377. Private Sub 第2期_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 第2期_dgv.CellClick
  378. If e.RowIndex = -1 Then : Else : 明細選項_bt.Text = 第2期_dgv("細項", e.RowIndex).Value.ToString : 明細選項_bt.Text = Strings.Format(Val(明細選項_bt.Text), "#,##0") : End If
  379. End Sub
  380. Private Sub 第3期_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 第3期_dgv.CellClick
  381. If e.RowIndex = -1 Then : Else : 明細選項_bt.Text = 第3期_dgv("細項", e.RowIndex).Value.ToString : 明細選項_bt.Text = Strings.Format(Val(明細選項_bt.Text), "#,##0") : End If
  382. End Sub
  383. Private Sub 第4期_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 第4期_dgv.CellClick
  384. If e.RowIndex = -1 Then : Else : 明細選項_bt.Text = 第4期_dgv("細項", e.RowIndex).Value.ToString : 明細選項_bt.Text = Strings.Format(Val(明細選項_bt.Text), "#,##0") : End If
  385. End Sub
  386. Private Sub 第5期_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 第5期_dgv.CellClick
  387. If e.RowIndex = -1 Then : Else : 明細選項_bt.Text = 第5期_dgv("細項", e.RowIndex).Value.ToString : 明細選項_bt.Text = Strings.Format(Val(明細選項_bt.Text), "#,##0") : End If
  388. End Sub
  389. Private Sub 合約編號1_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 合約編號1_cb.SelectedIndexChanged
  390. Set_合約清單()
  391. End Sub
  392. Private Sub 工程期1_ch_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 工程期1_ch.SelectedIndexChanged
  393. Set_合約清單()
  394. End Sub
  395. Private Sub NUD3_ValueChanged(sender As Object, e As EventArgs) Handles NUD3.ValueChanged
  396. If CH2.Checked = True Then
  397. If 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " Then : NUD2.Value = NUD3.Value / 110 * 10
  398. ElseIf 稅額顯示_lb.Text = "PPN 11%稅額 = Rp. " Then : NUD2.Value = NUD3.Value / 111 * 11
  399. ElseIf 稅額顯示_lb.Text = "PPN 5%稅額 = Rp. " Then : NUD2.Value = NUD3.Value / 105 * 5
  400. ElseIf 稅額顯示_lb.Text = "PPN 0%稅額 = Rp. " Then : NUD2.Value = 0
  401. End If
  402. NUD1.Value = NUD3.Value - NUD2.Value
  403. 金額1_und.Value = NUD3.Value / 100 * 工程款1_nud.Value : 金額2_und.Value = NUD3.Value / 100 * 工程款2_nud.Value
  404. 金額3_und.Value = NUD3.Value / 100 * 工程款3_nud.Value : 金額4_und.Value = NUD3.Value / 100 * 工程款4_nud.Value
  405. 金額5_und.Value = NUD3.Value / 100 * 工程款5_nud.Value
  406. 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value
  407. End If
  408. End Sub
  409. Private Sub NUD1_ValueChanged(sender As Object, e As EventArgs) Handles NUD1.ValueChanged
  410. If CH1.Checked = True Then
  411. NUD2.Value = NUD1.Value / 100 * 10 : NUD3.Value = NUD1.Value + NUD2.Value
  412. 金額1_und.Value = NUD3.Value / 100 * 工程款1_nud.Value : 金額2_und.Value = NUD3.Value / 100 * 工程款2_nud.Value
  413. 金額3_und.Value = NUD3.Value / 100 * 工程款3_nud.Value : 金額4_und.Value = NUD3.Value / 100 * 工程款4_nud.Value
  414. 金額5_und.Value = NUD3.Value / 100 * 工程款5_nud.Value
  415. 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value
  416. End If
  417. End Sub
  418. Private Sub CH1_CheckedChanged(sender As Object, e As EventArgs) Handles CH1.Click
  419. CH1.Checked = True : CH2.Checked = False : NUD1.Enabled = True : NUD3.Enabled = False
  420. End Sub
  421. Private Sub CH2_CheckedChanged(sender As Object, e As EventArgs) Handles CH2.Click
  422. CH1.Checked = False : CH2.Checked = True : NUD1.Enabled = False : NUD3.Enabled = True
  423. End Sub
  424. Private Sub 工程款1_nud_ValueChanged(sender As Object, e As EventArgs) Handles 工程款1_nud.ValueChanged
  425. 工程款6_nud.Value = 工程款1_nud.Value + 工程款2_nud.Value + 工程款3_nud.Value + 工程款4_nud.Value + 工程款5_nud.Value
  426. 金額1_und.Value = NUD3.Value / 100 * 工程款1_nud.Value : 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value
  427. End Sub
  428. Private Sub 工程款2_nud_ValueChanged(sender As Object, e As EventArgs) Handles 工程款2_nud.ValueChanged
  429. 工程款6_nud.Value = 工程款1_nud.Value + 工程款2_nud.Value + 工程款3_nud.Value + 工程款4_nud.Value + 工程款5_nud.Value
  430. 金額2_und.Value = NUD3.Value / 100 * 工程款2_nud.Value : 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value
  431. End Sub
  432. Private Sub 工程款3_nud_ValueChanged(sender As Object, e As EventArgs) Handles 工程款3_nud.ValueChanged
  433. 工程款6_nud.Value = 工程款1_nud.Value + 工程款2_nud.Value + 工程款3_nud.Value + 工程款4_nud.Value + 工程款5_nud.Value
  434. 金額3_und.Value = NUD3.Value / 100 * 工程款3_nud.Value : 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value
  435. End Sub
  436. Private Sub 工程款4_nud_ValueChanged(sender As Object, e As EventArgs) Handles 工程款4_nud.ValueChanged
  437. 工程款6_nud.Value = 工程款1_nud.Value + 工程款2_nud.Value + 工程款3_nud.Value + 工程款4_nud.Value + 工程款5_nud.Value
  438. 金額4_und.Value = NUD3.Value / 100 * 工程款4_nud.Value : 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value
  439. End Sub
  440. Private Sub 工程款5_nud_ValueChanged(sender As Object, e As EventArgs) Handles 工程款5_nud.ValueChanged
  441. 工程款6_nud.Value = 工程款1_nud.Value + 工程款2_nud.Value + 工程款3_nud.Value + 工程款4_nud.Value + 工程款5_nud.Value
  442. 金額5_und.Value = NUD3.Value / 100 * 工程款5_nud.Value : 金額6_und.Value = 金額1_und.Value + 金額2_und.Value + 金額3_und.Value + 金額4_und.Value + 金額5_und.Value
  443. End Sub
  444. Private Sub NUD4_ValueChanged(sender As Object, e As EventArgs) Handles NUD4.ValueChanged
  445. NUD6.Value = NUD4.Value + NUD5.Value
  446. End Sub
  447. Private Sub NUD5_ValueChanged(sender As Object, e As EventArgs) Handles NUD5.ValueChanged
  448. NUD6.Value = NUD4.Value + NUD5.Value
  449. End Sub
  450. Private Sub 比例_nud_ValueChanged(sender As Object, e As EventArgs) Handles 比例_nud.ValueChanged
  451. 請款金額_nud.Value = NUD1.Value / 100 * 比例_nud.Value
  452. End Sub
  453. Private Sub 稅金_nud_ValueChanged(sender As Object, e As EventArgs) Handles 稅金_nud.ValueChanged
  454. 請款總額_nud.Value = 請款金額_nud.Value / 100 * 稅金_nud.Value + 請款金額_nud.Value
  455. End Sub
  456. Private Sub 請款金額_nud_ValueChanged(sender As Object, e As EventArgs) Handles 請款金額_nud.ValueChanged
  457. If 請款金額_nud.Value / NUD1.Value * 100 > 100 Then : 比例_nud.Value = 100 : Else : 比例_nud.Value = 請款金額_nud.Value / NUD1.Value * 100 : End If
  458. 請款總額_nud.Value = 請款金額_nud.Value / 100 * 稅金_nud.Value + 請款金額_nud.Value
  459. End Sub
  460. Private Sub 請款總額_nud_ValueChanged(sender As Object, e As EventArgs) Handles 請款總額_nud.ValueChanged
  461. 請款金額_nud.Value = 請款總額_nud.Value / (100 + 稅金_nud.Value) * 100
  462. End Sub
  463. Private Sub 請款期數_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 請款期數_cb.SelectedIndexChanged
  464. If 請款期數_cb.Text = "" Then : 比例_nud.Value = 0
  465. ElseIf 請款期數_cb.Text = "一" Then
  466. 比例_nud.Value = 工程款1_nud.Value : 請款內容_tb.Text = "Prepayments 預付款" : 主頁明細_ch.Checked = False : 報告移交單_ch.Checked = False
  467. ElseIf 請款期數_cb.Text = "二" Then
  468. 比例_nud.Value = 工程款2_nud.Value : 請款內容_tb.Text = "Material Cost Application 材料到貨款" : 主頁明細_ch.Checked = False : 報告移交單_ch.Checked = False
  469. ElseIf 請款期數_cb.Text = "三" Then
  470. 比例_nud.Value = 工程款3_nud.Value : 請款內容_tb.Text = "Installation Fee Application 施工請款 " : 主頁明細_ch.Checked = False : 報告移交單_ch.Checked = False
  471. ElseIf 請款期數_cb.Text = "四" Then
  472. 比例_nud.Value = 工程款4_nud.Value : 請款內容_tb.Text = "Final Acceptance 驗收款 " : 主頁明細_ch.Checked = True : 報告移交單_ch.Checked = True
  473. ElseIf 請款期數_cb.Text = "五" Then
  474. 比例_nud.Value = 工程款5_nud.Value : 請款內容_tb.Text = "Assure 保留款 " : 主頁明細_ch.Checked = False : 報告移交單_ch.Checked = True
  475. End If
  476. End Sub
  477. Private Sub 新增資料_bt_Click(sender As Object, e As EventArgs) Handles 新增資料_bt.Click
  478. If 合約編號_tb.Text = "" Then
  479. If 系統語言 = "繁體中文" Then : MsgBox("資訊不夠,無法生成明細!!") : Else : MsgBox("Not enough information to generate details!!") : End If : Else
  480. If 工程款6_nud.Value <> 100 Then
  481. If 系統語言 = "繁體中文" Then : MsgBox("工程款估驗 不等於 100%!!") : Else : MsgBox("Project appraisal is not equal to 100%!!!") : End If : Else
  482. PA = 合約編號_tb.Text : 合約明細存檔()
  483. Dim SS As String
  484. If 系統語言 = "繁體中文" Then : SS = "合約工期款項細分不可大於10筆!!" : Else : SS = "The subdivision of the contract duration payment cannot be greater than 10!!" : End If
  485. If TabControl2.SelectedIndex = 0 Then
  486. If 第1期_dgv.Rows.Count = 10 Then : MsgBox(SS) : Else : PA1 = "1" : PA2 = 第1期_dgv.Rows.Count + 1 : SQL_合約明細新增() : End If
  487. ElseIf TabControl2.SelectedIndex = 1 Then
  488. If 第2期_dgv.Rows.Count = 10 Then : MsgBox(SS) : Else : PA1 = "2" : PA2 = 第2期_dgv.Rows.Count + 1 : SQL_合約明細新增() : End If
  489. ElseIf TabControl2.SelectedIndex = 2 Then
  490. If 第3期_dgv.Rows.Count = 10 Then : MsgBox(SS) : Else : PA1 = "3" : PA2 = 第3期_dgv.Rows.Count + 1 : SQL_合約明細新增() : End If
  491. ElseIf TabControl2.SelectedIndex = 3 Then
  492. If 第4期_dgv.Rows.Count = 10 Then : MsgBox(SS) : Else : PA1 = "4" : PA2 = 第4期_dgv.Rows.Count + 1 : SQL_合約明細新增() : End If
  493. ElseIf TabControl2.SelectedIndex = 4 Then
  494. If 第5期_dgv.Rows.Count = 10 Then : MsgBox(SS) : Else : PA1 = "5" : PA2 = 第5期_dgv.Rows.Count + 1 : SQL_合約明細新增() : End If
  495. End If
  496. PA = 合約編號_tb.Text
  497. PA1 = "1" : Set_合約明細1() : PA1 = "2" : Set_合約明細2() : PA1 = "3" : Set_合約明細3() : PA1 = "4" : Set_合約明細4() : PA1 = "5" : Set_合約明細5() : MsgBox("新增完成!!")
  498. End If
  499. End If
  500. End Sub
  501. Private Sub 刪除資料_bt_Click(sender As Object, e As EventArgs) Handles 刪除資料_bt.Click
  502. If 合約編號_tb.Text = "" Or 明細選項_bt.Text = "" Then
  503. If 系統語言 = "繁體中文" Then : MsgBox("資訊不夠,無法生成明細!!") : Else : MsgBox("Not enough information to generate details!!") : End If : Else
  504. If 工程款6_nud.Value <> 100 Then
  505. If 系統語言 = "繁體中文" Then : MsgBox("工程款估驗 不等於 100%!!") : Else : MsgBox("Project appraisal is not equal to 100%!!!") : End If : Else
  506. PA = 合約編號_tb.Text
  507. If TabControl2.SelectedIndex = 0 Then : PA1 = "1" : PA2 = 明細選項_bt.Text : SQL_合約明細刪除()
  508. ElseIf TabControl2.SelectedIndex = 1 Then : PA1 = "2" : PA2 = 明細選項_bt.Text : SQL_合約明細刪除()
  509. ElseIf TabControl2.SelectedIndex = 2 Then : PA1 = "3" : PA2 = 明細選項_bt.Text : SQL_合約明細刪除()
  510. ElseIf TabControl2.SelectedIndex = 3 Then : PA1 = "4" : PA2 = 明細選項_bt.Text : SQL_合約明細刪除()
  511. ElseIf TabControl2.SelectedIndex = 4 Then : PA1 = "5" : PA2 = 明細選項_bt.Text : SQL_合約明細刪除()
  512. End If
  513. PA = 合約編號_tb.Text
  514. PA1 = "1" : Set_合約明細1() : PA1 = "2" : Set_合約明細2() : PA1 = "3" : Set_合約明細3() : PA1 = "4" : Set_合約明細4() : PA1 = "5" : Set_合約明細5()
  515. If 系統語言 = "繁體中文" Then : MsgBox("刪除完成!!") : Else : MsgBox("Delete complete!!") : End If
  516. End If
  517. End If
  518. End Sub
  519. Private Sub 存檔_tb_Click(sender As Object, e As EventArgs) Handles 存檔_tb.Click
  520. 合約明細存檔() : If 系統語言 = "繁體中文" Then : MsgBox("存檔完成!!") : Else : MsgBox("Arsip selesai!!") : End If
  521. End Sub
  522. Private Sub 合約明細存檔()
  523. For i As Integer = 0 To 第1期_dgv.Rows.Count - 1
  524. PA1 = "1" : PA2 = 第1期_dgv.Rows(i).Cells("細項").Value : PA3 = 第1期_dgv.Rows(i).Cells("內容").Value
  525. NU1 = 第1期_dgv.Rows(i).Cells("比例").Value : NU2 = 第1期_dgv.Rows(i).Cells("金額").Value : SQL_合約明細修改()
  526. Next
  527. For i As Integer = 0 To 第2期_dgv.Rows.Count - 1
  528. PA1 = "2" : PA2 = 第2期_dgv.Rows(i).Cells("細項").Value : PA3 = 第2期_dgv.Rows(i).Cells("內容").Value
  529. NU1 = 第2期_dgv.Rows(i).Cells("比例").Value : NU2 = 第2期_dgv.Rows(i).Cells("金額").Value : SQL_合約明細修改()
  530. Next
  531. For i As Integer = 0 To 第3期_dgv.Rows.Count - 1
  532. PA1 = "3" : PA2 = 第3期_dgv.Rows(i).Cells("細項").Value : PA3 = 第3期_dgv.Rows(i).Cells("內容").Value
  533. NU1 = 第3期_dgv.Rows(i).Cells("比例").Value : NU2 = 第3期_dgv.Rows(i).Cells("金額").Value : SQL_合約明細修改()
  534. Next
  535. For i As Integer = 0 To 第4期_dgv.Rows.Count - 1
  536. PA1 = "4" : PA2 = 第4期_dgv.Rows(i).Cells("細項").Value : PA3 = 第4期_dgv.Rows(i).Cells("內容").Value
  537. NU1 = 第4期_dgv.Rows(i).Cells("比例").Value : NU2 = 第4期_dgv.Rows(i).Cells("金額").Value : SQL_合約明細修改()
  538. Next
  539. For i As Integer = 0 To 第5期_dgv.Rows.Count - 1
  540. PA1 = "5" : PA2 = 第5期_dgv.Rows(i).Cells("細項").Value : PA3 = 第5期_dgv.Rows(i).Cells("內容").Value
  541. NU1 = 第5期_dgv.Rows(i).Cells("比例").Value : NU2 = 第5期_dgv.Rows(i).Cells("金額").Value : SQL_合約明細修改()
  542. Next
  543. End Sub
  544. Private Sub 查詢_bt_Click(sender As Object, e As EventArgs) Handles 查詢_bt.Click
  545. PA = 關鍵字搜尋_tb.Text : Set_合約清單()
  546. End Sub
  547. Private Sub 開新的請款單_bt_Click(sender As Object, e As EventArgs) Handles 開新的請款單_bt.Click
  548. If 合約編號_tb.Text = "" Then : If 系統語言 = "繁體中文" Then : MsgBox("請先選擇合約!!") : Else : MsgBox("Please select a contract first!!") : End If : Else
  549. SQL_請款單_最後一筆資料()
  550. If dr.Read() Then : EDR = Double.Parse(Strings.Right(dr("請款編號").ToString, 9)) : Else : EDR = 0 : End If
  551. conn.Close() : EDR += 1
  552. If EDR < 10 Then : ESTR = "HP" & "00000000" & EDR
  553. ElseIf EDR > 9 And EDR < 100 Then : ESTR = "HP" & "0000000" & EDR
  554. ElseIf EDR > 99 And EDR < 1000 Then : ESTR = "HP" & "000000" & EDR
  555. ElseIf EDR > 999 And EDR < 10000 Then : ESTR = "HP" & "00000" & EDR
  556. ElseIf EDR > 9999 And EDR < 100000 Then : ESTR = "HP" & "0000" & EDR
  557. ElseIf EDR > 99999 And EDR < 100000 Then : ESTR = "HP" & "000" & EDR
  558. ElseIf EDR > 999999 And EDR < 1000000 Then : ESTR = "HP" & "00" & EDR
  559. ElseIf EDR > 9999999 And EDR < 10000000 Then : ESTR = "HP" & "0" & EDR
  560. ElseIf EDR > 99999999 Then : ESTR = "HP" & EDR : End If
  561. 請款單號_tb.Text = ESTR : 請款期數_cb.Text = "" : 比例_nud.Value = 0 : 稅金_nud.Value = 11
  562. 付款期限_cb.Text = "" : 申請日期_dtp.Value = Today()
  563. End If
  564. End Sub
  565. Private Sub 存檔_bt_Click(sender As Object, e As EventArgs) Handles 存檔_bt.Click
  566. If 合約編號_tb.Text = "" Then : If 系統語言 = "繁體中文" Then : MsgBox("請先選擇合約!!") : Else : MsgBox("Please select a contract first!!") : End If : Else
  567. If 請款單號_tb.Text = "" Then
  568. If 系統語言 = "繁體中文" Then : MsgBox("請先按開新請款單或是選擇舊請款單!!") : Else : MsgBox("Please click to open a new invoice or select an old one!!") : End If : Else
  569. If 請款期數_cb.Text = "" Then : If 系統語言 = "繁體中文" Then : MsgBox("請先選擇請款期數!!") : Else : MsgBox("Please select the payment period first!!") : End If : Else
  570. If 請款金額_nud.Value = 0 Then : If 系統語言 = "繁體中文" Then : MsgBox("請款金額不可為零!!") : Else : MsgBox("The amount requested cannot be zero!!") : End If : Else
  571. If 付款期限_cb.Text = "" Then : If 系統語言 = "繁體中文" Then : MsgBox("沒有指定付款期限!!") : Else : MsgBox("No payment deadline specified!!") : End If : Else
  572. PA = 合約編號_tb.Text : PA1 = 請款單號_tb.Text : PA2 = 請款期數_cb.Text : PA3 = 請款內容_tb.Text : PA4 = 請款金額_nud.Value : PA5 = 稅金_nud.Value
  573. PA6 = 付款期限_cb.Text : PA7 = Strings.Format(申請日期_dtp.Value, "yyyy/MM/dd") : PA8 = 其他意見_tb.Text : PA9 = 請款總額_nud.Value : PA10 = 比例_nud.Value
  574. SQL_請款單_最後一筆資料1()
  575. If dr.Read() Then : SQL_請款單_修改()
  576. Else
  577. If 請款金額_nud.Value > ANUD5.Value Then
  578. If 系統語言 = "繁體中文" Then : MsgBox("請款單大於剩餘款,無法新增請款單!!")
  579. Else : MsgBox("The payment request is larger than the remaining amount, and the payment request cannot be added!!") : End If : Else
  580. SQL_請款單_新增()
  581. End If
  582. End If : Set_請款清單() : 請款計算() : If 系統語言 = "繁體中文" Then : MsgBox("存檔完成!!") : Else : MsgBox("Archive complete!!") : End If
  583. End If
  584. End If
  585. End If
  586. End If
  587. End If
  588. End Sub
  589. Private Sub 刪除_bt_Click(sender As Object, e As EventArgs) Handles 刪除_bt.Click
  590. If 合約編號_tb.Text = "" Then : If 系統語言 = "繁體中文" Then : MsgBox("請先選擇合約!!") : Else : MsgBox("Please select a contract first!!") : End If : Else
  591. If 請款單號_tb.Text = "" Then : If 系統語言 = "繁體中文" Then : MsgBox("請先選擇請款單!!") : Else : MsgBox("Please select the invoice first!!") : End If : Else
  592. PA1 = 請款單號_tb.Text : SQL_請款單_刪除() : Set_請款清單() : 請款計算()
  593. If 系統語言 = "繁體中文" Then : MsgBox("合約請款單刪除完成!!") : Else : MsgBox("Contract Requisition Deletion Completed!!") : End If
  594. End If
  595. End If
  596. End Sub
  597. Private Sub 報告移交()
  598. B02_tb.Text = Strings.Right(Strings.Format(Today(), "yyyy/MM/dd"), 2) : B04_tb.Text = Strings.Left(Strings.Format(Today(), "yyyy/MM/dd"), 4)
  599. If Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "01" Then : B03_tb.Text = "Jan"
  600. ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "02" Then : B03_tb.Text = "Feb"
  601. ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "03" Then : B03_tb.Text = "Ber"
  602. ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "04" Then : B03_tb.Text = "Apr"
  603. ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "05" Then : B03_tb.Text = "Mun"
  604. ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "06" Then : B03_tb.Text = "Jun"
  605. ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "07" Then : B03_tb.Text = "Jul"
  606. ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "08" Then : B03_tb.Text = "Agu"
  607. ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "09" Then : B03_tb.Text = "Sep"
  608. ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "10" Then : B03_tb.Text = "Okt"
  609. ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "11" Then : B03_tb.Text = "Nov"
  610. ElseIf Strings.Mid(Strings.Format(Today(), "yyyy/MM/dd"), 6, 2) = "12" Then : B03_tb.Text = "Des" : End If
  611. B36_tb.Text = B02_tb.Text : B37_tb.Text = B03_tb.Text : B38_tb.Text = B04_tb.Text
  612. B07_tb.Text = 客戶名稱_tb.Text : B30_tb.Text = 客戶名稱_tb.Text : B42_tb.Text = 客戶名稱_tb.Text : B22_tb.Text = 合約編號_tb.Text : B23_tb.Text = 工程名稱_英_tb.Text
  613. If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : B12_tb.Text = "PT HONG XHE INDUSTRIAL" : B43_tb.Text = "PT HONG XHE INDUSTRIAL"
  614. Else : B12_tb.Text = "PT PUNCAK GEMILANG SEMESTA" : B43_tb.Text = "PT PUNCAK GEMILANG SEMESTA" : End If
  615. End Sub
  616. Private Sub 報告移交計算()
  617. If 請款期數_cb.Text = "四" Then
  618. Dim SS As Integer = 0
  619. For i As Integer = 0 To 請款單_dgv.Rows.Count - 1 : If 請款單_dgv("期數", i).Value.ToString() <> "五" Then : SS += 請款單_dgv("比例", i).Value : End If : Next
  620. B32_tb.Text = "Pihak kesatu (I) telah memeriksa hasil pekerjaan Pihak kedua (II) yang telah selesai dikerjakan sesuai dengan kontrak."
  621. A01_lb.Text = "BERITA ACARA SERAH TERIMA PERTAMA" : B31_tb.Text = "Penagihan Invoice Pelunasan " & SS & "%" : 報告移交()
  622. B19_tb.Visible = True : B27_tb.Visible = True : B28_tb.Visible = True : B29_tb.Visible = True : B33_tb.Visible = True
  623. B44_tb.Visible = True : B45_tb.Visible = True : B46_tb.Visible = True : 報告移交單_ch.Enabled = True
  624. ElseIf 請款期數_cb.Text = "五" Then
  625. B32_tb.Text = "Pihak kesatu (I) telah memeriksa hasil pekerjaan Pihak kedua (II) yang telah selesai dikerjakan dan dinyatakan 100% selesai dalam masa garansi."
  626. A01_lb.Text = "BERITA ACARA SERAH TERIMA KEDUA" : B31_tb.Text = "Penagihan Invoice Pelunasan 100%" : 報告移交()
  627. B19_tb.Visible = False : B27_tb.Visible = False : B28_tb.Visible = False : B29_tb.Visible = False : B33_tb.Visible = False
  628. B44_tb.Visible = False : B45_tb.Visible = False : B46_tb.Visible = False : 報告移交單_ch.Enabled = True
  629. Else
  630. 視窗2_pl.Visible = False : 報告移交單_ch.Enabled = False : 報告移交單_ch.Checked = False
  631. End If
  632. End Sub
  633. Private Sub 報告移交_bt_Click(sender As Object, e As EventArgs) Handles 報告移交_bt.Click
  634. If 視窗2_pl.Visible = False Then : 視窗2_pl.BringToFront()
  635. If 請款期數_cb.Text = "四" Then : 視窗2_pl.Location = New System.Drawing.Point(261, 19) : 視窗2_pl.Visible = True : 報告移交計算()
  636. ElseIf 請款期數_cb.Text = "五" Then : 視窗2_pl.Location = New System.Drawing.Point(261, 19) : 視窗2_pl.Visible = True : 報告移交計算()
  637. Else : 視窗2_pl.Visible = False : 報告移交單_ch.Checked = False
  638. If 系統語言 = "繁體中文" Then : MsgBox("所選請款期數,無法列印報告移交單!!")
  639. Else : MsgBox("The selected collection period cannot print the report handover slip!!") : End If : End If
  640. Else : 視窗2_pl.Visible = False : End If
  641. End Sub
  642. Private Sub CanceL2_bt_Click(sender As Object, e As EventArgs) Handles CanceL2_bt.Click
  643. If 視窗2_pl.Visible = False Then : 視窗2_pl.Visible = True : 視窗2_pl.BringToFront() : Else
  644. 視窗2_pl.Visible = False : End If
  645. End Sub
  646. Private Sub 視窗2_pl_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 視窗2_pl.MouseDown
  647. If e.Button = MouseButtons.Left Then : OldX = e.X : OldY = e.Y : drag = True : End If
  648. End Sub
  649. Private Sub 視窗2_pl_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 視窗2_pl.MouseMove
  650. If drag Then : 視窗2_pl.Left = 視窗2_pl.Left + e.X - OldX : 視窗2_pl.Top = 視窗2_pl.Top + e.Y - OldY : End If
  651. End Sub
  652. Private Sub 縮放2_bt_Click(sender As Object, e As EventArgs) Handles 縮放2_bt.Click
  653. Dim NX, NY As Integer : NX = 合約_dgv.Size.Width : NY = 合約_dgv.Size.Height
  654. If 放大 = True Then
  655. 合約_dgv.Size = New System.Drawing.Point(NX - 400, NY) : 放大 = False : 合約_dgv.Columns("工程名稱_中").Visible = False
  656. Else
  657. 合約_dgv.Size = New System.Drawing.Point(NX + 400, NY) : 放大 = True : 合約_dgv.Columns("工程名稱_中").Visible = True
  658. End If
  659. End Sub
  660. Private Sub 視窗2_pl_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 視窗2_pl.MouseUp
  661. drag = False
  662. End Sub
  663. Private Sub 列印_bt_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click
  664. If 合約編號_tb.Text = "" Then
  665. If 系統語言 = "繁體中文" Then : MsgBox("請先選擇合約!!") : Else : MsgBox("Please select a contract first!!") : End If : Else
  666. If 請款單號_tb.Text = "" Then
  667. If 系統語言 = "繁體中文" Then : MsgBox("請先選擇請款單!!") : Else : MsgBox("Please select the invoice first!!") : End If : Else
  668. If 請款期數_cb.Text = "" Then
  669. If 系統語言 = "繁體中文" Then : MsgBox("沒有請款期數,無法列印!!") : Else : MsgBox("There is no demand period and cannot be printed!!") : End If : Else
  670. If 請款金額_nud.Value = 0 Then
  671. If 系統語言 = "繁體中文" Then : MsgBox("請款金額為零,無法列印!!") : Else : MsgBox("The amount requested is zero and cannot be printed!!") : End If : Else
  672. If 付款期限_cb.Text = "" Then
  673. If 系統語言 = "繁體中文" Then : MsgBox("沒有指定付款期限,無法列印!!") : Else : MsgBox("No payment deadline specified, cannot print!!") : End If : Else
  674. Try
  675. xlApp = CType(CreateObject("Excel.Application"), Application)
  676. xlApp.Visible = True
  677. xlApp.DisplayAlerts = True
  678. xlApp.Application.WindowState = xlMaximized
  679. xlBook = xlApp.Workbooks.Add
  680. '----------------------------------------------------------------------------------------------------------------------
  681. If 報告移交_bt.Visible = True Then
  682. If 報告移交單_ch.Checked = True Then
  683. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select : xlApp.Sheets(1).Name = "報告移交單"
  684. xlBook.Activate() : xlSheet.Activate()
  685. xlSheet.Cells(2, 1) = A01_lb.Text : xlSheet.Cells(4, 1) = B01_tb.Text & " " & B02_tb.Text & " " & B03_tb.Text & " " & B04_tb.Text & " " & B05_tb.Text
  686. xlSheet.Cells(6, 1) = B06_tb.Text : xlSheet.Cells(6, 3) = B07_tb.Text : xlSheet.Cells(7, 1) = B08_tb.Text : xlSheet.Cells(7, 3) = B09_tb.Text
  687. xlSheet.Cells(9, 1) = B10_tb.Text : xlSheet.Cells(11, 1) = B11_tb.Text : xlSheet.Cells(11, 3) = B12_tb.Text : xlSheet.Cells(12, 1) = B13_tb.Text
  688. xlSheet.Cells(12, 3) = B14_tb.Text : xlSheet.Cells(14, 1) = B15_tb.Text
  689. xlSheet.Cells(16, 2) = B16_tb.Text : xlSheet.Cells(16, 3) = "':" : xlSheet.Cells(16, 4) = B22_tb.Text
  690. xlSheet.Cells(17, 2) = B17_tb.Text : xlSheet.Cells(17, 3) = "':" : xlSheet.Cells(17, 4) = B23_tb.Text
  691. xlSheet.Cells(18, 2) = B18_tb.Text : xlSheet.Cells(18, 3) = "':" : xlSheet.Cells(18, 4) = B24_tb.Text & " " & B25_tb.Text & " " & B26_tb.Text
  692. Dim NX As Integer = 19
  693. If 請款期數_cb.Text = "四" Then
  694. xlSheet.Cells(NX, 2) = B19_tb.Text : xlSheet.Cells(NX, 3) = "':" : xlSheet.Cells(NX, 4) = B27_tb.Text & " " & B28_tb.Text & " " & B29_tb.Text : NX += 1
  695. xlSheet.Cells(NX, 2) = B20_tb.Text : xlSheet.Cells(NX, 3) = "':" : xlSheet.Cells(NX, 4) = B30_tb.Text : NX += 1
  696. xlSheet.Cells(NX, 2) = B21_tb.Text : xlSheet.Cells(NX, 3) = "':" : xlSheet.Cells(NX, 4) = B31_tb.Text : NX += 2
  697. xlSheet.Cells(NX, 1) = B32_tb.Text : NX += 1
  698. xlSheet.Cells(NX, 1) = B33_tb.Text + " " + B44_tb.Text + " " + B45_tb.Text + " " & B46_tb.Text : NX += 1
  699. xlSheet.Cells(NX, 1) = B34_tb.Text : NX += 2
  700. xlSheet.Cells(NX, 4) = B35_tb.Text : xlSheet.Cells(NX, 5) = B36_tb.Text & " " & B37_tb.Text & " " & B38_tb.Text : NX += 2
  701. xlSheet.Cells(NX, 5) = B39_tb.Text : NX += 1
  702. xlSheet.Cells(NX, 2) = B40_tb.Text : xlSheet.Cells(NX, 5) = B41_tb.Text : NX += 1
  703. xlSheet.Cells(NX, 2) = B42_tb.Text : xlSheet.Cells(NX, 5) = B43_tb.Text
  704. Else
  705. xlSheet.Cells(NX, 2) = B20_tb.Text : xlSheet.Cells(NX, 3) = "':" : xlSheet.Cells(NX, 4) = B30_tb.Text : NX += 1
  706. xlSheet.Cells(NX, 2) = B21_tb.Text : xlSheet.Cells(NX, 3) = "':" : xlSheet.Cells(NX, 4) = B31_tb.Text : NX += 2
  707. xlSheet.Cells(NX, 1) = B32_tb.Text : NX += 1 : xlSheet.Cells(NX, 1) = B34_tb.Text : NX += 2
  708. xlSheet.Cells(NX, 4) = B35_tb.Text : xlSheet.Cells(NX, 5) = B36_tb.Text & " " & B37_tb.Text & " " & B38_tb.Text : NX += 2
  709. xlSheet.Cells(NX, 5) = B39_tb.Text : NX += 1
  710. xlSheet.Cells(NX, 2) = B40_tb.Text : xlSheet.Cells(NX, 5) = B41_tb.Text : NX += 1
  711. xlSheet.Cells(NX, 2) = B42_tb.Text : xlSheet.Cells(NX, 5) = B43_tb.Text
  712. End If
  713. AB(xlApp, xlSheet)
  714. If Strings.Left(合約編號_tb.Text, 2) = "GCM" Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If : FF(xlApp, xlSheet)
  715. End If
  716. End If
  717. '----------------------------------------------------------------------------------------------------------------------
  718. If 請款單_ch.Checked = True Then
  719. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select : xlApp.Sheets(1).Name = "請款單"
  720. xlBook.Activate() : xlSheet.Activate()
  721. xlSheet.Cells(2, 1) = "請款明細表 Rincian Tagihan" : xlSheet.Cells(3, 1) = "TO : " & 客戶名稱_tb.Text
  722. xlSheet.Cells(3, 9) = "日期 : " & Strings.Format(Today(), "yyyy/MM/dd")
  723. xlSheet.Cells(4, 1) = "工程項目 : " & 工程名稱_中_tb.Text & vbCrLf & 工程名稱_英_tb.Text : xlSheet.Cells(4, 9) = "期別 : 第" & 請款期數_cb.Text & "期"
  724. xlSheet.Cells(5, 1) = "(未稅)本合約工程款 Total Kontrak Sebelum Ppn Rp : "
  725. If 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " Then : xlSheet.Cells(5, 5) = 金額6_und.Value / 110 * 100
  726. ElseIf 稅額顯示_lb.Text = "PPN 11%稅額 = Rp. " Then : xlSheet.Cells(5, 5) = 金額6_und.Value / 111 * 100
  727. ElseIf 稅額顯示_lb.Text = "PPN 5%稅額 = Rp. " Then : xlSheet.Cells(5, 5) = 金額6_und.Value / 105 * 100
  728. ElseIf 稅額顯示_lb.Text = "PPN 0%稅額 = Rp. " Then : xlSheet.Cells(5, 5) = 金額6_und.Value
  729. End If
  730. xlSheet.Cells(7, 1) = "No." : xlSheet.Cells(7, 2) = "Description" : xlSheet.Cells(7, 3) = "Rate" : xlSheet.Cells(7, 4) = "Total Amount" & vbCrLf & "總金額"
  731. xlSheet.Cells(7, 5) = "This Period" & vbCrLf & "本期請款" : xlSheet.Cells(7, 7) = "Accumulation" & vbCrLf & "累計請款" : xlSheet.Cells(7, 9) = "Remarks"
  732. If 新版_ch.Checked = False Then
  733. xlSheet.Cells(8, 1) = "1" : xlSheet.Cells(8, 2) = "Prepayments" & vbCrLf & "(預付款)" : xlSheet.Cells(8, 3) = 工程款1_nud.Value / 100
  734. If 請款期數_cb.Text = "一" Then : xlSheet.Cells(8, 5) = "=C8" : Else : xlSheet.Cells(8, 5) = "0" : End If
  735. xlSheet.Cells(9, 1) = "2" : xlSheet.Cells(9, 2) = "Material Cost Application" & vbCrLf & "(材料到貨款)" : xlSheet.Cells(9, 3) = 工程款2_nud.Value / 100
  736. If 請款期數_cb.Text = "二" Then : xlSheet.Cells(9, 5) = "=C9" : Else : xlSheet.Cells(9, 5) = "0" : End If
  737. xlSheet.Cells(10, 1) = "3" : xlSheet.Cells(10, 2) = "Installation Fee Application" & vbCrLf & "(施工請款)" : xlSheet.Cells(10, 3) = 工程款3_nud.Value / 100
  738. If 請款期數_cb.Text = "三" Then : xlSheet.Cells(10, 5) = "=C10" : Else : xlSheet.Cells(10, 5) = "0" : End If
  739. xlSheet.Cells(11, 1) = "4" : xlSheet.Cells(11, 2) = "Final Acceptance" & vbCrLf & "(驗收款)" : xlSheet.Cells(11, 3) = 工程款4_nud.Value / 100
  740. If 請款期數_cb.Text = "四" Then : xlSheet.Cells(11, 5) = "=C11" : Else : xlSheet.Cells(11, 5) = "0" : End If
  741. xlSheet.Cells(12, 1) = "5" : xlSheet.Cells(12, 2) = "Assure" & vbCrLf & "(保留款)" : xlSheet.Cells(12, 3) = 工程款5_nud.Value / 100
  742. If 請款期數_cb.Text = "五" Then : xlSheet.Cells(12, 5) = "=C12" : Else : xlSheet.Cells(12, 5) = "0" : End If
  743. For i As Integer = 8 To 12
  744. If i = 11 Then : xlSheet.Cells(i, 4) = "=C" & i & "*$E$5 + " & ANUD3.Value : Else : xlSheet.Cells(i, 4) = "=C" & i & "*$E$5" : End If
  745. xlSheet.Cells(i, 6) = "=IF(E" & i & "=0,0,D" & i & ")" : If i = 8 Then : xlSheet.Cells(i, 7) = "=IF(E" & i & "=0,C" & i & ",0)"
  746. Else : xlSheet.Cells(i, 7) = "=IF(G" & i - 1 & "=0,0,IF(E" & i & "=0,C" & i & ",0))" : End If
  747. xlSheet.Cells(i, 8) = "=G" & i & "*$E$5"
  748. Next
  749. xlSheet.Cells(13, 1) = "Total" : xlSheet.Cells(13, 4) = "=D12+D11+D10+D9+D8" : xlSheet.Cells(13, 5) = "=E8+E9+E10+E11+E12"
  750. xlSheet.Cells(13, 6) = "=F8+F9+F10+F11+F12" : xlSheet.Cells(13, 7) = "=G8+G9+G10+G11+G12" : xlSheet.Cells(13, 8) = "=H8+H9+H10+H11+H12"
  751. xlSheet.Cells(15, 2) = "本期估驗 Nominal Tagihan" & vbCrLf & "(未稅Belum Termasuk Pajak)" : xlSheet.Cells(15, 3) = "' : "
  752. xlSheet.Cells(15, 4) = "=F13" : xlSheet.Cells(16, 2) = "PPN " & 稅金_nud.Value & "%" : xlSheet.Cells(16, 3) = "' : "
  753. xlSheet.Cells(16, 4) = 請款總額_nud.Value - 請款金額_nud.Value : xlSheet.Cells(17, 4) = "=D15+D16"
  754. xlSheet.Cells(18, 1) = "本期請款金額 Total Tagihan : Rp" : xlSheet.Cells(18, 3) = "' : " : xlSheet.Cells(18, 4) = "=D17"
  755. xlSheet.Cells(18, 7) = "元整" : xlSheet.Cells(18, 8) = "(含稅) Termasuk Ppn" : xlSheet.Cells(21, 2) = 客戶名稱_tb.Text : xlSheet.Cells(22, 2) = "驗收代表人"
  756. BB(xlApp, xlSheet)
  757. Else
  758. xlSheet.Cells(8, 1) = "1" : xlSheet.Cells(8, 2) = "Prepayments" & vbCrLf & "(預付款)" : xlSheet.Cells(8, 3) = 工程款1_nud.Value / 100
  759. If 請款期數_cb.Text = "一" Then : xlSheet.Cells(8, 5) = "=C8" : Else : xlSheet.Cells(8, 5) = "0" : End If
  760. xlSheet.Cells(9, 1) = "2" : xlSheet.Cells(9, 2) = "Material Cost Application" & vbCrLf & "(材料到貨款)" : xlSheet.Cells(9, 3) = 工程款2_nud.Value / 100
  761. If 請款期數_cb.Text = "二" Then : xlSheet.Cells(9, 5) = "=C9" : Else : xlSheet.Cells(9, 5) = "0" : End If
  762. xlSheet.Cells(10, 1) = "3" : xlSheet.Cells(10, 2) = "Installation Fee & Final Application" & vbCrLf & "(施工.驗收款)"
  763. xlSheet.Cells(10, 3) = 工程款4_nud.Value / 100 + 工程款3_nud.Value / 100
  764. If 請款期數_cb.Text = "三" Or 請款期數_cb.Text = "四" Then : xlSheet.Cells(10, 5) = "=C10" : Else : xlSheet.Cells(10, 5) = "0" : End If
  765. xlSheet.Cells(11, 1) = "4" : xlSheet.Cells(11, 2) = "Assure" & vbCrLf & "(保留款)" : xlSheet.Cells(11, 3) = 工程款5_nud.Value / 100
  766. If 請款期數_cb.Text = "五" Then : xlSheet.Cells(11, 5) = "=C11" : Else : xlSheet.Cells(11, 5) = "0" : End If
  767. For i As Integer = 8 To 11
  768. If i = 10 Then : xlSheet.Cells(i, 4) = "=C" & i & "*$E$5 + " & ANUD3.Value : Else : xlSheet.Cells(i, 4) = "=C" & i & "*$E$5" : End If
  769. xlSheet.Cells(i, 6) = "=IF(E" & i & "=0,0,D" & i & ")" : If i = 8 Then : xlSheet.Cells(i, 7) = "=IF(E" & i & "=0,C" & i & ",0)"
  770. Else : xlSheet.Cells(i, 7) = "=IF(G" & i - 1 & "=0,0,IF(E" & i & "=0,C" & i & ",0))" : End If
  771. xlSheet.Cells(i, 8) = "=G" & i & "*$E$5"
  772. Next
  773. xlSheet.Cells(12, 1) = "Total" : xlSheet.Cells(12, 4) = "=D11+D10+D9+D8" : xlSheet.Cells(12, 5) = "=E8+E9+E10+E11"
  774. xlSheet.Cells(12, 6) = "=F8+F9+F10+F11" : xlSheet.Cells(12, 7) = "=G8+G9+G10+G11" : xlSheet.Cells(12, 8) = "=H8+H9+H10+H11"
  775. xlSheet.Cells(14, 2) = "本期估驗 Nominal Tagihan" & vbCrLf & "(未稅Belum Termasuk Pajak)" : xlSheet.Cells(14, 3) = "' : "
  776. xlSheet.Cells(14, 4) = "=F12" : xlSheet.Cells(16, 2) = "PPN " & 稅金_nud.Value & "%" : xlSheet.Cells(15, 3) = "' : "
  777. xlSheet.Cells(15, 4) = 請款總額_nud.Value - 請款金額_nud.Value : xlSheet.Cells(16, 4) = "=D14+D15"
  778. xlSheet.Cells(17, 1) = "本期請款金額 Total Tagihan : Rp" : xlSheet.Cells(17, 3) = "' : " : xlSheet.Cells(17, 4) = "=D16"
  779. xlSheet.Cells(17, 7) = "元整" : xlSheet.Cells(17, 8) = "(含稅) Termasuk Ppn" : xlSheet.Cells(20, 2) = 客戶名稱_tb.Text : xlSheet.Cells(21, 2) = "驗收代表人"
  780. BB2(xlApp, xlSheet)
  781. End If
  782. If Strings.Left(合約編號_tb.Text, 2) = "GCM" Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If : FF(xlApp, xlSheet)
  783. End If
  784. '----------------------------------------------------------------------------------------------------------------------
  785. If 主頁_ch.Checked = True Then
  786. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select : xlApp.Sheets(1).Name = "主頁"
  787. xlBook.Activate() : xlSheet.Activate()
  788. Dim BF As String
  789. If Strings.Left(合約編號_tb.Text, 2) = "GCM" Then : BF = "G.C.M. Smart Enterprise LTD." & vbCrLf & "(工巧明智能企業有限公司)"
  790. Else : BF = "PT.Indonesia Cemerlang System" & vbCrLf & "(輝煌系統有限公司)" : End If
  791. Dim CF As String = ""
  792. If 請款期數_cb.Text = "一" Then : CF = "第一次請款" & vbCrLf & "The First Installment of The Project Funds"
  793. ElseIf 請款期數_cb.Text = "二" Then : CF = "第二次請款" & vbCrLf & "The Second Installment of The Project Funds"
  794. ElseIf 請款期數_cb.Text = "三" Then : CF = "第三次請款" & vbCrLf & "The Third Installment of The Project Funds"
  795. ElseIf 請款期數_cb.Text = "四" Then : CF = "第四次請款" & vbCrLf & "The Fourth Installment of The Project Funds"
  796. ElseIf 請款期數_cb.Text = "五" Then : CF = "第五次請款" & vbCrLf & "The Fifth Installment of The Project Funds"
  797. End If
  798. xlSheet.Cells(2, 1) = "工程款撥付申請表"
  799. xlSheet.Cells(3, 1) = "Form Request Pembayaran Proyek Pembangunan"
  800. xlSheet.Cells(4, 1) = "客戶名稱 : " & vbCrLf & "Client's Name" : xlSheet.Cells(4, 2) = 客戶名稱_tb.Text
  801. xlSheet.Cells(5, 1) = "工程名稱:" & vbCrLf & "Nama Proyek" : xlSheet.Cells(5, 2) = 工程名稱_中_tb.Text & vbCrLf & 工程名稱_英_tb.Text
  802. xlSheet.Cells(6, 1) = "施工合同號:" & vbCrLf & "No. Kontrak Konstruksi" : xlSheet.Cells(6, 2) = 合約編號_tb.Text
  803. xlSheet.Cells(7, 1) = "施工單位:" & vbCrLf & "Perusahaan Konstruksi" : xlSheet.Cells(7, 2) = BF
  804. xlSheet.Cells(8, 1) = "付款專案:" & vbCrLf & "Proyek Pembayaran" : xlSheet.Cells(8, 2) = CF
  805. xlSheet.Cells(8, 5) = "合同總額 (未稅):" & vbCrLf & "Jumlah Total Kontrak"
  806. If 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " Then
  807. xlSheet.Cells(8, 6) = Strings.Format(ANUD2.Value / 1.1, "#,##0")
  808. Else
  809. xlSheet.Cells(8, 6) = Strings.Format(ANUD2.Value / 1.11, "#,##0")
  810. End If
  811. xlSheet.Cells(9, 1) = "請款單位:" & vbCrLf & "Departemen Pemohon" : xlSheet.Cells(9, 2) = BF
  812. xlSheet.Cells(9, 5) = "要求付款日期:" & vbCrLf & "Permintaan Tanggal Pembayaran" : xlSheet.Cells(9, 6) = 付款期限_cb.Text
  813. xlSheet.Cells(10, 1) = "本次請款金額 (未稅):" & vbCrLf & "Total Tagihan" : xlSheet.Cells(10, 2) = Strings.Format(請款金額_nud.Value, "#,##0")
  814. xlSheet.Cells(10, 5) = "累計已收金額 (未稅):" & vbCrLf & "Akumulasi Biaya yang Diterima"
  815. Dim 已請 As Long
  816. For I As Integer = 0 To 請款單_dgv.Rows.Count - 1
  817. If 請款期數_cb.Text = "一" Then
  818. 已請 = 0
  819. ElseIf 請款期數_cb.Text = "二" Then
  820. If 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "一" Then
  821. 已請 = 已請 + 請款單_dgv.Rows(I).Cells("請款金額").Value
  822. End If
  823. ElseIf 請款期數_cb.Text = "三" Then
  824. If 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "一" Or 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "二" Then
  825. 已請 = 已請 + 請款單_dgv.Rows(I).Cells("請款金額").Value
  826. End If
  827. ElseIf 請款期數_cb.Text = "四" Then
  828. If 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "一" Or 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "二" Or
  829. 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "三" Then
  830. 已請 = 已請 + 請款單_dgv.Rows(I).Cells("請款金額").Value
  831. End If
  832. ElseIf 請款期數_cb.Text = "五" Then
  833. If 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "一" Or 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "二" Or
  834. 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "三" Or 請款單_dgv.Rows(I).Cells("期數").Value.ToString = "四" Then
  835. 已請 = 已請 + 請款單_dgv.Rows(I).Cells("請款金額").Value
  836. End If
  837. End If
  838. Next
  839. xlSheet.Cells(10, 6) = Strings.Format(已請, "#,##0")
  840. xlSheet.Cells(11, 1) = "本次請款內容:" & vbCrLf & "Deskripsi Tagihan" : xlSheet.Cells(11, 2) = 請款內容_tb.Text
  841. If 主頁明細_ch.Checked = True Then
  842. xlSheet.Cells(14, 2) = "合約金額(Contract Amount) : "
  843. If 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " Then
  844. xlSheet.Cells(14, 4) = Strings.Format(ANUD1.Value / 1.1, "#,##0")
  845. Else
  846. xlSheet.Cells(14, 4) = Strings.Format(ANUD1.Value / 1.11, "#,##0")
  847. End If : xlSheet.Cells(14, 5) = " RP (未稅)"
  848. xlSheet.Cells(15, 2) = "結算金額(Settlement Amount) : "
  849. If 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " Then
  850. xlSheet.Cells(15, 4) = Strings.Format(ANUD2.Value / 1.1, "#,##0")
  851. Else
  852. xlSheet.Cells(15, 4) = Strings.Format(ANUD2.Value / 1.11, "#,##0")
  853. End If : xlSheet.Cells(15, 5) = " RP (未稅)"
  854. xlSheet.Cells(16, 2) = "實際追加減(Add To) : "
  855. If 稅額顯示_lb.Text = "PPN 10%稅額 = Rp. " Then
  856. xlSheet.Cells(16, 4) = Strings.Format(ANUD3.Value / 1.1, "#,##0")
  857. Else
  858. xlSheet.Cells(16, 4) = Strings.Format(ANUD3.Value / 1.11, "#,##0")
  859. End If : xlSheet.Cells(16, 5) = " RP (未稅)"
  860. xlSheet.Cells(17, 2) = "已請款(Requested) : " : xlSheet.Cells(17, 4) = Strings.Format(已請, "#,##0") : xlSheet.Cells(17, 5) = " RP (未稅)"
  861. xlSheet.Cells(18, 2) = "剩餘款(Remaining) : " : xlSheet.Cells(18, 4) = "=D15-D17" : xlSheet.Cells(18, 5) = " RP (未稅)"
  862. xlSheet.Cells(19, 2) = "其中:"
  863. If 請款期數_cb.Text = "四" Then : xlSheet.Cells(20, 2) = "驗收款(Final acceptance) : " : Else : xlSheet.Cells(20, 2) = "未收款(Unpaid) : " : End If
  864. xlSheet.Cells(20, 4) = "=D15-D17-D21" : xlSheet.Cells(20, 5) = " RP (未稅)"
  865. xlSheet.Cells(21, 2) = "保留款(Assure) : " : xlSheet.Cells(21, 4) = "= D15 * " & 工程款5_nud.Value & "/ 100" : xlSheet.Cells(21, 5) = " RP (未稅)"
  866. End If
  867. xlSheet.Cells(23, 3) = "申請人 Pemohon:" : xlSheet.Cells(23, 4) = BF
  868. xlSheet.Cells(25, 3) = "申請時間 Waktu:" : xlSheet.Cells(25, 4) = Strings.Format(申請日期_dtp.Value, "yyyy/MM/dd")
  869. xlSheet.Cells(26, 1) = "籌建辦審批意見:" & vbCrLf & "Komentar Penyetuju Kantor Konstruksi Umum" : xlSheet.Cells(26, 2) = 其他意見_tb.Text
  870. xlSheet.Cells(36, 3) = "審核人 Disetujui oleh:" : xlSheet.Cells(37, 3) = "審核時間 Waktu:"
  871. xlSheet.Cells(39, 1) = "本表一式三份:施工單位、籌建辦、財務單位各一份。"
  872. xlSheet.Cells(40, 1) = "Form ini dirangkap 3 lembar: Perusahaan konstruksi, kantor konstruksi umum, departemen finance"
  873. AA(xlApp, xlSheet)
  874. If 甲方_tb.Text = "JCS" Then : JCS(xlApp, xlSheet) : ElseIf 甲方_tb.Text = "J2" Then : J2(xlApp, xlSheet) : Else
  875. If Strings.Left(合約編號_tb.Text, 2) = "GCM" Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If : FF(xlApp, xlSheet)
  876. End If
  877. End If
  878. If 報告移交_bt.Visible = True Then
  879. If 報告移交單_ch.Checked = True And 請款單_ch.Checked = True And 主頁_ch.Checked = True Then : xlApp.Sheets(4).Delete
  880. ElseIf 報告移交單_ch.Checked = True And 請款單_ch.Checked = True And 主頁_ch.Checked = False Then : xlApp.Sheets(3).Delete
  881. ElseIf 報告移交單_ch.Checked = True And 請款單_ch.Checked = False And 主頁_ch.Checked = True Then : xlApp.Sheets(3).Delete
  882. ElseIf 報告移交單_ch.Checked = False And 請款單_ch.Checked = True And 主頁_ch.Checked = True Then : xlApp.Sheets(3).Delete
  883. ElseIf 報告移交單_ch.Checked = True And 請款單_ch.Checked = False And 主頁_ch.Checked = False Then : xlApp.Sheets(2).Delete
  884. ElseIf 報告移交單_ch.Checked = False And 請款單_ch.Checked = True And 主頁_ch.Checked = False Then : xlApp.Sheets(2).Delete
  885. ElseIf 報告移交單_ch.Checked = False And 請款單_ch.Checked = False And 主頁_ch.Checked = True Then : xlApp.Sheets(2).Delete
  886. End If
  887. Else
  888. If 報告移交單_ch.Checked = True And 請款單_ch.Checked = True And 主頁_ch.Checked = True Then : xlApp.Sheets(3).Delete
  889. ElseIf 報告移交單_ch.Checked = True And 請款單_ch.Checked = True And 主頁_ch.Checked = False Then : xlApp.Sheets(2).Delete
  890. ElseIf 報告移交單_ch.Checked = True And 請款單_ch.Checked = False And 主頁_ch.Checked = True Then : xlApp.Sheets(2).Delete
  891. ElseIf 報告移交單_ch.Checked = False And 請款單_ch.Checked = True And 主頁_ch.Checked = True Then : xlApp.Sheets(2).Delete
  892. ElseIf 報告移交單_ch.Checked = True And 請款單_ch.Checked = False And 主頁_ch.Checked = False Then : xlApp.Sheets(1).Delete
  893. ElseIf 報告移交單_ch.Checked = False And 請款單_ch.Checked = True And 主頁_ch.Checked = False Then : xlApp.Sheets(1).Delete
  894. ElseIf 報告移交單_ch.Checked = False And 請款單_ch.Checked = False And 主頁_ch.Checked = True Then : xlApp.Sheets(1).Delete
  895. End If
  896. End If
  897. xlSheet.PageSetup.PrintArea = ""
  898. xlApp.Cells.Select()
  899. xlApp.Application.WindowState = xlMinimized
  900. If 系統語言 = "繁體中文" Then : MsgBox("列印完成!!") : Else : MsgBox("Printing is complete!!") : End If
  901. Catch ex As Exception
  902. MsgBox(ex.Message)
  903. End Try
  904. End If
  905. End If
  906. End If
  907. End If
  908. End If
  909. End Sub
  910. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  911. Return CType(xlBook.Worksheets.Add, Worksheet)
  912. End Function
  913. Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  914. xlSheet.Cells.Select()
  915. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  916. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  917. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 95
  918. xlSheet.Rows("2:3").Select
  919. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 18 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  920. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  921. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 30 : xlSheet.Columns("B:D").Select : myExcel.Selection.ColumnWidth = 15
  922. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 30 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 15
  923. xlSheet.Rows("4:7").Select : myExcel.Selection.RowHeight = 40
  924. xlSheet.Range("B4:F4").Select()
  925. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  926. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  927. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  928. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  929. xlSheet.Range("B5:F5").Select() : With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False
  930. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  931. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  932. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  933. xlSheet.Range("B6:F6").Select()
  934. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  935. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  936. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  937. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  938. xlSheet.Range("B7:F7").Select()
  939. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  940. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  941. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  942. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  943. xlSheet.Range("A2:F2").Select()
  944. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  945. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  946. xlSheet.Range("A3:F3").Select()
  947. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  948. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  949. xlSheet.Rows("8:10").Select : myExcel.Selection.RowHeight = 40
  950. xlSheet.Range("B8:D8").Select()
  951. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  952. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  953. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  954. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  955. xlSheet.Range("B9:D9").Select()
  956. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  957. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  958. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  959. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  960. xlSheet.Range("B10:D10").Select()
  961. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  962. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  963. xlSheet.Range("F8:F10").Select()
  964. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  965. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  966. xlSheet.Range("B11:F12").Select()
  967. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  968. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  969. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False
  970. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  971. xlSheet.Range("A11:A25").Select()
  972. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  973. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  974. xlSheet.Range("D24:F24").Select()
  975. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  976. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  977. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  978. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  979. xlSheet.Rows("24:24").Select : myExcel.Selection.RowHeight = 13.5
  980. xlSheet.Range("C24").Select()
  981. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  982. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  983. xlSheet.Range("C25").Select()
  984. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  985. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  986. xlSheet.Range("D25").Select()
  987. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  988. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  989. xlSheet.Rows("26:26").Select : myExcel.Selection.RowHeight = 13.5
  990. xlSheet.Range("A26:A37").Select()
  991. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  992. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  993. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False
  994. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  995. xlSheet.Range("A11:A25").Select()
  996. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False
  997. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  998. xlSheet.Range("B26:F35").Select()
  999. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1000. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1001. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False
  1002. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1003. xlSheet.Range("C36").Select()
  1004. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1005. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1006. xlSheet.Range("C37").Select()
  1007. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1008. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1009. xlSheet.Range("A4:F10").Select()
  1010. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1011. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1012. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1013. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1014. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1015. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1016. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1017. xlSheet.Range("B11:F25").Select()
  1018. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1019. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1020. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1021. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1022. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1023. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1024. xlSheet.Range("A11:A25").Select()
  1025. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1026. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1027. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1028. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1029. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1030. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1031. xlSheet.Range("A26:A37").Select()
  1032. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1033. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1034. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1035. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1036. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1037. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1038. xlSheet.Range("B26:F37").Select()
  1039. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1040. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1041. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1042. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1043. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1044. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1045. xlSheet.Range("A4:F37").Select()
  1046. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1047. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1048. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1049. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1050. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1051. xlSheet.Range("A38:F41").Select()
  1052. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1053. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1054. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1055. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1056. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1057. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1058. myExcel.ActiveWindow.DisplayGridlines = False
  1059. xlSheet.Range("D23:F24").Select()
  1060. With myExcel.Selection : .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1061. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.UnMerge
  1062. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1063. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1064. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  1065. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1066. xlSheet.Range("D21").Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  1067. xlSheet.Range("I6").Select()
  1068. End Sub
  1069. Private Sub BB(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  1070. xlSheet.Cells.Select()
  1071. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  1072. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1073. xlSheet.Range("D15:F18").Select()
  1074. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 14 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  1075. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1076. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 5 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 40
  1077. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 17
  1078. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 17
  1079. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 17
  1080. xlSheet.Columns("I:I").Select : myExcel.Selection.ColumnWidth = 10
  1081. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 95 : xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 30
  1082. xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 50 : xlSheet.Rows("5:5").Select : myExcel.Selection.RowHeight = 25
  1083. xlSheet.Rows("7:7").Select : myExcel.Selection.RowHeight = 40 : xlSheet.Rows("8:12").Select : myExcel.Selection.RowHeight = 30
  1084. xlSheet.Rows("13:13").Select : myExcel.Selection.RowHeight = 30 : xlSheet.Rows("14:21").Select : myExcel.Selection.RowHeight = 30
  1085. xlSheet.Rows("23:23").Select : myExcel.Selection.RowHeight = 120
  1086. xlSheet.Range("A2:I2").Select()
  1087. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1088. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1089. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  1090. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1091. myExcel.Selection.Font.Underline = xlUnderlineStyleSingle
  1092. xlSheet.Range("A3:G3").Select()
  1093. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1094. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1095. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1096. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1097. xlSheet.Range("H3:I3").Select()
  1098. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1099. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1100. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1101. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1102. xlSheet.Range("A4:G4").Select()
  1103. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1104. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1105. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1106. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1107. With myExcel.Selection : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1108. .ReadingOrder = xlContext : End With
  1109. xlSheet.Range("H4:I4").Select()
  1110. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  1111. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1112. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  1113. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1114. xlSheet.Range("A5:D5").Select()
  1115. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1116. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1117. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1118. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1119. xlSheet.Range("E5:I5").Select()
  1120. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1121. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1122. myExcel.Selection.NumberFormatLocal = "#,##0"
  1123. xlSheet.Range("E7:F7").Select()
  1124. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1125. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1126. xlSheet.Range("G7:H7").Select()
  1127. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1128. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1129. xlSheet.Range("A7:I7").Select()
  1130. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1131. .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  1132. xlSheet.Range("A8:A12").Select()
  1133. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1134. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1135. xlSheet.Range("A8:B12").Select()
  1136. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1137. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1138. xlSheet.Range("C8:C12").Select() : myExcel.Selection.Style = "Percent"
  1139. xlSheet.Range("E8:E13").Select() : myExcel.Selection.Style = "Percent"
  1140. xlSheet.Range("G8:G13").Select() : myExcel.Selection.Style = "Percent"
  1141. xlSheet.Range("D8:D18").Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  1142. xlSheet.Range("F8:F13").Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  1143. xlSheet.Range("H8:H13").Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  1144. xlSheet.Range("A13:C13").Select()
  1145. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1146. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1147. xlSheet.Range("B15:B16").Select()
  1148. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1149. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1150. xlSheet.Range("D15:E15").Select()
  1151. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1152. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1153. xlSheet.Range("D16:E16").Select()
  1154. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1155. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1156. xlSheet.Range("D17:E17").Select()
  1157. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1158. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1159. xlSheet.Range("D18:F18").Select()
  1160. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1161. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1162. xlSheet.Range("B21:D21").Select()
  1163. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1164. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1165. xlSheet.Range("B22:D22").Select()
  1166. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1167. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1168. xlSheet.Range("A3:I4").Select()
  1169. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1170. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1171. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1172. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1173. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1174. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1175. xlSheet.Range("A5:I5").Select()
  1176. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1177. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1178. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1179. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1180. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1181. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1182. xlSheet.Range("A7:I7").Select()
  1183. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1184. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1185. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1186. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1187. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1188. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1189. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1190. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1191. xlSheet.Range("A8:I12").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 = xlMedium : End With
  1194. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1195. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1196. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1197. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1198. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1199. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1200. xlSheet.Range("A13:I13").Select()
  1201. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1202. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1203. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1204. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1205. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1206. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1207. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1208. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1209. xlSheet.Range("B16:E16").Select()
  1210. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1211. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  1212. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1213. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1214. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1215. xlSheet.Range("D18:F18").Select()
  1216. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1217. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  1218. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1219. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1220. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1221. xlSheet.Range("A14:I23").Select()
  1222. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1223. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1224. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1225. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1226. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1227. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1228. xlSheet.Range("J16").Select() : myExcel.ActiveWindow.DisplayGridlines = False
  1229. xlSheet.Range("C7:D12").Select() : With myExcel.Selection.Font : .ThemeColor = xlThemeColorAccent6 : .TintAndShade = 0 : End With
  1230. xlSheet.Range("D13").Select() : With myExcel.Selection.Font : .ThemeColor = xlThemeColorAccent6 : .TintAndShade = 0 : End With
  1231. xlSheet.Range("E7:F13").Select() : With myExcel.Selection.Font : .Color = -16776961 : .TintAndShade = 0 : End With
  1232. xlSheet.Range("G7:H13").Select() : With myExcel.Selection.Font : .ThemeColor = xlThemeColorAccent1 : .TintAndShade = 0 : End With
  1233. xlSheet.Range("A7:I13").Select() : myExcel.Selection.Font.Bold = True
  1234. End Sub
  1235. Private Sub BB2(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  1236. xlSheet.Cells.Select()
  1237. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  1238. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1239. xlSheet.Range("D14:F17").Select()
  1240. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 14 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  1241. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1242. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 5 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 40
  1243. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 17
  1244. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 17
  1245. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 17
  1246. xlSheet.Columns("I:I").Select : myExcel.Selection.ColumnWidth = 10
  1247. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 95 : xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 30
  1248. xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 50 : xlSheet.Rows("5:5").Select : myExcel.Selection.RowHeight = 25
  1249. xlSheet.Rows("7:7").Select : myExcel.Selection.RowHeight = 40 : xlSheet.Rows("8:11").Select : myExcel.Selection.RowHeight = 30
  1250. xlSheet.Rows("12:12").Select : myExcel.Selection.RowHeight = 30 : xlSheet.Rows("13:20").Select : myExcel.Selection.RowHeight = 30
  1251. xlSheet.Rows("22:22").Select : myExcel.Selection.RowHeight = 120
  1252. xlSheet.Range("A2:I2").Select()
  1253. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1254. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1255. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  1256. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1257. myExcel.Selection.Font.Underline = xlUnderlineStyleSingle
  1258. xlSheet.Range("A3:G3").Select()
  1259. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1260. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1261. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1262. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1263. xlSheet.Range("H3:I3").Select()
  1264. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1265. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1266. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1267. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1268. xlSheet.Range("A4:G4").Select()
  1269. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1270. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1271. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1272. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1273. With myExcel.Selection : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  1274. .ReadingOrder = xlContext : End With
  1275. xlSheet.Range("H4:I4").Select()
  1276. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  1277. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1278. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  1279. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1280. xlSheet.Range("A5:D5").Select()
  1281. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1282. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1283. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1284. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1285. xlSheet.Range("E5:I5").Select()
  1286. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1287. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1288. myExcel.Selection.NumberFormatLocal = "#,##0"
  1289. xlSheet.Range("E7:F7").Select()
  1290. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1291. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1292. xlSheet.Range("G7:H7").Select()
  1293. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1294. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1295. xlSheet.Range("A7:I7").Select()
  1296. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1297. .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  1298. xlSheet.Range("A8:A11").Select()
  1299. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1300. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1301. xlSheet.Range("A8:B11").Select()
  1302. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1303. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1304. xlSheet.Range("C8:C11").Select() : myExcel.Selection.Style = "Percent"
  1305. xlSheet.Range("E8:E12").Select() : myExcel.Selection.Style = "Percent"
  1306. xlSheet.Range("G8:G12").Select() : myExcel.Selection.Style = "Percent"
  1307. xlSheet.Range("D8:D17").Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  1308. xlSheet.Range("F8:F12").Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  1309. xlSheet.Range("H8:H12").Select() : myExcel.Selection.NumberFormatLocal = "#,##0"
  1310. xlSheet.Range("A12:C12").Select()
  1311. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1312. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1313. xlSheet.Range("B14:B15").Select()
  1314. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1315. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1316. xlSheet.Range("D14:E14").Select()
  1317. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1318. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1319. xlSheet.Range("D15:E15").Select()
  1320. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1321. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1322. xlSheet.Range("D16:E16").Select()
  1323. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1324. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1325. xlSheet.Range("D17:F17").Select()
  1326. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1327. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1328. xlSheet.Range("B20:D20").Select()
  1329. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1330. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1331. xlSheet.Range("B21:D21").Select()
  1332. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1333. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1334. xlSheet.Range("A3:I4").Select()
  1335. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1336. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1337. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1338. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1339. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1340. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1341. xlSheet.Range("A5:I5").Select()
  1342. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1343. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1344. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1345. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1346. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1347. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1348. xlSheet.Range("A7:I7").Select()
  1349. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1350. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1351. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1352. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1353. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1354. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1355. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1356. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1357. xlSheet.Range("A8:I11").Select()
  1358. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1359. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1360. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1361. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1362. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1363. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1364. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1365. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1366. xlSheet.Range("A12:I12").Select()
  1367. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1368. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1369. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1370. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1371. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1372. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1373. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1374. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1375. xlSheet.Range("B15:E15").Select()
  1376. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1377. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  1378. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1379. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1380. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1381. xlSheet.Range("D17:F17").Select()
  1382. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1383. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  1384. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1385. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1386. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1387. xlSheet.Range("A13:I22").Select()
  1388. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1389. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1390. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1391. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1392. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  1393. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1394. xlSheet.Range("J16").Select() : myExcel.ActiveWindow.DisplayGridlines = False
  1395. xlSheet.Range("C7:D11").Select() : With myExcel.Selection.Font : .ThemeColor = xlThemeColorAccent6 : .TintAndShade = 0 : End With
  1396. xlSheet.Range("D12").Select() : With myExcel.Selection.Font : .ThemeColor = xlThemeColorAccent6 : .TintAndShade = 0 : End With
  1397. xlSheet.Range("E7:F12").Select() : With myExcel.Selection.Font : .Color = -16776961 : .TintAndShade = 0 : End With
  1398. xlSheet.Range("G7:H12").Select() : With myExcel.Selection.Font : .ThemeColor = xlThemeColorAccent1 : .TintAndShade = 0 : End With
  1399. xlSheet.Range("A7:I12").Select() : myExcel.Selection.Font.Bold = True
  1400. End Sub
  1401. Private Sub AB(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  1402. Dim 位置 As String
  1403. xlSheet.Cells.Select()
  1404. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  1405. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1406. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 5 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 30
  1407. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 3 : xlSheet.Columns("D:E").Select : myExcel.Selection.ColumnWidth = 40
  1408. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 95
  1409. xlSheet.Range("A2:E2").Select()
  1410. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1411. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1412. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 18 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  1413. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1414. myExcel.Selection.Font.Underline = xlUnderlineStyleSingle
  1415. xlSheet.Range("A4:E4").Select()
  1416. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1417. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1418. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1419. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1420. xlSheet.Range("A6:B6").Select()
  1421. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1422. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1423. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1424. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1425. xlSheet.Range("C6:E6").Select()
  1426. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1427. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1428. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1429. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1430. xlSheet.Range("A7:B7").Select()
  1431. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1432. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1433. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1434. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1435. xlSheet.Rows("7:7").Select : myExcel.Selection.RowHeight = 30
  1436. xlSheet.Range("C7:E7").Select()
  1437. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1438. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1439. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  1440. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1441. xlSheet.Range("A9:E9").Select()
  1442. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1443. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1444. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1445. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1446. xlSheet.Range("A6:B7").Select()
  1447. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1448. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  1449. xlSheet.Range("A11:B11").Select()
  1450. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1451. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1452. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1453. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1454. xlSheet.Range("A12:B12").Select()
  1455. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1456. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1457. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1458. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1459. xlSheet.Range("C11:E11").Select()
  1460. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1461. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1462. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1463. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1464. xlSheet.Rows("12:12").Select : myExcel.Selection.RowHeight = 30
  1465. xlSheet.Range("C12:E12").Select()
  1466. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1467. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1468. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  1469. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1470. xlSheet.Range("A14:E14").Select()
  1471. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1472. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1473. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1474. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1475. If 請款期數_cb.Text = "四" Then : 位置 = "D16:D21" : Else : 位置 = "D16:D20" : End If : xlSheet.Range(位置).Select()
  1476. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1477. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1478. If 請款期數_cb.Text = "四" Then : 位置 = "C16:C21" : Else : 位置 = "C16:C20" : End If : xlSheet.Range(位置).Select()
  1479. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1480. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1481. If 請款期數_cb.Text = "四" Then
  1482. xlSheet.Rows("23:23").Select : myExcel.Selection.RowHeight = 30
  1483. xlSheet.Range("A23:E23").Select()
  1484. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1485. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1486. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  1487. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1488. Else : End If
  1489. If 請款期數_cb.Text = "四" Then
  1490. xlSheet.Rows("24:24").Select : myExcel.Selection.RowHeight = 30 : 位置 = "A24:E24" : xlSheet.Range(位置).Select()
  1491. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1492. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1493. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1494. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1495. Else
  1496. xlSheet.Rows("22:22").Select : myExcel.Selection.RowHeight = 30 : 位置 = "A22:E22" : xlSheet.Range(位置).Select()
  1497. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1498. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1499. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False
  1500. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1501. End If
  1502. If 請款期數_cb.Text = "四" Then : 位置 = "A25:E25" : Else : 位置 = "A23:E23" : End If : xlSheet.Range(位置).Select()
  1503. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1504. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1505. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1506. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1507. If 請款期數_cb.Text = "四" Then : xlSheet.Range("D27").Select() : Else : xlSheet.Range("D25").Select() : End If
  1508. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1509. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1510. If 請款期數_cb.Text = "四" Then : xlSheet.Range("E27").Select() : Else : xlSheet.Range("E25").Select() : End If
  1511. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1512. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1513. If 請款期數_cb.Text = "四" Then : xlSheet.Range("E29:E31").Select() : Else : xlSheet.Range("E27:E29").Select() : End If
  1514. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1515. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1516. If 請款期數_cb.Text = "四" Then : xlSheet.Range("B31:D31").Select() : Else : xlSheet.Range("B29:D29").Select() : End If
  1517. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1518. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1519. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1520. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1521. If 請款期數_cb.Text = "四" Then : xlSheet.Range("B30").Select() : Else : xlSheet.Range("B28").Select() : End If
  1522. With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  1523. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1524. If 請款期數_cb.Text = "四" Then : xlSheet.Rows("32:32").Select : Else : xlSheet.Rows("30:30").Select : End If : myExcel.Selection.RowHeight = 100
  1525. myExcel.ActiveWindow.DisplayGridlines = False
  1526. End Sub
  1527. Private Sub CC(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  1528. Clipboard.SetDataObject(PictureBox1.Image)
  1529. xlSheet.Range("A1").Select()
  1530. myExcel.ActiveSheet.Pictures.Paste.Select
  1531. myExcel.Selection.ShapeRange.Height = 93
  1532. myExcel.Selection.ShapeRange.IncrementLeft(0)
  1533. myExcel.Selection.ShapeRange.IncrementTop(0)
  1534. End Sub
  1535. Private Sub DD(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  1536. Clipboard.SetDataObject(PictureBox2.Image)
  1537. xlSheet.Range("A1").Select()
  1538. myExcel.ActiveSheet.Pictures.Paste.Select
  1539. myExcel.Selection.ShapeRange.Height = 93
  1540. myExcel.Selection.ShapeRange.IncrementLeft(0)
  1541. myExcel.Selection.ShapeRange.IncrementTop(0)
  1542. End Sub
  1543. Private Sub JCS(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  1544. Clipboard.SetDataObject(JCS_PB.Image)
  1545. xlSheet.Range("A1").Select()
  1546. myExcel.ActiveSheet.Pictures.Paste.Select
  1547. myExcel.Selection.ShapeRange.Height = 93
  1548. myExcel.Selection.ShapeRange.IncrementLeft(0)
  1549. myExcel.Selection.ShapeRange.IncrementTop(0)
  1550. End Sub
  1551. Private Sub J2(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  1552. Clipboard.SetDataObject(J2_PB.Image)
  1553. xlSheet.Range("A1").Select()
  1554. myExcel.ActiveSheet.Pictures.Paste.Select
  1555. myExcel.Selection.ShapeRange.Height = 93
  1556. myExcel.Selection.ShapeRange.IncrementLeft(0)
  1557. myExcel.Selection.ShapeRange.IncrementTop(0)
  1558. End Sub
  1559. Private Sub FF(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  1560. myExcel.Application.PrintCommunication = False : With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "" : .PrintTitleColumns = "" : End With
  1561. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  1562. With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "第 &P 頁,共 &N 頁" : .RightFooter = ""
  1563. .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
  1564. .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
  1565. .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
  1566. .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = True : .CenterVertically = False : .Draft = False
  1567. .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = False : .OddAndEvenPagesHeaderFooter = False
  1568. .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True
  1569. .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" : .EvenPage.LeftFooter.Text = ""
  1570. .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = ""
  1571. .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = ""
  1572. End With : myExcel.Application.PrintCommunication = True
  1573. End Sub
  1574. End Class