123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508 |
- Option Strict Off
- Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
- Imports Microsoft.Office.Interop.Excel.Constants
- Imports Microsoft.Office.Interop.Excel.XlBordersIndex
- Imports Microsoft.Office.Interop.Excel.XlLineStyle
- Imports Microsoft.Office.Interop.Excel.XlBorderWeight
- Imports Microsoft.Office.Interop.Excel.XlThemeFont
- Imports Microsoft.Office.Interop.Excel.XlThemeColor
- Imports Microsoft.Office.Interop.Excel.XlWindowState
- Imports System.Data.SqlClient
- Public Class 財務_對帳表
- ReadOnly conn1 As New SqlConnection
- ReadOnly cmd As New SqlCommand : ReadOnly cmd1 As New SqlCommand
- ReadOnly ds, ds1, ds2 As New DataSet
- Dim N2 As Integer
- Dim xlApp As Microsoft.Office.Interop.Excel.Application
- Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
- Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
- Dim 位置1 As String
- Private Sub Set_清單1()
- 明細_dgv.DataSource = Nothing : ds.Clear()
- 明細_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- 明細_dgv.ColumnHeadersHeight = 25
- 明細_dgv.AllowUserToAddRows = False
- 明細_dgv.RowTemplate.Height = 30
- If 只有收入_cb.Checked = False And 只有支出_cb.Checked = False Then : SQL3 = ""
- ElseIf 只有收入_cb.Checked = True And 只有支出_cb.Checked = False Then : SQL3 = " AND (Cast(公帳流水帳.支出 AS money) = 0)"
- ElseIf 只有收入_cb.Checked = False And 只有支出_cb.Checked = True Then : SQL3 = " AND (Cast(公帳流水帳.收入 AS money) = 0)" : End If
-
- If 全部_ch.Checked = True And 含稅_ch.Checked = False And 非稅_ch.Checked = False Then : SQL2 = "" & SQL3
- ElseIf 全部_ch.Checked = False And 含稅_ch.Checked = True And 非稅_ch.Checked = False Then : SQL2 = " AND (公帳流水帳.含稅 = 1)" & SQL3
- ElseIf 全部_ch.Checked = False And 含稅_ch.Checked = False And 非稅_ch.Checked = True Then : SQL2 = " AND (公帳流水帳.含稅 = 0 OR 公帳流水帳.含稅 IS NULL)" & SQL3 : End If
- If 公司編號_cb.Text = "全部" Or 公司編號_cb.Text = "" Then : PA51 = "" : Else : PA51 = " AND (公帳控制表.公司編號 LIKE N'" & 公司編號_cb.Text & "')" : End If
- SQL_營運成本收支單對帳表()
- da.Fill(ds) : 明細_dgv.DataSource = ds.Tables(0) : conn.Close() : Set_grid()
-
- If 視窗2_pl.Visible = True Then
- Set_特別計算() : 剃除預設() : 剃除計算()
- End If
- End Sub
- Private Sub Set_grid()
- 明細_dgv.Columns(0).FillWeight = 120 : 明細_dgv.Columns(1).FillWeight = 60 : 明細_dgv.Columns(2).FillWeight = 80 : 明細_dgv.Columns(3).FillWeight = 60
- 明細_dgv.Columns(4).FillWeight = 80 : 明細_dgv.Columns(5).FillWeight = 50 : 明細_dgv.Columns(6).FillWeight = 150 : 明細_dgv.Columns(7).FillWeight = 300
- 明細_dgv.Columns(8).FillWeight = 70 : 明細_dgv.Columns(9).FillWeight = 70 : 明細_dgv.Columns(10).FillWeight = 70 : 明細_dgv.Columns(11).FillWeight = 70
- 明細_dgv.Columns(12).FillWeight = 70 : 明細_dgv.Columns(13).FillWeight = 50 : 明細_dgv.Columns(14).FillWeight = 70 : 明細_dgv.Columns(15).FillWeight = 50
- 明細_dgv.Columns(16).FillWeight = 70 : 明細_dgv.Columns(17).Visible = False : 明細_dgv.Columns(18).Visible = False : 明細_dgv.Columns(19).Visible = False
- 明細_dgv.Columns(20).Visible = False : 明細_dgv.Columns(21).FillWeight = 50 : 明細_dgv.Columns(22).FillWeight = 50
-
- If 隱藏申請審核資訊_cb.Checked = False Then
- 明細_dgv.Columns(1).Visible = True : 明細_dgv.Columns(2).Visible = True : 明細_dgv.Columns(3).Visible = True : 明細_dgv.Columns(4).Visible = True
- Else
- 明細_dgv.Columns(1).Visible = False : 明細_dgv.Columns(2).Visible = False : 明細_dgv.Columns(3).Visible = False : 明細_dgv.Columns(4).Visible = False
- End If
-
- If 隱藏作帳點交資訊_cb.Checked = False Then
- 明細_dgv.Columns(13).Visible = True : 明細_dgv.Columns(14).Visible = True : 明細_dgv.Columns(15).Visible = True : 明細_dgv.Columns(16).Visible = True
- Else
- 明細_dgv.Columns(13).Visible = False : 明細_dgv.Columns(14).Visible = False : 明細_dgv.Columns(15).Visible = False : 明細_dgv.Columns(16).Visible = False
- End If
- 明細_dgv.Columns(8).Visible = False : 明細_dgv.Columns(9).Visible = False : 明細_dgv.Columns(21).Visible = False : 明細_dgv.Columns(22).Visible = False
- 明細_dgv.Columns(8).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(9).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(10).DefaultCellStyle.Format = "#,##0"
- 明細_dgv.Columns(11).DefaultCellStyle.Format = "#,##0"
- 明細_dgv.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 明細_dgv.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- 明細_dgv.Columns(9).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 明細_dgv.Columns(9).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- 明細_dgv.Columns(10).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 明細_dgv.Columns(10).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- 明細_dgv.Columns(11).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : 明細_dgv.Columns(11).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- 明細_dgv.Columns(21).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns(21).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- 明細_dgv.Columns(22).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : 明細_dgv.Columns(22).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
-
- 支出1_tb.Text = "0" : 現金1_tb.Text = "0" : 損益1_tb.Text = "0" : 零用金1_tb.Text = "0" : 已兌現支票1_tb.Text = "0" : 未兌現支票1_tb.Text = "0"
- For i As Integer = 0 To 明細_dgv.Rows.Count - 1
- 現金1_tb.Text = Val(現金1_tb.Text) + 明細_dgv.Rows(i).Cells("收入").Value * 明細_dgv.Rows(i).Cells("匯率").Value
- 支出1_tb.Text = Val(支出1_tb.Text) + 明細_dgv.Rows(i).Cells("支出").Value * 明細_dgv.Rows(i).Cells("匯率").Value
- 零用金1_tb.Text = Val(零用金1_tb.Text) + 明細_dgv.Rows(i).Cells("零用金").Value * 明細_dgv.Rows(i).Cells("匯率").Value
- If 明細_dgv(9, i).Value <> 0 And 明細_dgv(18, i).Value = True Then
- 已兌現支票1_tb.Text = Val(已兌現支票1_tb.Text) + 明細_dgv.Rows(i).Cells("支票").Value * 明細_dgv.Rows(i).Cells("匯率").Value
- ElseIf 明細_dgv(9, i).Value <> 0 And 明細_dgv(18, i).Value = False Then
- 未兌現支票1_tb.Text = Val(未兌現支票1_tb.Text) + 明細_dgv.Rows(i).Cells("支票").Value * 明細_dgv.Rows(i).Cells("匯率").Value
- End If
- If 明細_dgv("幣別", i).Value = "台幣現金" Then : 明細_dgv("幣別", i).Value = "台幣" : Else : 明細_dgv("幣別", i).Value = "人民幣" : End If
- Next i
- 損益1_tb.Text = Val(已兌現支票1_tb.Text) + Val(零用金1_tb.Text) + Val(現金1_tb.Text) - Val(支出1_tb.Text)
- If Val(損益1_tb.Text) > 0 Then : 損益1_tb.ForeColor = Color.Blue : Else : 損益1_tb.ForeColor = Color.Red : End If
-
- 支出1_tb.Text = Strings.Format(Val(支出1_tb.Text), "#,##0")
- 損益1_tb.Text = Strings.Format(Val(損益1_tb.Text), "#,##0")
- 現金1_tb.Text = Strings.Format(Val(現金1_tb.Text), "#,##0")
- 零用金1_tb.Text = Strings.Format(Val(零用金1_tb.Text), "#,##0")
- 已兌現支票1_tb.Text = Strings.Format(Val(已兌現支票1_tb.Text), "#,##0")
- 未兌現支票1_tb.Text = Strings.Format(Val(未兌現支票1_tb.Text), "#,##0")
- End Sub
- Private Sub ComboBox1下拉表單資料載入()
- conn.Close()
- SQL_營運成本收支單對帳表_查詢最後一筆年份清單() : 查詢日期_cb.Items.Clear()
- While (dr.Read()) : 查詢日期_cb.Items.Add(dr("年份")) : End While
- conn.Close()
- End Sub
- Private Sub 載入公司編號cb()
- SQL_公司編號_下拉清單() : 公司編號_cb.Items.Clear() : 公司編號_cb.Items.Add("全部")
- While (dr.Read()) : 公司編號_cb.Items.Add(dr("公司編號")) : End While : conn.Close()
- End Sub
-
- Private Sub 營運成本收支單_對帳表_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Me.MdiParent = ICS_ASMS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
- 視窗2_pl.Visible = False : Panel1.SendToBack() : 載入公司編號cb()
- 現金_tb.Text = "0" : 支出_tb.Text = "0" : 損益_tb.Text = "0" : 零用金_tb.Text = "0" : 已兌現支票_tb.Text = "0" : 未兌現支票_tb.Text = "0"
- 現金1_tb.Text = "0" : 支出1_tb.Text = "0" : 損益1_tb.Text = "0" : 零用金1_tb.Text = "0" : 已兌現支票1_tb.Text = "0" : 未兌現支票1_tb.Text = "0"
- SQL_營運成本收支單對帳表_修改會計() : conn.Close() : SQL_營運成本收支單對帳表_修改出納() : conn.Close() : SQL_營運成本收支單對帳表_修改現金() : conn.Close()
- SQL_營運成本收支單對帳表_修改備用金() : conn.Close() : SQL_營運成本收支單對帳表_修改公帳() : conn.Close() : SQL_營運成本收支單對帳表_修改支票() : conn.Close()
- SQL_營運成本收支單對帳表_修改日期() : conn.Close() : SQL_營運成本收支單對帳表_修改出納日期() : conn.Close()
-
- ComboBox1下拉表單資料載入()
- 查詢日期_cb.Text = Year(Today) : 查詢日期1_cb.SelectedIndex = Month(Today) - 1
- PA20 = "" : PA19 = "" : PA18 = "" : PA17 = 查詢日期_cb.Text : PA16 = 查詢日期1_cb.Text
- PA20 = "AND (公帳控制表.申請日期 LIKE N'" & PA17 & "/" & PA16 & "%') "
- If ICS_ASMS_ERP_SYS.Size.Width > 1440 And ICS_ASMS_ERP_SYS.Size.Height > 900 Then : 字體_NUD.Value = 9 : 隱藏申請審核資訊_cb.Checked = False
- ElseIf ICS_ASMS_ERP_SYS.Size.Width <= 1440 And ICS_ASMS_ERP_SYS.Size.Height <= 900 Then : 字體_NUD.Value = 7.6 : 隱藏申請審核資訊_cb.Checked = True : End If
- If 公司 = True Then
- Else
- 公司編號_lb.Visible = False : 公司編號_cb.Visible = False
- End If
- End Sub
- Private Sub 營運成本收支單_對帳表_SizeChanged(sender As Object, e As EventArgs) Handles MyBase.SizeChanged
- If ICS_ASMS_ERP_SYS.Size.Width > 1440 And ICS_ASMS_ERP_SYS.Size.Height > 900 Then : 字體_NUD.Value = 9 : 隱藏申請審核資訊_cb.Checked = False
- ElseIf ICS_ASMS_ERP_SYS.Size.Width <= 1440 And ICS_ASMS_ERP_SYS.Size.Height <= 900 Then : 字體_NUD.Value = 7.6 : 隱藏申請審核資訊_cb.Checked = True : End If
- End Sub
- Dim 已超出 As Boolean
- Private Sub 明細_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 明細_dgv.MouseUp
- If 明細_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
- If 明細_dgv.SelectedCells.Count > 0 Then
- If 明細_dgv.SelectedCells(0).ColumnIndex >= 8 And 明細_dgv.SelectedCells(0).ColumnIndex <= 11 Then
- If 已超出 = False Then
- Dim x As Double = 0
- For i As Integer = 0 To 明細_dgv.SelectedCells.Count - 1
- x += Val(明細_dgv.Rows(明細_dgv.SelectedCells.Item(i).RowIndex).Cells(明細_dgv.SelectedCells.Item(i).ColumnIndex).Value)
- Next i : ICS_ASMS_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(x, "#,##0")
- Else : ICS_ASMS_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0") : End If
- Else : 已超出 = True : ICS_ASMS_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0")
- End If
- End If
- End Sub
- Private Sub 全部_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 全部_ch.Click
- 全部_ch.Checked = True : 含稅_ch.Checked = False : 非稅_ch.Checked = False : Set_清單1()
- End Sub
- Private Sub 含稅_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 含稅_ch.Click
- 全部_ch.Checked = False : 含稅_ch.Checked = True : 非稅_ch.Checked = False : Set_清單1()
- End Sub
- Private Sub 非稅_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 非稅_ch.Click
- 全部_ch.Checked = False : 含稅_ch.Checked = False : 非稅_ch.Checked = True : Set_清單1()
- End Sub
- Private Sub 清除查詢資料_bt_Click(sender As Object, e As EventArgs) Handles 清除查詢資料_bt.Click
- ComboBox1下拉表單資料載入()
- 查詢日期1_cb.Items.Clear()
- 查詢日期1_cb.Items.Add("01") : 查詢日期1_cb.Items.Add("02") : 查詢日期1_cb.Items.Add("03") : 查詢日期1_cb.Items.Add("04") : 查詢日期1_cb.Items.Add("05") : 查詢日期1_cb.Items.Add("06")
- 查詢日期1_cb.Items.Add("07") : 查詢日期1_cb.Items.Add("08") : 查詢日期1_cb.Items.Add("09") : 查詢日期1_cb.Items.Add("10") : 查詢日期1_cb.Items.Add("11") : 查詢日期1_cb.Items.Add("12")
- PA17 = "" : PA16 = "" : PA20 = ""
- 明細_dgv.DataSource = Nothing : ds.Clear()
- Set_清單1()
- End Sub
- Private Sub 對帳記錄存檔_bt_Click(sender As Object, e As EventArgs) Handles 對帳記錄存檔_bt.Click
- For i As Integer = 0 To 明細_dgv.Rows.Count - 1
- PA15 = 明細_dgv.Rows(i).Cells("現金點交").Value : PA14 = 明細_dgv.Rows(i).Cells("零用金點交").Value
- PA13 = 明細_dgv.Rows(i).Cells("支出點交").Value : PA12 = 明細_dgv.Rows(i).Cells("支票兌現").Value
- PA11 = 明細_dgv.Rows(i).Cells("收支單號").Value : PA10 = 明細_dgv.Rows(i).Cells("項次").Value
- 資料數 = 明細_dgv.Rows.Count : MyModule1.進度條()
- SQL_營運成本收支單對帳表_修改對帳記錄存檔() : conn1.Close()
- Next
- MsgBox("存檔完成。") : Set_清單1() : ICS_ASMS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
- End Sub
- Private Sub 總金額計算()
- Dim FFGG As Integer = 0 : Dim GGHH As Integer = 0 : Dim HHJJ As Integer = 0 : Dim JJKK As Integer = 0 : Dim KKLL As Integer = 0
- 現金_tb.Text = "0" : 支出_tb.Text = "0" : 損益_tb.Text = "0" : 零用金_tb.Text = "0" : 已兌現支票_tb.Text = "0" : 未兌現支票_tb.Text = "0"
- For i As Integer = 0 To 明細_dgv.Rows.Count - 1
- If 明細_dgv.Rows(i).Cells("收支單號").Value = 收支單號_tb.Text Then
- FFGG = Val(FFGG) + 明細_dgv.Rows(i).Cells("收入").Value * 明細_dgv.Rows(i).Cells("匯率").Value
- GGHH = Val(GGHH) + 明細_dgv.Rows(i).Cells("支出").Value * 明細_dgv.Rows(i).Cells("匯率").Value
- HHJJ = Val(HHJJ) + 明細_dgv.Rows(i).Cells("零用金").Value * 明細_dgv.Rows(i).Cells("匯率").Value
- If 明細_dgv(9, i).Value <> 0 And 明細_dgv(18, i).Value = True Then
- JJKK = Val(JJKK) + 明細_dgv.Rows(i).Cells("支票").Value * 明細_dgv.Rows(i).Cells("匯率").Value
- ElseIf 明細_dgv(9, i).Value <> 0 And 明細_dgv(18, i).Value = False Then
- KKLL = Val(KKLL) + 明細_dgv.Rows(i).Cells("支票").Value * 明細_dgv.Rows(i).Cells("匯率").Value
- End If
- End If
- Next i
- 現金_tb.Text = FFGG : 支出_tb.Text = GGHH : 零用金_tb.Text = HHJJ : 已兌現支票_tb.Text = JJKK : 未兌現支票_tb.Text = KKLL
- 損益_tb.Text = JJKK + HHJJ + FFGG - GGHH
- If Val(損益_tb.Text) > 0 Then : 損益_tb.ForeColor = Color.Blue : Else : 損益_tb.ForeColor = Color.Red : End If
- 現金_tb.Text = Strings.Format(Val(現金_tb.Text), "#,##0") : 支出_tb.Text = Strings.Format(Val(支出_tb.Text), "#,##0") : 損益_tb.Text = Strings.Format(Val(損益_tb.Text), "#,##0")
- 零用金_tb.Text = Strings.Format(Val(零用金_tb.Text), "#,##0")
- 已兌現支票_tb.Text = Strings.Format(Val(已兌現支票_tb.Text), "#,##0")
- 未兌現支票_tb.Text = Strings.Format(Val(未兌現支票_tb.Text), "#,##0")
- End Sub
- Private Sub 明細_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 明細_dgv.CellClick
- If e.RowIndex = -1 Then : Else
- 收支單號_tb.Text = 明細_dgv.Rows(e.RowIndex).Cells("收支單號").Value : 總金額計算()
- End If
- End Sub
- Private Sub 明細_dgv_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles 明細_dgv.RowPostPaint
- Dim linePen As New Pen(Color.Blue, 2)
- If e.RowIndex = 明細_dgv.Rows.Count - 1 Then
- Exit Sub
- Else
- If 明細_dgv(0, e.RowIndex).Value.ToString <> 明細_dgv(0, e.RowIndex + 1).Value.ToString Then
- Dim startX As Integer = IIf(明細_dgv.RowHeadersVisible, 明細_dgv.RowHeadersWidth, 0)
- Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
- Dim endX As Integer = startX + 明細_dgv.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - 明細_dgv.HorizontalScrollingOffset
- e.Graphics.DrawLine(linePen, startX, startY, endX, startY)
- Exit Sub
- End If
- End If
- For i As Integer = 0 To 明細_dgv.Rows.Count - 1
- If 明細_dgv(9, i).Value <> 0 And 明細_dgv(18, i).Value = True Then
- 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
- ElseIf 明細_dgv(9, i).Value <> 0 And 明細_dgv(18, i).Value = False Then
- 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow
- End If
- Next
- End Sub
- Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 查詢日期_cb.SelectedIndexChanged
- PA17 = 查詢日期_cb.Text
- If PA17 = "" Or PA16 = "" Then
- Else : PA20 = "AND (公帳控制表.申請日期 LIKE N'" & PA17 & "/" & PA16 & "%') " : Set_清單1()
- End If
- End Sub
- Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 查詢日期1_cb.SelectedIndexChanged
- PA16 = 查詢日期1_cb.Text
- If PA17 = "" Or PA16 = "" Then
- Else : PA20 = "AND (公帳控制表.申請日期 LIKE N'" & PA17 & "/" & PA16 & "%') " : Set_清單1()
- End If
- End Sub
- Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles 只顯示支票資料_cb.Click
- If 只顯示支票資料_cb.Checked = False Then : PA19 = "" : Set_清單1()
- Else : PA19 = " AND (公帳流水帳.支票數 <> 0) " : Set_清單1()
- End If
- End Sub
- Private Sub CheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles 隱藏申請審核資訊_cb.Click
- Set_grid()
- End Sub
- Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) Handles 隱藏作帳點交資訊_cb.Click
- Set_grid()
- End Sub
- Private Sub 只有收入_cb_CheckedChanged(sender As Object, e As EventArgs) Handles 只有收入_cb.Click
- If 只有收入_cb.Checked = True Then
- 只有收入_cb.Checked = True : 只有支出_cb.Checked = False
- Else
- 只有收入_cb.Checked = False : 只有支出_cb.Checked = False
- End If : Set_清單1()
- End Sub
- Private Sub 只有支出_cb_CheckedChanged(sender As Object, e As EventArgs) Handles 只有支出_cb.Click
- If 只有支出_cb.Checked = True Then
- 只有收入_cb.Checked = False : 只有支出_cb.Checked = True
- Else
- 只有收入_cb.Checked = False : 只有支出_cb.Checked = False
- End If : Set_清單1()
- End Sub
- '-----------------------------滑鼠右鍵--------------------------------------------------------------------------------------------------------------------------------------
- 'Private Sub BBBToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles BBBToolStripMenuItem.Click
- ' MsgBox("待開發。")
- ' '列印_零用金支付明細.ShowDialog()
- 'End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles 關鍵字查詢_bt.Click
- PA = InputBox("請輸入要查詢的關鍵字。")
- PA18 = " AND (公帳控制表.支付單號 LIKE N'%" & PA & "%' OR 公帳控制表.申請人 LIKE N'%" & PA & "%' OR 公帳控制表.審核人 LIKE N'%" & PA &
- "%' OR 公帳流水帳.明細 LIKE N'%" & PA & "%' OR 公帳控制表.備註 LIKE N'%" & PA & "%' OR 公帳流水帳.備註 LIKE N'%" & PA & "%')" : Set_清單1()
- PA18 = "" : PA = ""
- End Sub
- '-----------------------------EXCEL--------------------------------------------------------------------------------------------------------------------------------------
- Private Shared Function NewMethod(xlBook As Microsoft.Office.Interop.Excel.Workbook) As Microsoft.Office.Interop.Excel.Worksheet
- Return CType(xlBook.Worksheets.Add, Microsoft.Office.Interop.Excel.Worksheet)
- End Function
- Private Sub 匯出EXCEL_bt_Click(sender As Object, e As EventArgs) Handles 匯出EXCEL_bt.Click
- xlApp = CType(CreateObject("Excel.Application"), Microsoft.Office.Interop.Excel.Application)
- xlApp.Visible = True
- xlApp.DisplayAlerts = True
- xlApp.Application.WindowState = xlMaximized
- xlBook = xlApp.Workbooks.Add
- xlSheet = NewMethod(xlBook)
- xlBook.Activate()
- xlSheet.Activate()
-
- xlSheet.Cells(1, 1) = "XXXX-營運費用收支明細表" : xlSheet.Cells(2, 1) = "收支單號 " : xlSheet.Cells(2, 2) = "申請人" : xlSheet.Cells(2, 3) = "申請日期 "
- xlSheet.Cells(2, 4) = "審核人" : xlSheet.Cells(2, 5) = "審核日期" : xlSheet.Cells(2, 6) = "項次" : xlSheet.Cells(2, 7) = "會計科目 " : xlSheet.Cells(2, 8) = "用途與內容"
- xlSheet.Cells(2, 9) = "零用金" : xlSheet.Cells(2, 10) = "支票" : xlSheet.Cells(2, 11) = "收入" : xlSheet.Cells(2, 12) = "支出"
- For i As Integer = 0 To 明細_dgv.Rows.Count - 1
- xlSheet.Cells(i + 3, 1) = 明細_dgv.Rows(i).Cells("收支單號").Value : xlSheet.Cells(i + 3, 2) = 明細_dgv.Rows(i).Cells("申請人").Value
- xlSheet.Cells(i + 3, 3) = 明細_dgv.Rows(i).Cells("申請日期").Value : xlSheet.Cells(i + 3, 4) = 明細_dgv.Rows(i).Cells("審核人").Value
- xlSheet.Cells(i + 3, 5) = 明細_dgv.Rows(i).Cells("審核日期").Value : xlSheet.Cells(i + 3, 6) = 明細_dgv.Rows(i).Cells("項次").Value
- xlSheet.Cells(i + 3, 7) = 明細_dgv.Rows(i).Cells("會計科目").Value : xlSheet.Cells(i + 3, 8) = 明細_dgv.Rows(i).Cells("用途與內容").Value
- xlSheet.Cells(i + 3, 9) = 明細_dgv.Rows(i).Cells("零用金").Value : xlSheet.Cells(i + 3, 10) = 明細_dgv.Rows(i).Cells("支票").Value
- xlSheet.Cells(i + 3, 11) = 明細_dgv.Rows(i).Cells("收入").Value : xlSheet.Cells(i + 3, 12) = 明細_dgv.Rows(i).Cells("支出").Value
- N2 = i + 3
- Next i
- xlSheet.Cells(N2 + 1, 8) = "合計"
- xlSheet.Cells(N2 + 1, 9) = "=SUM(I3:I" & N2 & ")" : xlSheet.Cells(N2 + 1, 10) = "=SUM(J3:J" & N2 & ")"
- xlSheet.Cells(N2 + 1, 11) = "=SUM(K3:K" & N2 & ")" : xlSheet.Cells(N2 + 1, 12) = "=SUM(L3:L" & N2 & ")"
- '--------------------------------------彙總-----------------------------
- xlSheet.Cells(N2 + 2, 8) = "彙總"
- xlSheet.Cells(N2 + 2, 9) = "=I" & N2 + 1 & "+J" & N2 + 1 & "+K" & N2 + 1 & "-L" & N2 + 1 & ""
-
- BB(xlApp, xlSheet) : xlSheet.Cells(2, 12) = "支出"
- xlSheet.PageSetup.PrintArea = ""
- xlApp.Cells.Select()
- xlApp.Application.WindowState = xlMinimized
- MsgBox("列印完成!!!")
- End Sub
- Private Sub BB(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
- xlSheet.Cells.Select()
- With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
- .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
-
- xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 15 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 9
- xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 9 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 9
- xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 9 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 5
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False
- End With
-
- xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 20 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 35
- With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False
- End With
-
- xlSheet.Columns("I:L").Select : myExcel.Selection.ColumnWidth = 9 : myExcel.Selection.Style = "Comma"
- myExcel.Selection.NumberFormatLocal = "_-* #,##0.0_-;-* #,##0.0_-;_-* ""-""??_-;_-@_-"
- myExcel.Selection.NumberFormatLocal = "_-* #,##0_-;-* #,##0_-;_-* ""-""??_-;_-@_-"
- xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 35 : xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 30
- With myExcel.Selection : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
- .ReadingOrder = xlContext : .MergeCells = False : End With
-
- myExcel.Selection.AutoFilter
- xlSheet.Rows("1:1").Select
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
-
- xlSheet.Range("A1:L1").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
-
- xlSheet.Rows("3:3").Select : myExcel.ActiveWindow.FreezePanes = True : xlSheet.Range("A1:L2").Select()
- myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
-
- xlSheet.Range("A3:L" & N2).Select()
- myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
-
- xlSheet.Range("L2").Select() : myExcel.Selection.ClearContents
-
- xlSheet.Range("A2:L2").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlTop : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
- With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 14 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
- .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
- With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
- .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
- With myExcel.Selection.Interior : .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorAccent6 : .TintAndShade = 0 : .PatternTintAndShade = 0 : End With
-
- xlSheet.Range("A1:L1").Select() : myExcel.Selection.Font.Size = 11
- With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
- .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
- End Sub
- Private Sub 字體_NUD_ValueChanged(sender As Object, e As EventArgs) Handles 字體_NUD.ValueChanged
- 明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", 字體_NUD.Value)
- End Sub
- '----------------------自創視窗滑鼠拖曳功能---------------------------------------------------------------------------------------------------------
- Dim OldX, OldY As Long : Dim drag As Boolean
- Private Sub CanceL2_bt_Click(sender As Object, e As EventArgs) Handles CanceL2_bt.Click
- If 視窗2_pl.Visible = False Then
- 視窗2_pl.Visible = True : 視窗2_pl.BringToFront()
- Else : 視窗2_pl.Visible = False
- For i As Integer = 0 To 明細_dgv.Rows.Count - 1 : 明細_dgv.Rows(i).Cells("備註").Value = "" : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.White : Next
- End If
- End Sub
- Private Sub 視窗2_pl_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 視窗2_pl.MouseDown
- If e.Button = MouseButtons.Left Then : OldX = e.X : OldY = e.Y : drag = True : End If
- End Sub
- Private Sub 視窗2_pl_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 視窗2_pl.MouseMove
- If drag Then : 視窗2_pl.Left = 視窗2_pl.Left + e.X - OldX : 視窗2_pl.Top = 視窗2_pl.Top + e.Y - OldY : End If
- End Sub
- Private Sub 視窗2_pl_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 視窗2_pl.MouseUp
- drag = False
- End Sub
- Private Sub Set_特別計算()
- 剔除存檔_dgv.DataSource = Nothing : ds2.Clear()
- 剔除存檔_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- 剔除存檔_dgv.ColumnHeadersHeight = 25 : 剔除存檔_dgv.AllowUserToAddRows = False : 剔除存檔_dgv.RowTemplate.Height = 25
- SQL_剔除存檔()
- da.Fill(ds2) : 剔除存檔_dgv.DataSource = ds2.Tables(0) : conn.Close()
-
- 會科_dgv.DataSource = Nothing : ds1.Clear()
- 會科_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- 會科_dgv.ColumnHeadersHeight = 25 : 會科_dgv.AllowUserToAddRows = False : 會科_dgv.RowTemplate.Height = 25
- PA = 查詢日期_cb.Text & "/" & 查詢日期1_cb.Text : SQL_剔除會科()
- da.Fill(ds1) : 會科_dgv.DataSource = ds1.Tables(0) : conn.Close()
- 會科_dgv.Columns(0).FillWeight = 30 : 會科_dgv.Columns(2).Visible = False
- 會科_dgv.Columns(3).DefaultCellStyle.Format = "#,##0"
- 會科_dgv.Columns(3).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
- 會科_dgv.Columns(3).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
-
- For i As Integer = 0 To 會科_dgv.Rows.Count - 1
- 會科_dgv.Rows(i).Cells("選擇").Value = False
- For II As Integer = 0 To 剔除存檔_dgv.Rows.Count - 1
- If 會科_dgv.Rows(i).Cells("會計科目").Value.ToString = 剔除存檔_dgv.Rows(II).Cells("剔除會科").Value.ToString Then : 會科_dgv.Rows(i).Cells("選擇").Value = True : End If
- Next
- 會科_dgv.Rows(i).Cells("金額").Value = "0"
- For II As Integer = 0 To 明細_dgv.Rows.Count - 1
- If 會科_dgv.Rows(i).Cells("會計科目").Value.ToString = 明細_dgv.Rows(II).Cells("會計科目").Value.ToString Then
- 會科_dgv.Rows(i).Cells("金額").Value += 明細_dgv.Rows(II).Cells("收入").Value.ToString
- 會科_dgv.Rows(i).Cells("金額").Value += 明細_dgv.Rows(II).Cells("支出").Value.ToString
- End If
- Next
- Next
- End Sub
- Private Sub 特別計算_bt_Click_1(sender As Object, e As EventArgs) Handles 特別計算_bt.Click
- If 視窗2_pl.Visible = True Then : 視窗2_pl.Visible = False
- For i As Integer = 0 To 明細_dgv.Rows.Count - 1 : 明細_dgv.Rows(i).Cells("備註").Value = "" : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.White : Next
- Else : 視窗2_pl.Visible = True : 視窗2_pl.BringToFront() : Set_特別計算() : 剃除預設() : 剃除計算() : End If
- End Sub
- Private Sub 會科_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 會科_dgv.CellClick
- If e.RowIndex = -1 Then : Else
- If 會科_dgv.Rows(e.RowIndex).Cells("選擇").Value = False Then : 會科_dgv.Rows(e.RowIndex).Cells("選擇").Value = True
- Else : 會科_dgv.Rows(e.RowIndex).Cells("選擇").Value = False : End If
- End If
- End Sub
- Private Sub 存檔_bt_Click(sender As Object, e As EventArgs) Handles 存檔_bt.Click
- For i As Integer = 0 To 會科_dgv.Rows.Count - 1
- If 會科_dgv.Rows(i).Cells("選擇").Value = True Then
- PA1 = 會科_dgv.Rows(i).Cells("會計科目").Value.ToString : SQL_剔除存檔比對() : If dr.Read Then : Else : SQL_剔除存檔新增() : End If
- End If
- Next : 剃除預設() : 剃除計算()
- End Sub
- Private Sub 剃除計算_bt_Click(sender As Object, e As EventArgs) Handles 剃除計算_bt.Click
- For i As Integer = 0 To 明細_dgv.Rows.Count - 1 : 明細_dgv.Rows(i).Cells("備註").Value = "" : 明細_dgv.Rows(i).DefaultCellStyle.BackColor = Color.White : Next
- 剃除預設() : 剃除計算()
- End Sub
- Private Sub 公司編號_cb_Click(sender As Object, e As EventArgs) Handles 公司編號_cb.Click
- CB選擇清單(公司編號_cb, 公司編號_cb.Text)
- End Sub
- Private Sub 公司編號_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 公司編號_cb.SelectedIndexChanged
- Set_清單1() : 支出_tb.Text = "" : 損益_tb.Text = "" : 現金_tb.Text = "" : 收支單號_tb.Text = ""
- End Sub
-
- Private Sub 剃除預設()
- For i As Integer = 0 To 會科_dgv.Rows.Count - 1
- For II As Integer = 0 To 明細_dgv.Rows.Count - 1
- If 會科_dgv.Rows(i).Cells("會計科目").Value.ToString = 明細_dgv.Rows(II).Cells("會計科目").Value.ToString And 會科_dgv.Rows(i).Cells("選擇").Value = True Then
- 明細_dgv.Rows(II).Cells("備註").Value = "剔除" : 明細_dgv.Rows(II).DefaultCellStyle.BackColor = Color.LightBlue
- End If
- Next
- Next
- End Sub
- Private Sub 剃除計算()
- 剔除後收入_tb.Text = "0" : 剔除後支出_tb.Text = "0" : 剔除後總和_tb.Text = "0"
- For I As Integer = 0 To 明細_dgv.Rows.Count - 1
- If 明細_dgv.Rows(I).Cells("備註").Value.ToString <> "剔除" Then
- 剔除後收入_tb.Text = Strings.Format(CInt(剔除後收入_tb.Text) + CInt(明細_dgv.Rows(I).Cells("收入").Value.ToString), "#,##0")
- 剔除後支出_tb.Text = Strings.Format(CInt(剔除後支出_tb.Text) + CInt(明細_dgv.Rows(I).Cells("支出").Value.ToString), "#,##0")
- End If
- Next : 剔除後總和_tb.Text = Strings.Format(CInt(剔除後支出_tb.Text) - CInt(剔除後收入_tb.Text), "#,##0")
- End Sub
- Private Sub 明細_dgv_CellDoubleClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 明細_dgv.CellDoubleClick
- If e.RowIndex = -1 Then : Else
- If 視窗2_pl.Visible = True Then
- If 明細_dgv.Rows(e.RowIndex).Cells("備註").Value.ToString <> "剔除" Then
- 明細_dgv.Rows(e.RowIndex).Cells("備註").Value = "剔除" : 明細_dgv.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.LightBlue
- ElseIf 明細_dgv.Rows(e.RowIndex).Cells("備註").Value.ToString = "剔除" Then
- 明細_dgv.Rows(e.RowIndex).Cells("備註").Value = "" : 明細_dgv.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.White
- End If : 剃除計算()
- End If
- End If
- End Sub
-
-
-
- Private Sub 關鍵字查詢_bt_MouseEnter(sender As Object, e As EventArgs) Handles 關鍵字查詢_bt.MouseEnter
- ToolTip1.SetToolTip(Me.關鍵字查詢_bt, "關鍵字查詢")
- End Sub
- Private Sub 清除查詢資料_bt_MouseEnter(sender As Object, e As EventArgs) Handles 清除查詢資料_bt.MouseEnter
- ToolTip1.SetToolTip(Me.清除查詢資料_bt, "清除查詢資料")
- End Sub
- Private Sub 匯出EXCEL_bt_MouseEnter(sender As Object, e As EventArgs) Handles 匯出EXCEL_bt.MouseEnter
- ToolTip1.SetToolTip(Me.匯出EXCEL_bt, "匯出EXCEL")
- End Sub
- End Class
|