暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

現金收支單申請.vb 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. Option Strict Off
  2. Public Class 現金收支單申請
  3. ReadOnly ds As New DataSet : ReadOnly ds1 As New DataSet
  4. Dim 新項次 As String : Dim NUM1 As Integer
  5. Private Sub Set_清單1()
  6. DataGridView2.DataSource = Nothing : ds1.Clear()
  7. DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  8. DataGridView2.ColumnHeadersHeight = 25
  9. DataGridView2.AllowUserToAddRows = False
  10. SQL_營運成本收支單申請清單()
  11. da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close()
  12. DataGridView2.Columns(0).FillWeight = 160 : DataGridView2.Columns(1).FillWeight = 100 : DataGridView2.Columns(2).FillWeight = 100 : DataGridView2.Columns(3).Visible = False
  13. End Sub
  14. Private Sub Set_費用清單()
  15. DataGridView1.DataSource = Nothing : ds.Clear()
  16. DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  17. DataGridView1.ColumnHeadersHeight = 25
  18. DataGridView1.AllowUserToAddRows = False
  19. DataGridView1.RowTemplate.Height = 35
  20. SQL_營運成本收支單申請費用清單()
  21. da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
  22. DataGridView1.Columns(0).Visible = False : DataGridView1.Columns(1).FillWeight = 80 : DataGridView1.Columns(2).FillWeight = 200 : DataGridView1.Columns(3).FillWeight = 500
  23. DataGridView1.Columns(4).Visible = False : DataGridView1.Columns(5).Visible = False : DataGridView1.Columns(6).FillWeight = 140 : DataGridView1.Columns(7).FillWeight = 140
  24. DataGridView1.Columns(8).FillWeight = 200 : DataGridView1.Columns(9).Visible = False : DataGridView1.Columns(10).FillWeight = 100
  25. DataGridView1.Columns(1).ReadOnly = True : DataGridView1.Columns(2).ReadOnly = True : DataGridView1.Columns(10).ReadOnly = True
  26. DataGridView1.Columns(4).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(5).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(6).DefaultCellStyle.Format = "#,##0"
  27. DataGridView1.Columns(7).DefaultCellStyle.Format = "#,##0"
  28. DataGridView1.Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  29. DataGridView1.Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  30. DataGridView1.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView1.Columns(4).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  31. DataGridView1.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView1.Columns(5).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  32. DataGridView1.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView1.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  33. DataGridView1.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView1.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  34. DataGridView1.Columns(10).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(10).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  35. DataGridView1.EditMode = DataGridViewEditMode.EditOnEnter
  36. TextBox5.Text = "0" : TextBox2.Text = "0" : TextBox6.Text = "0" : TextBox7.Text = "0" : TextBox8.Text = "0"
  37. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  38. TextBox5.Text = Val(TextBox5.Text) + DataGridView1.Rows(i).Cells("現金").Value : TextBox2.Text = Val(TextBox2.Text) + DataGridView1.Rows(i).Cells("支出").Value
  39. TextBox7.Text = Val(TextBox7.Text) + DataGridView1.Rows(i).Cells("開票").Value : TextBox8.Text = Val(TextBox8.Text) + DataGridView1.Rows(i).Cells("收票").Value
  40. If DataGridView1.Rows(i).Cells("支出").Value <> 0 And DataGridView1.Rows(i).Cells("現金").Value = 0 Then
  41. DataGridView1.Rows(i).Cells("狀態").Value = "付現"
  42. ElseIf DataGridView1.Rows(i).Cells("支出").Value = 0 And DataGridView1.Rows(i).Cells("現金").Value <> 0 Then
  43. DataGridView1.Rows(i).Cells("狀態").Value = "收現"
  44. End If
  45. Next i
  46. TextBox6.Text = Val(TextBox5.Text) - Val(TextBox2.Text)
  47. If Val(TextBox6.Text) > 0 Then : TextBox6.ForeColor = Color.Blue : Else : TextBox6.ForeColor = Color.Red : End If
  48. TextBox5.Text = Format(Val(TextBox5.Text), "#,##0") : TextBox2.Text = Format(Val(TextBox2.Text), "#,##0") : TextBox6.Text = Format(Val(TextBox6.Text), "#,##0")
  49. TextBox7.Text = Format(Val(TextBox7.Text), "#,##0") : TextBox8.Text = Format(Val(TextBox8.Text), "#,##0")
  50. End Sub
  51. Private Sub ComboBox1下拉表單資料載入()
  52. PA = ComboBox4.Text : SQL_會計科目_第三階_不含流動票務()
  53. ComboBox1.Items.Clear() : ComboBox6.Items.Clear() : While (dr.Read()) : ComboBox1.Items.Add(dr("會計科目")) : ComboBox6.Items.Add(dr("編號")) : End While : conn.Close()
  54. If ComboBox1.Items.Count <> 0 Then : ComboBox1.SelectedIndex = 0 : End If
  55. End Sub
  56. Private Sub ComboBox2下拉表單資料載入()
  57. SQL_會計科目_第一階_不含流動票務()
  58. ComboBox5.Items.Clear() : ComboBox2.Items.Clear() : While (dr.Read()) : ComboBox5.Items.Add(dr("第一階")) : ComboBox2.Items.Add(dr("編號")) : End While : conn.Close()
  59. End Sub
  60. Private Sub ComboBox3下拉表單資料載入()
  61. PA = ComboBox2.Text : SQL_會計科目_第二階_不含流動票務()
  62. ComboBox3.Items.Clear() : ComboBox4.Items.Clear() : While (dr.Read()) : ComboBox3.Items.Add(dr("第二階")) : ComboBox4.Items.Add(dr("編號")) : End While : conn.Close() : PA = ""
  63. End Sub
  64. Private Sub 營運成本支付申請_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  65. Me.MdiParent = MAOJI_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  66. RadioButton1.Checked = True : DateTimePicker2.Visible = False : 複製單據開單ToolStripMenuItem.Enabled = False : ComboBox6.Visible = False
  67. TextBox7.Visible = False : TextBox8.Visible = False : Label10.Visible = False : Label11.Visible = False
  68. DataGridView2.Visible = True : Set_清單1() : ComboBox2下拉表單資料載入()
  69. End Sub
  70. Private Sub ComboBox5_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox5.TextChanged
  71. ComboBox2.SelectedIndex = ComboBox5.SelectedIndex : TextBox9.Text = "" : ComboBox3下拉表單資料載入() : ComboBox1下拉表單資料載入()
  72. End Sub
  73. Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.TextChanged
  74. ComboBox5.SelectedIndex = ComboBox2.SelectedIndex : ComboBox3下拉表單資料載入() : ComboBox1下拉表單資料載入()
  75. End Sub
  76. Private Sub ComboBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox3.TextChanged
  77. ComboBox4.SelectedIndex = ComboBox3.SelectedIndex : ComboBox1下拉表單資料載入()
  78. End Sub
  79. Private Sub ComboBox4_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox4.TextChanged
  80. ComboBox3.SelectedIndex = ComboBox4.SelectedIndex : ComboBox1下拉表單資料載入()
  81. End Sub
  82. Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
  83. ComboBox6.SelectedIndex = ComboBox1.SelectedIndex
  84. End Sub
  85. Private Sub ComboBox6_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox6.SelectedIndexChanged
  86. ComboBox1.SelectedIndex = ComboBox6.SelectedIndex
  87. End Sub
  88. Private Sub TextBox9_TextChanged(sender As Object, e As EventArgs) Handles TextBox9.TextChanged
  89. PA = TextBox9.Text : SQL_會計科目_關鍵字_不含流動票務()
  90. ComboBox1.Items.Clear() : ComboBox6.Items.Clear() : While (dr.Read()) : ComboBox1.Items.Add(dr("會計科目")) : ComboBox6.Items.Add(dr("編號")) : End While : conn.Close()
  91. If ComboBox1.Items.Count <> 0 Then : ComboBox1.SelectedIndex = 0 : End If : PA = ""
  92. End Sub
  93. Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
  94. If Label62.Visible = True Then : Label62.Visible = False : Else : Label62.Visible = True : End If
  95. End Sub
  96. Private Sub DataGridView1_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
  97. TextBox5.Text = "0" : TextBox2.Text = "0" : TextBox6.Text = "0" : TextBox7.Text = "0" : TextBox8.Text = "0"
  98. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  99. TextBox5.Text = Val(TextBox5.Text) + DataGridView1.Rows(i).Cells("現金").Value : TextBox2.Text = Val(TextBox2.Text) + DataGridView1.Rows(i).Cells("支出").Value
  100. TextBox7.Text = Val(TextBox7.Text) + DataGridView1.Rows(i).Cells("開票").Value : TextBox8.Text = Val(TextBox8.Text) + DataGridView1.Rows(i).Cells("收票").Value
  101. If DataGridView1.Rows(i).Cells("支出").Value <> 0 And DataGridView1.Rows(i).Cells("現金").Value = 0 Then
  102. DataGridView1.Rows(i).Cells("狀態").Value = "付現"
  103. ElseIf DataGridView1.Rows(i).Cells("支出").Value = 0 And DataGridView1.Rows(i).Cells("現金").Value <> 0 Then
  104. DataGridView1.Rows(i).Cells("狀態").Value = "收現"
  105. End If
  106. Next i
  107. TextBox6.Text = Val(TextBox5.Text) - Val(TextBox2.Text)
  108. If Val(TextBox6.Text) > 0 Then : TextBox6.ForeColor = Color.Blue : Else : TextBox6.ForeColor = Color.Red : End If
  109. TextBox5.Text = Format(Val(TextBox5.Text), "#,##0") : TextBox2.Text = Format(Val(TextBox2.Text), "#,##0") : TextBox6.Text = Format(Val(TextBox6.Text), "#,##0")
  110. TextBox7.Text = Format(Val(TextBox7.Text), "#,##0") : TextBox8.Text = Format(Val(TextBox8.Text), "#,##0")
  111. End Sub
  112. Private Sub DataGridView2_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView2.CellClick
  113. If e.RowIndex = -1 Then : Else
  114. TextBox1.Text = DataGridView2(0, e.RowIndex).Value.ToString : DateTimePicker1.Value = DataGridView2(1, e.RowIndex).Value.ToString : Set_費用清單()
  115. TextBox3.Text = DataGridView2(3, e.RowIndex).Value.ToString
  116. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  117. If DataGridView1.Rows(i).Cells("支出").Value <> 0 And DataGridView1.Rows(i).Cells("現金").Value = 0 Then
  118. DataGridView1.Rows(i).Cells("狀態").Value = "付現"
  119. ElseIf DataGridView1.Rows(i).Cells("支出").Value = 0 And DataGridView1.Rows(i).Cells("現金").Value <> 0 Then
  120. DataGridView1.Rows(i).Cells("狀態").Value = "收現"
  121. End If
  122. Next i
  123. End If
  124. End Sub
  125. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
  126. If e.RowIndex = -1 Then : Else
  127. TextBox4.Text = DataGridView1(1, e.RowIndex).Value.ToString
  128. End If
  129. End Sub
  130. Private Sub Set_切換格式()
  131. DataGridView1.DataSource = Nothing : ds.Clear() : TextBox1.Text = "" : TextBox3.Text = "" : TextBox4.Text = "" : TextBox5.Text = "" : TextBox2.Text = "" : TextBox6.Text = ""
  132. TextBox7.Text = "" : TextBox8.Text = "" : ComboBox1下拉表單資料載入() : Set_清單1()
  133. End Sub
  134. Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.Click
  135. RadioButton1.Checked = True : RadioButton2.Checked = False : RadioButton3.Checked = False : 申請完成ToolStripMenuItem.Enabled = True : 複製單據開單ToolStripMenuItem.Enabled = False
  136. 開立現金收支單ToolStripMenuItem.Enabled = True : Button2.Enabled = True : 新增一筆資料ToolStripMenuItem.Enabled = True
  137. 刪除支付單中選中的資料ToolStripMenuItem.Enabled = True : 刪除選中的現金收支單ToolStripMenuItem.Enabled = True : Set_切換格式()
  138. End Sub
  139. Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton2.Click
  140. RadioButton1.Checked = False : RadioButton2.Checked = True : RadioButton3.Checked = False : 申請完成ToolStripMenuItem.Enabled = False : 複製單據開單ToolStripMenuItem.Enabled = False
  141. 開立現金收支單ToolStripMenuItem.Enabled = False : Button2.Enabled = False : 新增一筆資料ToolStripMenuItem.Enabled = False
  142. 刪除支付單中選中的資料ToolStripMenuItem.Enabled = False : 刪除選中的現金收支單ToolStripMenuItem.Enabled = False : Set_切換格式()
  143. End Sub
  144. Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton3.Click
  145. If CC(28) = False Then
  146. RadioButton1.Checked = False : RadioButton2.Checked = False : RadioButton3.Checked = True : 申請完成ToolStripMenuItem.Enabled = False : 複製單據開單ToolStripMenuItem.Enabled = True
  147. 開立現金收支單ToolStripMenuItem.Enabled = False : Button2.Enabled = False : 新增一筆資料ToolStripMenuItem.Enabled = False
  148. 刪除支付單中選中的資料ToolStripMenuItem.Enabled = False : 刪除選中的現金收支單ToolStripMenuItem.Enabled = False : Set_切換格式()
  149. Else
  150. RadioButton1.Checked = False : RadioButton2.Checked = False : RadioButton3.Checked = True : 申請完成ToolStripMenuItem.Enabled = True : 複製單據開單ToolStripMenuItem.Enabled = True
  151. 開立現金收支單ToolStripMenuItem.Enabled = True : Button2.Enabled = True : 新增一筆資料ToolStripMenuItem.Enabled = True
  152. 刪除支付單中選中的資料ToolStripMenuItem.Enabled = True : 刪除選中的現金收支單ToolStripMenuItem.Enabled = True : Set_切換格式()
  153. End If
  154. End Sub
  155. Private Sub 存檔()
  156. PA4 = TextBox1.Text
  157. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  158. 資料數 = DataGridView1.Rows.Count : MyModule1.進度條()
  159. PA1 = DataGridView1.Rows(i).Cells("用途").Value : NU1 = DataGridView1.Rows(i).Cells("支出").Value : PA2 = DataGridView1.Rows(i).Cells("備註").Value
  160. PA3 = DataGridView1.Rows(i).Cells("科目編號").Value : NU2 = DataGridView1.Rows(i).Cells("現金").Value : NU3 = DataGridView1.Rows(i).Cells("開票").Value
  161. NU4 = DataGridView1.Rows(i).Cells("收票").Value : PA5 = DataGridView1.Rows(i).Cells("項次").Value : PA6 = DataGridView1.Rows(i).Cells("狀態").Value : PA7 = gUserName
  162. SQL_營運成本收支單申請修改() : conn.Close()
  163. Next : MAOJI_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  164. End Sub
  165. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  166. Timer1.Enabled = False : Label62.Visible = False
  167. 開立現金收支單ToolStripMenuItem.Enabled = True : RadioButton1.Enabled = True : RadioButton2.Enabled = True : DataGridView2.Enabled = True : RadioButton3.Enabled = True
  168. 存檔() : Set_清單1() : MsgBox("申請完成,請通知主管審核。")
  169. End Sub
  170. Private Sub Set_日期格式轉換()
  171. If CheckBox1.Checked = False Then : DTP = Format(Today(), "yyyy/MM/dd") : DTP1 = Format(Today(), "yyyyMMdd")
  172. Else : DTP1 = Format(DateTimePicker1.Value, "yyyyMMdd") : DTP = Format(DateTimePicker1.Value, "yyyy/MM/dd") : End If
  173. End Sub
  174. Private Sub 開立零用金支付單()
  175. Dim NUM1 As Integer : Timer1.Enabled = True
  176. Set_日期格式轉換()
  177. For i As Integer = 1 To 999
  178. NUM1 = 0 + i
  179. If NUM1 < 10 Then : TextBox1.Text = "OE-" & DTP1 & "-00" & NUM1
  180. ElseIf NUM1 > 9 And NUM1 < 100 Then : TextBox1.Text = "OE-" & DTP1 & "-0" & NUM1
  181. ElseIf NUM1 > 99 Then : TextBox1.Text = "OE-" & DTP1 & "-" & NUM1 : End If : PA = TextBox1.Text
  182. SQL_營運成本收支單申請_支付單號流水號()
  183. If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  184. Next
  185. SQL_營運成本控制表新增() : TextBox3.Text = gUserName
  186. End Sub
  187. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  188. Set_日期格式轉換() : 開立零用金支付單() : 開立現金收支單ToolStripMenuItem.Enabled = False : RadioButton1.Enabled = False : RadioButton2.Enabled = False : RadioButton3.Enabled = False
  189. DataGridView2.Enabled = False : RadioButton1.Checked = True : RadioButton2.Checked = False : RadioButton3.Checked = False : 申請完成ToolStripMenuItem.Enabled = True
  190. 複製單據開單ToolStripMenuItem.Enabled = False : 開立現金收支單ToolStripMenuItem.Enabled = True : Button2.Enabled = True : 新增一筆資料ToolStripMenuItem.Enabled = True
  191. 刪除支付單中選中的資料ToolStripMenuItem.Enabled = True : 刪除選中的現金收支單ToolStripMenuItem.Enabled = True
  192. Set_清單1()
  193. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  194. PA1 = TextBox1.Text : PA2 = DataGridView1.Rows(i).Cells("項次").Value : PA3 = DataGridView1.Rows(i).Cells("科目編號").Value : PA4 = DataGridView1.Rows(i).Cells("用途").Value
  195. NU1 = DataGridView1.Rows(i).Cells("支出").Value : PA5 = DataGridView1.Rows(i).Cells("備註").Value : NU2 = DataGridView1.Rows(i).Cells("現金").Value
  196. NU3 = DataGridView1.Rows(i).Cells("開票").Value : NU4 = DataGridView1.Rows(i).Cells("收票").Value : PA6 = DataGridView1.Rows(i).Cells("狀態").Value : PA7 = gUserName
  197. SQL_營運成本明細表新增()
  198. Next : Set_費用清單() : MsgBox("複製單據開立完成。")
  199. End Sub
  200. '----------------------滑鼠右鍵--------------------------------------------------------------------------------------------------------------------------------------------------------------------
  201. Private Sub 重新讀取ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新讀取ToolStripMenuItem.Click
  202. Set_清單1()
  203. End Sub
  204. Private Sub 開立零用金支付單ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 開立現金收支單ToolStripMenuItem.Click
  205. 開立零用金支付單()
  206. 開立現金收支單ToolStripMenuItem.Enabled = False : RadioButton1.Enabled = False : RadioButton2.Enabled = False : RadioButton3.Enabled = False : DataGridView2.Enabled = False
  207. DataGridView1.DataSource = Nothing : ds.Clear() : conn.Close() : Set_清單1()
  208. End Sub
  209. Private Sub 刪除選中的零用金支付單ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 刪除選中的現金收支單ToolStripMenuItem.Click
  210. Dim aa As MsgBoxResult = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
  211. If aa = MsgBoxResult.Ok Then
  212. PA1 = TextBox1.Text : SQL_營運成本控制表刪除() : conn.Close() : SQL_營運成本明細表刪除() : conn.Close()
  213. TextBox1.Text = "" : TextBox3.Text = "" : TextBox4.Text = "" : DataGridView1.DataSource = Nothing : ds.Clear() : Set_清單1()
  214. End If
  215. End Sub
  216. Private Sub 刪除支付單中選中的資料ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 刪除支付單中選中的資料ToolStripMenuItem.Click
  217. If TextBox4.Text = "" Then : MsgBox("未選擇需要刪除的資料。")
  218. Else
  219. PA1 = TextBox1.Text : PA2 = TextBox4.Text
  220. 存檔() : SQL_營運成本明細表刪除單筆() : conn.Close() : Set_費用清單() : Dim NUM1 As Integer = 0
  221. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  222. NUM1 += 1 : If NUM1 < 10 Then : 新項次 = "0" & NUM1 : ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1 : End If
  223. PA1 = 新項次 : PA2 = TextBox1.Text : PA3 = DataGridView1.Rows(i).Cells("項次").Value
  224. SQL_營運成本明細表項次修改() : conn.Close()
  225. Next : Set_費用清單()
  226. End If
  227. End Sub
  228. Private Sub 新增一筆資料ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 新增一筆資料ToolStripMenuItem.Click
  229. If ComboBox6.Text = "" Then : MsgBox("沒有選擇會計科目。")
  230. Else
  231. If TextBox1.Text = "" Then : 開立零用金支付單() : End If
  232. Set_日期格式轉換() : 存檔() : PA = TextBox1.Text
  233. SQL_營運成本明細表項次新增查詢()
  234. If dr.Read() Then : 新項次 = dr("項次") : Else : 新項次 = "00" : End If : conn.Close() : NUM1 = Double.Parse(新項次) + 1
  235. If NUM1 < 10 Then : 新項次 = "0" & NUM1
  236. ElseIf NUM1 > 9 And NUM1 < 100 Then : 新項次 = NUM1 : End If
  237. PA1 = TextBox1.Text : PA2 = 新項次 : PA3 = ComboBox6.Text : PA4 = "" : NU1 = 0 : PA5 = "" : NU2 = 0 : NU3 = 0 : NU4 = 0 : PA6 = "" : PA7 = gUserName
  238. SQL_營運成本明細表新增() : Set_費用清單()
  239. End If
  240. End Sub
  241. Private Sub 申請完成ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 申請完成ToolStripMenuItem.Click
  242. Me.Button2.PerformClick()
  243. End Sub
  244. Private Sub 複製單據開單ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 複製單據開單ToolStripMenuItem.Click
  245. Me.Button1.PerformClick()
  246. End Sub
  247. End Class