?? indexform.vb
字號:
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 + -