⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 indexform.vb

📁 本人收集到的流水帐软件!小巧实用,希望对大家有说帮助.
💻 VB
📖 第 1 页 / 共 5 页
字号:
                End With
            End If
        End If
    End Sub

    '类别管理—建立类别对象
    Sub SelectTypeGuestInfo()
        Dim S As New S_TypeGuestInfo
        S.Type_AdminName = AdminName
        With New D_TypeGuestInfo
            TypeDataset = .ListType(S, ErrStr)
        End With
    End Sub

    '收入记帐—在ListView中显示收入计帐明细的信息
    Sub ListSR()
        j = 0.0
        Me.ListViewSR.Items.Clear()
        With New D_InGuestInfo
            Dim S As New S_InGuestInfo
            S.In_AdminName = AdminName
            S.In_TypeName = "收入"
            Dim SRDataSet As New System.Data.DataSet
            SRDataSet = .ListInGuestInfo(S, ErrStr)
            If SRDataSet Is Nothing Then
                MsgBox("读取失败!")
            Else
                For i = 0 To SRDataSet.Tables(0).Rows.Count - 1
                    Dim item As New ListViewItem
                    item.SubItems.Add(SRDataSet.Tables(0).Rows(i)("In_Data").ToString)
                    item.SubItems.Add(SRDataSet.Tables(0).Rows(i)("In_TypeName").ToString)
                    item.SubItems.Add(SRDataSet.Tables(0).Rows(i)("In_Type").ToString)
                    item.SubItems.Add(SRDataSet.Tables(0).Rows(i)("In_Money").ToString)
                    item.SubItems.Add(SRDataSet.Tables(0).Rows(i)("In_Text").ToString)
                    Me.ListViewSR.Items.Add(item)
                    j = SRDataSet.Tables(0).Rows(i)("In_Money") + j
                Next
            End If
            Me.LabelAllSr.Text = "所有的收入:" & j & "元"
        End With
    End Sub

    '支出记帐—在ListView中显示支出计帐明细的信息
    Sub ListZC()
        j = 0.0
        Me.ListViewZC.Items.Clear()
        With New D_InGuestInfo
            Dim S As New S_InGuestInfo
            S.In_AdminName = AdminName
            S.In_TypeName = "支出"
            Dim ZCDataSet As New System.Data.DataSet
            ZCDataSet = .ListInGuestInfo(S, ErrStr)
            If ZCDataSet Is Nothing Then
                MsgBox("读取失败!")
            Else
                For i = 0 To ZCDataSet.Tables(0).Rows.Count - 1
                    Dim item As New ListViewItem
                    item.SubItems.Add(ZCDataSet.Tables(0).Rows(i)("In_Data").ToString)
                    item.SubItems.Add(ZCDataSet.Tables(0).Rows(i)("In_TypeName").ToString)
                    item.SubItems.Add(ZCDataSet.Tables(0).Rows(i)("In_Type").ToString)
                    item.SubItems.Add(ZCDataSet.Tables(0).Rows(i)("In_Money"))
                    item.SubItems.Add(ZCDataSet.Tables(0).Rows(i)("In_Text").ToString)
                    Me.ListViewZC.Items.Add(item)
                    j = ZCDataSet.Tables(0).Rows(i)("In_Money") + j
                Next
            End If
            Me.LabelAllZC.Text = "所有的收入:" & j & "元"
        End With
    End Sub

    '收入记帐—选择收入类别下拉菜单时发生
    Private Sub ComboBoxSRType_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBoxSRType.MouseEnter
        Me.ComboBoxSRType.Items.Clear()
        SelectTypeGuestInfo()
        For i = 0 To TypeDataset.Tables(0).Rows.Count - 1
            Me.ComboBoxSRType.Items.Add(TypeDataset.Tables(0).Rows(i)("Type_Name"))
        Next
    End Sub

    '支出记帐—选择支出类别下拉菜单时发生
    Private Sub ComboBoxZCType_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBoxZCType.MouseEnter
        Me.ComboBoxZCType.Items.Clear()
        SelectTypeGuestInfo()
        For i = 0 To TypeDataset.Tables(0).Rows.Count - 1
            Me.ComboBoxZCType.Items.Add(TypeDataset.Tables(0).Rows(i)("Type_Name"))
        Next
    End Sub

    '支出记帐—删除支出项目中选中的数据
    Private Sub ButtonZCDel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonZCDel.Click
        If Me.ListViewZC.SelectedItems.Count <= 0 Then '判断是否选中记录
            MsgBox("请选择要删除的支出记录!", MsgBoxStyle.Exclamation)
        Else
            IsClose = MsgBox("你确认要删除此条支出?", MsgBoxStyle.OKCancel + MsgBoxStyle.Information + MsgBoxStyle.SystemModal, "小鱼流水帐")
            If IsClose = MsgBoxResult.OK Then '判断是否退出
                Dim S As New S_InGuestInfo
                S.In_AdminName = AdminName
                S.In_TypeName = "支出"
                S.In_Data = Me.ListViewZC.SelectedItems(0).SubItems(1).Text
                S.In_Type = Me.ListViewZC.SelectedItems(0).SubItems(3).Text
                S.In_Money = Me.ListViewZC.SelectedItems(0).SubItems(4).Text
                S.In_Text = Me.ListViewZC.SelectedItems(0).SubItems(5).Text
                With New D_InGuestInfo
                    temp = .DelInGuestInfo(S, ErrStr)
                    If temp = True Then
                        ListZC()
                    End If
                End With
            End If
        End If
    End Sub

    '收入记帐—删除收入项目中选中的数据
    Private Sub ButtonSRDel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonSRDel.Click
        If Me.ListViewSR.SelectedItems.Count <= 0 Then '判断是否选中记录
            MsgBox("请选择要删除的支出记录!", MsgBoxStyle.Exclamation)
        Else
            IsClose = MsgBox("你确认要删除此条收入?", MsgBoxStyle.OKCancel + MsgBoxStyle.Information + MsgBoxStyle.SystemModal, "小鱼流水帐")
            If IsClose = MsgBoxResult.OK Then '判断是否退出
                Dim S As New S_InGuestInfo
                S.In_AdminName = AdminName
                S.In_TypeName = "收入"
                S.In_Data = Me.ListViewSR.SelectedItems(0).SubItems(1).Text
                S.In_Type = Me.ListViewSR.SelectedItems(0).SubItems(3).Text
                S.In_Money = Me.ListViewSR.SelectedItems(0).SubItems(4).Text
                S.In_Text = Me.ListViewSR.SelectedItems(0).SubItems(5).Text
                With New D_InGuestInfo
                    temp = .DelInGuestInfo(S, ErrStr)
                    If temp = True Then
                        ListSR()
                    End If
                End With
            End If
        End If
    End Sub

    '点右上角关闭触发事件
    Private Sub IndexForm_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        Application.ExitThread()
        Application.Exit()
    End Sub

    '收支查询—按日期查询收支项目
    Private Sub ButtonSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSearch.Click
        ListSelectData()
        m = 0
        n = 0
        With New D_InGuestInfo
            Dim S As New S_InGuestInfo
            S.In_AdminName = AdminName
            S.In_Data = Me.DateTimePickerSelect.Value.Date
            '计算选择日期收入的总金额
            S.In_TypeName = "收入"
            Dim InCountDataset As New DataSet
            InCountDataset = .SelectCountDate(S, ErrStr)
            If InCountDataset Is Nothing Or InCountDataset.Tables(0).Rows.Count = 0 Then
                m = 0
            Else
                For i = 0 To InCountDataset.Tables(0).Rows.Count - 1
                    m = InCountDataset.Tables(0).Rows(i)("In_Money") + m
                Next
            End If
            '计算选择日期支出的总金额
            S.In_TypeName = "支出"
            Dim OutCountDataset As New DataSet
            OutCountDataset = .SelectCountDate(S, ErrStr)
            If OutCountDataset Is Nothing Or OutCountDataset.Tables(0).Rows.Count = 0 Then
                n = 0
            Else
                For i = 0 To InCountDataset.Tables(0).Rows.Count - 1
                    n = OutCountDataset.Tables(0).Rows(i)("In_Money") + n
                Next
            End If
            Me.LabelIOCount.Text = "当天收支合计:"
            Me.LabelIOCount.Text = Me.LabelIOCount.Text & (m - n) & "元"
        End With
    End Sub

    '收支查询—删除查询中的一条记录
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If Me.ListViewSelectData.SelectedItems.Count <= 0 Then '判断是否选中记录
            MsgBox("请选择要删除的支出记录!", MsgBoxStyle.Exclamation)
        Else
            IsClose = MsgBox("你确认要删除此条支出?", MsgBoxStyle.OKCancel + MsgBoxStyle.Information + MsgBoxStyle.SystemModal, "小鱼流水帐")
            If IsClose = MsgBoxResult.OK Then '判断是否退出
                Dim S As New S_InGuestInfo
                S.In_Id = Me.ListViewSelectData.SelectedItems(0).SubItems(6).Text
                With New D_InGuestInfo
                    temp = .DelInGuestInfoId(S, ErrStr)
                    If temp = True Then
                        ListSelectData()
                    End If
                End With
            End If
        End If
    End Sub

    '收支查询—显示按时间查询的记录
    Sub ListSelectData()
        Dim SelectDS As New DataSet
        Dim SelectDate As String = Me.DateTimePickerSelect.Value.Date
        With New D_InGuestInfo
            Dim S As New S_InGuestInfo
            S.In_Data = SelectDate
            S.In_AdminName = AdminName
            SelectDS = .SelectSr(S, ErrStr)
            If SelectDS Is Nothing Then
                MsgBox("收入查询失败!")
            Else
                Me.ListViewSelectData.Items.Clear()
                For i = 0 To SelectDS.Tables(0).Rows.Count - 1
                    Dim item As New ListViewItem
                    item.SubItems.Add(SelectDS.Tables(0).Rows(i)("In_Data").ToString)
                    item.SubItems.Add(SelectDS.Tables(0).Rows(i)("In_TypeName").ToString)
                    item.SubItems.Add(SelectDS.Tables(0).Rows(i)("In_Type").ToString)
                    item.SubItems.Add(SelectDS.Tables(0).Rows(i)("In_Money").ToString)
                    item.SubItems.Add(SelectDS.Tables(0).Rows(i)("In_Text").ToString)
                    item.SubItems.Add(SelectDS.Tables(0).Rows(i)("In_Id").ToString)
                    Me.ListViewSelectData.Items.Add(item)
                Next
            End If
        End With
        CountAllMoney()
    End Sub

    '收支查询—修改记录,弹出窗口
    Private Sub ButtonEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonEdit.Click
        If Me.ListViewSelectData.SelectedItems.Count <= 0 Then '判断是否选中记录
            MsgBox("请选择要删除的支出记录!", MsgBoxStyle.Exclamation)
        Else
            S_Select.In_Id = Me.ListViewSelectData.SelectedItems(0).SubItems(6).Text
            S_Select.In_TypeName = Me.ListViewSelectData.SelectedItems(0).SubItems(2).Text
            S_Select.In_Type = Me.ListViewSelectData.SelectedItems(0).SubItems(3).Text
            S_Select.In_Money = Me.ListViewSelectData.SelectedItems(0).SubItems(4).Text
            S_Select.In_Text = Me.ListViewSelectData.SelectedItems(0).SubItems(5).Text
            Dim FormEdit As New EditInfo
            FormEdit.ShowDialog()
        End If
    End Sub

    '点击日期控件清空
    Private Sub DateTimePickerSelect_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePickerSelect.ValueChanged
        Me.ListViewSelectData.Items.Clear()
    End Sub

    '计算所有的收入支出
    Sub CountAllMoney()
        m = 0
        n = 0
        With New D_InGuestInfo
            Dim S As New S_InGuestInfo
            S.In_AdminName = AdminName
            '计算选择日期收入的总金额
            S.In_TypeName = "收入"
            Dim InAllCountDataset As New DataSet
            InAllCountDataset = .SelectallCount(S, ErrStr)
            If I

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -