Public Class Form_FinancialRecords_Development
    Dim m_Table As New System.Data.DataTable
    Dim m_InitOver As Boolean = False

    Public Shared cst_TABLE_NAME As String = "收支明细表_开发"

    Public Enum COLS
        序号
        日期
        收入
        支出
        余额
        收支类别
        收支子类别
        机种
        交易方
        业务类型
        事由
        经手人
        单据类型
        单据编号
        备注1
        备注2
        备注3
        记录日期
        记录时间
        max
    End Enum

    Public Enum COLS_PROP
        Name
        Insert
        Visible
    End Enum

    '名称/Query
    Public Shared m_COLS_NAME(,) As String = {
        {"序号", "0", "1"},
        {"日期", "1", "1"},
        {"收入", "1", "1"},
        {"支出", "1", "1"},
        {"余额", "1", "1"},
        {"收支类别", "1", "1"},
        {"收支子类别", "1", "1"},
        {"机种", "1", "1"},
        {"交易方", "1", "1"},
        {"业务类型", "1", "1"},
        {"事由", "1", "1"},
        {"经手人", "1", "1"},
        {"单据类型", "1", "1"},
        {"单据编号", "1", "1"},
        {"备注1", "1", "1"},
        {"备注2", "1", "1"},
        {"备注3", "1", "1"},
        {"记录日期", "1", "1"},
        {"记录时间", "1", "1"}
    }

    Private m_ColsType() As FlexCell.CellTypeEnum = {
        FlexCell.CellTypeEnum.TextBox,
        FlexCell.CellTypeEnum.Calendar,
        FlexCell.CellTypeEnum.TextBox,
        FlexCell.CellTypeEnum.TextBox,
        FlexCell.CellTypeEnum.TextBox,
        FlexCell.CellTypeEnum.ComboBox,
        FlexCell.CellTypeEnum.ComboBox,
        FlexCell.CellTypeEnum.ComboBox,
        FlexCell.CellTypeEnum.ComboBox,
        FlexCell.CellTypeEnum.ComboBox,
        FlexCell.CellTypeEnum.TextBox,
        FlexCell.CellTypeEnum.TextBox,
        FlexCell.CellTypeEnum.ComboBox,
        FlexCell.CellTypeEnum.TextBox,
        FlexCell.CellTypeEnum.TextBox,
        FlexCell.CellTypeEnum.TextBox,
        FlexCell.CellTypeEnum.TextBox,
        FlexCell.CellTypeEnum.TextBox,
        FlexCell.CellTypeEnum.TextBox
        }


    Dim gridItemRecords_收支类别 As New System.Windows.Forms.AutoCompleteStringCollection
    Dim gridItemRecords_机种 As New System.Windows.Forms.AutoCompleteStringCollection
    Dim gridItemRecords_交易方 As New System.Windows.Forms.AutoCompleteStringCollection
    Dim gridItemRecords_业务类型 As New System.Windows.Forms.AutoCompleteStringCollection
    Dim gridItemRecords_单据类型 As New System.Windows.Forms.AutoCompleteStringCollection

    Dim gridSubList_收支类别 As New ArrayList

    Dim gridItemRecords_收支子类别 As New System.Windows.Forms.AutoCompleteStringCollection

    Private Sub FillGridHeaderByDataTable()
        Grid1.NewFile()

        Grid1.AllowUserSort = False
        Grid1.DisplayFocusRect = False
        Grid1.ExtendLastCol = True
        Grid1.DisplayRowArrow = True
        Grid1.BoldFixedCell = False
        Grid1.SortIndicatorStyle = FlexCell.SortIndicatorStyleEnum.Light3D

        Grid1.Cols = COLS.max
        Dim colIndex As Integer = 0
        For col As Integer = 0 To COLS.max - 1
            If m_COLS_NAME(col, COLS_PROP.Visible) = "1" Then
                Grid1.Cell(0, colIndex).Text = m_COLS_NAME(col, 0)
                Grid1.Column(colIndex).CellType = m_ColsType(col)
                colIndex += 1
            End If
        Next

        SetGridDataSource()


        '调整宽度
        Grid1.Column(COLS.序号).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_序号
        Grid1.Column(COLS.日期).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_日期
        Grid1.Column(COLS.收入).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_收入
        Grid1.Column(COLS.支出).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_支出
        Grid1.Column(COLS.余额).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_余额
        Grid1.Column(COLS.收支类别).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_收支类别
        Grid1.Column(COLS.收支子类别).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_收支子类别
        Grid1.Column(COLS.机种).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_机种
        Grid1.Column(COLS.交易方).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_交易方
        Grid1.Column(COLS.业务类型).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_业务类型
        Grid1.Column(COLS.事由).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_事由
        Grid1.Column(COLS.经手人).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_经手人
        Grid1.Column(COLS.单据类型).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_单据类型
        Grid1.Column(COLS.单据编号).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_单据编号
        Grid1.Column(COLS.备注1).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_备注1
        Grid1.Column(COLS.备注2).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_备注2
        Grid1.Column(COLS.备注3).Width = My.Settings.FORM_FINAN_RECORD_COL_WIDTH_备注3
        Me.Height = My.Settings.FORM_FINAN_RECORD_HEIGHT
        Me.Width = My.Settings.FORM_FINAN_RECORD_WIDTH


        Grid1.Column(COLS.余额).Locked = True
        Grid1.Column(COLS.记录日期).Locked = True
        Grid1.Column(COLS.记录时间).Locked = True


        Grid1.AllowUserSort = True
        Grid1.Locked = False
        Grid1.Column(COLS.序号).Locked = True

        Grid1.Rows = 500

        '更新序号
        UpdateItemSN()

        Application.DoEvents()
    End Sub

    Private Sub SetGridDataSource()
        With Grid1.ComboBox(COLS.收支类别)
            .DataSource = Nothing
            .DataSource = gridItemRecords_收支类别
            .Locked = False
            .AutoComplete = True
        End With
        With Grid1.ComboBox(COLS.收支子类别)
            .DataSource = Nothing
            .DataSource = gridItemRecords_收支子类别
            .Locked = False
            .AutoComplete = True
        End With
        With Grid1.ComboBox(COLS.机种)
            .DataSource = Nothing
            .DataSource = gridItemRecords_机种
            .Locked = False
            .AutoComplete = True
        End With
        With Grid1.ComboBox(COLS.交易方)
            .DataSource = Nothing
            .DataSource = gridItemRecords_交易方
            .Locked = False
            .AutoComplete = True
        End With
        With Grid1.ComboBox(COLS.业务类型)
            .DataSource = Nothing
            .DataSource = gridItemRecords_业务类型
            .Locked = False
            .AutoComplete = True
        End With
        With Grid1.ComboBox(COLS.单据类型)
            .DataSource = Nothing
            .DataSource = gridItemRecords_单据类型
            .Locked = False
            .AutoComplete = True
        End With
    End Sub

    Private Sub Form_FinancialRecords_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_序号 = Grid1.Column(COLS.序号).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_日期 = Grid1.Column(COLS.日期).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_收入 = Grid1.Column(COLS.收入).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_支出 = Grid1.Column(COLS.支出).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_余额 = Grid1.Column(COLS.余额).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_收支类别 = Grid1.Column(COLS.收支类别).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_收支子类别 = Grid1.Column(COLS.收支子类别).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_机种 = Grid1.Column(COLS.机种).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_交易方 = Grid1.Column(COLS.交易方).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_业务类型 = Grid1.Column(COLS.业务类型).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_事由 = Grid1.Column(COLS.事由).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_经手人 = Grid1.Column(COLS.经手人).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_单据类型 = Grid1.Column(COLS.单据类型).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_单据编号 = Grid1.Column(COLS.单据编号).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_备注1 = Grid1.Column(COLS.备注1).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_备注2 = Grid1.Column(COLS.备注2).Width
        My.Settings.FORM_FINAN_RECORD_COL_WIDTH_备注3 = Grid1.Column(COLS.备注3).Width
        My.Settings.FORM_FINAN_RECORD_HEIGHT = Me.Height
        My.Settings.FORM_FINAN_RECORD_WIDTH = Me.Width

        My.Settings.Save()
        CGirdInfo.SaveRecentList("财务_收支类别", gridItemRecords_收支类别)
        'CGirdInfo.SaveRecentList("财务_收支子类别", gridItemRecords_收支子类别)
        CGirdInfo.SaveRecentList("财务_机种", gridItemRecords_机种)
        CGirdInfo.SaveRecentList("财务_交易方", gridItemRecords_交易方)
        CGirdInfo.SaveRecentList("财务_业务类型", gridItemRecords_业务类型)
        CGirdInfo.SaveRecentList("财务_单据类型", gridItemRecords_单据类型)
        CGirdInfo.SaveRecentSubList(gridSubList_收支类别)
    End Sub

    Private Sub Form_FinancialRecords_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        CGirdInfo.LoadRecentList("财务_收支类别", gridItemRecords_收支类别)
        'CGirdInfo.LoadRecentList("财务_收支子类别", gridItemRecords_收支子类别)
        CGirdInfo.LoadRecentList("财务_机种", gridItemRecords_机种)
        CGirdInfo.LoadRecentList("财务_交易方", gridItemRecords_交易方)
        CGirdInfo.LoadRecentList("财务_业务类型", gridItemRecords_业务类型)
        CGirdInfo.LoadRecentList("财务_单据类型", gridItemRecords_单据类型)
        CGirdInfo.LoadRecentSubList("财务_收支类别", gridSubList_收支类别)

        gridItemRecords_收支子类别 = Nothing

        FillGridHeaderByDataTable()
    End Sub


    Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
        Grid1.Selection.InsertRows()
        UpdateItemSN()
    End Sub

    Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click
        Grid1.Selection.DeleteByRow()
        UpdateItemSN()
    End Sub

    Private Sub 新建NToolStripButton_Click(sender As Object, e As EventArgs) Handles 新建NToolStripButton.Click
        FillGridHeaderByDataTable()
    End Sub
    Private Sub 保存SToolStripButton_Click(sender As Object, e As EventArgs) Handles 保存SToolStripButton.Click
        If CheckAllRowValid() = False Then
            MsgBox("输入信息存在错误!")
            Return
        End If

        '计算余额
        Dim dblBalance As Double = 0
        If GetLatestBalance(dblBalance) = False Then
            MsgBox("查询余额失败!")
            Return
        End If

        '计算各个有效列对应的余额
        Dim dblIncom As Double = 0
        Dim dblExpenditure As Double = 0
        For row = 1 To Grid1.Rows - 1
            If Grid1.Cell(row, COLS.序号).BackColor = Color.Green Then
                dblIncom = Grid1.Cell(row, COLS.收入).Text
                dblExpenditure = Grid1.Cell(row, COLS.支出).Text
                dblBalance += dblIncom
                dblBalance -= dblExpenditure

                Grid1.Cell(row, COLS.余额).Text = dblBalance
            End If
        Next

        '更新"记录日期"及"记录时间"
        Dim mCurrDateTime As Date = Now
        For row = 1 To Grid1.Rows - 1
            If Grid1.Cell(row, COLS.序号).BackColor = Color.Green Then
                Grid1.Cell(row, COLS.记录日期).Text = mCurrDateTime.ToString("yyyy-MM-dd")
                Grid1.Cell(row, COLS.记录时间).Text = mCurrDateTime.ToString("HH:mm:ss")
            End If
        Next


        '将列表中的数据保存到数据库中
        If SaveFinancialRecordItems() = True Then
            MsgBox("保存成功!")
        Else
            MsgBox("保存失败!")
        End If

        '更新历史列表
        SaveRecentList()
    End Sub

    Private Function SaveRecentList() As Boolean
        For row As Integer = 1 To Grid1.Rows - 1
            CGirdInfo.AddToRecentList(Grid1.Cell(row, COLS.机种).Text, gridItemRecords_机种)
            CGirdInfo.AddToRecentList(Grid1.Cell(row, COLS.交易方).Text, gridItemRecords_交易方)
            CGirdInfo.AddToRecentList(Grid1.Cell(row, COLS.业务类型).Text, gridItemRecords_业务类型)
            CGirdInfo.AddToRecentList(Grid1.Cell(row, COLS.单据类型).Text, gridItemRecords_单据类型)
            CGirdInfo.AddToRecentList(Grid1.Cell(row, COLS.收支类别).Text, gridItemRecords_收支类别)
            If Grid1.Cell(row, COLS.收支类别).Text.Length > 0 AndAlso Grid1.Cell(row, COLS.收支子类别).Text.Length > 0 Then
                CGirdInfo.AddToRecentSubList("财务_收支类别", Grid1.Cell(row, COLS.收支类别).Text, Grid1.Cell(row, COLS.收支子类别).Text, gridSubList_收支类别)
            End If
        Next

        SetGridDataSource()

        Return True
    End Function

    Private Function CheckRowValid(ByVal rowIndex As Integer) As Boolean
        Dim checkResult As Boolean = True

        If Grid1.Cell(rowIndex, COLS.日期).Text.Length = 0 Then
            Grid1.Cell(rowIndex, COLS.日期).BackColor = Color.Red
            checkResult = False
        Else
            Grid1.Cell(rowIndex, COLS.日期).BackColor = Color.Green
        End If

        Dim strVal1 As String = Grid1.Cell(rowIndex, COLS.收入).Text
        Dim strVal2 As String = Grid1.Cell(rowIndex, COLS.支出).Text
        Dim DataValid1 As Boolean = False
        Dim DataValid2 As Boolean = False
        If strVal1.Length > 0 AndAlso strVal1 <> "0" Then
            DataValid1 = isDoubleValue(strVal1)

            If DataValid1 = False Then
                Grid1.Cell(rowIndex, COLS.收入).BackColor = Color.Red
            Else
                Grid1.Cell(rowIndex, COLS.收入).BackColor = Color.Green
            End If
        End If
        If strVal2.Length > 0 AndAlso strVal2 <> "0" Then
            DataValid2 = isDoubleValue(strVal2)

            If DataValid2 = False Then
                Grid1.Cell(rowIndex, COLS.支出).BackColor = Color.Red
            Else
                Grid1.Cell(rowIndex, COLS.支出).BackColor = Color.Green
            End If
        End If

        If (DataValid1 = True AndAlso DataValid2 = True) OrElse
           (DataValid1 = False AndAlso DataValid2 = False) Then
            Grid1.Cell(rowIndex, COLS.收入).BackColor = Color.Red
            Grid1.Cell(rowIndex, COLS.支出).BackColor = Color.Red
            checkResult = False
        Else
            If DataValid1 = False Then
                Grid1.Cell(rowIndex, COLS.收入).Text = "0"
                Grid1.Cell(rowIndex, COLS.收入).BackColor = Color.Green
            End If
            If DataValid2 = False Then
                Grid1.Cell(rowIndex, COLS.支出).Text = "0"
                Grid1.Cell(rowIndex, COLS.支出).BackColor = Color.Green
            End If
        End If


        If Grid1.Cell(rowIndex, COLS.收支类别).Text.Length = 0 Then
            Grid1.Cell(rowIndex, COLS.收支类别).BackColor = Color.Red
            checkResult = False
        Else
            Grid1.Cell(rowIndex, COLS.收支类别).BackColor = Color.Green
        End If

        If Grid1.Cell(rowIndex, COLS.收支子类别).Text.Length = 0 Then
            Grid1.Cell(rowIndex, COLS.收支子类别).BackColor = Color.Red
            checkResult = False
        Else
            Grid1.Cell(rowIndex, COLS.收支子类别).BackColor = Color.Green
        End If

        If Grid1.Cell(rowIndex, COLS.机种).Text.Length = 0 Then
            Grid1.Cell(rowIndex, COLS.机种).BackColor = Color.Red
            checkResult = False
        Else
            Grid1.Cell(rowIndex, COLS.机种).BackColor = Color.Green
        End If

        If Grid1.Cell(rowIndex, COLS.交易方).Text.Length = 0 Then
            Grid1.Cell(rowIndex, COLS.交易方).BackColor = Color.Red
            checkResult = False
        Else
            Grid1.Cell(rowIndex, COLS.交易方).BackColor = Color.Green
        End If

        If Grid1.Cell(rowIndex, COLS.业务类型).Text.Length = 0 Then
            Grid1.Cell(rowIndex, COLS.业务类型).BackColor = Color.Red
            checkResult = False
        Else
            Grid1.Cell(rowIndex, COLS.业务类型).BackColor = Color.Green
        End If

        If Grid1.Cell(rowIndex, COLS.事由).Text.Length = 0 Then
            Grid1.Cell(rowIndex, COLS.事由).BackColor = Color.Red
            checkResult = False
        Else
            Grid1.Cell(rowIndex, COLS.事由).BackColor = Color.Green
        End If

        If Grid1.Cell(rowIndex, COLS.经手人).Text.Length = 0 Then
            Grid1.Cell(rowIndex, COLS.经手人).BackColor = Color.Red
            checkResult = False
        Else
            Grid1.Cell(rowIndex, COLS.经手人).BackColor = Color.Green
        End If

        If Grid1.Cell(rowIndex, COLS.单据类型).Text.Length = 0 Then
            Grid1.Cell(rowIndex, COLS.单据类型).BackColor = Color.Red
            checkResult = False
        Else
            Grid1.Cell(rowIndex, COLS.单据类型).BackColor = Color.Green
        End If

        If Grid1.Cell(rowIndex, COLS.单据编号).Text.Length = 0 Then
            Grid1.Cell(rowIndex, COLS.单据编号).BackColor = Color.Red
            checkResult = False
        Else
            Grid1.Cell(rowIndex, COLS.单据编号).BackColor = Color.Green
        End If


        Return checkResult
    End Function

    Private Function CheckAllRowValid() As Boolean
        '清除表状态
        For row As Integer = 1 To Grid1.Rows - 1
            For col As Integer = 0 To Grid1.Cols - 1
                Grid1.Cell(row, col).BackColor = Color.White
            Next
        Next

        Dim checkResult As Boolean = True
        Dim isEmpty As Boolean = True
        For row As Integer = 1 To Grid1.Rows - 1
            If Grid1.Cell(row, COLS.日期).Text.Length > 0 Then
                isEmpty = False
                If CheckRowValid(row) = False Then
                    checkResult = False
                Else
                    Grid1.Cell(row, COLS.序号).BackColor = Color.Green
                End If
            End If
        Next

        If isEmpty = True Then
            checkResult = False
            MsgBox("列表为空！")
        End If

        Return checkResult
    End Function

    Private Function SaveFinancialRecordItems() As Boolean
        Dim row As Integer
        Dim col As Integer
        Dim result As Boolean = True

        'INSERT INTO table_name(col_name,...) values(expr,...)
        Dim strInsert As String = "INSERT INTO `" & cst_TABLE_NAME & "` "
        Dim insertItems As String = ""
        For col = 0 To COLS.max - 1
            If m_COLS_NAME(col, COLS_PROP.Insert) = "1" Then
                If insertItems.Length > 0 Then
                    insertItems &= ","
                End If
                insertItems &= "`" & m_COLS_NAME(col, 0) & "`"
            End If
        Next

        '增加“操作人”字段
        insertItems &= ",`操作人`"

        For row = 1 To Grid1.Rows - 1
            If Grid1.Cell(row, COLS.序号).BackColor = Color.Green Then
                Dim insertValues As String = ""

                For col = 0 To COLS.max - 1
                    If m_COLS_NAME(col, COLS_PROP.Insert) = "1" Then
                        If insertValues.Length > 0 Then
                            insertValues &= ","
                        End If

                        If Grid1.Column(col).CellType = FlexCell.CellTypeEnum.CheckBox Then
                            If Grid1.Cell(row, col).BooleanValue = True Then
                                insertValues &= "'1'"
                            Else
                                insertValues &= "'0'"
                            End If
                        Else
                            insertValues &= "'" & Grid1.Cell(row, col).Text & "'"
                        End If
                    End If
                Next

                insertValues &= "," & "'" & Current_UserName & "'"

                Dim strSQL As String = strInsert & "(" & insertItems & ") values(" & insertValues & ")"
                If SQL_ExeCommand(COL_RIGHTS.财务管理, strSQL) = False Then
                    result = False
                    Exit For
                End If
            End If
        Next

        Return result
    End Function

    Private Sub UpdateItemSN()
        For row As Integer = 1 To Grid1.Rows - 1
            Grid1.Cell(row, COLS.序号).Text = row
        Next
    End Sub

    Private Sub Grid1_CellChange(Sender As Object, e As FlexCell.Grid.CellChangeEventArgs) Handles Grid1.CellChange
        If e.Row > 0 AndAlso e.Col = COLS.收支类别 Then
            Grid1.Cell(e.Row, COLS.收支子类别).Text = ""

            ''查找当前“收支类别”对应的子类别
            'If Grid1.Cell(e.Row, COLS.收支类别).Text.Length > 0 Then
            '    CGirdInfo.GetRecentSubList("财务_收支类别", Grid1.Cell(e.Row, COLS.收支类别).Text, gridSubList_收支类别, gridItemRecords_收支子类别)
            '    SetGridDataSource()
            'End If
        End If
    End Sub

    Private Sub Grid1_RowColChange(Sender As Object, e As FlexCell.Grid.RowColChangeEventArgs) Handles Grid1.RowColChange
        If e.Row > 0 AndAlso e.Col = COLS.收支子类别 Then
            '查找当前“收支类别”对应的子类别
            If Grid1.Cell(e.Row, COLS.收支类别).Text.Length > 0 Then
                CGirdInfo.GetRecentSubList("财务_收支类别", Grid1.Cell(e.Row, COLS.收支类别).Text, gridSubList_收支类别, gridItemRecords_收支子类别)
                SetGridDataSource()
            End If
        End If
    End Sub

    Private Function GetLatestBalance(ByRef rBalance As Double) As Boolean
        Dim result As Boolean = False
        Dim strSQL As String = "SELECT `" & m_COLS_NAME(COLS.余额, COLS_PROP.Name) & "` FROM `" & cst_TABLE_NAME & "` WHERE `" & m_COLS_NAME(COLS.序号, COLS_PROP.Name) & "`= (SELECT max(`" & m_COLS_NAME(COLS.序号, COLS_PROP.Name) & "`) FROM `" & cst_TABLE_NAME & "`)"

        rBalance = 0

        m_Table.Rows.Clear()
        m_Table.Columns.Clear()
        If SQL_Query(COL_RIGHTS.财务管理, strSQL, m_Table) = True Then
            Try
                rBalance = m_Table.Rows(0).Item(0)
            Catch ex As Exception
            End Try
            result = True
        End If

        Return result
    End Function
End Class