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

財物支付單申請_傳票.vb 175KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750
  1. Option Strict Off
  2. Imports System.IO
  3. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  4. Imports Microsoft.Office.Interop.Excel.Constants
  5. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  6. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  7. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  8. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  9. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  10. Imports Microsoft.Office.Interop.Excel.XlWindowState
  11. Imports Microsoft.Office.Interop.Excel
  12. Public Class 財物支付單申請_傳票
  13. Dim SK1, SK2 As String : Dim 不可編輯x, 已開啟 As Boolean
  14. Dim 新項次 As String : Dim 新流水1 As String : Dim 新流水2 As String
  15. Dim NUM1 As Integer : Dim 匯率1 As Double : Dim 對話框(20) As String
  16. Dim xlApp As Application
  17. Dim xlBook As Workbook
  18. Dim xlSheet As Worksheet
  19. Private Sub 語言轉換讀取()
  20. If 系統語言 = "繁體中文" Then : 語言 = "CH" : ElseIf 系統語言 = "English" Then : 語言 = "EN" : ElseIf 系統語言 = "Indonesian" Then : 語言 = "IN" : End If
  21. If 跨部門開啟 = False Then : Me.Text = 系統語言字典("H001-112-" & 語言) : Else : Me.Text = 系統語言字典("H001-113-" & 語言) : End If
  22. 財務單號_lb.Text = 系統語言字典("H301-129-" & 語言) : Label1.Text = 系統語言字典("H314-100-" & 語言) : Label2.Text = 系統語言字典("H314-101-" & 語言)
  23. Label3.Text = 系統語言字典("H314-102-" & 語言) : Label4.Text = 系統語言字典("H314-103-" & 語言) : Label5.Text = 系統語言字典("H314-104-" & 語言)
  24. Label6.Text = 系統語言字典("H314-105-" & 語言) : 會計科目_lb.Text = 系統語言字典("H301-120-" & 語言) : 表頭(113) = 系統語言字典("H204-120-" & 語言)
  25. 表頭(112) = 系統語言字典("H301-107-" & 語言) : 表頭(39) = 系統語言字典("H301-134-" & 語言) : 表頭(111) = 系統語言字典("H301-108-" & 語言)
  26. 表頭(20) = 系統語言字典("H314-124-" & 語言) : 表頭(107) = 系統語言字典("H301-111-" & 語言) : 表頭(109) = 系統語言字典("H301-109-" & 語言)
  27. 表頭(11) = 系統語言字典("H301-112-" & 語言) : 表頭(114) = 系統語言字典("H301-113-" & 語言) : 表頭(98) = 系統語言字典("H301-114-" & 語言)
  28. 表頭(115) = 系統語言字典("H301-116-" & 語言) : 表頭(108) = 系統語言字典("H301-117-" & 語言) : 表頭(110) = 系統語言字典("H301-115-" & 語言)
  29. Label8.Text = 系統語言字典("H314-106-" & 語言) : Label9.Text = 系統語言字典("H314-107-" & 語言) : Label10.Text = 系統語言字典("H314-108-" & 語言)
  30. Label11.Text = 系統語言字典("H314-109-" & 語言) : Label12.Text = 系統語言字典("H314-110-" & 語言) : 對話框(2) = 系統語言字典("H301-125-" & 語言)
  31. 對話框(3) = 系統語言字典("G000-117-" & 語言) : 對話框(1) = 系統語言字典("H301-124-" & 語言) : 表頭(1) = 系統語言字典("H314-106-" & 語言)
  32. 對話框(4) = 系統語言字典("H301-127-" & 語言) : 對話框(5) = 系統語言字典("H302-119-" & 語言) : 對話框(6) = 系統語言字典("H302-120-" & 語言)
  33. 對話框(7) = 系統語言字典("H302-121-" & 語言) : 表頭(2) = 系統語言字典("H507-121-" & 語言) : 表頭(3) = 系統語言字典("H314-111-" & 語言)
  34. 對話框(8) = 系統語言字典("H314-112-" & 語言) : Label18.Text = 系統語言字典("H314-113-" & 語言) : Label15.Text = 系統語言字典("H314-114-" & 語言)
  35. Label17.Text = 系統語言字典("H314-115-" & 語言) : Label16.Text = 系統語言字典("H314-116-" & 語言) : Label19.Text = 系統語言字典("H301-140-" & 語言)
  36. 對話框(9) = 系統語言字典("H314-123-" & 語言) : Label20.Text = 系統語言字典("H314-124-" & 語言) : 對話框(10) = 系統語言字典("H303-129-" & 語言)
  37. 對話框(11) = 系統語言字典("H303-102-" & 語言) : 對話框(12) = 系統語言字典("H303-101-" & 語言) : 對話框(13) = 系統語言字典("H611-112-" & 語言)
  38. 對話框(14) = 系統語言字典("H611-111-" & 語言) : 對話框(15) = 系統語言字典("H611-113-" & 語言) : 對話框(16) = 系統語言字典("H405-105-" & 語言)
  39. 對話框(17) = 系統語言字典("H405-104-" & 語言) : 對話框(18) = 系統語言字典("H405-106-" & 語言) : Label21.Text = 系統語言字典("H303-108-" & 語言)
  40. 月_ch.Text = 系統語言字典("H306-106-" & 語言) : 週_ch.Text = 系統語言字典("H303-139-" & 語言) : 日_ch.Text = 系統語言字典("H303-140-" & 語言)
  41. 解開星期五_ch.Text = 系統語言字典("H314-129-" & 語言)
  42. 修改BT()
  43. End Sub
  44. Private Sub 修改BT()
  45. If 月_ch.Checked Then
  46. 當月_bt.Text = 對話框(10) : 上個月_bt.Text = 對話框(11) : 下個月_bt.Text = 對話框(12)
  47. ElseIf 週_ch.Checked Then
  48. 當月_bt.Text = 對話框(13) : 上個月_bt.Text = 對話框(14) : 下個月_bt.Text = 對話框(15)
  49. Else
  50. 當月_bt.Text = 對話框(16) : 上個月_bt.Text = 對話框(17) : 下個月_bt.Text = 對話框(18)
  51. End If
  52. End Sub
  53. Private Sub 載入支付對象()
  54. Dim ds1 As New DataSet : 支付對象1_dgv.DataSource = Nothing : ds1.Clear()
  55. 支付對象1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  56. 支付對象1_dgv.ColumnHeadersHeight = 40 : 支付對象1_dgv.AllowUserToAddRows = False
  57. SQL_支付對象選單()
  58. da.Fill(ds1) : 支付對象1_dgv.DataSource = ds1.Tables(0) : conn.Close()
  59. Dim ds2 As New DataSet : 支付對象2_dgv.DataSource = Nothing : ds2.Clear()
  60. 支付對象2_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  61. 支付對象2_dgv.ColumnHeadersHeight = 40 : 支付對象2_dgv.AllowUserToAddRows = False
  62. SQL_支付對象選單2()
  63. da.Fill(ds2) : 支付對象2_dgv.DataSource = ds2.Tables(0) : conn.Close()
  64. 支付對象_cb.Items.Clear()
  65. For i As Integer = 0 To 支付對象1_dgv.Rows.Count - 1
  66. 支付對象_cb.Items.Add("A-" & 支付對象1_dgv.Rows(i).Cells(2).Value.ToString)
  67. Next
  68. For j As Integer = 0 To 支付對象2_dgv.Rows.Count - 1
  69. Dim 要加入cb As Boolean = True
  70. Dim 要加入的文字 As String = 支付對象2_dgv.Rows(j).Cells(0).Value.ToString
  71. For k As Integer = 0 To 支付對象1_dgv.Rows.Count - 1
  72. If 要加入的文字 = 支付對象1_dgv.Rows(k).Cells(2).Value.ToString Then
  73. 要加入cb = False
  74. Exit For
  75. End If
  76. Next
  77. If 要加入cb Then
  78. 支付對象_cb.Items.Add("B-" & 要加入的文字)
  79. End If
  80. Next
  81. End Sub
  82. Private Sub Set_清單1()
  83. Dim ds1 As New DataSet : 財務收支單_dgv.DataSource = Nothing : ds1.Clear()
  84. 財務收支單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  85. 財務收支單_dgv.ColumnHeadersHeight = 40 : 財務收支單_dgv.AllowUserToAddRows = False
  86. If 條件_cb.Text = "N/A" Then
  87. SQL2 = " AND (財務收支控制表.審核人 IS NULL OR 財務收支控制表.審核人 LIKE '') "
  88. ElseIf 條件_cb.Text = "App" Then
  89. SQL2 = " AND (財務收支控制表.審核人 NOT LIKE '') AND (財務收支控制表.審核人 NOT LIKE N'作廢%') AND (財務收支控制表.審核人 IS NOT NULL) "
  90. ElseIf 條件_cb.Text = "Void" Then
  91. SQL2 = " AND (財務收支控制表.審核人 LIKE N'作廢-%') "
  92. End If
  93. If 跨部門開啟 = False Then '-------申請登入時
  94. PA25 = 部門選單_cb.Text & SK2 & SK1 & 年份2_cb.Text
  95. Dim 時間條件 As String = "AND (財務收支明細表.支付日期 BETWEEN '" & Strings.Format(開始日期_dtp.Value, "yyyy/MM/dd") & "' AND
  96. '" & Strings.Format(結束日期_dtp.Value, "yyyy/MM/dd") & "') "
  97. Dim 條件 As String
  98. If HX_ch.Checked Then : 條件 = " AND (財務收支明細表.流水號 LIKE N'%HXI%') "
  99. ElseIf PGS_ch.Checked Then : 條件 = " AND (財務收支明細表.流水號 LIKE N'%PGS%') " : Else : 條件 = "" : End If
  100. SQL_財物支付單申請_查詢財務收支控制表(時間條件, 條件)
  101. ElseIf 跨部門開啟 = True Then '-------審核登入時
  102. Dim 條件, 時間條件, 審核條件 As String
  103. If HX_ch.Checked Then : 條件 = " AND (財務收支明細表.流水號 LIKE N'%HXI%') " '審X主X O
  104. ElseIf PGS_ch.Checked Then : 條件 = " AND (財務收支明細表.流水號 LIKE N'%PGS%') " '審O主X X
  105. Else : 條件 = "" : End If '審O主O O
  106. 時間條件 = "AND (財務收支明細表.支付日期 BETWEEN '" & Strings.Format(開始日期_dtp.Value, "yyyy/MM/dd") & "' AND '" & Strings.Format(結束日期_dtp.Value, "yyyy/MM/dd") & "') "
  107. 審核條件 = ""
  108. SQL_財物支付單申請_查詢財務收支控制表1(條件, 時間條件, 審核條件)
  109. End If : SQL2 = ""
  110. da.Fill(ds1) : 財務收支單_dgv.DataSource = ds1.Tables(0) : conn.Close()
  111. 財務收支單_dgv.Columns(0).FillWeight = 125 : 財務收支單_dgv.Columns(1).FillWeight = 75 : 財務收支單_dgv.Columns(2).FillWeight = 120
  112. 財務收支單_dgv.Columns(11).FillWeight = 40 : 財務收支單_dgv.Columns(12).FillWeight = 40
  113. 財務收支單_dgv.Columns("核准圖檔").Visible = False : 財務收支單_dgv.Columns(11).Visible = False : 財務收支單_dgv.Columns(12).Visible = False
  114. 財務收支單_dgv.Columns("檢查人").Visible = False : 財務收支單_dgv.Columns("主管人").Visible = False : 財務收支單_dgv.Columns("申請日期").Visible = False
  115. For I As Integer = 3 To 10 : 財務收支單_dgv.Columns(I).Visible = False : Next : For I As Integer = 13 To 15 : 財務收支單_dgv.Columns(I).Visible = False : Next
  116. 財務收支單_dgv.Columns(0).ReadOnly = True : 財務收支單_dgv.Columns(1).ReadOnly = True : 財務收支單_dgv.Columns(2).ReadOnly = True
  117. For I As Integer = 0 To 財務收支單_dgv.Rows.Count - 1
  118. 財務收支單_dgv.Rows(I).Cells(11).Value = False : 財務收支單_dgv.Rows(I).Cells(12).Value = False
  119. If Strings.Left(財務收支單_dgv.Rows(I).Cells(10).Value.ToString, 2) = "作廢" Or Strings.Left(財務收支單_dgv.Rows(I).Cells("主管人").Value.ToString, 2) = "作廢" Then
  120. 財務收支單_dgv.Rows(I).Cells(12).Value = True
  121. End If
  122. If 財務收支單_dgv.Rows(I).Cells("主管人").Value.ToString <> "" Then
  123. If 財務收支單_dgv.Rows(I).Cells("主管人").Value.ToString.Substring(0, 2) <> "作廢" Then
  124. 財務收支單_dgv.Rows(I).Cells(11).Value = True
  125. End If
  126. End If
  127. Next
  128. End Sub
  129. Private Sub 部門選單下拉清單讀取()
  130. SQL_部門選單() : 部門選單_cb.Items.Clear() : While (dr.Read()) : 部門選單_cb.Items.Add(dr("部門")) : End While : conn.Close()
  131. End Sub
  132. Private Sub 第三層下拉表單資料載入()
  133. PA26 = 編號2_cb.Text : SQL_財務單會計科目3() : 第三層_cb.Items.Clear() : 編號3_cb.Items.Clear() : 第三層_cb.Items.Add("") : 編號3_cb.Items.Add("")
  134. While (dr.Read()) : 第三層_cb.Items.Add(dr("會計科目")) : 編號3_cb.Items.Add(dr("編號")) : End While : conn.Close()
  135. If 第三層_cb.Items.Count <> 0 Then : 第三層_cb.SelectedIndex = 0 : End If
  136. End Sub
  137. Private Sub 第一層下拉表單資料載入()
  138. SQL_財務單會計科目1() : 第一層_cb.Items.Clear() : 編號1_cb.Items.Clear()
  139. While (dr.Read()) : 第一層_cb.Items.Add(dr("第一階")) : 編號1_cb.Items.Add(dr("編號")) : End While : conn.Close() : 第一層_cb.Text = "" : 編號1_cb.Text = ""
  140. End Sub
  141. Private Sub 第二層下拉表單資料載入()
  142. PA25 = 編號1_cb.Text : SQL_財務單會計科目2() : 第二層_cb.Items.Clear() : 編號2_cb.Items.Clear() : 第二層_cb.Items.Add("") : 編號2_cb.Items.Add("")
  143. While (dr.Read()) : 第二層_cb.Items.Add(dr("第二階")) : 編號2_cb.Items.Add(dr("編號")) : End While : conn.Close() : 第二層_cb.Text = "" : 編號2_cb.Text = ""
  144. End Sub
  145. Private Sub 匯率()
  146. SQL_營運成本收支單申請_查詢匯率()
  147. If dr.Read() Then
  148. 人民幣匯率_tb.Text = dr("中心匯率").ToString : 美金匯率_tb.Text = dr("美金匯率").ToString : 印尼匯率_tb.Text = dr("印尼盾").ToString : conn.Close() : dr.Close()
  149. Else : conn.Close() : dr.Close() : 匯率管理.Close() : 匯率管理.Show() : 匯率管理.BringToFront() : End If
  150. End Sub
  151. Private Sub Set_切換格式()
  152. 明細_dgv.DataSource = Nothing : 單號_tb.Text = "" : 申請人_tb.Text = ""
  153. 第三層下拉表單資料載入() : Set_清單1()
  154. End Sub
  155. Private Sub 財物支付單申請_傳票_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  156. 已開啟 = False
  157. If 跨部門開啟 = False Then : Me.AutoScroll = True : 首次開啟 = True : 申請_p.Visible = True : 審核_p.Visible = False
  158. ElseIf 跨部門開啟 = True Then : Me.MdiParent = HX_PGS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True : 首次開啟 = True : 申請_p.Visible = False : 審核_p.Visible = True : End If
  159. 年份2_cb.Text = Year(Today) : 月份2_cb.SelectedIndex = Month(Today) - 1 : Panel1.SendToBack() : 條件_cb.Text = "N/A" : 支付日期_dtp.Enabled = False
  160. 風格() : H(314) = True : 介面 = "H314" : 語言轉換讀取() : 第一層下拉表單資料載入() : 幣別_cb.Text = "IDR" : 顯示說明(999, False)
  161. MyMod.清單字體大小調整()
  162. 財務收支單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
  163. 已開啟 = True
  164. End Sub
  165. Private Sub 財物支付單申請_傳票_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
  166. 部門選單下拉清單讀取() : 載入支付對象()
  167. SQL_主管名稱(2, 23) : If dr.Read Then : 出納人員 = dr("姓名").ToString : End If
  168. If 跨部門開啟 = False Then : CB選擇清單(部門選單_cb, 部門選單_cb.Text) : CB選擇清單(選擇公司_cb, 選擇公司_cb.Text) : End If
  169. 月_ch.Checked = True : 週_ch.Checked = False : 日_ch.Checked = False : HX_ch.Checked = False : PGS_ch.Checked = False : ALL_ch.Checked = True
  170. 當月_bt.PerformClick()
  171. If PA48 = "採購" Then : 匯率() : 開立收支單_bt.Visible = False : 申請完成_bt.Visible = False : 首次開啟 = False
  172. Else : 匯率() : 幣別_cb.SelectedIndex = 3 : 編號1_cb.Text = "B-02" : 首次開啟 = False : End If : PA48 = "" : 修改BT()
  173. End Sub
  174. Private Sub 財物支付單申請_傳票_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
  175. If 跨部門開啟 = False Then : H(314) = False : 跨部門開啟 = False
  176. ElseIf 跨部門開啟 = True Then : H(314) = False : 跨部門開啟 = False : MyMod.虛擬桌面開啟() : End If
  177. End Sub
  178. Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
  179. 介面 = "H314" : 語言轉換讀取() : Set_清單1() : 第一層下拉表單資料載入() : 幣別_cb.SelectedIndex = 3 : 編號1_cb.Text = "B-02" : 修改BT() : Set_清單1()
  180. End Sub
  181. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  182. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  183. End Sub
  184. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  185. timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
  186. End Sub
  187. Private Sub 財務收支單_dgv_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles 財務收支單_dgv.CellClick
  188. If e.RowIndex = -1 Then : Else
  189. 單號_tb.Text = 財務收支單_dgv(0, e.RowIndex).Value.ToString : 申請日期_dtp.Value = 財務收支單_dgv("申請日期", e.RowIndex).Value.ToString
  190. 申請人_tb.Text = 財務收支單_dgv(2, e.RowIndex).Value.ToString : 系統單號_bt.Text = 財務收支單_dgv(3, e.RowIndex).Value.ToString
  191. 幣別_cb.Text = 財務收支單_dgv(4, e.RowIndex).Value.ToString : 編號1_cb.Text = Strings.Left(財務收支單_dgv("類別", e.RowIndex).Value.ToString, 4)
  192. 編號2_cb.Text = Strings.Left(財務收支單_dgv("類別", e.RowIndex).Value.ToString, 7) : 編號3_cb.Text = 財務收支單_dgv("類別", e.RowIndex).Value.ToString
  193. 金額大寫_tb.Text = 財務收支單_dgv("大寫", e.RowIndex).Value.ToString : 部門選單_cb.Text = Strings.Mid(財務收支單_dgv(0, e.RowIndex).Value.ToString, 5, 3)
  194. 內容_tb.Text = 財務收支單_dgv("明細", e.RowIndex).Value.ToString : 支付對象_tb.Text = 財務收支單_dgv("支付對象", e.RowIndex).Value.ToString
  195. 營行帳號_tb.Text = 財務收支單_dgv("公司", e.RowIndex).Value.ToString : 支付銀行_tb.Text = 財務收支單_dgv("付款銀行", e.RowIndex).Value.ToString
  196. 銀行支行_tb.Text = 財務收支單_dgv("銀行支行", e.RowIndex).Value.ToString : 檢查人_tb.Text = 財務收支單_dgv("檢查人", e.RowIndex).Value.ToString
  197. 主管_tb.Text = 財務收支單_dgv("主管人", e.RowIndex).Value.ToString : 支付對象_cb.Text = 財務收支單_dgv("支付對象", e.RowIndex).Value.ToString
  198. If 財務收支單_dgv(1, e.RowIndex).Value.ToString <> "" Then : 支付日期_dtp.Value = 財務收支單_dgv(1, e.RowIndex).Value : Else : 支付日期_dtp.Value = Today : End If
  199. If 財務收支單_dgv(11, e.RowIndex).Value = True Or 財務收支單_dgv(12, e.RowIndex).Value = True Then : 不可編輯x = True : Else : 不可編輯x = False : End If
  200. If Strings.Left(財務收支單_dgv.Rows(e.RowIndex).Cells(10).Value.ToString, 2) = "作廢" Then
  201. 審核人_tb.Text = 系統語言字典("H314-111-" & 語言) & Strings.Mid(財務收支單_dgv("審核人", e.RowIndex).Value.ToString, 3, 50)
  202. Else : 審核人_tb.Text = 財務收支單_dgv("審核人", e.RowIndex).Value.ToString : End If
  203. 申請金額_nud.Value = CLng(財務收支單_dgv("支出", e.RowIndex).Value.ToString) : 大寫轉換()
  204. If 財務收支單_dgv(0, e.RowIndex).Value.ToString.Contains("HXI") Then : PictureBox1.BringToFront()
  205. ElseIf 財務收支單_dgv(0, e.RowIndex).Value.ToString.Contains("PGS") Then : PictureBox1.SendToBack() : Else : PictureBox1.BringToFront() : End If
  206. PA1 = 財務收支單_dgv("核准圖檔", e.RowIndex).Value.ToString : SQL_主管簽名檔管理_圖片流水號()
  207. 簽名圖_pb.Image = Nothing
  208. While dr.Read() = True
  209. Dim unused As Byte() = New Byte(-1) {}
  210. Dim bytes As Byte() = DirectCast(dr.Item("簽名檔圖片"), Byte())
  211. Dim oStream As New MemoryStream(bytes)
  212. 簽名圖_pb.Image = Bitmap.FromStream(oStream)
  213. End While : conn.Close() : 簽名圖_pb.SizeMode = 4
  214. End If
  215. End Sub
  216. Private Sub ComboBox5_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 第一層_cb.TextChanged
  217. 編號1_cb.SelectedIndex = 第一層_cb.SelectedIndex : 查詢_tb.Text = "" : 第二層下拉表單資料載入() : 第三層下拉表單資料載入()
  218. End Sub
  219. Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 編號1_cb.TextChanged
  220. 第一層_cb.SelectedIndex = 編號1_cb.SelectedIndex : 第二層下拉表單資料載入() : 第三層下拉表單資料載入()
  221. End Sub
  222. Private Sub ComboBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 第二層_cb.TextChanged
  223. 編號2_cb.SelectedIndex = 第二層_cb.SelectedIndex : 第三層下拉表單資料載入()
  224. End Sub
  225. Private Sub ComboBox4_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 編號2_cb.TextChanged
  226. 第二層_cb.SelectedIndex = 編號2_cb.SelectedIndex : 第三層下拉表單資料載入()
  227. End Sub
  228. Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 第三層_cb.SelectedIndexChanged
  229. 編號3_cb.SelectedIndex = 第三層_cb.SelectedIndex
  230. End Sub
  231. Private Sub ComboBox6_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 編號3_cb.SelectedIndexChanged
  232. 第三層_cb.SelectedIndex = 編號3_cb.SelectedIndex
  233. End Sub
  234. Private Sub 部門選單_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 部門選單_cb.SelectedIndexChanged
  235. If 首次開啟 = False Then : Set_清單1() : End If
  236. End Sub
  237. Private Sub 部門選單_cb_Click(sender As Object, e As EventArgs) Handles 部門選單_cb.Click
  238. CB選擇清單(部門選單_cb, 部門選單_cb.Text)
  239. End Sub
  240. Private Sub 重選部門_bt_Click(sender As Object, e As EventArgs) Handles 重選部門_bt.Click
  241. CB選擇清單(部門選單_cb, 部門選單_cb.Text) : CB選擇清單(選擇公司_cb, 選擇公司_cb.Text)
  242. End Sub
  243. Private Sub 第二層_cb_Click(sender As Object, e As EventArgs) Handles 第二層_cb.Click
  244. CB選擇清單(第二層_cb, 第二層_cb.Text)
  245. End Sub
  246. Private Sub 第三層_cb_Click(sender As Object, e As EventArgs) Handles 第三層_cb.Click
  247. CB選擇清單(第三層_cb, 第三層_cb.Text)
  248. End Sub
  249. Private Sub 選擇公司_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 選擇公司_cb.SelectedIndexChanged
  250. If 選擇公司_cb.Text = "PT HONG XHE INDUSTRIAL" Then : PictureBox1.BringToFront() : SK2 = "/HXI-PP/" : Else : PictureBox1.SendToBack() : SK2 = "/PGS-PP/" : End If
  251. If 首次開啟 = False Then : Set_清單1() : End If
  252. End Sub
  253. Private Sub 申請日期_dtp_ValueChanged(sender As Object, e As EventArgs) Handles 申請日期_dtp.ValueChanged
  254. 匯率()
  255. End Sub
  256. Private Sub 年份2_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 年份2_cb.SelectedIndexChanged
  257. If 首次開啟 = False Then : Set_清單1() : End If
  258. End Sub
  259. Private Sub 年份2_cb_Click(sender As Object, e As EventArgs) Handles 年份2_cb.Click
  260. CB選擇清單(年份2_cb, 年份2_cb.Text)
  261. End Sub
  262. Private Sub 月份2_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 月份2_cb.SelectedIndexChanged
  263. If 月份2_cb.Text = "01" Then : SK1 = "I/" : ElseIf 月份2_cb.Text = "02" Then : SK1 = "II/" : ElseIf 月份2_cb.Text = "03" Then : SK1 = "III/"
  264. ElseIf 月份2_cb.Text = "04" Then : SK1 = "IV/" : ElseIf 月份2_cb.Text = "05" Then : SK1 = "V/" : ElseIf 月份2_cb.Text = "06" Then : SK1 = "VI/"
  265. ElseIf 月份2_cb.Text = "07" Then : SK1 = "VII/" : ElseIf 月份2_cb.Text = "08" Then : SK1 = "VIII/" : ElseIf 月份2_cb.Text = "09" Then : SK1 = "IX/"
  266. ElseIf 月份2_cb.Text = "10" Then : SK1 = "X/" : ElseIf 月份2_cb.Text = "11" Then : SK1 = "XI/" : ElseIf 月份2_cb.Text = "12" Then : SK1 = "XII/" : End If
  267. If 首次開啟 = False Then : Set_清單1() : End If
  268. End Sub
  269. Private Sub 月份2_cb_Click(sender As Object, e As EventArgs) Handles 月份2_cb.Click
  270. CB選擇清單(月份2_cb, 月份2_cb.Text)
  271. End Sub
  272. Private Sub Set_日期格式轉換()
  273. If 補單_cb.Checked = False Then : DTP = Strings.Format(Today(), "yyyy/MM/dd") : DTP1 = Strings.Format(Today(), "yyyyMMdd")
  274. Else : DTP1 = Strings.Format(申請日期_dtp.Value, "yyyyMMdd") : DTP = Strings.Format(申請日期_dtp.Value, "yyyy/MM/dd") : End If
  275. End Sub
  276. Private Sub Set_流水號()
  277. Dim NUM1 As Integer
  278. For NUM1 = 0 To 99
  279. Dim d As String : Dim f As String : Dim g As Integer = 1
  280. If Month(Now) < 10 Then : d = "0" & CStr(Month(Now)) : Else : d = CStr(Month(Now)) : End If
  281. If Now.Day() < 10 Then : f = "0" & CStr(Now.Day()) : Else : f = CStr(Now.Day()) : End If
  282. If NUM1 < 10 Then : 新流水1 = "B" & Microsoft.VisualBasic.Right(CStr(Year(Now)), 2) & d & f & "0" & NUM1
  283. Else : 新流水1 = "B" & Microsoft.VisualBasic.Right(CStr(Year(Now)), 2) & d & f & NUM1 : End If : PA19 = 新流水1
  284. SQL_營運成本收支單申請_查詢收支單公帳流水號()
  285. If dr.Read() Then : conn.Close() : Else : conn.Close() : NUM1 = 99 : End If
  286. Next
  287. End Sub
  288. Private Sub 開立收支單_bt_Click(sender As Object, e As EventArgs) Handles 開立收支單_bt.Click
  289. If 編號3_cb.Text = "" Or 幣別_cb.Text = "" Then : MGB(對話框(2), 1) : 首次開啟 = False : Else : 不可編輯x = False
  290. If 補單_cb.Checked = False Then : 申請日期_dtp.Value = Today() : End If : 申請人_tb.Text = gUserName
  291. Dim today1 As Date = Date.Today
  292. Dim dayOfWeek As DayOfWeek = today.DayOfWeek
  293. Dim daysToAdd As Integer = If(dayOfWeek <= DayOfWeek.Friday, DayOfWeek.Friday - dayOfWeek, 7 - (dayOfWeek - DayOfWeek.Friday))
  294. Dim nextFriday As Date = today1.AddDays(daysToAdd)
  295. 支付日期_dtp.Value = nextFriday ' 將 DateTimePicker 控制元件的值設置為下個星期五
  296. Dim NUM1 As Integer
  297. Set_日期格式轉換()
  298. For i As Integer = 1 To 999
  299. NUM1 = 0 + i
  300. If NUM1 < 10 Then : 系統單號_bt.Text = "OE-" & DTP1 & "-00" & NUM1
  301. ElseIf NUM1 > 9 And NUM1 < 100 Then : 系統單號_bt.Text = "OE-" & DTP1 & "-0" & NUM1
  302. ElseIf NUM1 > 99 Then : 系統單號_bt.Text = "OE-" & DTP1 & "-" & NUM1
  303. End If : conn.Close() : PA = 系統單號_bt.Text : PA15 = 系統單號_bt.Text
  304. SQL_營運成本收支單申請_查詢第一筆公帳支付單號()
  305. If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  306. Next : SQL_營運成本收支單申請_新增一筆財務收支控制表() : conn.Close() : 申請人_tb.Text = gUserName
  307. 月份2_cb.Text = Strings.Mid(Strings.Format(申請日期_dtp.Value, "yyyy/MM/dd"), 6, 2)
  308. PA25 = 部門選單_cb.Text & SK2 & SK1 & 年份2_cb.Text : SQL_財物支付單申請_查詢最後一筆公帳支付單號()
  309. If dr.Read() Then : 單號_tb.Text = Strings.Left(dr("流水號").ToString, 3) : Else : 單號_tb.Text = "000" : End If : conn.Close()
  310. 單號_tb.Text = CInt(單號_tb.Text) + 1
  311. If CInt(單號_tb.Text) < 10 Then : 單號_tb.Text = "00" & CInt(單號_tb.Text)
  312. ElseIf CInt(單號_tb.Text) > 9 And CInt(單號_tb.Text) < 100 Then : 單號_tb.Text = "0" & CInt(單號_tb.Text)
  313. ElseIf CInt(單號_tb.Text) > 99 And CInt(單號_tb.Text) < 1000 Then : 單號_tb.Text = CInt(單號_tb.Text) : End If
  314. 單號_tb.Text = 單號_tb.Text & "-" & 部門選單_cb.Text & SK2 & SK1 & 年份2_cb.Text
  315. PA19 = 單號_tb.Text : 新項次 = "01" : PA11 = 新項次
  316. 指定會科 = 編號3_cb.Text : PA13 = "0" : PA14 = 申請金額_nud.Value : PA12 = 內容_tb.Text : PA37 = "" : PA38 = 金額大寫_tb.Text : PA39 = 支付對象_tb.Text
  317. PA40 = 營行帳號_tb.Text : PA41 = 支付銀行_tb.Text : PA42 = 銀行支行_tb.Text
  318. If 幣別_cb.Text = "TWD" Then : 匯率1 = 1 / CDbl(印尼匯率_tb.Text)
  319. ElseIf 幣別_cb.Text = "RMB" Then : 匯率1 = CDbl(人民幣匯率_tb.Text) / CDbl(印尼匯率_tb.Text)
  320. ElseIf 幣別_cb.Text = "USD" Then : 匯率1 = CDbl(美金匯率_tb.Text) / CDbl(印尼匯率_tb.Text)
  321. ElseIf 幣別_cb.Text = "IDR" Then : 匯率1 = 1
  322. End If : PA16 = 匯率1
  323. SQL_新增財物支付單明細表資料(Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd")) : Set_清單1()
  324. End If
  325. End Sub
  326. Private Sub 開立收支單1_bt_Click(sender As Object, e As EventArgs) Handles 開立收支單1_bt.Click
  327. If 編號3_cb.Text = "" Or 幣別_cb.Text = "" Then : MGB(對話框(2), 1) : 首次開啟 = False : Else : 不可編輯x = False
  328. If 補單_cb.Checked = False Then : 申請日期_dtp.Value = Today() : End If : 申請人_tb.Text = gUserName
  329. Dim NUM1 As Integer
  330. Set_日期格式轉換()
  331. For i As Integer = 1 To 999
  332. NUM1 = 0 + i
  333. If NUM1 < 10 Then : 系統單號_bt.Text = "OE-" & DTP1 & "-00" & NUM1
  334. ElseIf NUM1 > 9 And NUM1 < 100 Then : 系統單號_bt.Text = "OE-" & DTP1 & "-0" & NUM1
  335. ElseIf NUM1 > 99 Then : 系統單號_bt.Text = "OE-" & DTP1 & "-" & NUM1
  336. End If : conn.Close() : PA = 系統單號_bt.Text : PA15 = 系統單號_bt.Text
  337. SQL_營運成本收支單申請_查詢第一筆公帳支付單號()
  338. If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  339. Next : SQL_營運成本收支單申請_新增一筆財務收支控制表() : conn.Close() : 申請人_tb.Text = gUserName
  340. 月份2_cb.Text = Strings.Mid(Strings.Format(申請日期_dtp.Value, "yyyy/MM/dd"), 6, 2)
  341. PA25 = 部門選單_cb.Text & SK2 & SK1 & 年份2_cb.Text : SQL_財物支付單申請_查詢最後一筆公帳支付單號()
  342. If dr.Read() Then : 單號_tb.Text = Strings.Left(dr("流水號").ToString, 3) : Else : 單號_tb.Text = "000" : End If : conn.Close()
  343. 單號_tb.Text = CInt(單號_tb.Text) + 1
  344. If CInt(單號_tb.Text) < 10 Then : 單號_tb.Text = "00" & CInt(單號_tb.Text)
  345. ElseIf CInt(單號_tb.Text) > 9 And CInt(單號_tb.Text) < 100 Then : 單號_tb.Text = "0" & CInt(單號_tb.Text)
  346. ElseIf CInt(單號_tb.Text) > 99 And CInt(單號_tb.Text) < 1000 Then : 單號_tb.Text = CInt(單號_tb.Text) : End If
  347. 單號_tb.Text = 單號_tb.Text & "-" & 部門選單_cb.Text & SK2 & SK1 & 年份2_cb.Text
  348. PA19 = 單號_tb.Text : 新項次 = "01" : PA11 = 新項次
  349. 指定會科 = 編號3_cb.Text : PA13 = "0" : PA14 = 申請金額_nud.Value : PA12 = 內容_tb.Text : PA37 = "" : PA38 = 金額大寫_tb.Text : PA39 = 支付對象_tb.Text
  350. PA40 = 營行帳號_tb.Text : PA41 = 支付銀行_tb.Text : PA42 = 銀行支行_tb.Text
  351. If 幣別_cb.Text = "TWD" Then : 匯率1 = 1 / CDbl(印尼匯率_tb.Text)
  352. ElseIf 幣別_cb.Text = "RMB" Then : 匯率1 = CDbl(人民幣匯率_tb.Text) / CDbl(印尼匯率_tb.Text)
  353. ElseIf 幣別_cb.Text = "USD" Then : 匯率1 = CDbl(美金匯率_tb.Text) / CDbl(印尼匯率_tb.Text)
  354. ElseIf 幣別_cb.Text = "IDR" Then : 匯率1 = 1
  355. End If : PA16 = 匯率1
  356. SQL_新增財物支付單明細表資料(Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd")) : Set_清單1()
  357. End If
  358. End Sub
  359. Private Sub 刪除收支單_bt_Click(sender As Object, e As EventArgs) Handles 刪除收支單_bt.Click
  360. If 不可編輯x = False Then
  361. If 系統單號_bt.Text = "" Then : MGB(對話框(3), 1) : 首次開啟 = False : Else
  362. MGB(對話框(4), 2)
  363. If 訊息回應 = "YES" Then
  364. PA20 = 單號_tb.Text
  365. Dim ds1 As New DataSet : 採購連結_dgv.DataSource = Nothing : ds1.Clear()
  366. 採購連結_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  367. 採購連結_dgv.ColumnHeadersHeight = 40 : 採購連結_dgv.AllowUserToAddRows = False
  368. SQL_財務採購關聯表_反改查詢()
  369. da.Fill(ds1) : 採購連結_dgv.DataSource = ds1.Tables(0) : conn.Close()
  370. For I As Integer = 0 To 採購連結_dgv.Rows.Count - 1
  371. PA21 = 採購連結_dgv.Rows(I).Cells("採購單號").Value.ToString : SQL_採購單控制表_反改查詢()
  372. If dr.Read Then : PA22 = CLng(dr("轉財務金額").ToString) - CLng(採購連結_dgv.Rows(I).Cells("轉財務金額").Value.ToString) : End If
  373. SQL_採購單控制表_反改()
  374. Next
  375. SQL_財務採購關聯表_反改()
  376. PA45 = 系統單號_bt.Text : SQL_營運成本收支單申請_刪除財務收支控制表() : SQL_營運成本收支單申請_刪除財務收支明細表() : conn.Close()
  377. 第二層_cb.Text = "" : 編號2_cb.Text = "" : 第三層_cb.Text = "" : 編號3_cb.Text = "" : 申請金額_nud.Value = 0
  378. 單號_tb.Text = "" : 申請人_tb.Text = "" : 金額大寫_tb.Text = "" : 內容_tb.Text = "" : 支付對象_tb.Text = "" : Set_清單1()
  379. End If : 首次開啟 = False
  380. End If
  381. Else : MGB(對話框(8), 1) : 首次開啟 = False : End If
  382. End Sub
  383. Private Sub 申請完成_bt_Click(sender As Object, e As EventArgs) Handles 申請完成_bt.Click
  384. If 不可編輯x = False Then
  385. If 系統單號_bt.Text = "" Then : MGB(對話框(3), 1) : 首次開啟 = False : Else
  386. PA1 = 內容_tb.Text : PA2 = 申請金額_nud.Value : PA4 = 編號3_cb.Text : PA3 = 金額大寫_tb.Text : PA6 = 系統單號_bt.Text : PA9 = "01"
  387. PA7 = 營行帳號_tb.Text : PA8 = 支付銀行_tb.Text : PA10 = 銀行支行_tb.Text : If 支付對象_tb.Text = "" Then : 支付對象_tb.Text = 支付對象_cb.Text : End If
  388. PA5 = 支付對象_tb.Text
  389. SQL_財物支付單修改(Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd")) : Set_清單1() : MGB(對話框(1), 1) : 首次開啟 = False
  390. End If
  391. Else
  392. If 登入人級別 = "00" Then
  393. PA1 = 內容_tb.Text : PA2 = 申請金額_nud.Value : PA4 = 編號3_cb.Text : PA3 = 金額大寫_tb.Text : PA6 = 系統單號_bt.Text : PA9 = "01"
  394. PA7 = 營行帳號_tb.Text : PA8 = 支付銀行_tb.Text : PA10 = 銀行支行_tb.Text : If 支付對象_tb.Text = "" Then : 支付對象_tb.Text = 支付對象_cb.Text : End If
  395. PA5 = 支付對象_tb.Text
  396. SQL_財物支付單修改(Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd")) : Set_清單1() : MGB(對話框(1), 1) : 首次開啟 = False
  397. End If
  398. MGB(對話框(8), 1) : 首次開啟 = False
  399. End If
  400. 解開星期五_ch.Checked = False : 支付日期_dtp.Enabled = False
  401. End Sub
  402. Private Sub 檢查人_bt_Click(sender As Object, e As EventArgs) Handles 檢查人_bt.Click
  403. If CInt(登入人級別) <= 5 Then
  404. If 檢查人_tb.Text = "" Then
  405. 檢查人_tb.Text = gUserName : SQL_財物支付單修改_檢查人(系統單號_bt.Text, 檢查人_tb.Text)
  406. LIN訊息通知("CC209", 出納人員, gUserName, "七日內") : LIN訊息通知("CC209", "李協叡", gUserName, "七日內")
  407. End If
  408. End If
  409. End Sub
  410. Private Sub 主管_bt_Click(sender As Object, e As EventArgs) Handles 主管_bt.Click
  411. If CInt(登入人級別) <= 3 Then
  412. If 主管_tb.Text = "" Then
  413. 主管_tb.Text = gUserName : SQL_財物支付單修改_主管(系統單號_bt.Text, 主管_tb.Text)
  414. End If
  415. End If
  416. End Sub
  417. Private Sub 審核通過_bt_Click(sender As Object, e As EventArgs) Handles 審核通過_bt.Click
  418. If 系統單號_bt.Text = "" Then : MGB(對話框(3), 1) : 首次開啟 = False : Else
  419. Set_日期格式轉換()
  420. If gUserName = 出納人員 Then : SQL_簽名檔查詢(出納人員) : If dr.Read Then : PA27 = dr("圖片流水號").ToString : Else : PA27 = "PG00000004" : End If
  421. Else : PA27 = "" : End If : PA28 = "" : PA29 = 系統單號_bt.Text
  422. SQL_營運成本收支單審核_修改財務收支控制表()
  423. SQL_營運成本收支單審核_修改財務收支明細表()
  424. PA1 = "01" : SQL_營運成本收支單審核_修改財務收支明細表備用金() : SQL_營運成本收支單審核_修改財務收支明細表現金() : SQL_營運成本收支單審核_修改財務收支明細表支出()
  425. SQL_營運成本收支單審核_修改財務收支明細表支付日期(Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd"))
  426. MGB(對話框(5), 1) : 首次開啟 = False : Set_清單1()
  427. LIN訊息通知("CC212", "LIN HSING HAO", 單號_tb.Text, Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd"))
  428. LIN訊息通知("CC212", "李協叡", 單號_tb.Text, Strings.Format(支付日期_dtp.Value, "yyyy/MM/dd"))
  429. End If
  430. End Sub
  431. Private Sub 單據作廢_bt_Click(sender As Object, e As EventArgs) Handles 單據作廢_bt.Click
  432. If 系統單號_bt.Text = "" Then : MGB(對話框(3), 1) : 首次開啟 = False : Else : INB(對話框(6)) : PA = 訊息回應
  433. If PA = "" Then : MGB(對話框(7), 1) : Else : Set_日期格式轉換()
  434. PA42 = 系統單號_bt.Text : SQL_營運成本收支單審核_審核人3() : conn.Close() : MGB(對話框(5), 1) : PA = "" : 首次開啟 = False : Set_清單1()
  435. End If
  436. End If
  437. End Sub
  438. Private Sub 申請金額_nud_ValueChanged(sender As Object, e As EventArgs) Handles 申請金額_nud.ValueChanged
  439. 大寫轉換()
  440. End Sub
  441. Private Sub 大寫轉換()
  442. Dim 個位(20), 十位(9), 百位(1), 千位(1), 百萬, 十億, 零, 拾, 百, 仟, 萬, 億, 兆, 答案 As String : Dim 數長 As Integer
  443. If 系統語言 = "繁體中文" Then
  444. 個位(0) = "零" : 個位(1) = "壹" : 個位(2) = "貳" : 個位(3) = "參" : 個位(4) = "肆" : 個位(5) = "伍" : 個位(6) = "陸" : 個位(7) = "柒" : 個位(8) = "捌" : 個位(9) = "玖"
  445. 零 = "零" : 拾 = "拾" : 百 = "百" : 仟 = "仟" : 萬 = "萬" : 億 = "億" : 兆 = "兆"
  446. ElseIf 系統語言 = "Indonesian" Then
  447. 個位(0) = "Nol" : 個位(1) = "Satu" : 個位(2) = "Dua" : 個位(3) = "Tiga" : 個位(4) = "Empat" : 個位(5) = "Lima" : 個位(6) = "Enam" : 個位(7) = "Tujuh"
  448. 個位(8) = "Delapan" : 個位(9) = "Sembilan" : 個位(10) = "Sepuluh" : 個位(11) = "Sebelas" : 個位(12) = "Dua Belas" : 個位(13) = "Tiga Belas" : 個位(14) = "Empat Belas"
  449. 個位(15) = "Lima Belas" : 個位(16) = "Enam Belas" : 個位(17) = "Tujuh Belas" : 個位(18) = "Delapan Belas" : 個位(19) = "Sembilan Belas" : 個位(20) = "Dua Puluh"
  450. 十位(1) = "Sepuluh" : 十位(2) = "Dua Puluh" : 十位(3) = "Tiga Puluh" : 十位(4) = "Empat Puluh" : 十位(5) = "Lima Puluh" : 十位(6) = "Enam Puluh" : 十位(7) = "Tujuh Puluh"
  451. 十位(8) = "Delapan Puluh" : 十位(9) = "Sembilan Puluh"
  452. 百位(0) = "Seratus" : 百位(1) = "Ratus" : 千位(0) = "Seribu" : 千位(1) = "Ribu" : 百萬 = "Juta" : 十億 = "Miliar" : 兆 = "Triliun"
  453. ElseIf 系統語言 = "English" Then
  454. 個位(0) = "Zero" : 個位(1) = "One" : 個位(2) = "Two" : 個位(3) = "Three" : 個位(4) = "Four" : 個位(5) = "Five" : 個位(6) = "Six" : 個位(7) = "Seven"
  455. 個位(8) = "Eight" : 個位(9) = "Nine" : 個位(10) = "Ten" : 個位(11) = "Eleven" : 個位(12) = "Twelve" : 個位(13) = "Thirteen" : 個位(14) = "Fourteen"
  456. 個位(15) = "Fifteen" : 個位(16) = "Sixteen" : 個位(17) = "Seventeen" : 個位(18) = "Eighteen" : 個位(19) = "Nineteen" : 個位(20) = "Twenty"
  457. 十位(1) = "Ten" : 十位(2) = "Twenty" : 十位(3) = "Thirty" : 十位(4) = "Forty" : 十位(5) = "Fifty" : 十位(6) = "Sixty" : 十位(7) = "Seventy" : 十位(8) = "Eighty"
  458. 十位(9) = "Ninety"
  459. 百位(0) = "One Hundred" : 百位(1) = "Hundred" : 千位(0) = "One Thousand" : 千位(1) = "Thousand" : 百萬 = "Million" : 十億 = "Billion" : 兆 = "Trillion"
  460. End If
  461. '--------------轉大寫-----------------------------------------------------------
  462. Dim 位數(13), 末位數 As String
  463. Dim NB As Long = 申請金額_nud.Value : Dim NBS As String = NB.ToString() : 數長 = NBS.Length
  464. 位數(1) = Strings.Left(NBS, 1) : 末位數 = Strings.Right(NBS, 1)
  465. If 數長 >= 2 Then : 位數(2) = Strings.Mid(NBS, 2, 1) : End If : If 數長 >= 3 Then : 位數(3) = Strings.Mid(NBS, 3, 1) : End If
  466. If 數長 >= 4 Then : 位數(4) = Strings.Mid(NBS, 4, 1) : End If : If 數長 >= 5 Then : 位數(5) = Strings.Mid(NBS, 5, 1) : End If
  467. If 數長 >= 6 Then : 位數(6) = Strings.Mid(NBS, 6, 1) : End If : If 數長 >= 7 Then : 位數(7) = Strings.Mid(NBS, 7, 1) : End If
  468. If 數長 >= 8 Then : 位數(8) = Strings.Mid(NBS, 8, 1) : End If : If 數長 >= 9 Then : 位數(9) = Strings.Mid(NBS, 9, 1) : End If
  469. If 數長 >= 10 Then : 位數(10) = Strings.Mid(NBS, 10, 1) : End If : If 數長 >= 11 Then : 位數(11) = Strings.Mid(NBS, 11, 1) : End If
  470. If 數長 >= 12 Then : 位數(12) = Strings.Mid(NBS, 12, 1) : End If : If 數長 >= 13 Then : 位數(13) = Strings.Mid(NBS, 13, 1) : End If
  471. If 系統語言 <> "繁體中文" Then
  472. If 申請金額_nud.Value < 21 Then : 答案 = 個位(申請金額_nud.Value)
  473. ElseIf 數長 = 2 Then
  474. If 位數(2) <> "0" And 末位數 = "0" Then : 答案 = 十位(位數(1))
  475. ElseIf 位數(2) <> "0" And 末位數 <> "0" Then : 答案 = 十位(位數(1)) & " " & 個位(末位數) : End If
  476. ElseIf 數長 = 3 Then
  477. '------------------百------------------------------------------------------------------------------------------------------
  478. If 位數(1) = "1" Then : 答案 = 百位(0) : ElseIf 位數(1) <> "1" Then : 答案 = 個位(位數(1)) & " " & 百位(1) : End If
  479. '------------------個十------------------------------------------------------------------------------------------------------
  480. If 位數(2) = "0" And 末位數 = "0" Then
  481. ElseIf 位數(2) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數)
  482. Else
  483. If CInt(位數(2) & 末位數) < 21 Then
  484. If 末位數 = "0" Then : 答案 &= " " & 十位(位數(2)) : Else : 答案 &= " " & 個位(位數(2) & 末位數) : End If
  485. Else
  486. If 位數(2) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(2))
  487. ElseIf 位數(2) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 個位(末位數) : End If
  488. End If
  489. End If
  490. ElseIf 數長 = 4 Then
  491. '------------------千------------------------------------------------------------------------------------------------------
  492. If 位數(1) = "1" Then : 答案 = 千位(0)
  493. ElseIf 位數(1) <> "1" Then : 答案 = 個位(位數(1)) & " " & 千位(1) : End If
  494. '------------------百------------------------------------------------------------------------------------------------------
  495. If CInt(位數(2) & 位數(3) & 末位數) < 100 Then
  496. ElseIf CInt(位數(2) & 位數(3) & 末位數) < 200 Then : 答案 &= " " & 百位(0)
  497. ElseIf CInt(位數(2) & 位數(3) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(2)) & " " & 百位(1) : End If
  498. '------------------個十------------------------------------------------------------------------------------------------------
  499. If 位數(3) = "0" And 末位數 = "0" Then
  500. ElseIf 位數(3) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數)
  501. Else
  502. If CInt(位數(3) & 末位數) < 21 Then
  503. If 末位數 = "0" Then : 答案 &= " " & 十位(位數(3)) : Else : 答案 &= " " & 個位(位數(3) & 末位數) : End If
  504. Else
  505. If 位數(3) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(3))
  506. ElseIf 位數(3) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 個位(末位數) : End If
  507. End If
  508. End If
  509. ElseIf 數長 = 5 Then
  510. '------------------十千(萬)------------------------------------------------------------------------------------------------------
  511. If CInt(位數(1) & 位數(2)) < 21 Then
  512. If 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 千位(1) : Else : 答案 = 個位(位數(1) & 位數(2)) & " " & 千位(1) : End If
  513. Else
  514. If 位數(1) <> "0" And 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 千位(1)
  515. ElseIf 位數(1) <> "0" And 位數(2) <> "0" Then : 答案 = 十位(位數(1)) & " " & 個位(位數(2)) & " " & 千位(1) : End If
  516. End If
  517. '------------------百------------------------------------------------------------------------------------------------------
  518. If CInt(位數(3) & 位數(4) & 末位數) < 100 Then
  519. ElseIf CInt(位數(3) & 位數(4) & 末位數) < 200 Then : 答案 &= " " & 百位(0)
  520. ElseIf CInt(位數(3) & 位數(4) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(3)) & " " & 百位(1) : End If
  521. '------------------個十------------------------------------------------------------------------------------------------------
  522. If 位數(4) = "0" And 末位數 = "0" Then
  523. ElseIf 位數(4) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數)
  524. Else
  525. If CInt(位數(4) & 末位數) < 21 Then
  526. If 末位數 = "0" Then : 答案 &= " " & 十位(位數(4)) : Else : 答案 &= " " & 個位(位數(4) & 末位數) : End If
  527. Else
  528. If 位數(4) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(4))
  529. ElseIf 位數(4) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 個位(末位數) : End If
  530. End If
  531. End If
  532. ElseIf 數長 = 6 Then
  533. '------------------百千(十萬)------------------------------------------------------------------------------------------------------
  534. If CInt(位數(1)) = 1 Then : 答案 = 百位(0) : Else : 答案 = 個位(位數(1)) & " " & 百位(1) : End If
  535. '------------------十千(萬)------------------------------------------------------------------------------------------------------
  536. If CInt(位數(2) & 位數(3)) < 21 Then
  537. If 位數(3) = "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 千位(1) : Else : 答案 &= " " & 個位(位數(2) & 位數(3)) & " " & 千位(1) : End If
  538. Else
  539. If 位數(2) <> "0" And 位數(3) = "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 千位(1)
  540. ElseIf 位數(2) <> "0" And 位數(3) <> "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 個位(位數(3)) & " " & 千位(1) : End If
  541. End If
  542. '------------------百------------------------------------------------------------------------------------------------------
  543. If CInt(位數(4) & 位數(5) & 末位數) < 100 Then
  544. ElseIf CInt(位數(4) & 位數(5) & 末位數) < 200 Then : 答案 &= " " & 百位(0)
  545. ElseIf CInt(位數(4) & 位數(5) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(4)) & " " & 百位(1) : End If
  546. '------------------個十------------------------------------------------------------------------------------------------------
  547. If 位數(5) = "0" And 末位數 = "0" Then
  548. ElseIf 位數(5) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數)
  549. Else
  550. If CInt(位數(5) & 末位數) < 21 Then
  551. If 末位數 = "0" Then : 答案 &= " " & 十位(位數(5)) : Else : 答案 &= " " & 個位(位數(5) & 末位數) : End If
  552. Else
  553. If 位數(5) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(5))
  554. ElseIf 位數(5) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 個位(末位數) : End If
  555. End If
  556. End If
  557. ElseIf 數長 = 7 Then
  558. '------------------百萬------------------------------------------------------------------------------------------------------
  559. 答案 = 個位(位數(1)) & " " & 百萬
  560. '------------------百千(十萬)------------------------------------------------------------------------------------------------------
  561. If CInt(位數(2)) = 0 Then : ElseIf CInt(位數(2)) = 1 Then : 答案 &= " " & 百位(0)
  562. ElseIf CInt(位數(2)) > 1 Then : 答案 &= " " & 個位(位數(2)) & " " & 百位(1) : End If
  563. '------------------十千(萬)------------------------------------------------------------------------------------------------------
  564. If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" Then : Else
  565. If CInt(位數(3) & 位數(4)) < 21 Then
  566. If 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= " " & 千位(1)
  567. ElseIf 位數(3) = "0" And 位數(4) <> "0" Then : 答案 &= " " & 個位(位數(4)) & " " & 千位(1)
  568. ElseIf 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 千位(1)
  569. ElseIf 位數(3) <> "0" And 位數(4) <> "0" Then : 答案 &= " " & 個位(位數(3) & 位數(4)) & " " & 千位(1) : End If
  570. Else
  571. If 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 千位(1)
  572. ElseIf 位數(3) <> "0" And 位數(4) <> "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 個位(位數(4)) & " " & 千位(1) : End If
  573. End If
  574. End If
  575. '------------------百------------------------------------------------------------------------------------------------------
  576. If CInt(位數(5) & 位數(6) & 末位數) < 100 Then
  577. ElseIf CInt(位數(5) & 位數(6) & 末位數) < 200 Then : 答案 &= " " & 百位(0)
  578. ElseIf CInt(位數(5) & 位數(6) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(5)) & " " & 百位(1) : End If
  579. '------------------個十------------------------------------------------------------------------------------------------------
  580. If 位數(6) = "0" And 末位數 = "0" Then
  581. ElseIf 位數(6) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數)
  582. Else
  583. If CInt(位數(6) & 末位數) < 21 Then
  584. If 末位數 = "0" Then : 答案 &= " " & 十位(位數(6)) : Else : 答案 &= " " & 個位(位數(6) & 末位數) : End If
  585. Else
  586. If 位數(6) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(6))
  587. ElseIf 位數(6) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 個位(末位數) : End If
  588. End If
  589. End If
  590. ElseIf 數長 = 8 Then
  591. '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------
  592. If CInt(位數(1) & 位數(2)) < 21 Then
  593. If 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 百萬 : Else : 答案 = 個位(位數(1) & 位數(2)) & " " & 百萬 : End If
  594. Else
  595. If 位數(1) <> "0" And 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 百萬
  596. ElseIf 位數(1) <> "0" And 位數(2) <> "0" Then : 答案 = 十位(位數(1)) & " " & 個位(位數(2)) & " " & 百萬 : End If
  597. End If
  598. '------------------百千(十萬)------------------------------------------------------------------------------------------------------
  599. If CInt(位數(3)) = 0 Then : ElseIf CInt(位數(3)) = 1 Then : 答案 &= " " & 百位(0)
  600. ElseIf CInt(位數(3)) > 1 Then : 答案 &= " " & 個位(位數(3)) & " " & 百位(1) : End If
  601. '------------------十千(萬)------------------------------------------------------------------------------------------------------
  602. If 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" Then : Else
  603. If CInt(位數(4) & 位數(5)) < 21 Then
  604. If 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= " " & 千位(1)
  605. ElseIf 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= " " & 個位(位數(5)) & " " & 千位(1)
  606. ElseIf 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 千位(1)
  607. ElseIf 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= " " & 個位(位數(4) & 位數(5)) & " " & 千位(1) : End If
  608. Else
  609. If 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 千位(1)
  610. ElseIf 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 個位(位數(5)) & " " & 千位(1) : End If
  611. End If
  612. End If
  613. '------------------百------------------------------------------------------------------------------------------------------
  614. If CInt(位數(6) & 位數(7) & 末位數) < 100 Then
  615. ElseIf CInt(位數(6) & 位數(7) & 末位數) < 200 Then : 答案 &= " " & 百位(0)
  616. ElseIf CInt(位數(6) & 位數(7) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(6)) & " " & 百位(1) : End If
  617. '------------------個十------------------------------------------------------------------------------------------------------
  618. If 位數(7) = "0" And 末位數 = "0" Then
  619. ElseIf 位數(7) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數)
  620. Else
  621. If CInt(位數(7) & 末位數) < 21 Then
  622. If 末位數 = "0" Then : 答案 &= " " & 十位(位數(7)) : Else : 答案 &= " " & 個位(位數(7) & 末位數) : End If
  623. Else
  624. If 位數(7) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(7))
  625. ElseIf 位數(7) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 個位(末位數) : End If
  626. End If
  627. End If
  628. ElseIf 數長 = 9 Then
  629. '------------------百百萬(億)------------------------------------------------------------------------------------------------------
  630. If CInt(位數(1)) = 1 Then : 答案 = 百位(0) : ElseIf CInt(位數(1)) > 1 Then : 答案 = 個位(位數(1)) & " " & 百位(1) : End If
  631. '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------
  632. If 位數(2) = "0" And 位數(3) = "0" Then : 答案 &= " " & 百萬
  633. ElseIf 位數(2) = "0" And 位數(3) <> "0" Then : 答案 &= " " & 個位(位數(3)) & " " & 百萬
  634. ElseIf CInt(位數(2) & 位數(3)) < 21 Then
  635. If 位數(3) = "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 百萬 : Else : 答案 &= " " & 個位(位數(2) & 位數(3)) & " " & 百萬 : End If
  636. ElseIf CInt(位數(2) & 位數(3)) >= 21 Then
  637. If 位數(2) <> "0" And 位數(3) = "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 百萬
  638. ElseIf 位數(2) <> "0" And 位數(3) <> "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 個位(位數(3)) & " " & 百萬 : End If
  639. End If
  640. '------------------百千(十萬)------------------------------------------------------------------------------------------------------
  641. If CInt(位數(4)) = 0 Then : ElseIf CInt(位數(4)) = 1 Then : 答案 &= " " & 百位(0)
  642. ElseIf CInt(位數(4)) > 1 Then : 答案 &= " " & 個位(位數(4)) & " " & 百位(1) : End If
  643. '------------------十千(萬)------------------------------------------------------------------------------------------------------
  644. If 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" Then : Else
  645. If CInt(位數(5) & 位數(6)) < 21 Then
  646. If 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= " " & 千位(1)
  647. ElseIf 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= " " & 個位(位數(6)) & " " & 千位(1)
  648. ElseIf 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 千位(1)
  649. ElseIf 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= " " & 個位(位數(5) & 位數(6)) & " " & 千位(1) : End If
  650. Else
  651. If 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 千位(1)
  652. ElseIf 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 個位(位數(6)) & " " & 千位(1) : End If
  653. End If
  654. End If
  655. '------------------百------------------------------------------------------------------------------------------------------
  656. If CInt(位數(7) & 位數(8) & 末位數) < 100 Then
  657. ElseIf CInt(位數(7) & 位數(8) & 末位數) < 200 Then : 答案 &= " " & 百位(0)
  658. ElseIf CInt(位數(7) & 位數(8) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(7)) & " " & 百位(1) : End If
  659. '------------------個十------------------------------------------------------------------------------------------------------
  660. If 位數(8) = "0" And 末位數 = "0" Then
  661. ElseIf 位數(8) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數)
  662. Else
  663. If CInt(位數(8) & 末位數) < 21 Then
  664. If 末位數 = "0" Then : 答案 &= " " & 十位(位數(8)) : Else : 答案 &= " " & 個位(位數(8) & 末位數) : End If
  665. Else
  666. If 位數(8) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(8))
  667. ElseIf 位數(8) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(8)) & " " & 個位(末位數) : End If
  668. End If
  669. End If
  670. ElseIf 數長 = 10 Then
  671. '------------------十億------------------------------------------------------------------------------------------------------
  672. 答案 = 個位(位數(1)) & " " & 十億
  673. '------------------百百萬(億)------------------------------------------------------------------------------------------------------
  674. If CInt(位數(2)) = 0 Then
  675. ElseIf CInt(位數(2)) = 1 Then : 答案 &= " " & 百位(0)
  676. ElseIf CInt(位數(2)) > 1 Then : 答案 &= " " & 個位(位數(2)) & " " & 百位(1) : End If
  677. '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------
  678. If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" Then
  679. ElseIf 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= " " & 百萬
  680. ElseIf 位數(3) = "0" And 位數(4) <> "0" Then : 答案 &= " " & 個位(位數(4)) & " " & 百萬
  681. ElseIf CInt(位數(3) & 位數(4)) < 21 Then
  682. If 位數(4) = "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 百萬 : Else : 答案 &= " " & 個位(位數(3) & 位數(4)) & " " & 百萬 : End If
  683. ElseIf CInt(位數(3) & 位數(4)) >= 21 Then
  684. If 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 百萬
  685. ElseIf 位數(3) <> "0" And 位數(4) <> "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 個位(位數(4)) & " " & 百萬 : End If
  686. End If
  687. '------------------百千(十萬)------------------------------------------------------------------------------------------------------
  688. If CInt(位數(5)) = 0 Then : ElseIf CInt(位數(5)) = 1 Then : 答案 &= " " & 百位(0)
  689. ElseIf CInt(位數(5)) > 1 Then : 答案 &= " " & 個位(位數(5)) & " " & 百位(1) : End If
  690. '------------------十千(萬)------------------------------------------------------------------------------------------------------
  691. If CInt(位數(6) & 位數(7)) < 21 Then
  692. If 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" Then
  693. ElseIf 位數(6) = "0" And 位數(7) = "0" Then : 答案 &= " " & 千位(1)
  694. ElseIf 位數(6) = "0" And 位數(7) <> "0" Then : 答案 &= " " & 個位(位數(7)) & " " & 千位(1)
  695. ElseIf 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 千位(1)
  696. ElseIf 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= " " & 個位(位數(6) & 位數(7)) & " " & 千位(1) : End If
  697. Else
  698. If 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 千位(1)
  699. ElseIf 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 個位(位數(7)) & " " & 千位(1) : End If
  700. End If
  701. '------------------百------------------------------------------------------------------------------------------------------
  702. If CInt(位數(8) & 位數(9) & 末位數) < 100 Then
  703. ElseIf CInt(位數(8) & 位數(9) & 末位數) < 200 Then : 答案 &= " " & 百位(0)
  704. ElseIf CInt(位數(8) & 位數(9) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(8)) & " " & 百位(1) : End If
  705. '------------------個十------------------------------------------------------------------------------------------------------
  706. If 位數(9) = "0" And 末位數 = "0" Then
  707. ElseIf 位數(9) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數)
  708. Else
  709. If CInt(位數(9) & 末位數) < 21 Then
  710. If 末位數 = "0" Then : 答案 &= " " & 十位(位數(9)) : Else : 答案 &= " " & 個位(位數(9) & 末位數) : End If
  711. Else
  712. If 位數(9) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(9))
  713. ElseIf 位數(9) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(9)) & " " & 個位(末位數) : End If
  714. End If
  715. End If
  716. ElseIf 數長 = 11 Then
  717. '------------------十十億(百億)------------------------------------------------------------------------------------------------------
  718. If CInt(位數(1) & 位數(2)) < 21 Then
  719. If 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 十億 : Else : 答案 = 個位(位數(1) & 位數(2)) & " " & 十億 : End If
  720. Else
  721. If 位數(1) <> "0" And 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 十億
  722. ElseIf 位數(1) <> "0" And 位數(2) <> "0" Then : 答案 = 十位(位數(1)) & " " & 個位(位數(2)) & " " & 十億 : End If
  723. End If
  724. '------------------百百萬(億)------------------------------------------------------------------------------------------------------
  725. If CInt(位數(3)) = 0 Then
  726. ElseIf CInt(位數(3)) = 1 Then : 答案 &= " " & 百位(0)
  727. ElseIf CInt(位數(3)) > 1 Then : 答案 &= " " & 個位(位數(3)) & " " & 百位(1) : End If
  728. '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------
  729. If 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" Then
  730. ElseIf 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= " " & 百萬
  731. ElseIf 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= " " & 個位(位數(5)) & " " & 百萬
  732. ElseIf CInt(位數(4) & 位數(5)) < 21 Then
  733. If 位數(5) = "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 百萬 : Else : 答案 &= " " & 個位(位數(4) & 位數(5)) & " " & 百萬 : End If
  734. ElseIf CInt(位數(4) & 位數(5)) >= 21 Then
  735. If 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 百萬
  736. ElseIf 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 個位(位數(5)) & " " & 百萬 : End If
  737. End If
  738. '------------------百千(十萬)------------------------------------------------------------------------------------------------------
  739. If CInt(位數(6)) = 0 Then : ElseIf CInt(位數(6)) = 1 Then : 答案 &= " " & 百位(0)
  740. ElseIf CInt(位數(6)) > 1 Then : 答案 &= " " & 個位(位數(6)) & " " & 百位(1) : End If
  741. '------------------十千(萬)------------------------------------------------------------------------------------------------------
  742. If CInt(位數(7) & 位數(8)) < 21 Then
  743. If 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" Then
  744. ElseIf 位數(7) = "0" And 位數(8) = "0" Then : 答案 &= " " & 千位(1)
  745. ElseIf 位數(7) = "0" And 位數(8) <> "0" Then : 答案 &= " " & 個位(位數(8)) & " " & 千位(1)
  746. ElseIf 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 千位(1)
  747. ElseIf 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= " " & 個位(位數(7) & 位數(8)) & " " & 千位(1) : End If
  748. Else
  749. If 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 千位(1)
  750. ElseIf 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 個位(位數(8)) & " " & 千位(1) : End If
  751. End If
  752. '------------------百------------------------------------------------------------------------------------------------------
  753. If CInt(位數(9) & 位數(10) & 末位數) < 100 Then
  754. ElseIf CInt(位數(9) & 位數(10) & 末位數) < 200 Then : 答案 &= " " & 百位(0)
  755. ElseIf CInt(位數(9) & 位數(10) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(9)) & " " & 百位(1) : End If
  756. '------------------個十------------------------------------------------------------------------------------------------------
  757. If 位數(10) = "0" And 末位數 = "0" Then
  758. ElseIf 位數(10) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數)
  759. Else
  760. If CInt(位數(10) & 末位數) < 21 Then
  761. If 末位數 = "0" Then : 答案 &= " " & 十位(位數(10)) : Else : 答案 &= " " & 個位(位數(10) & 末位數) : End If
  762. Else
  763. If 位數(10) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(10))
  764. ElseIf 位數(10) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(10)) & " " & 個位(末位數) : End If
  765. End If
  766. End If
  767. ElseIf 數長 = 12 Then
  768. '------------------百(千億)------------------------------------------------------------------------------------------------------
  769. If 位數(1) = "1" Then : 答案 = 百位(0) : ElseIf 位數(1) <> "1" Then : 答案 = 個位(位數(1)) & " " & 百位(1) : End If
  770. '------------------十十億(百億)------------------------------------------------------------------------------------------------------
  771. If 位數(2) = "0" And 位數(3) = "0" Then : 答案 &= " " & 十億
  772. ElseIf CInt(位數(2) & 位數(3)) < 21 Then
  773. If 位數(3) = "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 十億 : Else : 答案 &= " " & 個位(位數(2) & 位數(3)) & " " & 十億 : End If
  774. Else
  775. If 位數(2) <> "0" And 位數(3) = "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 十億
  776. ElseIf 位數(2) <> "0" And 位數(3) <> "0" Then : 答案 &= " " & 十位(位數(2)) & " " & 個位(位數(3)) & " " & 十億 : End If
  777. End If
  778. '------------------百百萬(億)------------------------------------------------------------------------------------------------------
  779. If CInt(位數(4)) = 0 Then
  780. ElseIf CInt(位數(4)) = 1 Then : 答案 &= " " & 百位(0)
  781. ElseIf CInt(位數(4)) > 1 Then : 答案 &= " " & 個位(位數(4)) & " " & 百位(1) : End If
  782. '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------
  783. If 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" Then
  784. ElseIf 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= " " & 百萬
  785. ElseIf 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= " " & 個位(位數(6)) & " " & 百萬
  786. ElseIf CInt(位數(5) & 位數(6)) < 21 Then
  787. If 位數(6) = "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 百萬 : Else : 答案 &= " " & 個位(位數(5) & 位數(6)) & " " & 百萬 : End If
  788. ElseIf CInt(位數(5) & 位數(6)) >= 21 Then
  789. If 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 百萬
  790. ElseIf 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= " " & 十位(位數(5)) & " " & 個位(位數(6)) & " " & 百萬 : End If
  791. End If
  792. '------------------百千(十萬)------------------------------------------------------------------------------------------------------
  793. If CInt(位數(7)) = 0 Then : ElseIf CInt(位數(7)) = 1 Then : 答案 &= " " & 百位(0)
  794. ElseIf CInt(位數(7)) > 1 Then : 答案 &= " " & 個位(位數(7)) & " " & 百位(1) : End If
  795. '------------------十千(萬)------------------------------------------------------------------------------------------------------
  796. If CInt(位數(8) & 位數(9)) < 21 Then
  797. If 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" Then
  798. ElseIf 位數(8) = "0" And 位數(9) = "0" Then : 答案 &= " " & 千位(1)
  799. ElseIf 位數(8) = "0" And 位數(9) <> "0" Then : 答案 &= " " & 個位(位數(9)) & " " & 千位(1)
  800. ElseIf 位數(8) <> "0" And 位數(9) = "0" Then : 答案 &= " " & 十位(位數(8)) & " " & 千位(1)
  801. ElseIf 位數(8) <> "0" And 位數(9) <> "0" Then : 答案 &= " " & 個位(位數(8) & 位數(9)) & " " & 千位(1) : End If
  802. Else
  803. If 位數(8) <> "0" And 位數(9) = "0" Then : 答案 &= " " & 十位(位數(8)) & " " & 千位(1)
  804. ElseIf 位數(8) <> "0" And 位數(9) <> "0" Then : 答案 &= " " & 十位(位數(8)) & " " & 個位(位數(9)) & " " & 千位(1) : End If
  805. End If
  806. '------------------百------------------------------------------------------------------------------------------------------
  807. If CInt(位數(10) & 位數(11) & 末位數) < 100 Then
  808. ElseIf CInt(位數(10) & 位數(11) & 末位數) < 200 Then : 答案 &= " " & 百位(0)
  809. ElseIf CInt(位數(10) & 位數(11) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(10)) & " " & 百位(1) : End If
  810. '------------------個十------------------------------------------------------------------------------------------------------
  811. If 位數(11) = "0" And 末位數 = "0" Then
  812. ElseIf 位數(11) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數)
  813. Else
  814. If CInt(位數(11) & 末位數) < 21 Then
  815. If 末位數 = "0" Then : 答案 &= " " & 十位(位數(11)) : Else : 答案 &= " " & 個位(位數(11) & 末位數) : End If
  816. Else
  817. If 位數(11) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(11))
  818. ElseIf 位數(11) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(11)) & " " & 個位(末位數) : End If
  819. End If
  820. End If
  821. ElseIf 數長 = 13 Then
  822. '------------------兆------------------------------------------------------------------------------------------------------
  823. 答案 = 個位(位數(1)) & " " & 兆
  824. '------------------百(千億)------------------------------------------------------------------------------------------------------
  825. If 位數(2) = "0" Then
  826. ElseIf 位數(2) = "1" Then : 答案 &= " " & 百位(0)
  827. ElseIf 位數(2) <> "1" Then : 答案 &= " " & 個位(位數(2)) & " " & 百位(1) : End If
  828. '------------------十十億(百億)------------------------------------------------------------------------------------------------------
  829. If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" Then
  830. ElseIf 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= " " & 十億
  831. ElseIf CInt(位數(3) & 位數(4)) < 21 Then
  832. If 位數(4) = "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 十億 : Else : 答案 &= " " & 個位(位數(3) & 位數(4)) & " " & 十億 : End If
  833. Else
  834. If 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 十億
  835. ElseIf 位數(3) <> "0" And 位數(4) <> "0" Then : 答案 &= " " & 十位(位數(3)) & " " & 個位(位數(4)) & " " & 十億 : End If
  836. End If
  837. '------------------百百萬(億)------------------------------------------------------------------------------------------------------
  838. If CInt(位數(5)) = 0 Then
  839. ElseIf CInt(位數(5)) = 1 Then : 答案 &= " " & 百位(0)
  840. ElseIf CInt(位數(5)) > 1 Then : 答案 &= " " & 個位(位數(5)) & " " & 百位(1) : End If
  841. '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------
  842. If 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" Then
  843. ElseIf 位數(6) = "0" And 位數(7) = "0" Then : 答案 &= " " & 百萬
  844. ElseIf 位數(6) = "0" And 位數(7) <> "0" Then : 答案 &= " " & 個位(位數(7)) & " " & 百萬
  845. ElseIf CInt(位數(6) & 位數(7)) < 21 Then
  846. If 位數(7) = "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 百萬 : Else : 答案 &= " " & 個位(位數(6) & 位數(7)) & " " & 百萬 : End If
  847. ElseIf CInt(位數(6) & 位數(7)) >= 21 Then
  848. If 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 百萬
  849. ElseIf 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= " " & 十位(位數(6)) & " " & 個位(位數(7)) & " " & 百萬 : End If
  850. End If
  851. '------------------百千(十萬)------------------------------------------------------------------------------------------------------
  852. If CInt(位數(8)) = 0 Then : ElseIf CInt(位數(8)) = 1 Then : 答案 &= " " & 百位(0)
  853. ElseIf CInt(位數(8)) > 1 Then : 答案 &= " " & 個位(位數(8)) & " " & 百位(1) : End If
  854. '------------------十千(萬)------------------------------------------------------------------------------------------------------
  855. If CInt(位數(9) & 位數(10)) < 21 Then
  856. If 位數(8) = "0" And 位數(9) = "0" And 位數(10) = "0" Then
  857. ElseIf 位數(9) = "0" And 位數(10) = "0" Then : 答案 &= " " & 千位(1)
  858. ElseIf 位數(9) = "0" And 位數(10) <> "0" Then : 答案 &= " " & 個位(位數(10)) & " " & 千位(1)
  859. ElseIf 位數(9) <> "0" And 位數(10) = "0" Then : 答案 &= " " & 十位(位數(9)) & " " & 千位(1)
  860. ElseIf 位數(9) <> "0" And 位數(10) <> "0" Then : 答案 &= " " & 個位(位數(9) & 位數(10)) & " " & 千位(1) : End If
  861. Else
  862. If 位數(9) <> "0" And 位數(10) = "0" Then : 答案 &= " " & 十位(位數(9)) & " " & 千位(1)
  863. ElseIf 位數(9) <> "0" And 位數(10) <> "0" Then : 答案 &= " " & 十位(位數(9)) & " " & 個位(位數(10)) & " " & 千位(1) : End If
  864. End If
  865. '------------------百------------------------------------------------------------------------------------------------------
  866. If CInt(位數(11) & 位數(12) & 末位數) < 100 Then
  867. ElseIf CInt(位數(11) & 位數(12) & 末位數) < 200 Then : 答案 &= " " & 百位(0)
  868. ElseIf CInt(位數(11) & 位數(12) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(11)) & " " & 百位(1) : End If
  869. '------------------個十------------------------------------------------------------------------------------------------------
  870. If 位數(12) = "0" And 末位數 = "0" Then
  871. ElseIf 位數(12) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數)
  872. Else
  873. If CInt(位數(12) & 末位數) < 21 Then
  874. If 末位數 = "0" Then : 答案 &= " " & 十位(位數(12)) : Else : 答案 &= " " & 個位(位數(12) & 末位數) : End If
  875. Else
  876. If 位數(12) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(12))
  877. ElseIf 位數(12) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(12)) & " " & 個位(末位數) : End If
  878. End If
  879. End If
  880. ElseIf 數長 = 14 Then
  881. '------------------十兆------------------------------------------------------------------------------------------------------
  882. If CInt(位數(1) & 位數(2)) < 21 Then
  883. If 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 兆 : Else : 答案 = 個位(位數(1) & 位數(2)) & " " & 兆 : End If
  884. Else
  885. If 位數(1) <> "0" And 位數(2) = "0" Then : 答案 = 十位(位數(1)) & " " & 兆
  886. ElseIf 位數(1) <> "0" And 位數(2) <> "0" Then : 答案 = 十位(位數(1)) & " " & 個位(位數(2)) & " " & 兆 : End If
  887. End If
  888. '------------------百(千億)------------------------------------------------------------------------------------------------------
  889. If 位數(3) = "0" Then
  890. ElseIf 位數(3) = "1" Then : 答案 &= " " & 百位(0)
  891. ElseIf 位數(3) <> "1" Then : 答案 &= " " & 個位(位數(3)) & " " & 百位(1) : End If
  892. '------------------十十億(百億)------------------------------------------------------------------------------------------------------
  893. If 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" Then
  894. ElseIf 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= " " & 十億
  895. ElseIf CInt(位數(4) & 位數(5)) < 21 Then
  896. If 位數(5) = "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 十億 : Else : 答案 &= " " & 個位(位數(4) & 位數(5)) & " " & 十億 : End If
  897. Else
  898. If 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 十億
  899. ElseIf 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= " " & 十位(位數(4)) & " " & 個位(位數(5)) & " " & 十億 : End If
  900. End If
  901. '------------------百百萬(億)------------------------------------------------------------------------------------------------------
  902. If CInt(位數(6)) = 0 Then
  903. ElseIf CInt(位數(6)) = 1 Then : 答案 &= " " & 百位(0)
  904. ElseIf CInt(位數(6)) > 1 Then : 答案 &= " " & 個位(位數(6)) & " " & 百位(1) : End If
  905. '------------------十百萬(千萬)------------------------------------------------------------------------------------------------------
  906. If 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" Then
  907. ElseIf 位數(7) = "0" And 位數(8) = "0" Then : 答案 &= " " & 百萬
  908. ElseIf 位數(7) = "0" And 位數(8) <> "0" Then : 答案 &= " " & 個位(位數(8)) & " " & 百萬
  909. ElseIf CInt(位數(7) & 位數(8)) < 21 Then
  910. If 位數(8) = "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 百萬 : Else : 答案 &= " " & 個位(位數(7) & 位數(8)) & " " & 百萬 : End If
  911. ElseIf CInt(位數(7) & 位數(8)) >= 21 Then
  912. If 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 百萬
  913. ElseIf 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= " " & 十位(位數(7)) & " " & 個位(位數(8)) & " " & 百萬 : End If
  914. End If
  915. '------------------百千(十萬)------------------------------------------------------------------------------------------------------
  916. If CInt(位數(9)) = 0 Then : ElseIf CInt(位數(9)) = 1 Then : 答案 &= " " & 百位(0)
  917. ElseIf CInt(位數(9)) > 1 Then : 答案 &= " " & 個位(位數(9)) & " " & 百位(1) : End If
  918. '------------------十千(萬)------------------------------------------------------------------------------------------------------
  919. If CInt(位數(10) & 位數(11)) < 21 Then
  920. If 位數(9) = "0" And 位數(10) = "0" And 位數(11) = "0" Then
  921. ElseIf 位數(10) = "0" And 位數(11) = "0" Then : 答案 &= " " & 千位(1)
  922. ElseIf 位數(10) = "0" And 位數(11) <> "0" Then : 答案 &= " " & 個位(位數(11)) & " " & 千位(1)
  923. ElseIf 位數(10) <> "0" And 位數(11) = "0" Then : 答案 &= " " & 十位(位數(10)) & " " & 千位(1)
  924. ElseIf 位數(10) <> "0" And 位數(11) <> "0" Then : 答案 &= " " & 個位(位數(10) & 位數(11)) & " " & 千位(1) : End If
  925. Else
  926. If 位數(10) <> "0" And 位數(11) = "0" Then : 答案 &= " " & 十位(位數(10)) & " " & 千位(1)
  927. ElseIf 位數(10) <> "0" And 位數(11) <> "0" Then : 答案 &= " " & 十位(位數(10)) & " " & 個位(位數(11)) & " " & 千位(1) : End If
  928. End If
  929. '------------------百------------------------------------------------------------------------------------------------------
  930. If CInt(位數(12) & 位數(13) & 末位數) < 100 Then
  931. ElseIf CInt(位數(12) & 位數(13) & 末位數) < 200 Then : 答案 &= " " & 百位(0)
  932. ElseIf CInt(位數(12) & 位數(13) & 末位數) >= 200 Then : 答案 &= " " & 個位(位數(12)) & " " & 百位(1) : End If
  933. '------------------個十------------------------------------------------------------------------------------------------------
  934. If 位數(13) = "0" And 末位數 = "0" Then
  935. ElseIf 位數(13) = "0" And 末位數 <> "0" Then : 答案 &= " " & 個位(末位數)
  936. Else
  937. If CInt(位數(13) & 末位數) < 21 Then
  938. If 末位數 = "0" Then : 答案 &= " " & 十位(位數(13)) : Else : 答案 &= " " & 個位(位數(13) & 末位數) : End If
  939. Else
  940. If 位數(13) <> "0" And 末位數 = "0" Then : 答案 &= " " & 十位(位數(13))
  941. ElseIf 位數(13) <> "0" And 末位數 <> "0" Then : 答案 &= " " & 十位(位數(13)) & " " & 個位(末位數)
  942. End If
  943. End If
  944. End If
  945. End If
  946. Else
  947. If 數長 = 1 Then : 答案 = 個位(申請金額_nud.Value)
  948. ElseIf 數長 = 2 Then
  949. If 末位數 = "0" Then : 答案 = 個位(位數(1)) & 拾 : Else : 答案 = 個位(位數(1)) & 拾 & 個位(末位數) : End If
  950. ElseIf 數長 = 3 Then : 答案 = 個位(位數(1)) & 百
  951. If 位數(2) = "0" And 末位數 = "0" Then
  952. ElseIf 位數(2) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數)
  953. ElseIf 位數(2) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 拾
  954. ElseIf 位數(2) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 拾 & 個位(末位數)
  955. End If
  956. ElseIf 數長 = 4 Then : 答案 = 個位(位數(1)) & 仟
  957. If 位數(2) = "0" And 位數(3) = "0" And 末位數 = "0" Then
  958. ElseIf 位數(2) = "0" And 位數(3) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數)
  959. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 拾 & 個位(末位數)
  960. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(3)) & 拾
  961. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 百
  962. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 百 & 零 & 個位(末位數)
  963. ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 百 & 個位(位數(3)) & 拾
  964. ElseIf 位數(2) <> "0" And 末位數 <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 百 & 個位(位數(3)) & 拾 & 個位(末位數)
  965. End If
  966. ElseIf 數長 = 5 Then : 答案 = 個位(位數(1)) & 萬
  967. If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" And 末位數 = "0" Then
  968. ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數)
  969. ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(4)) & 拾
  970. ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 拾 & 個位(末位數)
  971. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(3)) & 百
  972. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 零 & 個位(末位數)
  973. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾
  974. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 個位(末位數)
  975. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 仟
  976. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 零 & 個位(末位數)
  977. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 零 & 個位(位數(4)) & 拾
  978. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 零 & 個位(位數(4)) & 拾 & 個位(末位數)
  979. ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百
  980. ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 零 & 個位(末位數)
  981. ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾
  982. ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 個位(末位數)
  983. End If
  984. ElseIf 數長 = 6 Then
  985. If 位數(2) = "0" Then : 答案 = 個位(位數(1)) & 拾 & 萬 : Else : 答案 = 個位(位數(1)) & 拾 & 個位(位數(2)) & 萬 : End If
  986. If 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" And 末位數 = "0" Then
  987. ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數)
  988. ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(5)) & 拾
  989. ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 拾 & 個位(末位數)
  990. ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(4)) & 百
  991. ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 零 & 個位(末位數)
  992. ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾
  993. ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 個位(末位數)
  994. ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(3)) & 仟
  995. ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 零 & 個位(末位數)
  996. ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 零 & 個位(位數(5)) & 拾
  997. ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 零 & 個位(位數(5)) & 拾 & 個位(末位數)
  998. ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百
  999. ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 零 & 個位(末位數)
  1000. ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾
  1001. ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 個位(末位數)
  1002. End If
  1003. ElseIf 數長 = 7 Then : 答案 = 個位(位數(1)) & 百
  1004. If 位數(2) = "0" And 位數(3) = "0" Then : 答案 &= 萬
  1005. ElseIf 位數(2) = "0" And 位數(3) <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 萬
  1006. ElseIf 位數(2) <> "0" And 位數(3) = "0" Then : 答案 &= 個位(位數(2)) & 拾 & 萬
  1007. ElseIf 位數(2) <> "0" And 位數(3) <> "0" Then : 答案 &= 個位(位數(2)) & 拾 & 個位(位數(3)) & 萬
  1008. End If
  1009. If 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" And 末位數 = "0" Then
  1010. ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數)
  1011. ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(6)) & 拾
  1012. ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 拾 & 個位(末位數)
  1013. ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(5)) & 百
  1014. ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 零 & 個位(末位數)
  1015. ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾
  1016. ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 & 個位(末位數)
  1017. ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(4)) & 仟
  1018. ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 零 & 個位(末位數)
  1019. ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 零 & 個位(位數(6)) & 拾
  1020. ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 零 & 個位(位數(6)) & 拾 & 個位(末位數)
  1021. ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百
  1022. ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 零 & 個位(末位數)
  1023. ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾
  1024. ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 & 個位(末位數)
  1025. End If
  1026. ElseIf 數長 = 8 Then : 答案 = 個位(位數(1)) & 仟
  1027. If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= 萬
  1028. ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 萬
  1029. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 拾 & 個位(位數(4)) & 萬
  1030. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= 零 & 個位(位數(3)) & 拾 & 萬
  1031. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= 個位(位數(2)) & 百 & 萬
  1032. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) <> "0" Then : 答案 &= 個位(位數(2)) & 百 & 零 & 個位(位數(4)) & 萬
  1033. ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= 個位(位數(2)) & 百 & 個位(位數(3)) & 拾 & 萬
  1034. ElseIf 位數(2) <> "0" And 位數(4) <> "0" And 位數(4) <> "0" Then : 答案 &= 個位(位數(2)) & 百 & 個位(位數(3)) & 拾 & 個位(位數(4)) & 萬
  1035. End If
  1036. If 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" And 末位數 = "0" Then
  1037. ElseIf 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數)
  1038. ElseIf 位數(5) = "0" And 位數(6) = "0" And 位數(7) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(7)) & 拾
  1039. ElseIf 位數(5) = "0" And 位數(6) = "0" And 位數(7) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 拾 & 個位(末位數)
  1040. ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(6)) & 百
  1041. ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 零 & 個位(末位數)
  1042. ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾
  1043. ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 & 個位(末位數)
  1044. ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(5)) & 仟
  1045. ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 零 & 個位(末位數)
  1046. ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 零 & 個位(位數(7)) & 拾
  1047. ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 零 & 個位(位數(7)) & 拾 & 個位(末位數)
  1048. ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百
  1049. ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 零 & 個位(末位數)
  1050. ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾
  1051. ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 & 個位(末位數)
  1052. End If
  1053. ElseIf 數長 = 9 Then : 答案 = 個位(位數(1)) & 億
  1054. If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" Then
  1055. ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 萬
  1056. ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= 零 & 個位(位數(4)) & 拾 & 萬
  1057. ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 拾 & 個位(位數(5)) & 萬
  1058. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 萬
  1059. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 零 & 個位(位數(5)) & 萬
  1060. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 萬
  1061. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 個位(位數(5)) & 萬
  1062. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 萬
  1063. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 零 & 個位(位數(5)) & 萬
  1064. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 零 & 個位(位數(4)) & 拾 & 萬
  1065. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 零 & 個位(位數(4)) & 拾 & 個位(位數(5)) & 萬
  1066. ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 萬
  1067. ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 零 & 個位(位數(5)) & 萬
  1068. ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 萬
  1069. ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= 個位(位數(2)) & 仟 & 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 個位(位數(5)) & 萬
  1070. End If
  1071. If 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" And 末位數 = "0" Then
  1072. ElseIf 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數)
  1073. ElseIf 位數(6) = "0" And 位數(7) = "0" And 位數(8) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(8)) & 拾
  1074. ElseIf 位數(6) = "0" And 位數(7) = "0" And 位數(8) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 拾 & 個位(末位數)
  1075. ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(7)) & 百
  1076. ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 零 & 個位(末位數)
  1077. ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾
  1078. ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 & 個位(末位數)
  1079. ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(6)) & 仟
  1080. ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 零 & 個位(末位數)
  1081. ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 零 & 個位(位數(8)) & 拾
  1082. ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 零 & 個位(位數(8)) & 拾 & 個位(末位數)
  1083. ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百
  1084. ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 零 & 個位(末位數)
  1085. ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾
  1086. ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 & 個位(末位數)
  1087. End If
  1088. ElseIf 數長 = 10 Then
  1089. If 位數(2) = "0" Then : 答案 = 個位(位數(1)) & 拾 & 億 : Else : 答案 = 個位(位數(1)) & 拾 & 個位(位數(2)) & 億 : End If
  1090. If 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" Then
  1091. ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 萬
  1092. ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= 零 & 個位(位數(5)) & 拾 & 萬
  1093. ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 拾 & 個位(位數(6)) & 萬
  1094. ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 萬
  1095. ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 零 & 個位(位數(6)) & 萬
  1096. ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 萬
  1097. ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 個位(位數(6)) & 萬
  1098. ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 萬
  1099. ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 零 & 個位(位數(6)) & 萬
  1100. ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 零 & 個位(位數(5)) & 拾 & 萬
  1101. ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 零 & 個位(位數(5)) & 拾 & 個位(位數(6)) & 萬
  1102. ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 萬
  1103. ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 零 & 個位(位數(6)) & 萬
  1104. ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 萬
  1105. ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= 個位(位數(3)) & 仟 & 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 個位(位數(6)) & 萬
  1106. End If
  1107. If 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" And 末位數 = "0" Then
  1108. ElseIf 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數)
  1109. ElseIf 位數(7) = "0" And 位數(8) = "0" And 位數(9) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(9)) & 拾
  1110. ElseIf 位數(7) = "0" And 位數(8) = "0" And 位數(9) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(9)) & 拾 & 個位(末位數)
  1111. ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(8)) & 百
  1112. ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 零 & 個位(末位數)
  1113. ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾
  1114. ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 & 個位(末位數)
  1115. ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(7)) & 仟
  1116. ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 零 & 個位(末位數)
  1117. ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 零 & 個位(位數(9)) & 拾
  1118. ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 零 & 個位(位數(9)) & 拾 & 個位(末位數)
  1119. ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百
  1120. ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 零 & 個位(末位數)
  1121. ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾
  1122. ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 & 個位(末位數)
  1123. End If
  1124. ElseIf 數長 = 11 Then : 答案 = 個位(位數(1)) & 百
  1125. If 位數(2) = "0" And 位數(3) = "0" Then : 答案 &= 億
  1126. ElseIf 位數(2) = "0" And 位數(3) <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 億
  1127. ElseIf 位數(2) <> "0" And 位數(3) = "0" Then : 答案 &= 個位(位數(2)) & 拾 & 億
  1128. ElseIf 位數(2) <> "0" And 位數(3) <> "0" Then : 答案 &= 個位(位數(2)) & 拾 & 個位(位數(3)) & 億
  1129. End If
  1130. If 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" Then
  1131. ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" And 位數(7) <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 萬
  1132. ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= 零 & 個位(位數(6)) & 拾 & 萬
  1133. ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 拾 & 個位(位數(7)) & 萬
  1134. ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" And 位數(7) = "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 萬
  1135. ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" And 位數(7) <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 零 & 個位(位數(7)) & 萬
  1136. ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 & 萬
  1137. ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 & 個位(位數(7)) & 萬
  1138. ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 萬
  1139. ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" And 位數(7) <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 零 & 個位(位數(7)) & 萬
  1140. ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 零 & 個位(位數(6)) & 拾 & 萬
  1141. ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 零 & 個位(位數(6)) & 拾 & 個位(位數(7)) & 萬
  1142. ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" And 位數(7) = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 萬
  1143. ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" And 位數(7) <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 零 & 個位(位數(7)) & 萬
  1144. ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) = "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 & 萬
  1145. ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) <> "0" Then : 答案 &= 個位(位數(4)) & 仟 & 個位(位數(5)) & 百 & 個位(位數(6)) & 拾 & 個位(位數(7)) & 萬
  1146. End If
  1147. If 位數(8) = "0" And 位數(9) = "0" And 位數(10) = "0" And 末位數 = "0" Then
  1148. ElseIf 位數(8) = "0" And 位數(9) = "0" And 位數(10) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數)
  1149. ElseIf 位數(8) = "0" And 位數(9) = "0" And 位數(10) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(10)) & 拾
  1150. ElseIf 位數(8) = "0" And 位數(9) = "0" And 位數(10) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(10)) & 拾 & 個位(末位數)
  1151. ElseIf 位數(8) = "0" And 位數(9) <> "0" And 位數(10) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(9)) & 百
  1152. ElseIf 位數(8) = "0" And 位數(9) <> "0" And 位數(10) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(9)) & 百 & 零 & 個位(末位數)
  1153. ElseIf 位數(8) = "0" And 位數(9) <> "0" And 位數(10) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(9)) & 百 & 個位(位數(10)) & 拾
  1154. ElseIf 位數(8) = "0" And 位數(9) <> "0" And 位數(10) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(9)) & 百 & 個位(位數(10)) & 拾 & 個位(末位數)
  1155. ElseIf 位數(8) <> "0" And 位數(9) = "0" And 位數(10) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(8)) & 仟
  1156. ElseIf 位數(8) <> "0" And 位數(9) = "0" And 位數(10) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(8)) & 仟 & 零 & 個位(末位數)
  1157. ElseIf 位數(8) <> "0" And 位數(9) = "0" And 位數(10) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(8)) & 仟 & 零 & 個位(位數(10)) & 拾
  1158. ElseIf 位數(8) <> "0" And 位數(9) = "0" And 位數(10) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(8)) & 仟 & 零 & 個位(位數(10)) & 拾 & 個位(末位數)
  1159. ElseIf 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(8)) & 仟 & 個位(位數(9)) & 百
  1160. ElseIf 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(8)) & 仟 & 個位(位數(9)) & 百 & 零 & 個位(末位數)
  1161. ElseIf 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(8)) & 仟 & 個位(位數(9)) & 百 & 個位(位數(10)) & 拾
  1162. ElseIf 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(8)) & 仟 & 個位(位數(9)) & 百 & 個位(位數(10)) & 拾 & 個位(末位數)
  1163. End If
  1164. ElseIf 數長 = 12 Then : 答案 = 個位(位數(1)) & 仟
  1165. If 位數(2) = "0" And 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= 億
  1166. ElseIf 位數(2) = "0" And 位數(3) = "0" And 位數(4) <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 億
  1167. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) <> "0" Then : 答案 &= 零 & 個位(位數(3)) & 拾 & 個位(位數(4)) & 億
  1168. ElseIf 位數(2) = "0" And 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= 零 & 個位(位數(3)) & 拾 & 億
  1169. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) = "0" Then : 答案 &= 個位(位數(2)) & 百 & 億
  1170. ElseIf 位數(2) <> "0" And 位數(3) = "0" And 位數(4) <> "0" Then : 答案 &= 個位(位數(2)) & 百 & 零 & 個位(位數(4)) & 億
  1171. ElseIf 位數(2) <> "0" And 位數(3) <> "0" And 位數(4) = "0" Then : 答案 &= 個位(位數(2)) & 百 & 個位(位數(3)) & 拾 & 億
  1172. ElseIf 位數(2) <> "0" And 位數(4) <> "0" And 位數(4) <> "0" Then : 答案 &= 個位(位數(2)) & 百 & 個位(位數(3)) & 拾 & 個位(位數(4)) & 億
  1173. End If
  1174. If 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" Then
  1175. ElseIf 位數(5) = "0" And 位數(6) = "0" And 位數(7) = "0" And 位數(8) <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 萬
  1176. ElseIf 位數(5) = "0" And 位數(6) = "0" And 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= 零 & 個位(位數(7)) & 拾 & 萬
  1177. ElseIf 位數(5) = "0" And 位數(6) = "0" And 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 拾 & 個位(位數(8)) & 萬
  1178. ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) = "0" And 位數(8) = "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 萬
  1179. ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) = "0" And 位數(8) <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 零 & 個位(位數(8)) & 萬
  1180. ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 & 萬
  1181. ElseIf 位數(5) = "0" And 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 & 個位(位數(8)) & 萬
  1182. ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 萬
  1183. ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) = "0" And 位數(8) <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 零 & 個位(位數(8)) & 萬
  1184. ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 零 & 個位(位數(7)) & 拾 & 萬
  1185. ElseIf 位數(5) <> "0" And 位數(6) = "0" And 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 零 & 個位(位數(7)) & 拾 & 個位(位數(8)) & 萬
  1186. ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) = "0" And 位數(8) = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 萬
  1187. ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) = "0" And 位數(8) <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 零 & 個位(位數(8)) & 萬
  1188. ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) = "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 & 萬
  1189. ElseIf 位數(5) <> "0" And 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) <> "0" Then : 答案 &= 個位(位數(5)) & 仟 & 個位(位數(6)) & 百 & 個位(位數(7)) & 拾 & 個位(位數(8)) & 萬
  1190. End If
  1191. If 位數(9) = "0" And 位數(10) = "0" And 位數(11) = "0" And 末位數 = "0" Then
  1192. ElseIf 位數(9) = "0" And 位數(10) = "0" And 位數(11) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數)
  1193. ElseIf 位數(9) = "0" And 位數(10) = "0" And 位數(11) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(11)) & 拾
  1194. ElseIf 位數(9) = "0" And 位數(10) = "0" And 位數(11) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(11)) & 拾 & 個位(末位數)
  1195. ElseIf 位數(9) = "0" And 位數(10) <> "0" And 位數(11) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(10)) & 百
  1196. ElseIf 位數(9) = "0" And 位數(10) <> "0" And 位數(11) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(10)) & 百 & 零 & 個位(末位數)
  1197. ElseIf 位數(9) = "0" And 位數(10) <> "0" And 位數(11) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(10)) & 百 & 個位(位數(11)) & 拾
  1198. ElseIf 位數(9) = "0" And 位數(10) <> "0" And 位數(11) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(10)) & 百 & 個位(位數(11)) & 拾 & 個位(末位數)
  1199. ElseIf 位數(9) <> "0" And 位數(10) = "0" And 位數(11) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(9)) & 仟
  1200. ElseIf 位數(9) <> "0" And 位數(10) = "0" And 位數(11) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(9)) & 仟 & 零 & 個位(末位數)
  1201. ElseIf 位數(9) <> "0" And 位數(10) = "0" And 位數(11) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(9)) & 仟 & 零 & 個位(位數(11)) & 拾
  1202. ElseIf 位數(9) <> "0" And 位數(10) = "0" And 位數(11) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(9)) & 仟 & 零 & 個位(位數(11)) & 拾 & 個位(末位數)
  1203. ElseIf 位數(9) <> "0" And 位數(10) <> "0" And 位數(11) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(9)) & 仟 & 個位(位數(10)) & 百
  1204. ElseIf 位數(9) <> "0" And 位數(10) <> "0" And 位數(11) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(9)) & 仟 & 個位(位數(10)) & 百 & 零 & 個位(末位數)
  1205. ElseIf 位數(9) <> "0" And 位數(10) <> "0" And 位數(11) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(9)) & 仟 & 個位(位數(10)) & 百 & 個位(位數(11)) & 拾
  1206. ElseIf 位數(9) <> "0" And 位數(10) <> "0" And 位數(11) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(9)) & 仟 & 個位(位數(10)) & 百 & 個位(位數(11)) & 拾 & 個位(末位數)
  1207. End If
  1208. ElseIf 數長 = 13 Then : 答案 = 個位(位數(1)) & 兆 : 答案 &= 個位(位數(2)) & 仟
  1209. If 位數(3) = "0" And 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= 億
  1210. ElseIf 位數(3) = "0" And 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 億
  1211. ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) <> "0" Then : 答案 &= 零 & 個位(位數(4)) & 拾 & 個位(位數(5)) & 億
  1212. ElseIf 位數(3) = "0" And 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= 零 & 個位(位數(4)) & 拾 & 億
  1213. ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) = "0" Then : 答案 &= 個位(位數(3)) & 百 & 億
  1214. ElseIf 位數(3) <> "0" And 位數(4) = "0" And 位數(5) <> "0" Then : 答案 &= 個位(位數(3)) & 百 & 零 & 個位(位數(5)) & 億
  1215. ElseIf 位數(3) <> "0" And 位數(4) <> "0" And 位數(5) = "0" Then : 答案 &= 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 億
  1216. ElseIf 位數(3) <> "0" And 位數(5) <> "0" And 位數(5) <> "0" Then : 答案 &= 個位(位數(3)) & 百 & 個位(位數(4)) & 拾 & 個位(位數(5)) & 億
  1217. End If
  1218. If 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" Then
  1219. ElseIf 位數(6) = "0" And 位數(7) = "0" And 位數(8) = "0" And 位數(9) <> "0" Then : 答案 &= 零 & 個位(位數(9)) & 萬
  1220. ElseIf 位數(6) = "0" And 位數(7) = "0" And 位數(8) <> "0" And 位數(9) = "0" Then : 答案 &= 零 & 個位(位數(8)) & 拾 & 萬
  1221. ElseIf 位數(6) = "0" And 位數(7) = "0" And 位數(8) <> "0" And 位數(9) <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 拾 & 個位(位數(9)) & 萬
  1222. ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) = "0" And 位數(9) = "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 萬
  1223. ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) = "0" And 位數(9) <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 零 & 個位(位數(9)) & 萬
  1224. ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) = "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 & 萬
  1225. ElseIf 位數(6) = "0" And 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) <> "0" Then : 答案 &= 零 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 & 個位(位數(9)) & 萬
  1226. ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 萬
  1227. ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) = "0" And 位數(9) <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 零 & 個位(位數(9)) & 萬
  1228. ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) <> "0" And 位數(9) = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 零 & 個位(位數(8)) & 拾 & 萬
  1229. ElseIf 位數(6) <> "0" And 位數(7) = "0" And 位數(8) <> "0" And 位數(9) <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 零 & 個位(位數(8)) & 拾 & 個位(位數(9)) & 萬
  1230. ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) = "0" And 位數(9) = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 萬
  1231. ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) = "0" And 位數(9) <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 零 & 個位(位數(9)) & 萬
  1232. ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) = "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 & 萬
  1233. ElseIf 位數(6) <> "0" And 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) <> "0" Then : 答案 &= 個位(位數(6)) & 仟 & 個位(位數(7)) & 百 & 個位(位數(8)) & 拾 & 個位(位數(9)) & 萬
  1234. End If
  1235. If 位數(10) = "0" And 位數(11) = "0" And 位數(12) = "0" And 末位數 = "0" Then
  1236. ElseIf 位數(10) = "0" And 位數(11) = "0" And 位數(12) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數)
  1237. ElseIf 位數(10) = "0" And 位數(11) = "0" And 位數(12) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(12)) & 拾
  1238. ElseIf 位數(10) = "0" And 位數(11) = "0" And 位數(12) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(12)) & 拾 & 個位(末位數)
  1239. ElseIf 位數(10) = "0" And 位數(11) <> "0" And 位數(12) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(11)) & 百
  1240. ElseIf 位數(10) = "0" And 位數(11) <> "0" And 位數(12) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(11)) & 百 & 零 & 個位(末位數)
  1241. ElseIf 位數(10) = "0" And 位數(11) <> "0" And 位數(12) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(11)) & 百 & 個位(位數(12)) & 拾
  1242. ElseIf 位數(10) = "0" And 位數(11) <> "0" And 位數(12) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(11)) & 百 & 個位(位數(12)) & 拾 & 個位(末位數)
  1243. ElseIf 位數(10) <> "0" And 位數(11) = "0" And 位數(12) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(10)) & 仟
  1244. ElseIf 位數(10) <> "0" And 位數(11) = "0" And 位數(12) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(10)) & 仟 & 零 & 個位(末位數)
  1245. ElseIf 位數(10) <> "0" And 位數(11) = "0" And 位數(12) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(10)) & 仟 & 零 & 個位(位數(12)) & 拾
  1246. ElseIf 位數(10) <> "0" And 位數(11) = "0" And 位數(12) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(10)) & 仟 & 零 & 個位(位數(12)) & 拾 & 個位(末位數)
  1247. ElseIf 位數(10) <> "0" And 位數(11) <> "0" And 位數(12) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(10)) & 仟 & 個位(位數(11)) & 百
  1248. ElseIf 位數(10) <> "0" And 位數(11) <> "0" And 位數(12) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(10)) & 仟 & 個位(位數(11)) & 百 & 零 & 個位(末位數)
  1249. ElseIf 位數(10) <> "0" And 位數(11) <> "0" And 位數(12) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(10)) & 仟 & 個位(位數(11)) & 百 & 個位(位數(12)) & 拾
  1250. ElseIf 位數(10) <> "0" And 位數(11) <> "0" And 位數(12) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(10)) & 仟 & 個位(位數(11)) & 百 & 個位(位數(12)) & 拾 & 個位(末位數)
  1251. End If
  1252. ElseIf 數長 = 14 Then
  1253. If 位數(2) = "0" Then : 答案 = 個位(位數(1)) & 拾 & 兆 : Else : 答案 = 個位(位數(1)) & 拾 & 個位(位數(2)) & 兆 : End If : 答案 &= 個位(位數(3)) & 仟
  1254. If 位數(4) = "0" And 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= 億
  1255. ElseIf 位數(4) = "0" And 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= 零 & 個位(位數(6)) & 億
  1256. ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) <> "0" Then : 答案 &= 零 & 個位(位數(5)) & 拾 & 個位(位數(6)) & 億
  1257. ElseIf 位數(4) = "0" And 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= 零 & 個位(位數(5)) & 拾 & 億
  1258. ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) = "0" Then : 答案 &= 個位(位數(4)) & 百 & 億
  1259. ElseIf 位數(4) <> "0" And 位數(5) = "0" And 位數(6) <> "0" Then : 答案 &= 個位(位數(4)) & 百 & 零 & 個位(位數(6)) & 億
  1260. ElseIf 位數(4) <> "0" And 位數(5) <> "0" And 位數(6) = "0" Then : 答案 &= 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 億
  1261. ElseIf 位數(4) <> "0" And 位數(6) <> "0" And 位數(6) <> "0" Then : 答案 &= 個位(位數(4)) & 百 & 個位(位數(5)) & 拾 & 個位(位數(6)) & 億
  1262. End If
  1263. If 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" And 位數(10) = "0" Then
  1264. ElseIf 位數(7) = "0" And 位數(8) = "0" And 位數(9) = "0" And 位數(10) <> "0" Then : 答案 &= 零 & 個位(位數(10)) & 萬
  1265. ElseIf 位數(7) = "0" And 位數(8) = "0" And 位數(9) <> "0" And 位數(10) = "0" Then : 答案 &= 零 & 個位(位數(9)) & 拾 & 萬
  1266. ElseIf 位數(7) = "0" And 位數(8) = "0" And 位數(9) <> "0" And 位數(10) <> "0" Then : 答案 &= 零 & 個位(位數(9)) & 拾 & 個位(位數(10)) & 萬
  1267. ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) = "0" And 位數(10) = "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 萬
  1268. ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) = "0" And 位數(10) <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 零 & 個位(位數(10)) & 萬
  1269. ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) = "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 & 萬
  1270. ElseIf 位數(7) = "0" And 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) <> "0" Then : 答案 &= 零 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 & 個位(位數(10)) & 萬
  1271. ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) = "0" And 位數(10) = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 萬
  1272. ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) = "0" And 位數(10) <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 零 & 個位(位數(10)) & 萬
  1273. ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) <> "0" And 位數(10) = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 零 & 個位(位數(9)) & 拾 & 萬
  1274. ElseIf 位數(7) <> "0" And 位數(8) = "0" And 位數(9) <> "0" And 位數(10) <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 零 & 個位(位數(9)) & 拾 & 個位(位數(10)) & 萬
  1275. ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) = "0" And 位數(10) = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 萬
  1276. ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) = "0" And 位數(10) <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 零 & 個位(位數(10)) & 萬
  1277. ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) = "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 & 萬
  1278. ElseIf 位數(7) <> "0" And 位數(8) <> "0" And 位數(9) <> "0" And 位數(10) <> "0" Then : 答案 &= 個位(位數(7)) & 仟 & 個位(位數(8)) & 百 & 個位(位數(9)) & 拾 & 個位(位數(10)) & 萬
  1279. End If
  1280. If 位數(11) = "0" And 位數(12) = "0" And 位數(13) = "0" And 末位數 = "0" Then
  1281. ElseIf 位數(11) = "0" And 位數(12) = "0" And 位數(13) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(末位數)
  1282. ElseIf 位數(11) = "0" And 位數(12) = "0" And 位數(13) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(13)) & 拾
  1283. ElseIf 位數(11) = "0" And 位數(12) = "0" And 位數(13) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(13)) & 拾 & 個位(末位數)
  1284. ElseIf 位數(11) = "0" And 位數(12) <> "0" And 位數(13) = "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(12)) & 百
  1285. ElseIf 位數(11) = "0" And 位數(12) <> "0" And 位數(13) = "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(12)) & 百 & 零 & 個位(末位數)
  1286. ElseIf 位數(11) = "0" And 位數(12) <> "0" And 位數(13) <> "0" And 末位數 = "0" Then : 答案 &= 零 & 個位(位數(12)) & 百 & 個位(位數(13)) & 拾
  1287. ElseIf 位數(11) = "0" And 位數(12) <> "0" And 位數(13) <> "0" And 末位數 <> "0" Then : 答案 &= 零 & 個位(位數(12)) & 百 & 個位(位數(13)) & 拾 & 個位(末位數)
  1288. ElseIf 位數(11) <> "0" And 位數(12) = "0" And 位數(13) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(11)) & 仟
  1289. ElseIf 位數(11) <> "0" And 位數(12) = "0" And 位數(13) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(11)) & 仟 & 零 & 個位(末位數)
  1290. ElseIf 位數(11) <> "0" And 位數(12) = "0" And 位數(13) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(11)) & 仟 & 零 & 個位(位數(13)) & 拾
  1291. ElseIf 位數(11) <> "0" And 位數(12) = "0" And 位數(13) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(11)) & 仟 & 零 & 個位(位數(13)) & 拾 & 個位(末位數)
  1292. ElseIf 位數(11) <> "0" And 位數(12) <> "0" And 位數(13) = "0" And 末位數 = "0" Then : 答案 &= 個位(位數(11)) & 仟 & 個位(位數(12)) & 百
  1293. ElseIf 位數(11) <> "0" And 位數(12) <> "0" And 位數(13) = "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(11)) & 仟 & 個位(位數(12)) & 百 & 零 & 個位(末位數)
  1294. ElseIf 位數(11) <> "0" And 位數(12) <> "0" And 位數(13) <> "0" And 末位數 = "0" Then : 答案 &= 個位(位數(11)) & 仟 & 個位(位數(12)) & 百 & 個位(位數(13)) & 拾
  1295. ElseIf 位數(11) <> "0" And 位數(12) <> "0" And 位數(13) <> "0" And 末位數 <> "0" Then : 答案 &= 個位(位數(11)) & 仟 & 個位(位數(12)) & 百 & 個位(位數(13)) & 拾 & 個位(末位數)
  1296. End If
  1297. End If
  1298. End If
  1299. If 系統語言 = "繁體中文" Then : 金額大寫_tb.Text = 答案 & " 元整"
  1300. ElseIf 系統語言 = "Indonesian" Then : 金額大寫_tb.Text = 答案 & " Rupiah"
  1301. ElseIf 系統語言 = "English" Then : 金額大寫_tb.Text = 答案 & " Rupee" : End If
  1302. End Sub
  1303. Private Sub 列印成EXCEL_bt_Click(sender As Object, e As EventArgs) Handles 列印成EXCEL_bt.Click
  1304. If 主管_tb.Text = "" Then : MGB(對話框(9), 1) : Else
  1305. If 系統單號_bt.Text = "" Then : MGB(對話框(3), 1) : 首次開啟 = False : Else
  1306. xlApp = CType(CreateObject("Excel.Application"), Application)
  1307. xlBook = xlApp.Workbooks.Add
  1308. xlApp.DisplayAlerts = True
  1309. xlApp.Visible = True
  1310. xlApp.Application.WindowState = xlMaximized
  1311. xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select
  1312. xlApp.Sheets(1).Name = 單號_tb.Text.Replace("/", "_") : xlBook.Activate() : xlSheet.Activate()
  1313. xlSheet.Cells(2, 1) = Label7.Text
  1314. xlSheet.Cells(3, 1) = 單號_tb.Text
  1315. xlSheet.Cells(5, 2) = Label2.Text : xlSheet.Cells(5, 3) = "' : " : xlSheet.Cells(5, 4) = "'" & Strings.Format(申請日期_dtp.Value, "yyyy/MM/dd")
  1316. xlSheet.Cells(6, 2) = Label1.Text : xlSheet.Cells(6, 3) = "' : " : xlSheet.Cells(6, 4) = 部門選單_cb.Text
  1317. xlSheet.Cells(7, 2) = Label3.Text : xlSheet.Cells(7, 3) = "' : " : xlSheet.Cells(7, 4) = Strings.Format(申請金額_nud.Value, "#,##0")
  1318. xlSheet.Cells(8, 2) = Label4.Text : xlSheet.Cells(8, 3) = "' : " : xlSheet.Cells(8, 4) = 金額大寫_tb.Text
  1319. xlSheet.Cells(9, 2) = Label5.Text : xlSheet.Cells(9, 3) = "' : " : xlSheet.Cells(9, 4) = 內容_tb.Text
  1320. xlSheet.Cells(10, 2) = Label6.Text : xlSheet.Cells(10, 3) = "' : "
  1321. xlSheet.Cells(10, 4) = Label18.Text & " / " & 支付對象_tb.Text & vbLf &
  1322. Label15.Text & " / " & 營行帳號_tb.Text & vbLf &
  1323. Label17.Text & " / " & 支付銀行_tb.Text & vbLf &
  1324. Label16.Text & " / " & 銀行支行_tb.Text
  1325. xlSheet.Cells(12, 2) = Label8.Text : xlSheet.Cells(13, 2) = 申請人_tb.Text
  1326. xlSheet.Cells(12, 4) = Label19.Text : xlSheet.Cells(13, 4) = 檢查人_tb.Text
  1327. xlSheet.Cells(12, 6) = Label9.Text : xlSheet.Cells(13, 6) = 主管_tb.Text : xlSheet.Cells(14, 6) = Label11.Text
  1328. xlSheet.Cells(12, 8) = Label10.Text : xlSheet.Cells(13, 8) = 審核人_tb.Text : xlSheet.Cells(14, 8) = Label12.Text
  1329. AA(xlApp, xlSheet)
  1330. If 單號_tb.Text.Contains("HXI") Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If
  1331. xlApp.Sheets(2).Delete : xlSheet.PageSetup.PrintArea = ""
  1332. '-------------轉換成PDF---------------------------------------------------------------------
  1333. Dim SERT As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
  1334. xlBook.Sheets(1).ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, SERT & "\" & 單號_tb.Text.Replace("/", "_") & ".pdf", XlFixedFormatQuality.xlQualityStandard, True)
  1335. '-------------關閉EXCEL---------------------------------------------------------------------
  1336. xlApp.Cells.Select() : xlApp.Application.WindowState = xlMinimized
  1337. xlBook.Close(False)
  1338. Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet)
  1339. Runtime.InteropServices.Marshal.ReleaseComObject(xlBook)
  1340. Runtime.InteropServices.Marshal.ReleaseComObject(xlApp)
  1341. xlApp.Quit() : xlSheet = Nothing : xlBook = Nothing : xlApp = Nothing : GC.Collect()
  1342. '-------------開啟PDF---------------------------------------------------------------------
  1343. Dim pdfFilePath As String = SERT & "\" & 單號_tb.Text.Replace("/", "_") & ".pdf"
  1344. If IsChromeInstalled() Then
  1345. Try
  1346. Dim chromeProcess As New Process()
  1347. chromeProcess.StartInfo.FileName = "chrome"
  1348. chromeProcess.StartInfo.Arguments = """" & pdfFilePath & """"
  1349. chromeProcess.Start()
  1350. Catch ex As Exception
  1351. End Try
  1352. Else
  1353. Try
  1354. System.Diagnostics.Process.Start("""" & pdfFilePath & """")
  1355. Catch ex As Exception
  1356. End Try
  1357. End If
  1358. MGB(系統語言字典("H508-121-" & 語言), 1) : 首次開啟 = False
  1359. End If
  1360. End If
  1361. End Sub
  1362. ' 檢查系統是否已安裝 Google Chrome
  1363. Private Function IsChromeInstalled() As Boolean
  1364. Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
  1365. If key IsNot Nothing Then
  1366. For Each subkeyName As String In key.GetSubKeyNames()
  1367. Dim subkey As Microsoft.Win32.RegistryKey = key.OpenSubKey(subkeyName)
  1368. Dim displayName As Object = subkey.GetValue("DisplayName")
  1369. If displayName IsNot Nothing AndAlso displayName.ToString().Contains("Google Chrome") Then
  1370. Return True
  1371. End If
  1372. Next
  1373. End If
  1374. Return False
  1375. End Function
  1376. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  1377. Return CType(xlBook.Worksheets.Add, Worksheet)
  1378. End Function
  1379. Private Sub AA(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Worksheet)
  1380. xlSheet.Cells.Select()
  1381. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  1382. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1383. xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 90 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 25
  1384. xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 19 : xlSheet.Rows("5:7").Select : myExcel.Selection.RowHeight = 25
  1385. xlSheet.Rows("8:8").Select : myExcel.Selection.RowHeight = 50 : xlSheet.Rows("9:9").Select : myExcel.Selection.RowHeight = 100
  1386. xlSheet.Rows("10:10").Select : myExcel.Selection.RowHeight = 80 : xlSheet.Rows("13:13").Select : myExcel.Selection.RowHeight = 50
  1387. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 4 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 20
  1388. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 1.7 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 30
  1389. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 30
  1390. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 10 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 30
  1391. xlSheet.Columns("I:I").Select : myExcel.Selection.ColumnWidth = 4
  1392. xlSheet.Range("A2:I2").Select()
  1393. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1394. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1395. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  1396. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1397. xlSheet.Range("A3:I3").Select()
  1398. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1399. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1400. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 14 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  1401. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  1402. xlSheet.Range("B5:C10").Select()
  1403. With myExcel.Selection : .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1404. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1405. xlSheet.Range("D5:H5").Select()
  1406. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1407. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1408. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1409. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1410. xlSheet.Range("D6:H6").Select()
  1411. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1412. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1413. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1414. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1415. xlSheet.Range("D7:H7").Select()
  1416. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1417. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1418. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1419. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1420. xlSheet.Range("D8:H8").Select()
  1421. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1422. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1423. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1424. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1425. xlSheet.Range("D9:H9").Select()
  1426. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1427. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1428. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1429. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1430. xlSheet.Range("D10:H10").Select()
  1431. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1432. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
  1433. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1434. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  1435. xlSheet.Range("D12:H14").Select()
  1436. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1437. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1438. xlSheet.Range("A1:I2").Select()
  1439. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1440. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1441. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1442. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1443. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1444. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1445. xlSheet.Range("A3:I3").Select()
  1446. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1447. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1448. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1449. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1450. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1451. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1452. xlSheet.Range("A4:I14").Select()
  1453. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1454. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1455. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1456. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1457. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1458. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1459. xlSheet.Range("D5:H5").Select()
  1460. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1461. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  1462. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1463. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1464. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1465. xlSheet.Range("D6:H6").Select()
  1466. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1467. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone
  1468. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1469. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1470. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1471. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1472. xlSheet.Range("D7:H7").Select()
  1473. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1474. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone
  1475. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1476. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1477. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1478. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1479. xlSheet.Range("D8:H8").Select()
  1480. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1481. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone
  1482. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1483. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1484. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1485. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1486. xlSheet.Range("D9:H9").Select()
  1487. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1488. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone
  1489. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1490. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1491. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1492. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1493. xlSheet.Range("D10:H10").Select()
  1494. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1495. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone
  1496. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1497. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1498. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1499. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1500. xlSheet.Range("F13").Select()
  1501. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1502. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  1503. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1504. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1505. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1506. xlSheet.Range("H13").Select()
  1507. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1508. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  1509. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1510. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1511. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1512. myExcel.ActiveWindow.DisplayGridlines = False
  1513. xlSheet.Range("B5:B10").Select() : myExcel.Selection.Font.Bold = True : xlSheet.Range("D12:H12").Select() : myExcel.Selection.Font.Bold = True
  1514. xlSheet.Range("F14:H14").Select() : myExcel.Selection.Font.Bold = True
  1515. xlSheet.Range("D8:H10").Select()
  1516. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False
  1517. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  1518. xlSheet.Range("B13").Select()
  1519. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1520. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  1521. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1522. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1523. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1524. With myExcel.Selection : .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1525. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1526. xlSheet.Range("D13").Select()
  1527. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  1528. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  1529. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  1530. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  1531. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  1532. With myExcel.Selection : .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  1533. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
  1534. myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename =
  1535. Str01 & "\HXBWLOG.png"
  1536. myExcel.Application.PrintCommunication = False : With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "" : .PrintTitleColumns = "" : End With
  1537. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  1538. With myExcel.ActiveSheet.PageSetup : .LeftHeader = ""
  1539. .CenterHeader = "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "&G"
  1540. .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "" : .RightFooter = ""
  1541. .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
  1542. .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
  1543. .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
  1544. .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = True : .CenterVertically = False
  1545. .Draft = False : .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = False
  1546. .OddAndEvenPagesHeaderFooter = False : .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True
  1547. .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" : .EvenPage.LeftFooter.Text = ""
  1548. .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = ""
  1549. .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = ""
  1550. End With
  1551. myExcel.Application.PrintCommunication = True
  1552. End Sub
  1553. Private Sub CC(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Worksheet)
  1554. Clipboard.SetDataObject(PictureBox1.Image)
  1555. xlSheet.Range("A1").Select()
  1556. myExcel.ActiveSheet.Pictures.Paste.Select
  1557. myExcel.Selection.ShapeRange.Height = 88
  1558. myExcel.Selection.ShapeRange.IncrementLeft(50)
  1559. myExcel.Selection.ShapeRange.IncrementTop(2)
  1560. End Sub
  1561. Private Sub DD(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Worksheet)
  1562. Clipboard.SetDataObject(PictureBox2.Image)
  1563. xlSheet.Range("A1").Select()
  1564. myExcel.ActiveSheet.Pictures.Paste.Select
  1565. myExcel.Selection.ShapeRange.Height = 88
  1566. myExcel.Selection.ShapeRange.IncrementLeft(50)
  1567. myExcel.Selection.ShapeRange.IncrementTop(2)
  1568. End Sub
  1569. Private Sub HX_ch_CheckedChanged(sender As Object, e As EventArgs) Handles HX_ch.Click
  1570. HX_ch.Checked = True : PGS_ch.Checked = False : ALL_ch.Checked = False : Set_清單1()
  1571. End Sub
  1572. Private Sub PGS_ch_CheckedChanged(sender As Object, e As EventArgs) Handles PGS_ch.Click
  1573. HX_ch.Checked = False : PGS_ch.Checked = True : ALL_ch.Checked = False : Set_清單1()
  1574. End Sub
  1575. Private Sub ALL_ch_CheckedChanged(sender As Object, e As EventArgs) Handles ALL_ch.Click
  1576. HX_ch.Checked = False : PGS_ch.Checked = False : ALL_ch.Checked = True : Set_清單1()
  1577. End Sub
  1578. Private Sub 月_ch_Click(sender As Object, e As EventArgs) Handles 月_ch.Click
  1579. 月_ch.Checked = True : 週_ch.Checked = False : 日_ch.Checked = False : 修改BT() : 當月_bt.PerformClick()
  1580. End Sub
  1581. Private Sub 週_ch_Click(sender As Object, e As EventArgs) Handles 週_ch.Click
  1582. 月_ch.Checked = False : 週_ch.Checked = True : 日_ch.Checked = False : 修改BT() : 當月_bt.PerformClick()
  1583. End Sub
  1584. Private Sub 日_ch_Click(sender As Object, e As EventArgs) Handles 日_ch.Click
  1585. 月_ch.Checked = False : 週_ch.Checked = False : 日_ch.Checked = True : 修改BT() : 當月_bt.PerformClick()
  1586. End Sub
  1587. Private Sub 當月_bt_Click(sender As Object, e As EventArgs) Handles 當月_bt.Click
  1588. If 月_ch.Checked Then
  1589. 開始日期_dtp.Value = New Date(Today.Year, Today.Month, 1)
  1590. 結束日期_dtp.Value = 開始日期_dtp.Value.AddMonths(1).AddDays(-1)
  1591. ElseIf 週_ch.Checked Then
  1592. 開始日期_dtp.Value = Today.AddDays(-Today.DayOfWeek)
  1593. 結束日期_dtp.Value = Today.AddDays(6 - Today.DayOfWeek)
  1594. ElseIf 日_ch.Checked Then
  1595. 開始日期_dtp.Value = Today
  1596. 結束日期_dtp.Value = Today
  1597. End If
  1598. End Sub
  1599. Private Sub 上個月_bt_Click(sender As Object, e As EventArgs) Handles 上個月_bt.Click
  1600. If 月_ch.Checked Then
  1601. Dim today As Date = 開始日期_dtp.Value
  1602. Dim 前一個月第一天 As Date = today.AddMonths(-1).AddDays(1 - today.Day)
  1603. Dim 前一個月最後一天 As Date = 前一個月第一天.AddMonths(1).AddDays(-1)
  1604. 開始日期_dtp.Value = 前一個月第一天
  1605. 結束日期_dtp.Value = 前一個月最後一天
  1606. ElseIf 週_ch.Checked Then
  1607. Dim today As Date = 開始日期_dtp.Value
  1608. Dim 前一週第一天 As Date = today.AddDays(-7)
  1609. Dim 前一週最後一天 As Date = today.AddDays(-1)
  1610. 開始日期_dtp.Value = 前一週第一天
  1611. 結束日期_dtp.Value = 前一週最後一天
  1612. ElseIf 日_ch.Checked Then
  1613. Dim today As Date = 開始日期_dtp.Value
  1614. 開始日期_dtp.Value = today.AddDays(-1)
  1615. 結束日期_dtp.Value = today.AddDays(-1)
  1616. End If
  1617. End Sub
  1618. Private Sub 下個月_bt_Click(sender As Object, e As EventArgs) Handles 下個月_bt.Click
  1619. If 月_ch.Checked Then
  1620. Dim today As Date = 開始日期_dtp.Value
  1621. Dim 下個月第一天 As Date = today.AddMonths(1).AddDays(-today.Day + 1)
  1622. Dim 下個月最後一天 As Date = 下個月第一天.AddMonths(1).AddDays(-1)
  1623. 開始日期_dtp.Value = 下個月第一天
  1624. 結束日期_dtp.Value = 下個月最後一天
  1625. ElseIf 週_ch.Checked Then
  1626. Dim today As Date = 開始日期_dtp.Value
  1627. Dim 下一週第一天 As Date = today.AddDays(7)
  1628. Dim 下一週最後一天 As Date = today.AddDays(13)
  1629. 開始日期_dtp.Value = 下一週第一天
  1630. 結束日期_dtp.Value = 下一週最後一天
  1631. ElseIf 日_ch.Checked Then
  1632. Dim today As Date = 開始日期_dtp.Value
  1633. 開始日期_dtp.Value = today.AddDays(1)
  1634. 結束日期_dtp.Value = today.AddDays(1)
  1635. End If
  1636. End Sub
  1637. Private Sub 支付對象_cb_Click(sender As Object, e As EventArgs) Handles 支付對象_cb.Click
  1638. CB選擇清單(支付對象_cb, 支付對象_cb.Text)
  1639. End Sub
  1640. Private Sub 支付對象_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 支付對象_cb.SelectedIndexChanged
  1641. If 支付對象_cb.Text.Substring(0, 1) = "A" Then
  1642. For i As Integer = 0 To 支付對象1_dgv.Rows.Count - 1
  1643. Dim 要寫入的文字 As String = 支付對象_cb.Text.Substring(2)
  1644. If 要寫入的文字 = 支付對象1_dgv.Rows(i).Cells(2).Value.ToString Then
  1645. 支付對象_cb.Text = 支付對象1_dgv.Rows(i).Cells(2).Value.ToString : 支付對象_tb.Text = 支付對象1_dgv.Rows(i).Cells(2).Value.ToString
  1646. 支付銀行_tb.Text = 支付對象1_dgv.Rows(i).Cells(3).Value.ToString : 營行帳號_tb.Text = 支付對象1_dgv.Rows(i).Cells(4).Value.ToString
  1647. 銀行支行_tb.Text = 支付對象1_dgv.Rows(i).Cells(5).Value.ToString
  1648. Exit For
  1649. End If
  1650. Next
  1651. 支付銀行_tb.Enabled = False : 營行帳號_tb.Enabled = False : 銀行支行_tb.Enabled = False
  1652. ElseIf 支付對象_cb.Text.Substring(0, 1) = "B" Then
  1653. SQL_查詢支付對象資料(支付對象_cb.Text.Substring(2))
  1654. If dr.Read() Then
  1655. 支付對象_cb.Text = dr(0).ToString : 支付對象_tb.Text = dr(0).ToString
  1656. 支付銀行_tb.Text = dr(1).ToString : 營行帳號_tb.Text = dr(2).ToString
  1657. 銀行支行_tb.Text = dr(3).ToString
  1658. Else
  1659. 支付對象_cb.Text = 支付對象_cb.Text.Substring(2) : 支付對象_tb.Text = 支付對象_cb.Text.Substring(2)
  1660. 支付銀行_tb.Text = "" : 營行帳號_tb.Text = "" : 銀行支行_tb.Text = ""
  1661. End If
  1662. 支付銀行_tb.Enabled = True : 營行帳號_tb.Enabled = True : 銀行支行_tb.Enabled = True
  1663. End If
  1664. End Sub
  1665. Private Sub 條件_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 條件_cb.SelectedIndexChanged
  1666. If 已開啟 = True Then : Set_清單1() : End If
  1667. End Sub
  1668. Private Sub 解開星期五_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 解開星期五_ch.Click
  1669. If 解開星期五_ch.Checked = True Then : 支付日期_dtp.Enabled = True : Else : 支付日期_dtp.Enabled = False : End If
  1670. End Sub
  1671. Private Sub 結束日期_dtp_ValueChanged(sender As Object, e As EventArgs) Handles 結束日期_dtp.ValueChanged
  1672. If 已開啟 = True Then : Set_清單1() : End If
  1673. End Sub
  1674. Private Sub 風格()
  1675. If 深色風格 = False Then
  1676. Me.BackColor = SystemColors.Control
  1677. 財務單號_lb.ForeColor = Color.Black : Label1.ForeColor = Color.Black : Label2.ForeColor = Color.Black : 補單_cb.ForeColor = Color.Black
  1678. Label3.ForeColor = Color.Black : Label4.ForeColor = Color.Black : Label5.ForeColor = Color.Black : 會計科目_lb.ForeColor = Color.Black
  1679. Label6.ForeColor = Color.Black : Label7.ForeColor = Color.Black : Label8.ForeColor = Color.Black : Label9.ForeColor = Color.Black
  1680. Label10.ForeColor = Color.Black : Label11.ForeColor = Color.Black : Label12.ForeColor = Color.Black : Label13.ForeColor = Color.Black
  1681. Label14.ForeColor = Color.Black : HX_ch.ForeColor = Color.Black : PGS_ch.ForeColor = Color.Black : ALL_ch.ForeColor = Color.Black
  1682. Label18.ForeColor = Color.Black : Label17.ForeColor = Color.Black : Label15.ForeColor = Color.Black : Label16.ForeColor = Color.Black
  1683. Label19.ForeColor = Color.Black
  1684. 單號_tb.BackColor = Color.White : 單號_tb.ForeColor = Color.Black : 部門選單_cb.BackColor = Color.White : 部門選單_cb.ForeColor = Color.Black
  1685. 申請金額_nud.BackColor = Color.White : 申請金額_nud.ForeColor = Color.Black : 金額大寫_tb.BackColor = Color.White : 金額大寫_tb.ForeColor = Color.Black
  1686. 內容_tb.BackColor = Color.White : 內容_tb.ForeColor = Color.Black : 支付對象_tb.BackColor = Color.White : 支付對象_tb.ForeColor = Color.Black
  1687. 第二層_cb.BackColor = Color.White : 第二層_cb.ForeColor = Color.Black : 第三層_cb.BackColor = Color.White : 第三層_cb.ForeColor = Color.Black
  1688. 申請人_tb.BackColor = Color.White : 申請人_tb.ForeColor = Color.Black : 年份2_cb.BackColor = Color.White : 年份2_cb.ForeColor = Color.Black
  1689. 月份2_cb.BackColor = Color.White : 月份2_cb.ForeColor = Color.Black : 審核人_tb.BackColor = Color.White : 審核人_tb.ForeColor = Color.Black
  1690. 營行帳號_tb.BackColor = Color.White : 營行帳號_tb.ForeColor = Color.Black : 支付銀行_tb.BackColor = Color.White : 支付銀行_tb.ForeColor = Color.Black
  1691. 銀行支行_tb.BackColor = Color.White : 銀行支行_tb.ForeColor = Color.Black : 檢查人_tb.BackColor = Color.White : 檢查人_tb.ForeColor = Color.Black
  1692. 主管_tb.BackColor = Color.White : 主管_tb.ForeColor = Color.Black
  1693. 重選部門_bt.BackColor = Color.White : 開立收支單_bt.BackColor = Color.White : 申請完成_bt.BackColor = Color.White : 刪除收支單_bt.BackColor = Color.White
  1694. 列印成EXCEL_bt.BackColor = Color.White : 審核通過_bt.BackColor = Color.White : 單據作廢_bt.BackColor = Color.White : 檢查人_bt.BackColor = Color.White
  1695. 主管_bt.BackColor = Color.White
  1696. 財務收支單_dgv.EnableHeadersVisualStyles = True : 財務收支單_dgv.BackgroundColor = Color.White : 財務收支單_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
  1697. 財務收支單_dgv.DefaultCellStyle.BackColor = Color.White : 財務收支單_dgv.DefaultCellStyle.ForeColor = Color.Black
  1698. Else
  1699. Me.BackColor = Color.Black
  1700. 財務單號_lb.ForeColor = Color.White : Label1.ForeColor = Color.White : Label2.ForeColor = Color.White : 補單_cb.ForeColor = Color.White
  1701. Label3.ForeColor = Color.White : Label4.ForeColor = Color.White : Label5.ForeColor = Color.White : 會計科目_lb.ForeColor = Color.White
  1702. Label6.ForeColor = Color.White : Label7.ForeColor = Color.White : Label8.ForeColor = Color.White : Label9.ForeColor = Color.White
  1703. Label10.ForeColor = Color.White : Label11.ForeColor = Color.White : Label12.ForeColor = Color.White : Label13.ForeColor = Color.White
  1704. Label14.ForeColor = Color.White : HX_ch.ForeColor = Color.White : PGS_ch.ForeColor = Color.White : ALL_ch.ForeColor = Color.White
  1705. Label18.ForeColor = Color.White : Label17.ForeColor = Color.White : Label15.ForeColor = Color.White : Label16.ForeColor = Color.White
  1706. Label19.ForeColor = Color.White
  1707. 單號_tb.BackColor = Color.DimGray : 單號_tb.ForeColor = Color.White : 部門選單_cb.BackColor = Color.DimGray : 部門選單_cb.ForeColor = Color.White
  1708. 申請金額_nud.BackColor = Color.DimGray : 申請金額_nud.ForeColor = Color.White : 金額大寫_tb.BackColor = Color.DimGray : 金額大寫_tb.ForeColor = Color.White
  1709. 內容_tb.BackColor = Color.DimGray : 內容_tb.ForeColor = Color.White : 支付對象_tb.BackColor = Color.DimGray : 支付對象_tb.ForeColor = Color.White
  1710. 第二層_cb.BackColor = Color.DimGray : 第二層_cb.ForeColor = Color.White : 第三層_cb.BackColor = Color.DimGray : 第三層_cb.ForeColor = Color.White
  1711. 申請人_tb.BackColor = Color.DimGray : 申請人_tb.ForeColor = Color.White : 年份2_cb.BackColor = Color.DimGray : 年份2_cb.ForeColor = Color.White
  1712. 月份2_cb.BackColor = Color.DimGray : 月份2_cb.ForeColor = Color.White : 審核人_tb.BackColor = Color.DimGray : 審核人_tb.ForeColor = Color.White
  1713. 營行帳號_tb.BackColor = Color.DimGray : 營行帳號_tb.ForeColor = Color.White : 支付銀行_tb.BackColor = Color.DimGray : 支付銀行_tb.ForeColor = Color.White
  1714. 銀行支行_tb.BackColor = Color.DimGray : 銀行支行_tb.ForeColor = Color.White : 檢查人_tb.BackColor = Color.DimGray : 檢查人_tb.ForeColor = Color.White
  1715. 主管_tb.BackColor = Color.DimGray : 主管_tb.ForeColor = Color.White
  1716. 重選部門_bt.BackColor = Color.DimGray : 開立收支單_bt.BackColor = Color.DimGray : 申請完成_bt.BackColor = Color.DimGray : 刪除收支單_bt.BackColor = Color.DimGray
  1717. 列印成EXCEL_bt.BackColor = Color.DimGray : 審核通過_bt.BackColor = Color.DimGray : 單據作廢_bt.BackColor = Color.DimGray : 檢查人_bt.BackColor = Color.DimGray
  1718. 主管_bt.BackColor = Color.DimGray
  1719. 財務收支單_dgv.EnableHeadersVisualStyles = False : 財務收支單_dgv.BackgroundColor = Color.DimGray : 財務收支單_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
  1720. 財務收支單_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 財務收支單_dgv.DefaultCellStyle.BackColor = Color.Black
  1721. 財務收支單_dgv.DefaultCellStyle.ForeColor = Color.White
  1722. End If
  1723. End Sub
  1724. End Class