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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055
  1. Option Strict Off
  2. Public Class 營運成本收支_決算表
  3. ReadOnly ds As New DataSet : ReadOnly ds1 As New DataSet : ReadOnly ds2 As New DataSet : ReadOnly ds3 As New DataSet : ReadOnly ds4 As New DataSet : ReadOnly ds5 As New DataSet
  4. ReadOnly ds6 As New DataSet : ReadOnly ds7 As New DataSet : ReadOnly ds8 As New DataSet : ReadOnly ds9 As New DataSet : ReadOnly ds10 As New DataSet : ReadOnly ds11 As New DataSet
  5. ReadOnly ds12 As New DataSet : ReadOnly ds13 As New DataSet
  6. Private ReadOnly 列高 As Integer = 35
  7. Private Sub Set_清單()
  8. ds2.Clear()
  9. DataGridView2.DataSource = Nothing : DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  10. DataGridView2.ColumnHeadersHeight = 50 : DataGridView2.AllowUserToAddRows = False : DataGridView2.RowTemplate.Height = 列高
  11. SQL_營運成本收支_決算表年清單()
  12. da.Fill(ds2) : DataGridView2.DataSource = ds2.Tables(0) : conn.Close()
  13. TextBox61.Text = "0" : TextBox62.Text = "0" : TextBox63.Text = "0" : TextBox64.Text = "0" : TextBox77.Text = "0" : TextBox78.Text = "0" : TextBox91.Text = "0" : TextBox104.Text = "0"
  14. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  15. If DataGridView2.Rows(i).Cells("主項金額").Value.ToString = "" Then : DataGridView2.Rows(i).Cells("主項金額").Value = 0 : End If
  16. If DataGridView2.Rows(i).Cells("子項金額").Value.ToString = "" Then : DataGridView2.Rows(i).Cells("子項金額").Value = 0 : End If
  17. If DataGridView2.Rows(i).Cells("細項金額").Value.ToString = "" Then : DataGridView2.Rows(i).Cells("細項金額").Value = 0 : End If
  18. If DataGridView2.Rows(i).Cells("主項彙總").Value.ToString = "" Then : DataGridView2.Rows(i).Cells("主項彙總").Value = 0 : End If
  19. If DataGridView2.Rows(i).Cells("子項彙總").Value.ToString = "" Then : DataGridView2.Rows(i).Cells("子項彙總").Value = 0 : End If
  20. If DataGridView2.Rows(i).Cells("細項彙總").Value.ToString = "" Then : DataGridView2.Rows(i).Cells("細項彙總").Value = 0 : End If
  21. If DataGridView2.Rows(i).Cells("抵銷").Value = True Then
  22. DataGridView2.Rows(i).Cells("主項彙總").Value = DataGridView2.Rows(i).Cells("主項彙總").Value * -1
  23. DataGridView2.Rows(i).Cells("子項彙總").Value = DataGridView2.Rows(i).Cells("子項彙總").Value * -1
  24. DataGridView2.Rows(i).Cells("細項彙總").Value = DataGridView2.Rows(i).Cells("細項彙總").Value * -1
  25. End If
  26. If DataGridView2.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView2.Rows(i).Cells("主項彙總").Value = 0 : End If
  27. If DataGridView2.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView2.Rows(i).Cells("子項彙總").Value = 0 : End If
  28. If DataGridView2.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView2.Rows(i).Cells("主項金額").Value = 0 : End If
  29. If DataGridView2.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView2.Rows(i).Cells("子項金額").Value = 0 : End If
  30. If DataGridView2.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView2.Rows(i).Cells("子項").Value = "" : End If
  31. If DataGridView2.Rows(i).Cells("層級").Value.ToString <> "3" Then : DataGridView2.Rows(i).Cells("子細項").Value = "" : End If
  32. If i = 0 Then : Else
  33. If DataGridView2.Rows(i).Cells("第一階").Value.ToString = DataGridView2.Rows(i - 1).Cells("第一階").Value.ToString Then : DataGridView2.Rows(i).Cells("主項").Value = "" : End If
  34. If DataGridView2.Rows(i).Cells("第二階").Value.ToString = DataGridView2.Rows(i - 1).Cells("第二階").Value.ToString Then : DataGridView2.Rows(i).Cells("子項").Value = "" : End If
  35. End If
  36. If ComboBox2.Text = "" Then : ElseIf ComboBox2.Text <> "" And CheckBox1.Checked = False Then : TextBox61.Text = "0" : TextBox61.Visible = False : Else : TextBox61.Visible = True
  37. If DataGridView2.Rows(i).Cells("第一階").Value.ToString = ComboBox2.Text Then : TextBox61.Text = Val(TextBox61.Text) + DataGridView2.Rows(i).Cells("主項金額").Value : End If : End If
  38. If ComboBox3.Text = "" Then : ElseIf ComboBox3.Text <> "" And CheckBox2.Checked = False Then : TextBox62.Text = "0" : TextBox62.Visible = False : Else : TextBox62.Visible = True
  39. If DataGridView2.Rows(i).Cells("第一階").Value.ToString = ComboBox3.Text Then : TextBox62.Text = Val(TextBox62.Text) + DataGridView2.Rows(i).Cells("主項金額").Value : End If : End If
  40. If ComboBox4.Text = "" Then : ElseIf ComboBox4.Text <> "" And CheckBox3.Checked = False Then : TextBox63.Text = "0" : TextBox63.Visible = False : Else : TextBox63.Visible = True
  41. If DataGridView2.Rows(i).Cells("第一階").Value.ToString = ComboBox4.Text Then : TextBox63.Text = Val(TextBox63.Text) + DataGridView2.Rows(i).Cells("主項金額").Value : End If : End If
  42. If ComboBox5.Text = "" Then : ElseIf ComboBox5.Text <> "" And CheckBox4.Checked = False Then : TextBox77.Text = "0" : TextBox77.Visible = False : Else : TextBox77.Visible = True
  43. If DataGridView2.Rows(i).Cells("第一階").Value.ToString = ComboBox5.Text Then : TextBox77.Text = Val(TextBox77.Text) + DataGridView2.Rows(i).Cells("主項金額").Value : End If : End If
  44. If ComboBox6.Text = "" Then : ElseIf ComboBox6.Text <> "" And CheckBox5.Checked = False Then : TextBox78.Text = "0" : TextBox78.Visible = False : Else : TextBox78.Visible = True
  45. If DataGridView2.Rows(i).Cells("第一階").Value.ToString = ComboBox6.Text Then : TextBox78.Text = Val(TextBox78.Text) + DataGridView2.Rows(i).Cells("主項金額").Value : End If : End If
  46. If ComboBox7.Text = "" Then : ElseIf ComboBox7.Text <> "" And CheckBox6.Checked = False Then : TextBox91.Text = "0" : TextBox91.Visible = False : Else : TextBox91.Visible = True
  47. If DataGridView2.Rows(i).Cells("第一階").Value.ToString = ComboBox7.Text Then : TextBox91.Text = Val(TextBox91.Text) + DataGridView2.Rows(i).Cells("主項金額").Value : End If : End If
  48. If ComboBox8.Text = "" Then : ElseIf ComboBox8.Text <> "" And CheckBox7.Checked = False Then : TextBox104.Text = "0" : TextBox104.Visible = False : Else : TextBox104.Visible = True
  49. If DataGridView2.Rows(i).Cells("第一階").Value.ToString = ComboBox8.Text Then : TextBox104.Text = Val(TextBox104.Text) + DataGridView2.Rows(i).Cells("主項金額").Value : End If : End If
  50. Next
  51. TextBox64.Text = Val(TextBox61.Text) + Val(TextBox62.Text) + Val(TextBox63.Text) + Val(TextBox77.Text) + Val(TextBox78.Text) + Val(TextBox91.Text) + Val(TextBox104.Text)
  52. End Sub
  53. Private Sub Set_清單1()
  54. DataGridView1.DataSource = Nothing : ds.Clear() : DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  55. DataGridView1.ColumnHeadersHeight = 50 : DataGridView1.AllowUserToAddRows = False : DataGridView1.RowTemplate.Height = 列高
  56. PA = "01" : SQL_營運成本收支_決算表月清單()
  57. da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
  58. TextBox1.Text = "0" : TextBox2.Text = "0" : TextBox3.Text = "0" : TextBox4.Text = "0" : TextBox30.Text = "0" : TextBox76.Text = "0" : TextBox90.Text = "0" : TextBox103.Text = "0"
  59. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  60. If DataGridView1.Rows(i).Cells("主項金額").Value.ToString = "" Then : DataGridView1.Rows(i).Cells("主項金額").Value = 0 : End If
  61. If DataGridView1.Rows(i).Cells("子項金額").Value.ToString = "" Then : DataGridView1.Rows(i).Cells("子項金額").Value = 0 : End If
  62. If DataGridView1.Rows(i).Cells("細項金額").Value.ToString = "" Then : DataGridView1.Rows(i).Cells("細項金額").Value = 0 : End If
  63. If DataGridView1.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView1.Rows(i).Cells("主項金額").Value = 0 : End If
  64. If DataGridView1.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView1.Rows(i).Cells("子項金額").Value = 0 : End If
  65. If DataGridView1.Rows(i).Cells("主項金額").Value.ToString <> "0" Then : DataGridView1.Rows(i).Cells("金額").Value = DataGridView1.Rows(i).Cells("主項金額").Value
  66. ElseIf DataGridView1.Rows(i).Cells("子項金額").Value.ToString <> "0" Then : DataGridView1.Rows(i).Cells("金額").Value = DataGridView1.Rows(i).Cells("子項金額").Value
  67. ElseIf DataGridView1.Rows(i).Cells("細項金額").Value.ToString <> "0" Then : DataGridView1.Rows(i).Cells("金額").Value = DataGridView1.Rows(i).Cells("細項金額").Value
  68. Else : DataGridView1.Rows(i).Cells("金額").Value = 0 : End If
  69. DataGridView1.Rows(i).Cells("彙總").Value = DataGridView1.Rows(i).Cells("金額").Value
  70. If DataGridView1.Rows(i).Cells("抵銷").Value = True Then : DataGridView1.Rows(i).Cells("彙總").Value = DataGridView1.Rows(i).Cells("彙總").Value * -1 : End If
  71. If ComboBox2.Text = "" Then : Else
  72. If DataGridView1.Rows(i).Cells("第一階").Value.ToString = ComboBox2.Text Then : TextBox1.Text = Val(TextBox1.Text) + DataGridView1.Rows(i).Cells("主項金額").Value : End If : End If
  73. If ComboBox3.Text = "" Then : Else
  74. If DataGridView1.Rows(i).Cells("第一階").Value.ToString = ComboBox3.Text Then : TextBox2.Text = Val(TextBox2.Text) + DataGridView1.Rows(i).Cells("主項金額").Value : End If : End If
  75. If ComboBox4.Text = "" Then : Else
  76. If DataGridView1.Rows(i).Cells("第一階").Value.ToString = ComboBox4.Text Then : TextBox3.Text = Val(TextBox3.Text) + DataGridView1.Rows(i).Cells("主項金額").Value : End If : End If
  77. If ComboBox5.Text = "" Then : Else
  78. If DataGridView1.Rows(i).Cells("第一階").Value.ToString = ComboBox5.Text Then : TextBox76.Text = Val(TextBox76.Text) + DataGridView1.Rows(i).Cells("主項金額").Value : End If : End If
  79. If ComboBox6.Text = "" Then : Else
  80. If DataGridView1.Rows(i).Cells("第一階").Value.ToString = ComboBox6.Text Then : TextBox90.Text = Val(TextBox90.Text) + DataGridView1.Rows(i).Cells("主項金額").Value : End If : End If
  81. If ComboBox7.Text = "" Then : Else
  82. If DataGridView1.Rows(i).Cells("第一階").Value.ToString = ComboBox7.Text Then : TextBox103.Text = Val(TextBox103.Text) + DataGridView1.Rows(i).Cells("主項金額").Value : End If : End If
  83. If ComboBox8.Text = "" Then : Else
  84. If DataGridView1.Rows(i).Cells("第一階").Value.ToString = ComboBox8.Text Then : TextBox30.Text = Val(TextBox30.Text) + DataGridView1.Rows(i).Cells("主項金額").Value : End If : End If
  85. Next
  86. TextBox4.Text = Val(TextBox30.Text) + Val(TextBox1.Text) + Val(TextBox2.Text) + Val(TextBox3.Text) + Val(TextBox76.Text) + Val(TextBox90.Text) + Val(TextBox103.Text)
  87. End Sub
  88. Private Sub Set_清單2()
  89. DataGridView3.DataSource = Nothing : ds1.Clear() : DataGridView3.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  90. DataGridView3.ColumnHeadersHeight = 50 : DataGridView3.AllowUserToAddRows = False : DataGridView3.RowTemplate.Height = 列高
  91. PA = "02" : SQL_營運成本收支_決算表月清單()
  92. da.Fill(ds1) : DataGridView3.DataSource = ds1.Tables(0) : conn.Close()
  93. TextBox5.Text = "0" : TextBox6.Text = "0" : TextBox7.Text = "0" : TextBox8.Text = "0" : TextBox29.Text = "0" : TextBox75.Text = "0" : TextBox89.Text = "0" : TextBox102.Text = "0"
  94. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  95. If DataGridView3.Rows(i).Cells("主項金額").Value.ToString = "" Then : DataGridView3.Rows(i).Cells("主項金額").Value = 0 : End If
  96. If DataGridView3.Rows(i).Cells("子項金額").Value.ToString = "" Then : DataGridView3.Rows(i).Cells("子項金額").Value = 0 : End If
  97. If DataGridView3.Rows(i).Cells("細項金額").Value.ToString = "" Then : DataGridView3.Rows(i).Cells("細項金額").Value = 0 : End If
  98. If DataGridView3.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView3.Rows(i).Cells("主項金額").Value = 0 : End If
  99. If DataGridView3.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView3.Rows(i).Cells("子項金額").Value = 0 : End If
  100. If DataGridView3.Rows(i).Cells("主項金額").Value.ToString <> "0" Then : DataGridView3.Rows(i).Cells("金額").Value = DataGridView3.Rows(i).Cells("主項金額").Value
  101. ElseIf DataGridView3.Rows(i).Cells("子項金額").Value.ToString <> "0" Then : DataGridView3.Rows(i).Cells("金額").Value = DataGridView3.Rows(i).Cells("子項金額").Value
  102. ElseIf DataGridView3.Rows(i).Cells("細項金額").Value.ToString <> "0" Then : DataGridView3.Rows(i).Cells("金額").Value = DataGridView3.Rows(i).Cells("細項金額").Value
  103. Else : DataGridView3.Rows(i).Cells("金額").Value = 0 : End If
  104. DataGridView3.Rows(i).Cells("彙總").Value = DataGridView3.Rows(i).Cells("金額").Value
  105. If DataGridView3.Rows(i).Cells("抵銷").Value = True Then : DataGridView3.Rows(i).Cells("彙總").Value = DataGridView3.Rows(i).Cells("彙總").Value * -1 : End If
  106. If ComboBox2.Text = "" Then : Else
  107. If DataGridView3.Rows(i).Cells("第一階").Value.ToString = ComboBox2.Text Then : TextBox5.Text = Val(TextBox5.Text) + DataGridView3.Rows(i).Cells("主項金額").Value : End If : End If
  108. If ComboBox3.Text = "" Then : Else
  109. If DataGridView3.Rows(i).Cells("第一階").Value.ToString = ComboBox3.Text Then : TextBox6.Text = Val(TextBox6.Text) + DataGridView3.Rows(i).Cells("主項金額").Value : End If : End If
  110. If ComboBox4.Text = "" Then : Else
  111. If DataGridView3.Rows(i).Cells("第一階").Value.ToString = ComboBox4.Text Then : TextBox7.Text = Val(TextBox7.Text) + DataGridView3.Rows(i).Cells("主項金額").Value : End If : End If
  112. If ComboBox5.Text = "" Then : Else
  113. If DataGridView3.Rows(i).Cells("第一階").Value.ToString = ComboBox5.Text Then : TextBox75.Text = Val(TextBox75.Text) + DataGridView3.Rows(i).Cells("主項金額").Value : End If : End If
  114. If ComboBox6.Text = "" Then : Else
  115. If DataGridView3.Rows(i).Cells("第一階").Value.ToString = ComboBox6.Text Then : TextBox89.Text = Val(TextBox89.Text) + DataGridView3.Rows(i).Cells("主項金額").Value : End If : End If
  116. If ComboBox7.Text = "" Then : Else
  117. If DataGridView3.Rows(i).Cells("第一階").Value.ToString = ComboBox7.Text Then : TextBox102.Text = Val(TextBox102.Text) + DataGridView3.Rows(i).Cells("主項金額").Value : End If : End If
  118. If ComboBox8.Text = "" Then : Else
  119. If DataGridView3.Rows(i).Cells("第一階").Value.ToString = ComboBox8.Text Then : TextBox29.Text = Val(TextBox29.Text) + DataGridView3.Rows(i).Cells("主項金額").Value : End If : End If
  120. Next
  121. TextBox8.Text = Val(TextBox29.Text) + Val(TextBox5.Text) + Val(TextBox6.Text) + Val(TextBox7.Text) + Val(TextBox75.Text) + Val(TextBox89.Text) + Val(TextBox102.Text)
  122. End Sub
  123. Private Sub Set_清單3()
  124. DataGridView4.DataSource = Nothing : ds3.Clear() : DataGridView4.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  125. DataGridView4.ColumnHeadersHeight = 50 : DataGridView4.AllowUserToAddRows = False : DataGridView4.RowTemplate.Height = 列高
  126. PA = "03" : SQL_營運成本收支_決算表月清單()
  127. da.Fill(ds3) : DataGridView4.DataSource = ds3.Tables(0) : conn.Close()
  128. TextBox9.Text = "0" : TextBox10.Text = "0" : TextBox11.Text = "0" : TextBox12.Text = "0" : TextBox28.Text = "0" : TextBox74.Text = "0" : TextBox88.Text = "0" : TextBox101.Text = "0"
  129. For i As Integer = 0 To DataGridView4.Rows.Count - 1
  130. If DataGridView4.Rows(i).Cells("主項金額").Value.ToString = "" Then : DataGridView4.Rows(i).Cells("主項金額").Value = 0 : End If
  131. If DataGridView4.Rows(i).Cells("子項金額").Value.ToString = "" Then : DataGridView4.Rows(i).Cells("子項金額").Value = 0 : End If
  132. If DataGridView4.Rows(i).Cells("細項金額").Value.ToString = "" Then : DataGridView4.Rows(i).Cells("細項金額").Value = 0 : End If
  133. If DataGridView4.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView4.Rows(i).Cells("主項金額").Value = 0 : End If
  134. If DataGridView4.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView4.Rows(i).Cells("子項金額").Value = 0 : End If
  135. If DataGridView4.Rows(i).Cells("主項金額").Value.ToString <> "0" Then : DataGridView4.Rows(i).Cells("金額").Value = DataGridView4.Rows(i).Cells("主項金額").Value
  136. ElseIf DataGridView4.Rows(i).Cells("子項金額").Value.ToString <> "0" Then : DataGridView4.Rows(i).Cells("金額").Value = DataGridView4.Rows(i).Cells("子項金額").Value
  137. ElseIf DataGridView4.Rows(i).Cells("細項金額").Value.ToString <> "0" Then : DataGridView4.Rows(i).Cells("金額").Value = DataGridView4.Rows(i).Cells("細項金額").Value
  138. Else : DataGridView4.Rows(i).Cells("金額").Value = 0 : End If
  139. DataGridView4.Rows(i).Cells("彙總").Value = DataGridView4.Rows(i).Cells("金額").Value
  140. If DataGridView4.Rows(i).Cells("抵銷").Value = True Then : DataGridView4.Rows(i).Cells("彙總").Value = DataGridView4.Rows(i).Cells("彙總").Value * -1 : End If
  141. If ComboBox2.Text = "" Then : Else
  142. If DataGridView4.Rows(i).Cells("第一階").Value.ToString = ComboBox2.Text Then : TextBox9.Text = Val(TextBox9.Text) + DataGridView4.Rows(i).Cells("主項金額").Value : End If : End If
  143. If ComboBox3.Text = "" Then : Else
  144. If DataGridView4.Rows(i).Cells("第一階").Value.ToString = ComboBox3.Text Then : TextBox10.Text = Val(TextBox10.Text) + DataGridView4.Rows(i).Cells("主項金額").Value : End If : End If
  145. If ComboBox4.Text = "" Then : Else
  146. If DataGridView4.Rows(i).Cells("第一階").Value.ToString = ComboBox4.Text Then : TextBox11.Text = Val(TextBox11.Text) + DataGridView4.Rows(i).Cells("主項金額").Value : End If : End If
  147. If ComboBox5.Text = "" Then : Else
  148. If DataGridView4.Rows(i).Cells("第一階").Value.ToString = ComboBox5.Text Then : TextBox74.Text = Val(TextBox74.Text) + DataGridView4.Rows(i).Cells("主項金額").Value : End If : End If
  149. If ComboBox6.Text = "" Then : Else
  150. If DataGridView4.Rows(i).Cells("第一階").Value.ToString = ComboBox6.Text Then : TextBox88.Text = Val(TextBox88.Text) + DataGridView4.Rows(i).Cells("主項金額").Value : End If : End If
  151. If ComboBox7.Text = "" Then : Else
  152. If DataGridView4.Rows(i).Cells("第一階").Value.ToString = ComboBox7.Text Then : TextBox101.Text = Val(TextBox101.Text) + DataGridView4.Rows(i).Cells("主項金額").Value : End If : End If
  153. If ComboBox8.Text = "" Then : Else
  154. If DataGridView4.Rows(i).Cells("第一階").Value.ToString = ComboBox8.Text Then : TextBox28.Text = Val(TextBox28.Text) + DataGridView4.Rows(i).Cells("主項金額").Value : End If : End If
  155. Next
  156. TextBox12.Text = Val(TextBox28.Text) + Val(TextBox9.Text) + Val(TextBox10.Text) + Val(TextBox11.Text) + Val(TextBox74.Text) + Val(TextBox88.Text) + Val(TextBox101.Text)
  157. End Sub
  158. Private Sub Set_清單4()
  159. DataGridView5.DataSource = Nothing : ds4.Clear() : DataGridView5.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  160. DataGridView5.ColumnHeadersHeight = 50 : DataGridView5.AllowUserToAddRows = False : DataGridView5.RowTemplate.Height = 列高
  161. PA = "04" : SQL_營運成本收支_決算表月清單()
  162. da.Fill(ds4) : DataGridView5.DataSource = ds4.Tables(0) : conn.Close()
  163. TextBox13.Text = "0" : TextBox14.Text = "0" : TextBox15.Text = "0" : TextBox16.Text = "0" : TextBox27.Text = "0" : TextBox73.Text = "0" : TextBox87.Text = "0" : TextBox100.Text = "0"
  164. For i As Integer = 0 To DataGridView5.Rows.Count - 1
  165. If DataGridView5.Rows(i).Cells("主項金額").Value.ToString = "" Then : DataGridView5.Rows(i).Cells("主項金額").Value = 0 : End If
  166. If DataGridView5.Rows(i).Cells("子項金額").Value.ToString = "" Then : DataGridView5.Rows(i).Cells("子項金額").Value = 0 : End If
  167. If DataGridView5.Rows(i).Cells("細項金額").Value.ToString = "" Then : DataGridView5.Rows(i).Cells("細項金額").Value = 0 : End If
  168. If DataGridView5.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView5.Rows(i).Cells("主項金額").Value = 0 : End If
  169. If DataGridView5.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView5.Rows(i).Cells("子項金額").Value = 0 : End If
  170. If DataGridView5.Rows(i).Cells("主項金額").Value.ToString <> "0" Then : DataGridView5.Rows(i).Cells("金額").Value = DataGridView5.Rows(i).Cells("主項金額").Value
  171. ElseIf DataGridView5.Rows(i).Cells("子項金額").Value.ToString <> "0" Then : DataGridView5.Rows(i).Cells("金額").Value = DataGridView5.Rows(i).Cells("子項金額").Value
  172. ElseIf DataGridView5.Rows(i).Cells("細項金額").Value.ToString <> "0" Then : DataGridView5.Rows(i).Cells("金額").Value = DataGridView5.Rows(i).Cells("細項金額").Value
  173. Else : DataGridView5.Rows(i).Cells("金額").Value = 0 : End If
  174. DataGridView5.Rows(i).Cells("彙總").Value = DataGridView5.Rows(i).Cells("金額").Value
  175. If DataGridView5.Rows(i).Cells("抵銷").Value = True Then : DataGridView5.Rows(i).Cells("彙總").Value = DataGridView5.Rows(i).Cells("彙總").Value * -1 : End If
  176. If ComboBox2.Text = "" Then : Else
  177. If DataGridView5.Rows(i).Cells("第一階").Value.ToString = ComboBox2.Text Then : TextBox13.Text = Val(TextBox13.Text) + DataGridView5.Rows(i).Cells("主項金額").Value : End If : End If
  178. If ComboBox3.Text = "" Then : Else
  179. If DataGridView5.Rows(i).Cells("第一階").Value.ToString = ComboBox3.Text Then : TextBox14.Text = Val(TextBox14.Text) + DataGridView5.Rows(i).Cells("主項金額").Value : End If : End If
  180. If ComboBox4.Text = "" Then : Else
  181. If DataGridView5.Rows(i).Cells("第一階").Value.ToString = ComboBox4.Text Then : TextBox15.Text = Val(TextBox15.Text) + DataGridView5.Rows(i).Cells("主項金額").Value : End If : End If
  182. If ComboBox5.Text = "" Then : Else
  183. If DataGridView5.Rows(i).Cells("第一階").Value.ToString = ComboBox5.Text Then : TextBox73.Text = Val(TextBox73.Text) + DataGridView5.Rows(i).Cells("主項金額").Value : End If : End If
  184. If ComboBox6.Text = "" Then : Else
  185. If DataGridView5.Rows(i).Cells("第一階").Value.ToString = ComboBox6.Text Then : TextBox87.Text = Val(TextBox87.Text) + DataGridView5.Rows(i).Cells("主項金額").Value : End If : End If
  186. If ComboBox7.Text = "" Then : Else
  187. If DataGridView5.Rows(i).Cells("第一階").Value.ToString = ComboBox7.Text Then : TextBox100.Text = Val(TextBox100.Text) + DataGridView5.Rows(i).Cells("主項金額").Value : End If : End If
  188. If ComboBox8.Text = "" Then : Else
  189. If DataGridView5.Rows(i).Cells("第一階").Value.ToString = ComboBox8.Text Then : TextBox27.Text = Val(TextBox27.Text) + DataGridView5.Rows(i).Cells("主項金額").Value : End If : End If
  190. Next
  191. TextBox16.Text = Val(TextBox27.Text) + Val(TextBox13.Text) + Val(TextBox14.Text) + Val(TextBox15.Text) + Val(TextBox73.Text) + Val(TextBox87.Text) + Val(TextBox100.Text)
  192. End Sub
  193. Private Sub Set_清單5()
  194. DataGridView6.DataSource = Nothing : ds5.Clear() : DataGridView6.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  195. DataGridView6.ColumnHeadersHeight = 50 : DataGridView6.AllowUserToAddRows = False : DataGridView6.RowTemplate.Height = 列高
  196. PA = "05" : SQL_營運成本收支_決算表月清單()
  197. da.Fill(ds5) : DataGridView6.DataSource = ds5.Tables(0) : conn.Close()
  198. TextBox17.Text = "0" : TextBox18.Text = "0" : TextBox19.Text = "0" : TextBox20.Text = "0" : TextBox26.Text = "0" : TextBox72.Text = "0" : TextBox86.Text = "0" : TextBox99.Text = "0"
  199. For i As Integer = 0 To DataGridView6.Rows.Count - 1
  200. If DataGridView6.Rows(i).Cells("主項金額").Value.ToString = "" Then : DataGridView6.Rows(i).Cells("主項金額").Value = 0 : End If
  201. If DataGridView6.Rows(i).Cells("子項金額").Value.ToString = "" Then : DataGridView6.Rows(i).Cells("子項金額").Value = 0 : End If
  202. If DataGridView6.Rows(i).Cells("細項金額").Value.ToString = "" Then : DataGridView6.Rows(i).Cells("細項金額").Value = 0 : End If
  203. If DataGridView6.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView6.Rows(i).Cells("主項金額").Value = 0 : End If
  204. If DataGridView6.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView6.Rows(i).Cells("子項金額").Value = 0 : End If
  205. If DataGridView6.Rows(i).Cells("主項金額").Value.ToString <> "0" Then : DataGridView6.Rows(i).Cells("金額").Value = DataGridView6.Rows(i).Cells("主項金額").Value
  206. ElseIf DataGridView6.Rows(i).Cells("子項金額").Value.ToString <> "0" Then : DataGridView6.Rows(i).Cells("金額").Value = DataGridView6.Rows(i).Cells("子項金額").Value
  207. ElseIf DataGridView6.Rows(i).Cells("細項金額").Value.ToString <> "0" Then : DataGridView6.Rows(i).Cells("金額").Value = DataGridView6.Rows(i).Cells("細項金額").Value
  208. Else : DataGridView6.Rows(i).Cells("金額").Value = 0 : End If
  209. DataGridView6.Rows(i).Cells("彙總").Value = DataGridView6.Rows(i).Cells("金額").Value
  210. If DataGridView6.Rows(i).Cells("抵銷").Value = True Then : DataGridView6.Rows(i).Cells("彙總").Value = DataGridView6.Rows(i).Cells("彙總").Value * -1 : End If
  211. If ComboBox2.Text = "" Then : Else
  212. If DataGridView6.Rows(i).Cells("第一階").Value.ToString = ComboBox2.Text Then : TextBox17.Text = Val(TextBox17.Text) + DataGridView6.Rows(i).Cells("主項金額").Value : End If : End If
  213. If ComboBox3.Text = "" Then : Else
  214. If DataGridView6.Rows(i).Cells("第一階").Value.ToString = ComboBox3.Text Then : TextBox18.Text = Val(TextBox18.Text) + DataGridView6.Rows(i).Cells("主項金額").Value : End If : End If
  215. If ComboBox4.Text = "" Then : Else
  216. If DataGridView6.Rows(i).Cells("第一階").Value.ToString = ComboBox4.Text Then : TextBox19.Text = Val(TextBox19.Text) + DataGridView6.Rows(i).Cells("主項金額").Value : End If : End If
  217. If ComboBox5.Text = "" Then : Else
  218. If DataGridView6.Rows(i).Cells("第一階").Value.ToString = ComboBox5.Text Then : TextBox72.Text = Val(TextBox72.Text) + DataGridView6.Rows(i).Cells("主項金額").Value : End If : End If
  219. If ComboBox6.Text = "" Then : Else
  220. If DataGridView6.Rows(i).Cells("第一階").Value.ToString = ComboBox6.Text Then : TextBox86.Text = Val(TextBox86.Text) + DataGridView6.Rows(i).Cells("主項金額").Value : End If : End If
  221. If ComboBox7.Text = "" Then : Else
  222. If DataGridView6.Rows(i).Cells("第一階").Value.ToString = ComboBox7.Text Then : TextBox99.Text = Val(TextBox99.Text) + DataGridView6.Rows(i).Cells("主項金額").Value : End If : End If
  223. If ComboBox8.Text = "" Then : Else
  224. If DataGridView6.Rows(i).Cells("第一階").Value.ToString = ComboBox8.Text Then : TextBox26.Text = Val(TextBox26.Text) + DataGridView6.Rows(i).Cells("主項金額").Value : End If : End If
  225. Next
  226. TextBox20.Text = Val(TextBox17.Text) + Val(TextBox18.Text) + Val(TextBox19.Text) + Val(TextBox26.Text) + Val(TextBox72.Text) + Val(TextBox86.Text) + Val(TextBox99.Text)
  227. End Sub
  228. Private Sub Set_清單6()
  229. DataGridView7.DataSource = Nothing : ds6.Clear() : DataGridView7.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  230. DataGridView7.ColumnHeadersHeight = 50 : DataGridView7.AllowUserToAddRows = False : DataGridView7.RowTemplate.Height = 列高
  231. PA = "06" : SQL_營運成本收支_決算表月清單()
  232. da.Fill(ds6) : DataGridView7.DataSource = ds6.Tables(0) : conn.Close()
  233. TextBox21.Text = "0" : TextBox22.Text = "0" : TextBox23.Text = "0" : TextBox24.Text = "0" : TextBox25.Text = "0" : TextBox71.Text = "0" : TextBox85.Text = "0" : TextBox98.Text = "0"
  234. For i As Integer = 0 To DataGridView7.Rows.Count - 1
  235. If DataGridView7.Rows(i).Cells("主項金額").Value.ToString = "" Then : DataGridView7.Rows(i).Cells("主項金額").Value = 0 : End If
  236. If DataGridView7.Rows(i).Cells("子項金額").Value.ToString = "" Then : DataGridView7.Rows(i).Cells("子項金額").Value = 0 : End If
  237. If DataGridView7.Rows(i).Cells("細項金額").Value.ToString = "" Then : DataGridView7.Rows(i).Cells("細項金額").Value = 0 : End If
  238. If DataGridView7.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView7.Rows(i).Cells("主項金額").Value = 0 : End If
  239. If DataGridView7.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView7.Rows(i).Cells("子項金額").Value = 0 : End If
  240. If DataGridView7.Rows(i).Cells("主項金額").Value.ToString <> "0" Then : DataGridView7.Rows(i).Cells("金額").Value = DataGridView7.Rows(i).Cells("主項金額").Value
  241. ElseIf DataGridView7.Rows(i).Cells("子項金額").Value.ToString <> "0" Then : DataGridView7.Rows(i).Cells("金額").Value = DataGridView7.Rows(i).Cells("子項金額").Value
  242. ElseIf DataGridView7.Rows(i).Cells("細項金額").Value.ToString <> "0" Then : DataGridView7.Rows(i).Cells("金額").Value = DataGridView7.Rows(i).Cells("細項金額").Value
  243. Else : DataGridView7.Rows(i).Cells("金額").Value = 0 : End If
  244. DataGridView7.Rows(i).Cells("彙總").Value = DataGridView7.Rows(i).Cells("金額").Value
  245. If DataGridView7.Rows(i).Cells("抵銷").Value = True Then : DataGridView7.Rows(i).Cells("彙總").Value = DataGridView7.Rows(i).Cells("彙總").Value * -1 : End If
  246. If ComboBox2.Text = "" Then : Else
  247. If DataGridView7.Rows(i).Cells("第一階").Value.ToString = ComboBox2.Text Then : TextBox21.Text = Val(TextBox21.Text) + DataGridView7.Rows(i).Cells("主項金額").Value : End If : End If
  248. If ComboBox3.Text = "" Then : Else
  249. If DataGridView7.Rows(i).Cells("第一階").Value.ToString = ComboBox3.Text Then : TextBox22.Text = Val(TextBox22.Text) + DataGridView7.Rows(i).Cells("主項金額").Value : End If : End If
  250. If ComboBox4.Text = "" Then : Else
  251. If DataGridView7.Rows(i).Cells("第一階").Value.ToString = ComboBox4.Text Then : TextBox23.Text = Val(TextBox23.Text) + DataGridView7.Rows(i).Cells("主項金額").Value : End If : End If
  252. If ComboBox5.Text = "" Then : Else
  253. If DataGridView7.Rows(i).Cells("第一階").Value.ToString = ComboBox5.Text Then : TextBox71.Text = Val(TextBox71.Text) + DataGridView7.Rows(i).Cells("主項金額").Value : End If : End If
  254. If ComboBox6.Text = "" Then : Else
  255. If DataGridView7.Rows(i).Cells("第一階").Value.ToString = ComboBox6.Text Then : TextBox85.Text = Val(TextBox85.Text) + DataGridView7.Rows(i).Cells("主項金額").Value : End If : End If
  256. If ComboBox7.Text = "" Then : Else
  257. If DataGridView7.Rows(i).Cells("第一階").Value.ToString = ComboBox7.Text Then : TextBox98.Text = Val(TextBox98.Text) + DataGridView7.Rows(i).Cells("主項金額").Value : End If : End If
  258. If ComboBox8.Text = "" Then : Else
  259. If DataGridView7.Rows(i).Cells("第一階").Value.ToString = ComboBox8.Text Then : TextBox25.Text = Val(TextBox25.Text) + DataGridView7.Rows(i).Cells("主項金額").Value : End If : End If
  260. Next
  261. TextBox24.Text = Val(TextBox21.Text) + Val(TextBox22.Text) + Val(TextBox23.Text) + Val(TextBox25.Text) + Val(TextBox71.Text) + Val(TextBox85.Text) + Val(TextBox98.Text)
  262. End Sub
  263. Private Sub Set_清單7()
  264. DataGridView8.DataSource = Nothing : ds7.Clear() : DataGridView8.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  265. DataGridView8.ColumnHeadersHeight = 50 : DataGridView8.AllowUserToAddRows = False : DataGridView8.RowTemplate.Height = 列高
  266. PA = "07" : SQL_營運成本收支_決算表月清單()
  267. da.Fill(ds7) : DataGridView8.DataSource = ds7.Tables(0) : conn.Close()
  268. TextBox31.Text = "0" : TextBox32.Text = "0" : TextBox33.Text = "0" : TextBox34.Text = "0" : TextBox35.Text = "0" : TextBox70.Text = "0" : TextBox84.Text = "0" : TextBox97.Text = "0"
  269. For i As Integer = 0 To DataGridView8.Rows.Count - 1
  270. If DataGridView8.Rows(i).Cells("主項金額").Value.ToString = "" Then : DataGridView8.Rows(i).Cells("主項金額").Value = 0 : End If
  271. If DataGridView8.Rows(i).Cells("子項金額").Value.ToString = "" Then : DataGridView8.Rows(i).Cells("子項金額").Value = 0 : End If
  272. If DataGridView8.Rows(i).Cells("細項金額").Value.ToString = "" Then : DataGridView8.Rows(i).Cells("細項金額").Value = 0 : End If
  273. If DataGridView8.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView8.Rows(i).Cells("主項金額").Value = 0 : End If
  274. If DataGridView8.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView8.Rows(i).Cells("子項金額").Value = 0 : End If
  275. If DataGridView8.Rows(i).Cells("主項金額").Value.ToString <> "0" Then : DataGridView8.Rows(i).Cells("金額").Value = DataGridView8.Rows(i).Cells("主項金額").Value
  276. ElseIf DataGridView8.Rows(i).Cells("子項金額").Value.ToString <> "0" Then : DataGridView8.Rows(i).Cells("金額").Value = DataGridView8.Rows(i).Cells("子項金額").Value
  277. ElseIf DataGridView8.Rows(i).Cells("細項金額").Value.ToString <> "0" Then : DataGridView8.Rows(i).Cells("金額").Value = DataGridView8.Rows(i).Cells("細項金額").Value
  278. Else : DataGridView8.Rows(i).Cells("金額").Value = 0 : End If
  279. DataGridView8.Rows(i).Cells("彙總").Value = DataGridView8.Rows(i).Cells("金額").Value
  280. If DataGridView8.Rows(i).Cells("抵銷").Value = True Then : DataGridView8.Rows(i).Cells("彙總").Value = DataGridView8.Rows(i).Cells("彙總").Value * -1 : End If
  281. If ComboBox2.Text = "" Then : Else
  282. If DataGridView8.Rows(i).Cells("第一階").Value.ToString = ComboBox2.Text Then : TextBox35.Text = Val(TextBox35.Text) + DataGridView8.Rows(i).Cells("主項金額").Value : End If : End If
  283. If ComboBox3.Text = "" Then : Else
  284. If DataGridView8.Rows(i).Cells("第一階").Value.ToString = ComboBox3.Text Then : TextBox34.Text = Val(TextBox34.Text) + DataGridView8.Rows(i).Cells("主項金額").Value : End If : End If
  285. If ComboBox4.Text = "" Then : Else
  286. If DataGridView8.Rows(i).Cells("第一階").Value.ToString = ComboBox4.Text Then : TextBox33.Text = Val(TextBox33.Text) + DataGridView8.Rows(i).Cells("主項金額").Value : End If : End If
  287. If ComboBox5.Text = "" Then : Else
  288. If DataGridView8.Rows(i).Cells("第一階").Value.ToString = ComboBox5.Text Then : TextBox70.Text = Val(TextBox70.Text) + DataGridView8.Rows(i).Cells("主項金額").Value : End If : End If
  289. If ComboBox6.Text = "" Then : Else
  290. If DataGridView8.Rows(i).Cells("第一階").Value.ToString = ComboBox6.Text Then : TextBox84.Text = Val(TextBox84.Text) + DataGridView8.Rows(i).Cells("主項金額").Value : End If : End If
  291. If ComboBox7.Text = "" Then : Else
  292. If DataGridView8.Rows(i).Cells("第一階").Value.ToString = ComboBox7.Text Then : TextBox97.Text = Val(TextBox97.Text) + DataGridView8.Rows(i).Cells("主項金額").Value : End If : End If
  293. If ComboBox8.Text = "" Then : Else
  294. If DataGridView8.Rows(i).Cells("第一階").Value.ToString = ComboBox8.Text Then : TextBox31.Text = Val(TextBox31.Text) + DataGridView8.Rows(i).Cells("主項金額").Value : End If : End If
  295. Next
  296. TextBox32.Text = Val(TextBox35.Text) + Val(TextBox34.Text) + Val(TextBox33.Text) + Val(TextBox31.Text) + Val(TextBox70.Text) + Val(TextBox84.Text) + Val(TextBox97.Text)
  297. End Sub
  298. Private Sub Set_清單8()
  299. DataGridView9.DataSource = Nothing : ds8.Clear() : DataGridView9.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  300. DataGridView9.ColumnHeadersHeight = 50 : DataGridView9.AllowUserToAddRows = False : DataGridView9.RowTemplate.Height = 列高
  301. PA = "08" : SQL_營運成本收支_決算表月清單()
  302. da.Fill(ds8) : DataGridView9.DataSource = ds8.Tables(0) : conn.Close()
  303. TextBox36.Text = "0" : TextBox37.Text = "0" : TextBox38.Text = "0" : TextBox39.Text = "0" : TextBox40.Text = "0" : TextBox69.Text = "0" : TextBox83.Text = "0" : TextBox96.Text = "0"
  304. For i As Integer = 0 To DataGridView9.Rows.Count - 1
  305. If DataGridView9.Rows(i).Cells("主項金額").Value.ToString = "" Then : DataGridView9.Rows(i).Cells("主項金額").Value = 0 : End If
  306. If DataGridView9.Rows(i).Cells("子項金額").Value.ToString = "" Then : DataGridView9.Rows(i).Cells("子項金額").Value = 0 : End If
  307. If DataGridView9.Rows(i).Cells("細項金額").Value.ToString = "" Then : DataGridView9.Rows(i).Cells("細項金額").Value = 0 : End If
  308. If DataGridView9.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView9.Rows(i).Cells("主項金額").Value = 0 : End If
  309. If DataGridView9.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView9.Rows(i).Cells("子項金額").Value = 0 : End If
  310. If DataGridView9.Rows(i).Cells("主項金額").Value.ToString <> "0" Then : DataGridView9.Rows(i).Cells("金額").Value = DataGridView9.Rows(i).Cells("主項金額").Value
  311. ElseIf DataGridView9.Rows(i).Cells("子項金額").Value.ToString <> "0" Then : DataGridView9.Rows(i).Cells("金額").Value = DataGridView9.Rows(i).Cells("子項金額").Value
  312. ElseIf DataGridView9.Rows(i).Cells("細項金額").Value.ToString <> "0" Then : DataGridView9.Rows(i).Cells("金額").Value = DataGridView9.Rows(i).Cells("細項金額").Value
  313. Else : DataGridView9.Rows(i).Cells("金額").Value = 0 : End If
  314. DataGridView9.Rows(i).Cells("彙總").Value = DataGridView9.Rows(i).Cells("金額").Value
  315. If DataGridView9.Rows(i).Cells("抵銷").Value = True Then : DataGridView9.Rows(i).Cells("彙總").Value = DataGridView9.Rows(i).Cells("彙總").Value * -1 : End If
  316. If ComboBox2.Text = "" Then : Else
  317. If DataGridView9.Rows(i).Cells("第一階").Value.ToString = ComboBox2.Text Then : TextBox40.Text = Val(TextBox40.Text) + DataGridView9.Rows(i).Cells("主項金額").Value : End If : End If
  318. If ComboBox3.Text = "" Then : Else
  319. If DataGridView9.Rows(i).Cells("第一階").Value.ToString = ComboBox3.Text Then : TextBox39.Text = Val(TextBox39.Text) + DataGridView9.Rows(i).Cells("主項金額").Value : End If : End If
  320. If ComboBox4.Text = "" Then : Else
  321. If DataGridView9.Rows(i).Cells("第一階").Value.ToString = ComboBox4.Text Then : TextBox38.Text = Val(TextBox38.Text) + DataGridView9.Rows(i).Cells("主項金額").Value : End If : End If
  322. If ComboBox5.Text = "" Then : Else
  323. If DataGridView9.Rows(i).Cells("第一階").Value.ToString = ComboBox5.Text Then : TextBox69.Text = Val(TextBox69.Text) + DataGridView9.Rows(i).Cells("主項金額").Value : End If : End If
  324. If ComboBox6.Text = "" Then : Else
  325. If DataGridView9.Rows(i).Cells("第一階").Value.ToString = ComboBox6.Text Then : TextBox83.Text = Val(TextBox83.Text) + DataGridView9.Rows(i).Cells("主項金額").Value : End If : End If
  326. If ComboBox7.Text = "" Then : Else
  327. If DataGridView9.Rows(i).Cells("第一階").Value.ToString = ComboBox7.Text Then : TextBox96.Text = Val(TextBox96.Text) + DataGridView9.Rows(i).Cells("主項金額").Value : End If : End If
  328. If ComboBox8.Text = "" Then : Else
  329. If DataGridView9.Rows(i).Cells("第一階").Value.ToString = ComboBox8.Text Then : TextBox36.Text = Val(TextBox36.Text) + DataGridView9.Rows(i).Cells("主項金額").Value : End If : End If
  330. Next
  331. TextBox37.Text = Val(TextBox40.Text) + Val(TextBox39.Text) + Val(TextBox38.Text) + Val(TextBox36.Text) + Val(TextBox69.Text) + Val(TextBox83.Text) + Val(TextBox96.Text)
  332. End Sub
  333. Private Sub Set_清單9()
  334. DataGridView10.DataSource = Nothing : ds9.Clear() : DataGridView10.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  335. DataGridView10.ColumnHeadersHeight = 50 : DataGridView10.AllowUserToAddRows = False : DataGridView10.RowTemplate.Height = 列高
  336. PA = "09" : SQL_營運成本收支_決算表月清單()
  337. da.Fill(ds9) : DataGridView10.DataSource = ds9.Tables(0) : conn.Close()
  338. TextBox41.Text = "0" : TextBox42.Text = "0" : TextBox43.Text = "0" : TextBox44.Text = "0" : TextBox45.Text = "0" : TextBox68.Text = "0" : TextBox82.Text = "0" : TextBox95.Text = "0"
  339. For i As Integer = 0 To DataGridView10.Rows.Count - 1
  340. If DataGridView10.Rows(i).Cells("主項金額").Value.ToString = "" Then : DataGridView10.Rows(i).Cells("主項金額").Value = 0 : End If
  341. If DataGridView10.Rows(i).Cells("子項金額").Value.ToString = "" Then : DataGridView10.Rows(i).Cells("子項金額").Value = 0 : End If
  342. If DataGridView10.Rows(i).Cells("細項金額").Value.ToString = "" Then : DataGridView10.Rows(i).Cells("細項金額").Value = 0 : End If
  343. If DataGridView10.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView10.Rows(i).Cells("主項金額").Value = 0 : End If
  344. If DataGridView10.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView10.Rows(i).Cells("子項金額").Value = 0 : End If
  345. If DataGridView10.Rows(i).Cells("主項金額").Value.ToString <> "0" Then : DataGridView10.Rows(i).Cells("金額").Value = DataGridView10.Rows(i).Cells("主項金額").Value
  346. ElseIf DataGridView10.Rows(i).Cells("子項金額").Value.ToString <> "0" Then : DataGridView10.Rows(i).Cells("金額").Value = DataGridView10.Rows(i).Cells("子項金額").Value
  347. ElseIf DataGridView10.Rows(i).Cells("細項金額").Value.ToString <> "0" Then : DataGridView10.Rows(i).Cells("金額").Value = DataGridView10.Rows(i).Cells("細項金額").Value
  348. Else : DataGridView10.Rows(i).Cells("金額").Value = 0 : End If
  349. DataGridView10.Rows(i).Cells("彙總").Value = DataGridView10.Rows(i).Cells("金額").Value
  350. If DataGridView10.Rows(i).Cells("抵銷").Value = True Then : DataGridView10.Rows(i).Cells("彙總").Value = DataGridView10.Rows(i).Cells("彙總").Value * -1 : End If
  351. If ComboBox2.Text = "" Then : Else
  352. If DataGridView10.Rows(i).Cells("第一階").Value.ToString = ComboBox2.Text Then : TextBox45.Text = Val(TextBox45.Text) + DataGridView10.Rows(i).Cells("主項金額").Value : End If : End If
  353. If ComboBox3.Text = "" Then : Else
  354. If DataGridView10.Rows(i).Cells("第一階").Value.ToString = ComboBox3.Text Then : TextBox44.Text = Val(TextBox44.Text) + DataGridView10.Rows(i).Cells("主項金額").Value : End If : End If
  355. If ComboBox4.Text = "" Then : Else
  356. If DataGridView10.Rows(i).Cells("第一階").Value.ToString = ComboBox4.Text Then : TextBox43.Text = Val(TextBox43.Text) + DataGridView10.Rows(i).Cells("主項金額").Value : End If : End If
  357. If ComboBox5.Text = "" Then : Else
  358. If DataGridView10.Rows(i).Cells("第一階").Value.ToString = ComboBox5.Text Then : TextBox68.Text = Val(TextBox68.Text) + DataGridView10.Rows(i).Cells("主項金額").Value : End If : End If
  359. If ComboBox6.Text = "" Then : Else
  360. If DataGridView10.Rows(i).Cells("第一階").Value.ToString = ComboBox6.Text Then : TextBox82.Text = Val(TextBox82.Text) + DataGridView10.Rows(i).Cells("主項金額").Value : End If : End If
  361. If ComboBox7.Text = "" Then : Else
  362. If DataGridView10.Rows(i).Cells("第一階").Value.ToString = ComboBox7.Text Then : TextBox95.Text = Val(TextBox95.Text) + DataGridView10.Rows(i).Cells("主項金額").Value : End If : End If
  363. If ComboBox8.Text = "" Then : Else
  364. If DataGridView10.Rows(i).Cells("第一階").Value.ToString = ComboBox8.Text Then : TextBox41.Text = Val(TextBox41.Text) + DataGridView10.Rows(i).Cells("主項金額").Value : End If : End If
  365. Next
  366. TextBox42.Text = Val(TextBox45.Text) + Val(TextBox44.Text) + Val(TextBox43.Text) + Val(TextBox41.Text) + Val(TextBox68.Text) + Val(TextBox82.Text) + Val(TextBox95.Text)
  367. End Sub
  368. Private Sub Set_清單10()
  369. DataGridView11.DataSource = Nothing : ds10.Clear() : DataGridView11.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  370. DataGridView11.ColumnHeadersHeight = 50 : DataGridView11.AllowUserToAddRows = False : DataGridView11.RowTemplate.Height = 列高
  371. PA = "10" : SQL_營運成本收支_決算表月清單()
  372. da.Fill(ds10) : DataGridView11.DataSource = ds10.Tables(0) : conn.Close()
  373. TextBox46.Text = "0" : TextBox47.Text = "0" : TextBox48.Text = "0" : TextBox49.Text = "0" : TextBox50.Text = "0" : TextBox67.Text = "0" : TextBox81.Text = "0" : TextBox94.Text = "0"
  374. For i As Integer = 0 To DataGridView11.Rows.Count - 1
  375. If DataGridView11.Rows(i).Cells("主項金額").Value.ToString = "" Then : DataGridView11.Rows(i).Cells("主項金額").Value = 0 : End If
  376. If DataGridView11.Rows(i).Cells("子項金額").Value.ToString = "" Then : DataGridView11.Rows(i).Cells("子項金額").Value = 0 : End If
  377. If DataGridView11.Rows(i).Cells("細項金額").Value.ToString = "" Then : DataGridView11.Rows(i).Cells("細項金額").Value = 0 : End If
  378. If DataGridView11.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView11.Rows(i).Cells("主項金額").Value = 0 : End If
  379. If DataGridView11.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView11.Rows(i).Cells("子項金額").Value = 0 : End If
  380. If DataGridView11.Rows(i).Cells("主項金額").Value.ToString <> "0" Then : DataGridView11.Rows(i).Cells("金額").Value = DataGridView11.Rows(i).Cells("主項金額").Value
  381. ElseIf DataGridView11.Rows(i).Cells("子項金額").Value.ToString <> "0" Then : DataGridView11.Rows(i).Cells("金額").Value = DataGridView11.Rows(i).Cells("子項金額").Value
  382. ElseIf DataGridView11.Rows(i).Cells("細項金額").Value.ToString <> "0" Then : DataGridView11.Rows(i).Cells("金額").Value = DataGridView11.Rows(i).Cells("細項金額").Value
  383. Else : DataGridView11.Rows(i).Cells("金額").Value = 0 : End If
  384. DataGridView11.Rows(i).Cells("彙總").Value = DataGridView11.Rows(i).Cells("金額").Value
  385. If DataGridView11.Rows(i).Cells("抵銷").Value = True Then : DataGridView11.Rows(i).Cells("彙總").Value = DataGridView11.Rows(i).Cells("彙總").Value * -1 : End If
  386. If ComboBox2.Text = "" Then : Else
  387. If DataGridView11.Rows(i).Cells("第一階").Value.ToString = ComboBox2.Text Then : TextBox50.Text = Val(TextBox50.Text) + DataGridView11.Rows(i).Cells("主項金額").Value : End If : End If
  388. If ComboBox3.Text = "" Then : Else
  389. If DataGridView11.Rows(i).Cells("第一階").Value.ToString = ComboBox3.Text Then : TextBox49.Text = Val(TextBox49.Text) + DataGridView11.Rows(i).Cells("主項金額").Value : End If : End If
  390. If ComboBox4.Text = "" Then : Else
  391. If DataGridView11.Rows(i).Cells("第一階").Value.ToString = ComboBox4.Text Then : TextBox48.Text = Val(TextBox48.Text) + DataGridView11.Rows(i).Cells("主項金額").Value : End If : End If
  392. If ComboBox5.Text = "" Then : Else
  393. If DataGridView11.Rows(i).Cells("第一階").Value.ToString = ComboBox5.Text Then : TextBox67.Text = Val(TextBox67.Text) + DataGridView11.Rows(i).Cells("主項金額").Value : End If : End If
  394. If ComboBox6.Text = "" Then : Else
  395. If DataGridView11.Rows(i).Cells("第一階").Value.ToString = ComboBox6.Text Then : TextBox81.Text = Val(TextBox81.Text) + DataGridView11.Rows(i).Cells("主項金額").Value : End If : End If
  396. If ComboBox7.Text = "" Then : Else
  397. If DataGridView11.Rows(i).Cells("第一階").Value.ToString = ComboBox7.Text Then : TextBox94.Text = Val(TextBox94.Text) + DataGridView11.Rows(i).Cells("主項金額").Value : End If : End If
  398. If ComboBox8.Text = "" Then : Else
  399. If DataGridView11.Rows(i).Cells("第一階").Value.ToString = ComboBox8.Text Then : TextBox46.Text = Val(TextBox46.Text) + DataGridView11.Rows(i).Cells("主項金額").Value : End If : End If
  400. Next
  401. TextBox47.Text = Val(TextBox50.Text) + Val(TextBox49.Text) + Val(TextBox48.Text) + Val(TextBox46.Text) + Val(TextBox67.Text) + Val(TextBox81.Text) + Val(TextBox94.Text)
  402. End Sub
  403. Private Sub Set_清單11()
  404. DataGridView12.DataSource = Nothing : ds11.Clear() : DataGridView12.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  405. DataGridView12.ColumnHeadersHeight = 50 : DataGridView12.AllowUserToAddRows = False : DataGridView12.RowTemplate.Height = 列高
  406. PA = "11" : SQL_營運成本收支_決算表月清單()
  407. da.Fill(ds11) : DataGridView12.DataSource = ds11.Tables(0) : conn.Close()
  408. TextBox51.Text = "0" : TextBox52.Text = "0" : TextBox53.Text = "0" : TextBox54.Text = "0" : TextBox55.Text = "0" : TextBox66.Text = "0" : TextBox80.Text = "0" : TextBox93.Text = "0"
  409. For i As Integer = 0 To DataGridView12.Rows.Count - 1
  410. If DataGridView12.Rows(i).Cells("主項金額").Value.ToString = "" Then : DataGridView12.Rows(i).Cells("主項金額").Value = 0 : End If
  411. If DataGridView12.Rows(i).Cells("子項金額").Value.ToString = "" Then : DataGridView12.Rows(i).Cells("子項金額").Value = 0 : End If
  412. If DataGridView12.Rows(i).Cells("細項金額").Value.ToString = "" Then : DataGridView12.Rows(i).Cells("細項金額").Value = 0 : End If
  413. If DataGridView12.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView12.Rows(i).Cells("主項金額").Value = 0 : End If
  414. If DataGridView12.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView12.Rows(i).Cells("子項金額").Value = 0 : End If
  415. If DataGridView12.Rows(i).Cells("主項金額").Value.ToString <> "0" Then : DataGridView12.Rows(i).Cells("金額").Value = DataGridView12.Rows(i).Cells("主項金額").Value
  416. ElseIf DataGridView12.Rows(i).Cells("子項金額").Value.ToString <> "0" Then : DataGridView12.Rows(i).Cells("金額").Value = DataGridView12.Rows(i).Cells("子項金額").Value
  417. ElseIf DataGridView12.Rows(i).Cells("細項金額").Value.ToString <> "0" Then : DataGridView12.Rows(i).Cells("金額").Value = DataGridView12.Rows(i).Cells("細項金額").Value
  418. Else : DataGridView12.Rows(i).Cells("金額").Value = 0 : End If
  419. DataGridView12.Rows(i).Cells("彙總").Value = DataGridView12.Rows(i).Cells("金額").Value
  420. If DataGridView12.Rows(i).Cells("抵銷").Value = True Then : DataGridView12.Rows(i).Cells("彙總").Value = DataGridView12.Rows(i).Cells("彙總").Value * -1 : End If
  421. If ComboBox2.Text = "" Then : Else
  422. If DataGridView12.Rows(i).Cells("第一階").Value.ToString = ComboBox2.Text Then : TextBox55.Text = Val(TextBox55.Text) + DataGridView12.Rows(i).Cells("主項金額").Value : End If : End If
  423. If ComboBox3.Text = "" Then : Else
  424. If DataGridView12.Rows(i).Cells("第一階").Value.ToString = ComboBox3.Text Then : TextBox54.Text = Val(TextBox54.Text) + DataGridView12.Rows(i).Cells("主項金額").Value : End If : End If
  425. If ComboBox4.Text = "" Then : Else
  426. If DataGridView12.Rows(i).Cells("第一階").Value.ToString = ComboBox4.Text Then : TextBox53.Text = Val(TextBox53.Text) + DataGridView12.Rows(i).Cells("主項金額").Value : End If : End If
  427. If ComboBox5.Text = "" Then : Else
  428. If DataGridView12.Rows(i).Cells("第一階").Value.ToString = ComboBox5.Text Then : TextBox66.Text = Val(TextBox66.Text) + DataGridView12.Rows(i).Cells("主項金額").Value : End If : End If
  429. If ComboBox6.Text = "" Then : Else
  430. If DataGridView12.Rows(i).Cells("第一階").Value.ToString = ComboBox6.Text Then : TextBox80.Text = Val(TextBox80.Text) + DataGridView12.Rows(i).Cells("主項金額").Value : End If : End If
  431. If ComboBox7.Text = "" Then : Else
  432. If DataGridView12.Rows(i).Cells("第一階").Value.ToString = ComboBox7.Text Then : TextBox93.Text = Val(TextBox93.Text) + DataGridView12.Rows(i).Cells("主項金額").Value : End If : End If
  433. If ComboBox8.Text = "" Then : Else
  434. If DataGridView12.Rows(i).Cells("第一階").Value.ToString = ComboBox8.Text Then : TextBox51.Text = Val(TextBox51.Text) + DataGridView12.Rows(i).Cells("主項金額").Value : End If : End If
  435. Next
  436. TextBox52.Text = Val(TextBox55.Text) + Val(TextBox54.Text) + Val(TextBox53.Text) + Val(TextBox51.Text) + Val(TextBox66.Text) + Val(TextBox80.Text) + Val(TextBox93.Text)
  437. End Sub
  438. Private Sub Set_清單12()
  439. DataGridView13.DataSource = Nothing : ds12.Clear() : DataGridView13.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  440. DataGridView13.ColumnHeadersHeight = 50 : DataGridView13.AllowUserToAddRows = False : DataGridView13.RowTemplate.Height = 列高
  441. PA = "12" : SQL_營運成本收支_決算表月清單()
  442. da.Fill(ds12) : DataGridView13.DataSource = ds12.Tables(0) : conn.Close()
  443. TextBox56.Text = "0" : TextBox57.Text = "0" : TextBox58.Text = "0" : TextBox59.Text = "0" : TextBox60.Text = "0" : TextBox65.Text = "0" : TextBox79.Text = "0" : TextBox92.Text = "0"
  444. For i As Integer = 0 To DataGridView13.Rows.Count - 1
  445. If DataGridView13.Rows(i).Cells("主項金額").Value.ToString = "" Then : DataGridView13.Rows(i).Cells("主項金額").Value = 0 : End If
  446. If DataGridView13.Rows(i).Cells("子項金額").Value.ToString = "" Then : DataGridView13.Rows(i).Cells("子項金額").Value = 0 : End If
  447. If DataGridView13.Rows(i).Cells("細項金額").Value.ToString = "" Then : DataGridView13.Rows(i).Cells("細項金額").Value = 0 : End If
  448. If DataGridView13.Rows(i).Cells("層級").Value.ToString <> "1" Then : DataGridView13.Rows(i).Cells("主項金額").Value = 0 : End If
  449. If DataGridView13.Rows(i).Cells("層級").Value.ToString <> "2" Then : DataGridView13.Rows(i).Cells("子項金額").Value = 0 : End If
  450. If DataGridView13.Rows(i).Cells("主項金額").Value.ToString <> "0" Then : DataGridView13.Rows(i).Cells("金額").Value = DataGridView13.Rows(i).Cells("主項金額").Value
  451. ElseIf DataGridView13.Rows(i).Cells("子項金額").Value.ToString <> "0" Then : DataGridView13.Rows(i).Cells("金額").Value = DataGridView13.Rows(i).Cells("子項金額").Value
  452. ElseIf DataGridView13.Rows(i).Cells("細項金額").Value.ToString <> "0" Then : DataGridView13.Rows(i).Cells("金額").Value = DataGridView13.Rows(i).Cells("細項金額").Value
  453. Else : DataGridView13.Rows(i).Cells("金額").Value = 0 : End If
  454. DataGridView13.Rows(i).Cells("彙總").Value = DataGridView13.Rows(i).Cells("金額").Value
  455. If DataGridView13.Rows(i).Cells("抵銷").Value = True Then : DataGridView13.Rows(i).Cells("彙總").Value = DataGridView13.Rows(i).Cells("彙總").Value * -1 : End If
  456. If ComboBox2.Text = "" Then : Else
  457. If DataGridView13.Rows(i).Cells("第一階").Value.ToString = ComboBox2.Text Then : TextBox60.Text = Val(TextBox60.Text) + DataGridView13.Rows(i).Cells("主項金額").Value : End If : End If
  458. If ComboBox3.Text = "" Then : Else
  459. If DataGridView13.Rows(i).Cells("第一階").Value.ToString = ComboBox3.Text Then : TextBox59.Text = Val(TextBox59.Text) + DataGridView13.Rows(i).Cells("主項金額").Value : End If : End If
  460. If ComboBox4.Text = "" Then : Else
  461. If DataGridView13.Rows(i).Cells("第一階").Value.ToString = ComboBox4.Text Then : TextBox58.Text = Val(TextBox58.Text) + DataGridView13.Rows(i).Cells("主項金額").Value : End If : End If
  462. If ComboBox5.Text = "" Then : Else
  463. If DataGridView13.Rows(i).Cells("第一階").Value.ToString = ComboBox5.Text Then : TextBox65.Text = Val(TextBox65.Text) + DataGridView13.Rows(i).Cells("主項金額").Value : End If : End If
  464. If ComboBox6.Text = "" Then : Else
  465. If DataGridView13.Rows(i).Cells("第一階").Value.ToString = ComboBox6.Text Then : TextBox79.Text = Val(TextBox79.Text) + DataGridView13.Rows(i).Cells("主項金額").Value : End If : End If
  466. If ComboBox7.Text = "" Then : Else
  467. If DataGridView13.Rows(i).Cells("第一階").Value.ToString = ComboBox7.Text Then : TextBox92.Text = Val(TextBox92.Text) + DataGridView13.Rows(i).Cells("主項金額").Value : End If : End If
  468. If ComboBox8.Text = "" Then : Else
  469. If DataGridView13.Rows(i).Cells("第一階").Value.ToString = ComboBox8.Text Then : TextBox56.Text = Val(TextBox56.Text) + DataGridView13.Rows(i).Cells("主項金額").Value : End If : End If
  470. Next
  471. TextBox57.Text = Val(TextBox60.Text) + Val(TextBox59.Text) + Val(TextBox58.Text) + Val(TextBox56.Text) + Val(TextBox65.Text) + Val(TextBox79.Text) + Val(TextBox92.Text)
  472. End Sub
  473. Private Sub Set_清單13()
  474. DataGridView14.DataSource = Nothing : ds13.Clear() : DataGridView14.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  475. DataGridView14.ColumnHeadersHeight = 50 : DataGridView14.AllowUserToAddRows = False
  476. SQL_財務決算表合計預設()
  477. da.Fill(ds13) : DataGridView14.DataSource = ds13.Tables(0) : conn.Close()
  478. End Sub
  479. Private Sub ComboBox1下拉表單資料載入()
  480. PA = "%%" : SQL_年份清單查詢()
  481. ComboBox1.Items.Clear() : While (dr.Read()) : ComboBox1.Items.Add(dr("年份")) : End While : conn.Close()
  482. End Sub
  483. Private Sub ComboBox2下拉表單資料載入()
  484. SQL_營運成本收支_決算表_會計科目()
  485. ComboBox2.Items.Clear() : ComboBox3.Items.Clear() : ComboBox4.Items.Clear() : ComboBox5.Items.Clear() : ComboBox6.Items.Clear() : ComboBox7.Items.Clear() : ComboBox8.Items.Clear()
  486. While (dr.Read())
  487. ComboBox2.Items.Add(dr("會計科目")) : ComboBox3.Items.Add(dr("會計科目")) : ComboBox4.Items.Add(dr("會計科目")) : ComboBox5.Items.Add(dr("會計科目"))
  488. ComboBox6.Items.Add(dr("會計科目")) : ComboBox7.Items.Add(dr("會計科目")) : ComboBox8.Items.Add(dr("會計科目"))
  489. End While : conn.Close()
  490. End Sub
  491. Private Sub 格式設定()
  492. For i As Integer = 1 To 13
  493. Dim DataGridViewOO As DataGridView = CType(Me.Controls.Find("DataGridView" + i.ToString(), True)(0), DataGridView)
  494. If i = 2 Then
  495. DataGridViewOO.Columns(0).FillWeight = 50 : DataGridViewOO.Columns(1).Visible = False : DataGridViewOO.Columns(2).Visible = False : DataGridViewOO.Columns(3).FillWeight = 90
  496. DataGridViewOO.Columns(4).FillWeight = 90 : DataGridViewOO.Columns(5).FillWeight = 120 : DataGridViewOO.Columns(6).Visible = False : DataGridViewOO.Columns(7).Visible = False
  497. DataGridViewOO.Columns(8).Visible = False : DataGridViewOO.Columns(9).Visible = False : DataGridViewOO.Columns(10).FillWeight = 80 : DataGridViewOO.Columns(11).FillWeight = 80
  498. DataGridViewOO.Columns(12).FillWeight = 80
  499. DataGridViewOO.Columns(10).DefaultCellStyle.Format = "#,##0" : DataGridViewOO.Columns(11).DefaultCellStyle.Format = "#,##0" : DataGridViewOO.Columns(12).DefaultCellStyle.Format = "#,##0"
  500. DataGridViewOO.Columns(10).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  501. DataGridViewOO.Columns(10).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  502. DataGridViewOO.Columns(11).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  503. DataGridViewOO.Columns(11).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  504. DataGridViewOO.Columns(12).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  505. DataGridViewOO.Columns(12).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  506. DataGridViewOO.Columns(0).ReadOnly = True : DataGridViewOO.Columns(1).ReadOnly = True : DataGridViewOO.Columns(2).ReadOnly = True : DataGridViewOO.Columns(3).ReadOnly = True
  507. DataGridViewOO.Columns(4).ReadOnly = True : DataGridViewOO.Columns(5).ReadOnly = True : DataGridViewOO.Columns(10).ReadOnly = True : DataGridViewOO.Columns(11).ReadOnly = True
  508. DataGridViewOO.Columns(12).ReadOnly = True
  509. Else
  510. DataGridViewOO.Columns(0).FillWeight = 20 : DataGridViewOO.Columns(1).Visible = False : DataGridViewOO.Columns(2).Visible = False : DataGridViewOO.Columns(3).Visible = False
  511. DataGridViewOO.Columns(4).Visible = False : DataGridViewOO.Columns(5).Visible = False : DataGridViewOO.Columns(6).Visible = False : DataGridViewOO.Columns(7).Visible = False
  512. DataGridViewOO.Columns(9).Visible = False : DataGridViewOO.Columns(8).Visible = False : DataGridViewOO.Columns(10).Visible = False : DataGridViewOO.Columns(11).FillWeight = 75
  513. DataGridViewOO.Columns(11).DefaultCellStyle.Format = "#,##0"
  514. DataGridViewOO.Columns(11).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  515. DataGridViewOO.Columns(11).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  516. DataGridViewOO.Columns(11).ReadOnly = True
  517. End If
  518. Next
  519. If TextBox111.Text = "貸" Then
  520. TextBox61.Text = Val(TextBox61.Text) * -1 : TextBox1.Text = Val(TextBox1.Text) * -1 : TextBox5.Text = Val(TextBox5.Text) * -1 : TextBox9.Text = Val(TextBox9.Text) * -1
  521. TextBox13.Text = Val(TextBox13.Text) * -1 : TextBox17.Text = Val(TextBox17.Text) * -1 : TextBox21.Text = Val(TextBox21.Text) * -1 : TextBox35.Text = Val(TextBox35.Text) * -1
  522. TextBox40.Text = Val(TextBox40.Text) * -1 : TextBox45.Text = Val(TextBox45.Text) * -1 : TextBox50.Text = Val(TextBox50.Text) * -1 : TextBox55.Text = Val(TextBox55.Text) * -1
  523. TextBox60.Text = Val(TextBox60.Text) * -1
  524. TextBox61.ForeColor = Color.Red : TextBox1.ForeColor = Color.Red : TextBox5.ForeColor = Color.Red : TextBox9.ForeColor = Color.Red : TextBox13.ForeColor = Color.Red
  525. TextBox17.ForeColor = Color.Red : TextBox21.ForeColor = Color.Red : TextBox35.ForeColor = Color.Red : TextBox40.ForeColor = Color.Red : TextBox45.ForeColor = Color.Red
  526. TextBox50.ForeColor = Color.Red : TextBox55.ForeColor = Color.Red : TextBox60.ForeColor = Color.Red
  527. ElseIf TextBox111.Text = "借" Then
  528. TextBox61.ForeColor = Color.Blue : TextBox1.ForeColor = Color.Blue : TextBox5.ForeColor = Color.Blue : TextBox9.ForeColor = Color.Blue : TextBox13.ForeColor = Color.Blue
  529. TextBox17.ForeColor = Color.Blue : TextBox21.ForeColor = Color.Blue : TextBox35.ForeColor = Color.Blue : TextBox40.ForeColor = Color.Blue : TextBox45.ForeColor = Color.Blue
  530. TextBox50.ForeColor = Color.Blue : TextBox55.ForeColor = Color.Blue : TextBox60.ForeColor = Color.Blue
  531. ElseIf TextBox111.Text = "" Then
  532. TextBox61.ForeColor = Color.Black : TextBox1.ForeColor = Color.Black : TextBox5.ForeColor = Color.Black : TextBox9.ForeColor = Color.Black : TextBox13.ForeColor = Color.Black
  533. TextBox17.ForeColor = Color.Black : TextBox21.ForeColor = Color.Black : TextBox35.ForeColor = Color.Black : TextBox40.ForeColor = Color.Black : TextBox45.ForeColor = Color.Black
  534. TextBox50.ForeColor = Color.Black : TextBox55.ForeColor = Color.Black : TextBox60.ForeColor = Color.Black
  535. End If
  536. If TextBox110.Text = "貸" Then
  537. TextBox62.Text = Val(TextBox62.Text) * -1 : TextBox2.Text = Val(TextBox2.Text) * -1 : TextBox6.Text = Val(TextBox6.Text) * -1 : TextBox10.Text = Val(TextBox10.Text) * -1
  538. TextBox14.Text = Val(TextBox14.Text) * -1 : TextBox18.Text = Val(TextBox18.Text) * -1 : TextBox22.Text = Val(TextBox22.Text) * -1 : TextBox34.Text = Val(TextBox34.Text) * -1
  539. TextBox39.Text = Val(TextBox39.Text) * -1 : TextBox44.Text = Val(TextBox44.Text) * -1 : TextBox49.Text = Val(TextBox49.Text) * -1 : TextBox54.Text = Val(TextBox54.Text) * -1
  540. TextBox59.Text = Val(TextBox59.Text) * -1
  541. TextBox62.ForeColor = Color.Red : TextBox2.ForeColor = Color.Red : TextBox6.ForeColor = Color.Red : TextBox10.ForeColor = Color.Red : TextBox14.ForeColor = Color.Red
  542. TextBox18.ForeColor = Color.Red : TextBox22.ForeColor = Color.Red : TextBox34.ForeColor = Color.Red : TextBox39.ForeColor = Color.Red : TextBox44.ForeColor = Color.Red
  543. TextBox49.ForeColor = Color.Red : TextBox54.ForeColor = Color.Red : TextBox59.ForeColor = Color.Red
  544. ElseIf TextBox110.Text = "借" Then
  545. TextBox62.ForeColor = Color.Blue : TextBox2.ForeColor = Color.Blue : TextBox6.ForeColor = Color.Blue : TextBox10.ForeColor = Color.Blue : TextBox14.ForeColor = Color.Blue
  546. TextBox18.ForeColor = Color.Blue : TextBox22.ForeColor = Color.Blue : TextBox34.ForeColor = Color.Blue : TextBox39.ForeColor = Color.Blue : TextBox44.ForeColor = Color.Blue
  547. TextBox49.ForeColor = Color.Blue : TextBox54.ForeColor = Color.Blue : TextBox59.ForeColor = Color.Blue
  548. ElseIf TextBox110.Text = "" Then
  549. TextBox62.ForeColor = Color.Black : TextBox2.ForeColor = Color.Black : TextBox6.ForeColor = Color.Black : TextBox10.ForeColor = Color.Black : TextBox14.ForeColor = Color.Black
  550. TextBox18.ForeColor = Color.Black : TextBox22.ForeColor = Color.Black : TextBox34.ForeColor = Color.Black : TextBox39.ForeColor = Color.Black : TextBox44.ForeColor = Color.Black
  551. TextBox49.ForeColor = Color.Black : TextBox54.ForeColor = Color.Black : TextBox59.ForeColor = Color.Black
  552. End If
  553. If TextBox109.Text = "貸" Then
  554. TextBox63.Text = Val(TextBox63.Text) * -1 : TextBox3.Text = Val(TextBox3.Text) * -1 : TextBox7.Text = Val(TextBox7.Text) * -1 : TextBox11.Text = Val(TextBox11.Text) * -1
  555. TextBox15.Text = Val(TextBox15.Text) * -1 : TextBox19.Text = Val(TextBox19.Text) * -1 : TextBox23.Text = Val(TextBox23.Text) * -1 : TextBox33.Text = Val(TextBox33.Text) * -1
  556. TextBox38.Text = Val(TextBox38.Text) * -1 : TextBox43.Text = Val(TextBox43.Text) * -1 : TextBox48.Text = Val(TextBox48.Text) * -1 : TextBox53.Text = Val(TextBox53.Text) * -1
  557. TextBox58.Text = Val(TextBox58.Text) * -1
  558. TextBox63.ForeColor = Color.Red : TextBox3.ForeColor = Color.Red : TextBox7.ForeColor = Color.Red : TextBox11.ForeColor = Color.Red : TextBox15.ForeColor = Color.Red
  559. TextBox19.ForeColor = Color.Red : TextBox23.ForeColor = Color.Red : TextBox33.ForeColor = Color.Red : TextBox38.ForeColor = Color.Red : TextBox43.ForeColor = Color.Red
  560. TextBox48.ForeColor = Color.Red : TextBox53.ForeColor = Color.Red : TextBox58.ForeColor = Color.Red
  561. ElseIf TextBox109.Text = "借" Then
  562. TextBox63.ForeColor = Color.Blue : TextBox3.ForeColor = Color.Blue : TextBox7.ForeColor = Color.Blue : TextBox11.ForeColor = Color.Blue : TextBox15.ForeColor = Color.Blue
  563. TextBox19.ForeColor = Color.Blue : TextBox23.ForeColor = Color.Blue : TextBox33.ForeColor = Color.Blue : TextBox38.ForeColor = Color.Blue : TextBox43.ForeColor = Color.Blue
  564. TextBox48.ForeColor = Color.Blue : TextBox53.ForeColor = Color.Blue : TextBox58.ForeColor = Color.Blue
  565. ElseIf TextBox109.Text = "" Then
  566. TextBox63.ForeColor = Color.Black : TextBox3.ForeColor = Color.Black : TextBox7.ForeColor = Color.Black : TextBox11.ForeColor = Color.Black : TextBox15.ForeColor = Color.Black
  567. TextBox19.ForeColor = Color.Black : TextBox23.ForeColor = Color.Black : TextBox33.ForeColor = Color.Black : TextBox38.ForeColor = Color.Black : TextBox43.ForeColor = Color.Black
  568. TextBox48.ForeColor = Color.Black : TextBox53.ForeColor = Color.Black : TextBox58.ForeColor = Color.Black
  569. End If
  570. If TextBox108.Text = "貸" Then
  571. TextBox77.Text = Val(TextBox77.Text) * -1 : TextBox76.Text = Val(TextBox76.Text) * -1 : TextBox75.Text = Val(TextBox75.Text) * -1 : TextBox74.Text = Val(TextBox74.Text) * -1
  572. TextBox73.Text = Val(TextBox73.Text) * -1 : TextBox72.Text = Val(TextBox72.Text) * -1 : TextBox71.Text = Val(TextBox71.Text) * -1 : TextBox70.Text = Val(TextBox70.Text) * -1
  573. TextBox69.Text = Val(TextBox69.Text) * -1 : TextBox68.Text = Val(TextBox68.Text) * -1 : TextBox67.Text = Val(TextBox67.Text) * -1 : TextBox66.Text = Val(TextBox66.Text) * -1
  574. TextBox65.Text = Val(TextBox65.Text) * -1
  575. TextBox77.ForeColor = Color.Red : TextBox76.ForeColor = Color.Red : TextBox75.ForeColor = Color.Red : TextBox74.ForeColor = Color.Red : TextBox73.ForeColor = Color.Red
  576. TextBox72.ForeColor = Color.Red : TextBox71.ForeColor = Color.Red : TextBox70.ForeColor = Color.Red : TextBox69.ForeColor = Color.Red : TextBox68.ForeColor = Color.Red
  577. TextBox67.ForeColor = Color.Red : TextBox66.ForeColor = Color.Red : TextBox65.ForeColor = Color.Red
  578. ElseIf TextBox108.Text = "借" Then
  579. TextBox77.ForeColor = Color.Blue : TextBox76.ForeColor = Color.Blue : TextBox75.ForeColor = Color.Blue : TextBox74.ForeColor = Color.Blue : TextBox73.ForeColor = Color.Blue
  580. TextBox72.ForeColor = Color.Blue : TextBox71.ForeColor = Color.Blue : TextBox70.ForeColor = Color.Blue : TextBox69.ForeColor = Color.Blue : TextBox68.ForeColor = Color.Blue
  581. TextBox67.ForeColor = Color.Blue : TextBox66.ForeColor = Color.Blue : TextBox65.ForeColor = Color.Blue
  582. ElseIf TextBox108.Text = "" Then
  583. TextBox77.ForeColor = Color.Black : TextBox76.ForeColor = Color.Black : TextBox75.ForeColor = Color.Black : TextBox74.ForeColor = Color.Black : TextBox73.ForeColor = Color.Black
  584. TextBox72.ForeColor = Color.Black : TextBox71.ForeColor = Color.Black : TextBox70.ForeColor = Color.Black : TextBox69.ForeColor = Color.Black : TextBox68.ForeColor = Color.Black
  585. TextBox67.ForeColor = Color.Black : TextBox66.ForeColor = Color.Black : TextBox65.ForeColor = Color.Black
  586. End If
  587. If TextBox107.Text = "貸" Then
  588. TextBox78.Text = Val(TextBox78.Text) * -1 : TextBox90.Text = Val(TextBox90.Text) * -1 : TextBox89.Text = Val(TextBox89.Text) * -1 : TextBox88.Text = Val(TextBox88.Text) * -1
  589. TextBox87.Text = Val(TextBox87.Text) * -1 : TextBox86.Text = Val(TextBox86.Text) * -1 : TextBox85.Text = Val(TextBox85.Text) * -1 : TextBox84.Text = Val(TextBox84.Text) * -1
  590. TextBox83.Text = Val(TextBox83.Text) * -1 : TextBox82.Text = Val(TextBox82.Text) * -1 : TextBox81.Text = Val(TextBox81.Text) * -1 : TextBox80.Text = Val(TextBox80.Text) * -1
  591. TextBox79.Text = Val(TextBox79.Text) * -1
  592. TextBox78.ForeColor = Color.Red : TextBox90.ForeColor = Color.Red : TextBox89.ForeColor = Color.Red : TextBox88.ForeColor = Color.Red : TextBox87.ForeColor = Color.Red
  593. TextBox86.ForeColor = Color.Red : TextBox85.ForeColor = Color.Red : TextBox84.ForeColor = Color.Red : TextBox83.ForeColor = Color.Red : TextBox82.ForeColor = Color.Red
  594. TextBox81.ForeColor = Color.Red : TextBox80.ForeColor = Color.Red : TextBox79.ForeColor = Color.Red
  595. ElseIf TextBox107.Text = "借" Then
  596. TextBox78.ForeColor = Color.Blue : TextBox90.ForeColor = Color.Blue : TextBox89.ForeColor = Color.Blue : TextBox88.ForeColor = Color.Blue : TextBox87.ForeColor = Color.Blue
  597. TextBox86.ForeColor = Color.Blue : TextBox85.ForeColor = Color.Blue : TextBox84.ForeColor = Color.Blue : TextBox83.ForeColor = Color.Blue : TextBox82.ForeColor = Color.Blue
  598. TextBox81.ForeColor = Color.Blue : TextBox80.ForeColor = Color.Blue : TextBox79.ForeColor = Color.Blue
  599. ElseIf TextBox107.Text = "" Then
  600. TextBox78.ForeColor = Color.Black : TextBox90.ForeColor = Color.Black : TextBox89.ForeColor = Color.Black : TextBox88.ForeColor = Color.Black : TextBox87.ForeColor = Color.Black
  601. TextBox86.ForeColor = Color.Black : TextBox85.ForeColor = Color.Black : TextBox84.ForeColor = Color.Black : TextBox83.ForeColor = Color.Black : TextBox82.ForeColor = Color.Black
  602. TextBox81.ForeColor = Color.Black : TextBox80.ForeColor = Color.Black : TextBox79.ForeColor = Color.Black
  603. End If
  604. If TextBox106.Text = "貸" Then
  605. TextBox91.Text = Val(TextBox91.Text) * -1 : TextBox103.Text = Val(TextBox103.Text) * -1 : TextBox102.Text = Val(TextBox102.Text) * -1 : TextBox101.Text = Val(TextBox101.Text) * -1
  606. TextBox100.Text = Val(TextBox100.Text) * -1 : TextBox99.Text = Val(TextBox99.Text) * -1 : TextBox98.Text = Val(TextBox98.Text) * -1 : TextBox97.Text = Val(TextBox97.Text) * -1
  607. TextBox96.Text = Val(TextBox96.Text) * -1 : TextBox95.Text = Val(TextBox95.Text) * -1 : TextBox94.Text = Val(TextBox94.Text) * -1 : TextBox93.Text = Val(TextBox93.Text) * -1
  608. TextBox92.Text = Val(TextBox92.Text) * -1
  609. TextBox91.ForeColor = Color.Red : TextBox103.ForeColor = Color.Red : TextBox102.ForeColor = Color.Red : TextBox101.ForeColor = Color.Red : TextBox100.ForeColor = Color.Red
  610. TextBox99.ForeColor = Color.Red : TextBox98.ForeColor = Color.Red : TextBox97.ForeColor = Color.Red : TextBox96.ForeColor = Color.Red : TextBox95.ForeColor = Color.Red
  611. TextBox94.ForeColor = Color.Red : TextBox93.ForeColor = Color.Red : TextBox92.ForeColor = Color.Red
  612. ElseIf TextBox106.Text = "借" Then
  613. TextBox91.ForeColor = Color.Blue : TextBox103.ForeColor = Color.Blue : TextBox102.ForeColor = Color.Blue : TextBox101.ForeColor = Color.Blue : TextBox100.ForeColor = Color.Blue
  614. TextBox99.ForeColor = Color.Blue : TextBox98.ForeColor = Color.Blue : TextBox97.ForeColor = Color.Blue : TextBox96.ForeColor = Color.Blue : TextBox95.ForeColor = Color.Blue
  615. TextBox94.ForeColor = Color.Blue : TextBox93.ForeColor = Color.Blue : TextBox92.ForeColor = Color.Blue
  616. ElseIf TextBox106.Text = "" Then
  617. TextBox91.ForeColor = Color.Black : TextBox103.ForeColor = Color.Black : TextBox102.ForeColor = Color.Black : TextBox101.ForeColor = Color.Black : TextBox100.ForeColor = Color.Black
  618. TextBox99.ForeColor = Color.Black : TextBox98.ForeColor = Color.Black : TextBox97.ForeColor = Color.Black : TextBox96.ForeColor = Color.Black : TextBox95.ForeColor = Color.Black
  619. TextBox94.ForeColor = Color.Black : TextBox93.ForeColor = Color.Black : TextBox92.ForeColor = Color.Black
  620. End If
  621. If TextBox105.Text = "貸" Then
  622. TextBox104.Text = Val(TextBox104.Text) * -1 : TextBox30.Text = Val(TextBox30.Text) * -1 : TextBox29.Text = Val(TextBox29.Text) * -1 : TextBox28.Text = Val(TextBox28.Text) * -1
  623. TextBox27.Text = Val(TextBox27.Text) * -1 : TextBox26.Text = Val(TextBox26.Text) * -1 : TextBox25.Text = Val(TextBox25.Text) * -1 : TextBox31.Text = Val(TextBox31.Text) * -1
  624. TextBox36.Text = Val(TextBox36.Text) * -1 : TextBox41.Text = Val(TextBox41.Text) * -1 : TextBox46.Text = Val(TextBox46.Text) * -1 : TextBox51.Text = Val(TextBox51.Text) * -1
  625. TextBox56.Text = Val(TextBox56.Text) * -1
  626. TextBox104.ForeColor = Color.Red : TextBox30.ForeColor = Color.Red : TextBox29.ForeColor = Color.Red : TextBox28.ForeColor = Color.Red : TextBox27.ForeColor = Color.Red
  627. TextBox26.ForeColor = Color.Red : TextBox25.ForeColor = Color.Red : TextBox31.ForeColor = Color.Red : TextBox36.ForeColor = Color.Red : TextBox41.ForeColor = Color.Red
  628. TextBox46.ForeColor = Color.Red : TextBox51.ForeColor = Color.Red : TextBox56.ForeColor = Color.Red
  629. ElseIf TextBox105.Text = "借" Then
  630. TextBox104.ForeColor = Color.Blue : TextBox30.ForeColor = Color.Blue : TextBox29.ForeColor = Color.Blue : TextBox28.ForeColor = Color.Blue : TextBox27.ForeColor = Color.Blue
  631. TextBox26.ForeColor = Color.Blue : TextBox25.ForeColor = Color.Blue : TextBox31.ForeColor = Color.Blue : TextBox36.ForeColor = Color.Blue : TextBox41.ForeColor = Color.Blue
  632. TextBox46.ForeColor = Color.Blue : TextBox51.ForeColor = Color.Blue : TextBox56.ForeColor = Color.Blue
  633. ElseIf TextBox105.Text = "" Then
  634. TextBox104.ForeColor = Color.Black : TextBox30.ForeColor = Color.Black : TextBox29.ForeColor = Color.Black : TextBox28.ForeColor = Color.Black : TextBox27.ForeColor = Color.Black
  635. TextBox26.ForeColor = Color.Black : TextBox25.ForeColor = Color.Black : TextBox31.ForeColor = Color.Black : TextBox36.ForeColor = Color.Black : TextBox41.ForeColor = Color.Black
  636. TextBox46.ForeColor = Color.Black : TextBox51.ForeColor = Color.Black : TextBox56.ForeColor = Color.Black
  637. End If
  638. If Val(TextBox64.Text) < 0 Then : TextBox64.ForeColor = Color.Red : Else : TextBox64.ForeColor = Color.Blue : End If
  639. If Val(TextBox4.Text) < 0 Then : TextBox4.ForeColor = Color.Red : Else : TextBox4.ForeColor = Color.Blue : End If
  640. If Val(TextBox8.Text) < 0 Then : TextBox8.ForeColor = Color.Red : Else : TextBox8.ForeColor = Color.Blue : End If
  641. If Val(TextBox12.Text) < 0 Then : TextBox12.ForeColor = Color.Red : Else : TextBox12.ForeColor = Color.Blue : End If
  642. If Val(TextBox16.Text) < 0 Then : TextBox16.ForeColor = Color.Red : Else : TextBox16.ForeColor = Color.Blue : End If
  643. If Val(TextBox20.Text) < 0 Then : TextBox20.ForeColor = Color.Red : Else : TextBox20.ForeColor = Color.Blue : End If
  644. If Val(TextBox24.Text) < 0 Then : TextBox24.ForeColor = Color.Red : Else : TextBox24.ForeColor = Color.Blue : End If
  645. If Val(TextBox32.Text) < 0 Then : TextBox32.ForeColor = Color.Red : Else : TextBox32.ForeColor = Color.Blue : End If
  646. If Val(TextBox37.Text) < 0 Then : TextBox37.ForeColor = Color.Red : Else : TextBox37.ForeColor = Color.Blue : End If
  647. If Val(TextBox42.Text) < 0 Then : TextBox42.ForeColor = Color.Red : Else : TextBox42.ForeColor = Color.Blue : End If
  648. If Val(TextBox47.Text) < 0 Then : TextBox47.ForeColor = Color.Red : Else : TextBox47.ForeColor = Color.Blue : End If
  649. If Val(TextBox52.Text) < 0 Then : TextBox52.ForeColor = Color.Red : Else : TextBox52.ForeColor = Color.Blue : End If
  650. If Val(TextBox57.Text) < 0 Then : TextBox57.ForeColor = Color.Red : Else : TextBox57.ForeColor = Color.Blue : End If
  651. For no As Integer = 1 To 104
  652. Dim TextBoxOO As TextBox = CType(Me.Controls.Find("TextBox" + no.ToString(), True)(0), TextBox)
  653. TextBoxOO.Text = Format(Val(TextBoxOO.Text), "#,##0 ")
  654. Next
  655. End Sub
  656. Private Sub 合計預設值()
  657. Set_清單13()
  658. For i As Integer = 0 To DataGridView14.Rows.Count - 1
  659. Dim ComboBoxOO As ComboBox = CType(Me.Controls.Find("ComboBox" + (i + 2).ToString(), True)(0), ComboBox) : ComboBoxOO.Text = DataGridView14.Rows(i).Cells("名稱").Value
  660. Dim CheckBoxOO As CheckBox = CType(Me.Controls.Find("CheckBox" + (i + 1).ToString(), True)(0), CheckBox) : CheckBoxOO.Checked = DataGridView14.Rows(i).Cells("年度合計").Value
  661. Next
  662. End Sub
  663. Private Sub 營運報表_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  664. Me.MdiParent = MAOJI_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  665. DataGridView14.Visible = False : ComboBox2下拉表單資料載入() : 合計預設值() : ComboBox1下拉表單資料載入() : ComboBox1.Text = Year(Today)
  666. End Sub
  667. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  668. ComboBox2下拉表單資料載入()
  669. End Sub
  670. Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
  671. Set_清單() : Set_清單1() : Set_清單2() : Set_清單3() : Set_清單4() : Set_清單5() : Set_清單6() : Set_清單7() : Set_清單8() : Set_清單9() : Set_清單10() : Set_清單11() : Set_清單12()
  672. 格式設定()
  673. End Sub
  674. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  675. Set_清單() : Set_清單1() : Set_清單2() : Set_清單3() : Set_清單4() : Set_清單5() : Set_清單6() : Set_清單7() : Set_清單8() : Set_清單9() : Set_清單10() : Set_清單11() : Set_清單12()
  676. 格式設定()
  677. End Sub
  678. Private Sub DataGridView2_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView2.RowPostPaint
  679. Dim linePen As New Pen(Color.Blue, 2) : Dim linePen1 As New Pen(Color.Red, 2)
  680. If e.RowIndex = DataGridView2.Rows.Count - 1 Then : Exit Sub : Else
  681. If DataGridView2(1, e.RowIndex).Value.ToString <> DataGridView2(1, e.RowIndex + 1).Value.ToString Then
  682. Dim startX As Integer = IIf(DataGridView2.RowHeadersVisible, DataGridView2.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  683. Dim endX As Integer = startX + DataGridView2.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView2.HorizontalScrollingOffset
  684. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  685. End If
  686. If DataGridView2(2, e.RowIndex).Value.ToString <> DataGridView2(2, e.RowIndex + 1).Value.ToString Then
  687. Dim startX As Integer = IIf(DataGridView2.RowHeadersVisible, DataGridView2.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  688. Dim endX As Integer = startX + DataGridView2.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView2.HorizontalScrollingOffset
  689. e.Graphics.DrawLine(linePen1, startX, startY, endX, startY) : Exit Sub
  690. End If
  691. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  692. If DataGridView2("層級", i).Value = 1 Then : DataGridView2.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
  693. ElseIf DataGridView2("層級", i).Value = 2 Then : DataGridView2.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow : End If
  694. If DataGridView2("抵銷", i).Value = True Then : DataGridView2.Rows(i).DefaultCellStyle.ForeColor = Color.Red
  695. ElseIf DataGridView2("抵銷", i).Value = False Then : DataGridView2.Rows(i).DefaultCellStyle.ForeColor = Color.Blue : End If
  696. Next
  697. End If
  698. End Sub
  699. Private Sub DataGridView1_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView1.RowPostPaint
  700. Dim linePen As New Pen(Color.Blue, 2) : Dim linePen1 As New Pen(Color.Red, 2)
  701. If e.RowIndex = DataGridView1.Rows.Count - 1 Then : Exit Sub : Else
  702. If DataGridView1(1, e.RowIndex).Value.ToString <> DataGridView1(1, e.RowIndex + 1).Value.ToString Then
  703. Dim startX As Integer = IIf(DataGridView1.RowHeadersVisible, DataGridView1.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  704. Dim endX As Integer = startX + DataGridView1.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView1.HorizontalScrollingOffset
  705. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  706. End If
  707. If DataGridView1(2, e.RowIndex).Value.ToString <> DataGridView1(2, e.RowIndex + 1).Value.ToString Then
  708. Dim startX As Integer = IIf(DataGridView1.RowHeadersVisible, DataGridView1.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  709. Dim endX As Integer = startX + DataGridView1.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView1.HorizontalScrollingOffset
  710. e.Graphics.DrawLine(linePen1, startX, startY, endX, startY) : Exit Sub
  711. End If
  712. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  713. If DataGridView1("層級", i).Value = 1 Then : DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
  714. ElseIf DataGridView1("層級", i).Value = 2 Then : DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow : End If
  715. If DataGridView1("抵銷", i).Value = True Then : DataGridView1.Rows(i).DefaultCellStyle.ForeColor = Color.Red
  716. ElseIf DataGridView1("抵銷", i).Value = False Then : DataGridView1.Rows(i).DefaultCellStyle.ForeColor = Color.Blue : End If
  717. Next
  718. End If
  719. End Sub
  720. Private Sub DataGridView3_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView3.RowPostPaint
  721. Dim linePen As New Pen(Color.Blue, 2) : Dim linePen1 As New Pen(Color.Red, 2)
  722. If e.RowIndex = DataGridView3.Rows.Count - 1 Then : Exit Sub : Else
  723. If DataGridView3(1, e.RowIndex).Value.ToString <> DataGridView3(1, e.RowIndex + 1).Value.ToString Then
  724. Dim startX As Integer = IIf(DataGridView3.RowHeadersVisible, DataGridView3.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  725. Dim endX As Integer = startX + DataGridView3.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView3.HorizontalScrollingOffset
  726. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  727. End If
  728. If DataGridView3(2, e.RowIndex).Value.ToString <> DataGridView3(2, e.RowIndex + 1).Value.ToString Then
  729. Dim startX As Integer = IIf(DataGridView3.RowHeadersVisible, DataGridView3.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  730. Dim endX As Integer = startX + DataGridView3.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView3.HorizontalScrollingOffset
  731. e.Graphics.DrawLine(linePen1, startX, startY, endX, startY) : Exit Sub
  732. End If
  733. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  734. If DataGridView3("層級", i).Value = 1 Then : DataGridView3.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
  735. ElseIf DataGridView3("層級", i).Value = 2 Then : DataGridView3.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow : End If
  736. If DataGridView3("抵銷", i).Value = True Then : DataGridView3.Rows(i).DefaultCellStyle.ForeColor = Color.Red
  737. ElseIf DataGridView3("抵銷", i).Value = False Then : DataGridView3.Rows(i).DefaultCellStyle.ForeColor = Color.Blue : End If
  738. Next
  739. End If
  740. End Sub
  741. Private Sub DataGridView4_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView4.RowPostPaint
  742. Dim linePen As New Pen(Color.Blue, 2) : Dim linePen1 As New Pen(Color.Red, 2)
  743. If e.RowIndex = DataGridView4.Rows.Count - 1 Then : Exit Sub : Else
  744. If DataGridView4(1, e.RowIndex).Value.ToString <> DataGridView4(1, e.RowIndex + 1).Value.ToString Then
  745. Dim startX As Integer = IIf(DataGridView4.RowHeadersVisible, DataGridView4.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  746. Dim endX As Integer = startX + DataGridView4.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView4.HorizontalScrollingOffset
  747. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  748. End If
  749. If DataGridView4(2, e.RowIndex).Value.ToString <> DataGridView4(2, e.RowIndex + 1).Value.ToString Then
  750. Dim startX As Integer = IIf(DataGridView4.RowHeadersVisible, DataGridView4.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  751. Dim endX As Integer = startX + DataGridView4.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView4.HorizontalScrollingOffset
  752. e.Graphics.DrawLine(linePen1, startX, startY, endX, startY) : Exit Sub
  753. End If
  754. For i As Integer = 0 To DataGridView4.Rows.Count - 1
  755. If DataGridView4("層級", i).Value = 1 Then : DataGridView4.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
  756. ElseIf DataGridView4("層級", i).Value = 2 Then : DataGridView4.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow : End If
  757. If DataGridView4("抵銷", i).Value = True Then : DataGridView4.Rows(i).DefaultCellStyle.ForeColor = Color.Red
  758. ElseIf DataGridView4("抵銷", i).Value = False Then : DataGridView4.Rows(i).DefaultCellStyle.ForeColor = Color.Blue : End If
  759. Next
  760. End If
  761. End Sub
  762. Private Sub DataGridView5_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView5.RowPostPaint
  763. Dim linePen As New Pen(Color.Blue, 2) : Dim linePen1 As New Pen(Color.Red, 2)
  764. If e.RowIndex = DataGridView5.Rows.Count - 1 Then : Exit Sub : Else
  765. If DataGridView5(1, e.RowIndex).Value.ToString <> DataGridView5(1, e.RowIndex + 1).Value.ToString Then
  766. Dim startX As Integer = IIf(DataGridView5.RowHeadersVisible, DataGridView5.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  767. Dim endX As Integer = startX + DataGridView5.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView5.HorizontalScrollingOffset
  768. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  769. End If
  770. If DataGridView5(2, e.RowIndex).Value.ToString <> DataGridView5(2, e.RowIndex + 1).Value.ToString Then
  771. Dim startX As Integer = IIf(DataGridView5.RowHeadersVisible, DataGridView5.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  772. Dim endX As Integer = startX + DataGridView5.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView5.HorizontalScrollingOffset
  773. e.Graphics.DrawLine(linePen1, startX, startY, endX, startY) : Exit Sub
  774. End If
  775. For i As Integer = 0 To DataGridView5.Rows.Count - 1
  776. If DataGridView5("層級", i).Value = 1 Then : DataGridView5.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
  777. ElseIf DataGridView5("層級", i).Value = 2 Then : DataGridView5.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow : End If
  778. If DataGridView5("抵銷", i).Value = True Then : DataGridView5.Rows(i).DefaultCellStyle.ForeColor = Color.Red
  779. ElseIf DataGridView5("抵銷", i).Value = False Then : DataGridView5.Rows(i).DefaultCellStyle.ForeColor = Color.Blue : End If
  780. Next
  781. End If
  782. End Sub
  783. Private Sub DataGridView6_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView6.RowPostPaint
  784. Dim linePen As New Pen(Color.Blue, 2) : Dim linePen1 As New Pen(Color.Red, 2)
  785. If e.RowIndex = DataGridView6.Rows.Count - 1 Then : Exit Sub : Else
  786. If DataGridView6(1, e.RowIndex).Value.ToString <> DataGridView6(1, e.RowIndex + 1).Value.ToString Then
  787. Dim startX As Integer = IIf(DataGridView6.RowHeadersVisible, DataGridView6.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  788. Dim endX As Integer = startX + DataGridView6.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView6.HorizontalScrollingOffset
  789. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  790. End If
  791. If DataGridView6(2, e.RowIndex).Value.ToString <> DataGridView6(2, e.RowIndex + 1).Value.ToString Then
  792. Dim startX As Integer = IIf(DataGridView6.RowHeadersVisible, DataGridView6.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  793. Dim endX As Integer = startX + DataGridView6.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView6.HorizontalScrollingOffset
  794. e.Graphics.DrawLine(linePen1, startX, startY, endX, startY) : Exit Sub
  795. End If
  796. For i As Integer = 0 To DataGridView6.Rows.Count - 1
  797. If DataGridView6("層級", i).Value = 1 Then : DataGridView6.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
  798. ElseIf DataGridView6("層級", i).Value = 2 Then : DataGridView6.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow : End If
  799. If DataGridView6("抵銷", i).Value = True Then : DataGridView6.Rows(i).DefaultCellStyle.ForeColor = Color.Red
  800. ElseIf DataGridView6("抵銷", i).Value = False Then : DataGridView6.Rows(i).DefaultCellStyle.ForeColor = Color.Blue : End If
  801. Next
  802. End If
  803. End Sub
  804. Private Sub DataGridView7_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView7.RowPostPaint
  805. Dim linePen As New Pen(Color.Blue, 2) : Dim linePen1 As New Pen(Color.Red, 2)
  806. If e.RowIndex = DataGridView7.Rows.Count - 1 Then : Exit Sub : Else
  807. If DataGridView7(1, e.RowIndex).Value.ToString <> DataGridView7(1, e.RowIndex + 1).Value.ToString Then
  808. Dim startX As Integer = IIf(DataGridView7.RowHeadersVisible, DataGridView7.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  809. Dim endX As Integer = startX + DataGridView7.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView7.HorizontalScrollingOffset
  810. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  811. End If
  812. If DataGridView7(2, e.RowIndex).Value.ToString <> DataGridView7(2, e.RowIndex + 1).Value.ToString Then
  813. Dim startX As Integer = IIf(DataGridView7.RowHeadersVisible, DataGridView7.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  814. Dim endX As Integer = startX + DataGridView7.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView7.HorizontalScrollingOffset
  815. e.Graphics.DrawLine(linePen1, startX, startY, endX, startY) : Exit Sub
  816. End If
  817. For i As Integer = 0 To DataGridView7.Rows.Count - 1
  818. If DataGridView7("層級", i).Value = 1 Then : DataGridView7.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
  819. ElseIf DataGridView7("層級", i).Value = 2 Then : DataGridView7.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow : End If
  820. If DataGridView7("抵銷", i).Value = True Then : DataGridView7.Rows(i).DefaultCellStyle.ForeColor = Color.Red
  821. ElseIf DataGridView7("抵銷", i).Value = False Then : DataGridView7.Rows(i).DefaultCellStyle.ForeColor = Color.Blue : End If
  822. Next
  823. End If
  824. End Sub
  825. Private Sub DataGridView8_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView8.RowPostPaint
  826. Dim linePen As New Pen(Color.Blue, 2) : Dim linePen1 As New Pen(Color.Red, 2)
  827. If e.RowIndex = DataGridView8.Rows.Count - 1 Then : Exit Sub : Else
  828. If DataGridView8(1, e.RowIndex).Value.ToString <> DataGridView8(1, e.RowIndex + 1).Value.ToString Then
  829. Dim startX As Integer = IIf(DataGridView8.RowHeadersVisible, DataGridView8.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  830. Dim endX As Integer = startX + DataGridView8.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView8.HorizontalScrollingOffset
  831. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  832. End If
  833. If DataGridView8(2, e.RowIndex).Value.ToString <> DataGridView8(2, e.RowIndex + 1).Value.ToString Then
  834. Dim startX As Integer = IIf(DataGridView8.RowHeadersVisible, DataGridView8.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  835. Dim endX As Integer = startX + DataGridView8.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView8.HorizontalScrollingOffset
  836. e.Graphics.DrawLine(linePen1, startX, startY, endX, startY) : Exit Sub
  837. End If
  838. For i As Integer = 0 To DataGridView8.Rows.Count - 1
  839. If DataGridView8("層級", i).Value = 1 Then : DataGridView8.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
  840. ElseIf DataGridView8("層級", i).Value = 2 Then : DataGridView8.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow : End If
  841. If DataGridView8("抵銷", i).Value = True Then : DataGridView8.Rows(i).DefaultCellStyle.ForeColor = Color.Red
  842. ElseIf DataGridView8("抵銷", i).Value = False Then : DataGridView8.Rows(i).DefaultCellStyle.ForeColor = Color.Blue : End If
  843. Next
  844. End If
  845. End Sub
  846. Private Sub DataGridView9_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView9.RowPostPaint
  847. Dim linePen As New Pen(Color.Blue, 2) : Dim linePen1 As New Pen(Color.Red, 2)
  848. If e.RowIndex = DataGridView9.Rows.Count - 1 Then : Exit Sub : Else
  849. If DataGridView9(1, e.RowIndex).Value.ToString <> DataGridView9(1, e.RowIndex + 1).Value.ToString Then
  850. Dim startX As Integer = IIf(DataGridView9.RowHeadersVisible, DataGridView9.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  851. Dim endX As Integer = startX + DataGridView9.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView9.HorizontalScrollingOffset
  852. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  853. End If
  854. If DataGridView9(2, e.RowIndex).Value.ToString <> DataGridView9(2, e.RowIndex + 1).Value.ToString Then
  855. Dim startX As Integer = IIf(DataGridView9.RowHeadersVisible, DataGridView9.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  856. Dim endX As Integer = startX + DataGridView9.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView9.HorizontalScrollingOffset
  857. e.Graphics.DrawLine(linePen1, startX, startY, endX, startY) : Exit Sub
  858. End If
  859. For i As Integer = 0 To DataGridView9.Rows.Count - 1
  860. If DataGridView9("層級", i).Value = 1 Then : DataGridView9.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
  861. ElseIf DataGridView9("層級", i).Value = 2 Then : DataGridView9.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow : End If
  862. If DataGridView9("抵銷", i).Value = True Then : DataGridView9.Rows(i).DefaultCellStyle.ForeColor = Color.Red
  863. ElseIf DataGridView9("抵銷", i).Value = False Then : DataGridView9.Rows(i).DefaultCellStyle.ForeColor = Color.Blue : End If
  864. Next
  865. End If
  866. End Sub
  867. Private Sub DataGridView10_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView10.RowPostPaint
  868. Dim linePen As New Pen(Color.Blue, 2) : Dim linePen1 As New Pen(Color.Red, 2)
  869. If e.RowIndex = DataGridView10.Rows.Count - 1 Then : Exit Sub : Else
  870. If DataGridView10(1, e.RowIndex).Value.ToString <> DataGridView10(1, e.RowIndex + 1).Value.ToString Then
  871. Dim startX As Integer = IIf(DataGridView10.RowHeadersVisible, DataGridView10.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  872. Dim endX As Integer = startX + DataGridView10.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView10.HorizontalScrollingOffset
  873. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  874. End If
  875. If DataGridView10(2, e.RowIndex).Value.ToString <> DataGridView10(2, e.RowIndex + 1).Value.ToString Then
  876. Dim startX As Integer = IIf(DataGridView10.RowHeadersVisible, DataGridView10.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  877. Dim endX As Integer = startX + DataGridView10.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView10.HorizontalScrollingOffset
  878. e.Graphics.DrawLine(linePen1, startX, startY, endX, startY) : Exit Sub
  879. End If
  880. For i As Integer = 0 To DataGridView10.Rows.Count - 1
  881. If DataGridView10("層級", i).Value = 1 Then : DataGridView10.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
  882. ElseIf DataGridView10("層級", i).Value = 2 Then : DataGridView10.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow : End If
  883. If DataGridView10("抵銷", i).Value = True Then : DataGridView10.Rows(i).DefaultCellStyle.ForeColor = Color.Red
  884. ElseIf DataGridView10("抵銷", i).Value = False Then : DataGridView10.Rows(i).DefaultCellStyle.ForeColor = Color.Blue : End If
  885. Next
  886. End If
  887. End Sub
  888. Private Sub DataGridView11_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView11.RowPostPaint
  889. Dim linePen As New Pen(Color.Blue, 2) : Dim linePen1 As New Pen(Color.Red, 2)
  890. If e.RowIndex = DataGridView11.Rows.Count - 1 Then : Exit Sub : Else
  891. If DataGridView11(1, e.RowIndex).Value.ToString <> DataGridView11(1, e.RowIndex + 1).Value.ToString Then
  892. Dim startX As Integer = IIf(DataGridView11.RowHeadersVisible, DataGridView11.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  893. Dim endX As Integer = startX + DataGridView11.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView11.HorizontalScrollingOffset
  894. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  895. End If
  896. If DataGridView11(2, e.RowIndex).Value.ToString <> DataGridView11(2, e.RowIndex + 1).Value.ToString Then
  897. Dim startX As Integer = IIf(DataGridView11.RowHeadersVisible, DataGridView11.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  898. Dim endX As Integer = startX + DataGridView11.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView11.HorizontalScrollingOffset
  899. e.Graphics.DrawLine(linePen1, startX, startY, endX, startY) : Exit Sub
  900. End If
  901. For i As Integer = 0 To DataGridView11.Rows.Count - 1
  902. If DataGridView11("層級", i).Value = 1 Then : DataGridView11.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
  903. ElseIf DataGridView11("層級", i).Value = 2 Then : DataGridView11.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow : End If
  904. If DataGridView11("抵銷", i).Value = True Then : DataGridView11.Rows(i).DefaultCellStyle.ForeColor = Color.Red
  905. ElseIf DataGridView11("抵銷", i).Value = False Then : DataGridView11.Rows(i).DefaultCellStyle.ForeColor = Color.Blue : End If
  906. Next
  907. End If
  908. End Sub
  909. Private Sub DataGridView12_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView12.RowPostPaint
  910. Dim linePen As New Pen(Color.Blue, 2) : Dim linePen1 As New Pen(Color.Red, 2)
  911. If e.RowIndex = DataGridView12.Rows.Count - 1 Then : Exit Sub : Else
  912. If DataGridView12(1, e.RowIndex).Value.ToString <> DataGridView12(1, e.RowIndex + 1).Value.ToString Then
  913. Dim startX As Integer = IIf(DataGridView12.RowHeadersVisible, DataGridView12.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  914. Dim endX As Integer = startX + DataGridView12.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView12.HorizontalScrollingOffset
  915. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  916. End If
  917. If DataGridView12(2, e.RowIndex).Value.ToString <> DataGridView12(2, e.RowIndex + 1).Value.ToString Then
  918. Dim startX As Integer = IIf(DataGridView12.RowHeadersVisible, DataGridView12.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  919. Dim endX As Integer = startX + DataGridView12.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView12.HorizontalScrollingOffset
  920. e.Graphics.DrawLine(linePen1, startX, startY, endX, startY) : Exit Sub
  921. End If
  922. For i As Integer = 0 To DataGridView12.Rows.Count - 1
  923. If DataGridView12("層級", i).Value = 1 Then : DataGridView12.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
  924. ElseIf DataGridView12("層級", i).Value = 2 Then : DataGridView12.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow : End If
  925. If DataGridView12("抵銷", i).Value = True Then : DataGridView12.Rows(i).DefaultCellStyle.ForeColor = Color.Red
  926. ElseIf DataGridView12("抵銷", i).Value = False Then : DataGridView12.Rows(i).DefaultCellStyle.ForeColor = Color.Blue : End If
  927. Next
  928. End If
  929. End Sub
  930. Private Sub DataGridView13_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView13.RowPostPaint
  931. Dim linePen As New Pen(Color.Blue, 2) : Dim linePen1 As New Pen(Color.Red, 2)
  932. If e.RowIndex = DataGridView13.Rows.Count - 1 Then : Exit Sub : Else
  933. If DataGridView13(1, e.RowIndex).Value.ToString <> DataGridView13(1, e.RowIndex + 1).Value.ToString Then
  934. Dim startX As Integer = IIf(DataGridView13.RowHeadersVisible, DataGridView13.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  935. Dim endX As Integer = startX + DataGridView13.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView13.HorizontalScrollingOffset
  936. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  937. End If
  938. If DataGridView13(2, e.RowIndex).Value.ToString <> DataGridView13(2, e.RowIndex + 1).Value.ToString Then
  939. Dim startX As Integer = IIf(DataGridView13.RowHeadersVisible, DataGridView13.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  940. Dim endX As Integer = startX + DataGridView13.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView13.HorizontalScrollingOffset
  941. e.Graphics.DrawLine(linePen1, startX, startY, endX, startY) : Exit Sub
  942. End If
  943. For i As Integer = 0 To DataGridView13.Rows.Count - 1
  944. If DataGridView13("層級", i).Value = 1 Then : DataGridView13.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
  945. ElseIf DataGridView13("層級", i).Value = 2 Then : DataGridView13.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow : End If
  946. If DataGridView13("抵銷", i).Value = True Then : DataGridView13.Rows(i).DefaultCellStyle.ForeColor = Color.Red
  947. ElseIf DataGridView13("抵銷", i).Value = False Then : DataGridView13.Rows(i).DefaultCellStyle.ForeColor = Color.Blue : End If
  948. Next
  949. End If
  950. End Sub
  951. Private Sub DataGridView2_Scroll(ByVal sender As Object, ByVal e As ScrollEventArgs) Handles DataGridView2.Scroll
  952. DataGridView1.FirstDisplayedScrollingRowIndex = DataGridView2.FirstDisplayedScrollingRowIndex : DataGridView3.FirstDisplayedScrollingRowIndex = DataGridView2.FirstDisplayedScrollingRowIndex
  953. DataGridView4.FirstDisplayedScrollingRowIndex = DataGridView2.FirstDisplayedScrollingRowIndex : DataGridView5.FirstDisplayedScrollingRowIndex = DataGridView2.FirstDisplayedScrollingRowIndex
  954. DataGridView6.FirstDisplayedScrollingRowIndex = DataGridView2.FirstDisplayedScrollingRowIndex : DataGridView7.FirstDisplayedScrollingRowIndex = DataGridView2.FirstDisplayedScrollingRowIndex
  955. DataGridView8.FirstDisplayedScrollingRowIndex = DataGridView2.FirstDisplayedScrollingRowIndex : DataGridView9.FirstDisplayedScrollingRowIndex = DataGridView2.FirstDisplayedScrollingRowIndex
  956. DataGridView10.FirstDisplayedScrollingRowIndex = DataGridView2.FirstDisplayedScrollingRowIndex : DataGridView11.FirstDisplayedScrollingRowIndex = DataGridView2.FirstDisplayedScrollingRowIndex
  957. DataGridView12.FirstDisplayedScrollingRowIndex = DataGridView2.FirstDisplayedScrollingRowIndex : DataGridView13.FirstDisplayedScrollingRowIndex = DataGridView2.FirstDisplayedScrollingRowIndex
  958. End Sub
  959. Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
  960. PA1 = ComboBox2.Text : SQL_營運成本收支_決算表_彙總借貸()
  961. If dr.Read() Then : If dr("抵銷科目") = True Then : TextBox111.Text = "貸" : ElseIf dr("抵銷科目") = False Then : TextBox111.Text = "借" : End If : Else : TextBox111.Text = "" : End If
  962. End Sub
  963. Private Sub ComboBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox3.SelectedIndexChanged
  964. PA1 = ComboBox3.Text : SQL_營運成本收支_決算表_彙總借貸()
  965. If dr.Read() Then : If dr("抵銷科目") = True Then : TextBox110.Text = "貸" : ElseIf dr("抵銷科目") = False Then : TextBox110.Text = "借" : End If : Else : TextBox110.Text = "" : End If
  966. End Sub
  967. Private Sub ComboBox4_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox4.SelectedIndexChanged
  968. PA1 = ComboBox4.Text : SQL_營運成本收支_決算表_彙總借貸()
  969. If dr.Read() Then : If dr("抵銷科目") = True Then : TextBox109.Text = "貸" : ElseIf dr("抵銷科目") = False Then : TextBox109.Text = "借" : End If : Else : TextBox109.Text = "" : End If
  970. End Sub
  971. Private Sub ComboBox5_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox5.SelectedIndexChanged
  972. PA1 = ComboBox5.Text : SQL_營運成本收支_決算表_彙總借貸()
  973. If dr.Read() Then : If dr("抵銷科目") = True Then : TextBox108.Text = "貸" : ElseIf dr("抵銷科目") = False Then : TextBox108.Text = "借" : End If : Else : TextBox108.Text = "" : End If
  974. End Sub
  975. Private Sub ComboBox6_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox6.SelectedIndexChanged
  976. PA1 = ComboBox6.Text : SQL_營運成本收支_決算表_彙總借貸()
  977. If dr.Read() Then : If dr("抵銷科目") = True Then : TextBox107.Text = "貸" : ElseIf dr("抵銷科目") = False Then : TextBox107.Text = "借" : End If : Else : TextBox107.Text = "" : End If
  978. End Sub
  979. Private Sub ComboBox7_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox7.SelectedIndexChanged
  980. PA1 = ComboBox7.Text : SQL_營運成本收支_決算表_彙總借貸()
  981. If dr.Read() Then : If dr("抵銷科目") = True Then : TextBox106.Text = "貸" : ElseIf dr("抵銷科目") = False Then : TextBox106.Text = "借" : End If : Else : TextBox106.Text = "" : End If
  982. End Sub
  983. Private Sub ComboBox8_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox8.SelectedIndexChanged
  984. PA1 = ComboBox8.Text : SQL_營運成本收支_決算表_彙總借貸()
  985. If dr.Read() Then : If dr("抵銷科目") = True Then : TextBox105.Text = "貸" : ElseIf dr("抵銷科目") = False Then : TextBox105.Text = "借" : End If : Else : TextBox105.Text = "" : End If
  986. End Sub
  987. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  988. For i As Integer = 0 To DataGridView14.Rows.Count - 1
  989. Dim ComboBoxOO As ComboBox = CType(Me.Controls.Find("ComboBox" + (i + 2).ToString(), True)(0), ComboBox)
  990. Dim CheckBoxOO As CheckBox = CType(Me.Controls.Find("CheckBox" + (i + 1).ToString(), True)(0), CheckBox)
  991. PA1 = ComboBoxOO.Text : 布林1 = CheckBoxOO.Checked : PA2 = (i + 1) : SQL_財務決算表合計預設修改() : conn.Close()
  992. Next : MsgBox("存檔完畢。") : Me.重新整理ToolStripMenuItem.PerformClick()
  993. End Sub
  994. '-----------------------------滑鼠右鍵------------------------------------------------------------------------------------------------------------------------------------------
  995. Private Sub 重新整理ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新整理ToolStripMenuItem.Click
  996. 合計預設值() : Set_清單() : Set_清單1() : Set_清單2() : Set_清單3() : Set_清單4() : Set_清單5() : Set_清單6() : Set_清單7()
  997. Set_清單8() : Set_清單9() : Set_清單10() : Set_清單11() : Set_清單12() : 格式設定()
  998. End Sub
  999. End Class