📄 frmlistman.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form FrmListMan
Caption = "日常收支管理"
ClientHeight = 6345
ClientLeft = 60
ClientTop = 345
ClientWidth = 10650
LinkTopic = "Form1"
ScaleHeight = 6345
ScaleWidth = 10650
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 615
Left = 120
TabIndex = 5
Top = 40
Width = 10455
Begin VB.ComboBox cob_Flag
Height = 300
Left = 1080
Style = 2 'Dropdown List
TabIndex = 12
Top = 180
Width = 1215
End
Begin VB.ComboBox cob_Date
Height = 300
Left = 6120
TabIndex = 11
Top = 180
Width = 1215
End
Begin VB.CheckBox Check1
Caption = "全部"
Height = 375
Left = 8280
TabIndex = 9
Top = 143
Width = 735
End
Begin MSDataListLib.DataCombo dco_Type
Height = 330
Left = 3600
TabIndex = 8
Top = 165
Width = 1215
_ExtentX = 2143
_ExtentY = 582
_Version = 393216
Style = 2
Text = ""
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "收支日期"
Height = 180
Left = 5160
TabIndex = 10
Top = 240
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "收支分类"
Height = 180
Left = 2760
TabIndex = 7
Top = 240
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "收支类型"
Height = 180
Left = 240
TabIndex = 6
Top = 240
Width = 720
End
End
Begin VB.CommandButton Cmd_Back
Caption = "返 回"
Height = 495
Left = 7598
TabIndex = 4
Top = 5640
Width = 1335
End
Begin VB.CommandButton Cmd_Del
Caption = "删 除"
Height = 495
Left = 5638
TabIndex = 3
Top = 5640
Width = 1335
End
Begin VB.CommandButton Cmd_Modi
Caption = "修 改"
Height = 495
Left = 3678
TabIndex = 2
Top = 5640
Width = 1335
End
Begin VB.CommandButton Cmd_Add
Caption = "添 加"
Height = 495
Left = 1718
TabIndex = 1
Top = 5640
Width = 1335
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 120
Top = 5520
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 4695
Left = 120
TabIndex = 0
Top = 720
Width = 10455
_ExtentX = 18441
_ExtentY = 8281
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Ado_Type
Height = 330
Left = 120
Top = 5880
Visible = 0 'False
Width = 2055
_ExtentX = 3625
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Ado_Type"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "FrmListMan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Check1_Click()
'当选中全部时,将下拉列表数据清空,并设置为不可用状态。
If Check1.Value = 0 Then
cob_Flag.Enabled = True
dco_Type.Enabled = True
cob_Date.Enabled = True
Else
cob_Flag.Enabled = False
dco_Type.Enabled = False
cob_Date.Enabled = False
dco_Type.Text = ""
cob_Date.Text = ""
cob_Flag.ListIndex = -1
End If
'刷新数据
DataRefresh
End Sub
Private Sub Cmd_Add_Click()
FrmListEdit.Modify = False
FrmListEdit.OldSum = 0
FrmListEdit.txtDate = Date
FrmListEdit.txtSum = 0
FrmListEdit.Show 1
'刷新数据
DataRefresh
End Sub
Private Sub Cmd_Back_Click()
Unload Me
End Sub
Private Sub Cmd_Del_Click()
If Adodc1.Recordset.BOF = True Then
MsgBox "请选择记录"
Exit Sub
End If
'确认删除
If MsgBox("是否确定要删除收支信息?", vbYesNo, "请确认") = vbNo Then
Exit Sub
End If
'删除收支信息
MyList.Delete (Adodc1.Recordset.Fields(0))
MsgBox "成功删除"
'刷新数据
DataRefresh
End Sub
Private Sub Cmd_Modi_Click()
If Adodc1.Recordset.BOF = True Then
MsgBox "请选择记录"
Exit Sub
End If
FrmListEdit.Modify = True
FrmListEdit.OriLId = Adodc1.Recordset.Fields(0)
FrmListEdit.cob_Flag.ListIndex = Adodc1.Recordset.Fields(8)
'修改时,收支类型不能改变
FrmListEdit.cob_Flag.Enabled = False
FrmListEdit.dco_Type.Text = Trim(Adodc1.Recordset.Fields(2))
FrmListEdit.dco_Acc.Text = Trim(Adodc1.Recordset.Fields(3))
FrmListEdit.txtDate = Trim(Adodc1.Recordset.Fields(4))
FrmListEdit.OldSum = Adodc1.Recordset.Fields(5)
FrmListEdit.txtSum = Adodc1.Recordset.Fields(5)
FrmListEdit.dco_Mem.Text = Trim(Adodc1.Recordset.Fields(6))
If IsNull(Trim(Adodc1.Recordset.Fields(7))) Then
FrmListEdit.txtMemo = ""
Else
FrmListEdit.txtMemo = Trim(Adodc1.Recordset.Fields(7))
End If
FrmListEdit.Show 1
'刷新数据
DataRefresh
End Sub
Private Sub cob_Date_GotFocus()
'将焦点设置为下一个控件,否则将反复执行此过程
Cmd_Add.SetFocus
'如果cob_Date中包含日期,则将它赋值到FrmDateSel中
If cob_Date.Text <> "" Then
FrmDateSel.OriDate = cob_Date.Text
End If
'设置FrmDateSel窗体的位置
FrmDateSel.Left = Me.Left + cob_Date.Left + 350
FrmDateSel.Top = Me.Top + cob_Date.Top + cob_Date.Height + 450
FrmDateSel.Show 1
'将选择的日期显示到cob_Date控件中
cob_Date.Text = FrmDateSel.OriDate
DataRefresh
End Sub
Private Sub cob_Flag_Click()
dco_Type.Text = ""
If cob_Flag.ListIndex > -1 Then
'载入对应分类
Ado_Type.ConnectionString = Conn
Ado_Type.RecordSource = "Select * From Types Where Flag=" + Trim(cob_Flag.ListIndex) + " Order By TypeId"
Ado_Type.Refresh
Set dco_Type.RowSource = Ado_Type
dco_Type.ListField = "TypeName"
dco_Type.BoundColumn = "TypeId"
End If
'刷新记录
DataRefresh
End Sub
Private Sub dco_Type_Click(Area As Integer)
'刷新记录
DataRefresh
End Sub
Private Sub Form_Load()
cob_Flag.AddItem "收入", 0
cob_Flag.AddItem "支出", 1
cob_Flag.ListIndex = -1
Check1.Value = 1
cob_Flag.Enabled = False
cob_Date.Enabled = False
dco_Type.Enabled = False
'载入分类信息
Ado_Type.ConnectionString = Conn
Ado_Type.RecordSource = "Select * From Types Order By TypeId"
Ado_Type.Refresh
Set dco_Type.RowSource = Ado_Type
dco_Type.ListField = "TypeName"
dco_Type.BoundColumn = "TypeId"
'刷新记录
DataRefresh
End Sub
'刷新数据
Private Sub DataRefresh()
Dim TmpSource As String
Dim strSch As String
Dim StrDate As String
'设置查询条件
'判断是否选中“全部”,如果没有则提取不同的查询条件
If Check1.Value = 1 Then
strSch = ""
Else
If cob_Flag.ListIndex > 0 Then
strSch = " And l.Flag=" + Trim(cob_Flag.ListIndex)
End If
If Len(Trim(dco_Type.Text())) > 0 Then
strSch = strSch + " And l.TypeId=" + dco_Type.BoundText()
End If
If Len(Trim(cob_Date.Text)) > 0 Then
StrDate = Format(cob_Date.Text, "yyyy-mm-dd")
strSch = " AND l.UseDate='" + Trim(StrDate) + "'"
End If
End If
TmpSource = "Select l.Id, IIF(l.Flag=0,'收入','支出') AS 收支类型," _
+ "t.TypeName AS 分类名称,l.ANo AS 账号,l.UseDate AS 收支日期," _
+ "l.UseSum AS 收支金额,m.MemName AS 使用人,l.Memos AS 说明,l.Flag " _
+ " From InOutList l,Types t,Members m " _
+ " Where l.MemId=m.MemId And l.TypeId=t.TypeId" + strSch _
+ " Order By l.UseDate Desc"
'MsgBox TmpSource
Adodc1.ConnectionString = Conn
Adodc1.RecordSource = TmpSource
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
DataGrid1.Columns(0).Width = 0 '编号
DataGrid1.Columns(1).Width = 2100 '收支类型
DataGrid1.Columns(2).Width = 1000 '分类名称
DataGrid1.Columns(3).Width = 1600 '账号
DataGrid1.Columns(4).Width = 1000 '收支日期
DataGrid1.Columns(5).Width = 1200 '收支金额
DataGrid1.Columns(6).Width = 1000 '使用人
DataGrid1.Columns(7).Width = 1200 '说明
DataGrid1.Columns(8).Width = 0 'Flag
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -