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

📄 frmlistedit.frm

📁 家庭理财系统,使用VB6.0编写,相当不错,可以用于课程设计
💻 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"
Begin VB.Form FrmListEdit 
   Caption         =   "编辑日常收支信息"
   ClientHeight    =   3810
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5865
   LinkTopic       =   "Form1"
   ScaleHeight     =   3810
   ScaleWidth      =   5865
   StartUpPosition =   2  '屏幕中心
   Begin VB.ComboBox cob_Flag 
      Height          =   300
      ItemData        =   "FrmListEdit.frx":0000
      Left            =   1320
      List            =   "FrmListEdit.frx":0002
      Style           =   2  'Dropdown List
      TabIndex        =   15
      Top             =   240
      Width           =   1335
   End
   Begin VB.TextBox txtSum 
      Height          =   330
      Left            =   1320
      TabIndex        =   10
      Top             =   750
      Width           =   1335
   End
   Begin MSAdodcLib.Adodc Ado_Type 
      Height          =   330
      Left            =   0
      Top             =   2760
      Visible         =   0   'False
      Width           =   1575
      _ExtentX        =   2778
      _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
   Begin MSDataListLib.DataCombo dco_Type 
      Height          =   330
      Left            =   3960
      TabIndex        =   9
      Top             =   255
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   582
      _Version        =   393216
      Style           =   2
      Text            =   ""
   End
   Begin MSAdodcLib.Adodc Ado_Mem 
      Height          =   330
      Left            =   2880
      Top             =   1680
      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_Mem"
      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 MSDataListLib.DataCombo dco_Mem 
      Height          =   330
      Left            =   1320
      TabIndex        =   8
      Top             =   1710
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   582
      _Version        =   393216
      Style           =   2
      Text            =   ""
   End
   Begin VB.TextBox txtMemo 
      Height          =   810
      Left            =   1320
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   6
      Top             =   2160
      Width           =   3975
   End
   Begin VB.CommandButton Cmd_Cancel 
      Caption         =   "取 消"
      Height          =   375
      Left            =   3480
      TabIndex        =   3
      Top             =   3240
      Width           =   1215
   End
   Begin VB.CommandButton Cmd_OK 
      Caption         =   "确 定"
      Height          =   375
      Left            =   1200
      TabIndex        =   2
      Top             =   3240
      Width           =   1215
   End
   Begin VB.TextBox txtDate 
      Height          =   330
      Left            =   3960
      TabIndex        =   1
      Top             =   729
      Width           =   1335
   End
   Begin MSDataListLib.DataCombo dco_Acc 
      Height          =   330
      Left            =   1320
      TabIndex        =   13
      Top             =   1230
      Width           =   3975
      _ExtentX        =   7011
      _ExtentY        =   582
      _Version        =   393216
      Style           =   2
      Text            =   ""
   End
   Begin MSAdodcLib.Adodc Ado_Acc 
      Height          =   330
      Left            =   0
      Top             =   2400
      Visible         =   0   'False
      Width           =   1455
      _ExtentX        =   2566
      _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_Acc"
      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 VB.Label Label9 
      AutoSize        =   -1  'True
      Caption         =   "收支类型"
      Height          =   180
      Left            =   360
      TabIndex        =   14
      Top             =   330
      Width           =   720
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      Caption         =   "收支账号"
      Height          =   180
      Left            =   360
      TabIndex        =   12
      Top             =   1293
      Width           =   720
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      Caption         =   "收支金额"
      Height          =   180
      Left            =   360
      TabIndex        =   11
      Top             =   825
      Width           =   720
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      Caption         =   "说明"
      Height          =   180
      Left            =   720
      TabIndex        =   7
      Top             =   2160
      Width           =   360
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      Caption         =   "收支日期"
      Height          =   180
      Left            =   3000
      TabIndex        =   5
      Top             =   804
      Width           =   720
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "使用人"
      Height          =   180
      Left            =   540
      TabIndex        =   4
      Top             =   1800
      Width           =   540
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "收支分类"
      Height          =   180
      Left            =   3000
      TabIndex        =   0
      Top             =   330
      Width           =   720
   End
End
Attribute VB_Name = "FrmListEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public OriLId As Long
Public Modify As Boolean
Public OldSum As Double  '记录原始收支金额
Public DSum As Double '差值

Private Sub Cmd_Cancel_Click()
  Unload Me
End Sub

Private Sub Cmd_OK_Click()
  If Len(Trim(cob_Flag.Text)) = 0 Then
    MsgBox "请选择收支类型"
    cob_Flag.SetFocus
    Exit Sub
  End If
  If Len(Trim(dco_Type.Text)) = 0 Then
    MsgBox "请选择收支分类"
    dco_Type.SetFocus
    Exit Sub
  End If
  If Len(Trim(dco_Acc.Text)) = 0 Then
    MsgBox "请选择银行账号"
    dco_Acc.SetFocus
    Exit Sub
  End If
  If Len(Trim(txtDate)) = 0 Then
    MsgBox "请输入收支日期"
    txtDate.SetFocus
    Exit Sub
  End If
  If Len(Trim(txtSum)) = 0 Then
    MsgBox "请输入收支金额"
    txtSum.SetFocus
    Exit Sub
  End If
  If Len(Trim(dco_Mem.Text)) = 0 Then
    MsgBox "请选择使用人"
    dco_Mem.SetFocus
    Exit Sub
  End If
  '当交易类型为取款(1)时,选择帐户信息后,需要判断是否此账号金额是否足够
  If MyAcc.GetInfo(Trim(dco_Acc.BoundText())) And MyAcc.ASum < Val(txtSum) _
    And cob_Flag.ListIndex = 1 Then
    MsgBox "帐户余额不足,请重新选择收支帐户"
    dco_Acc.SetFocus
    Exit Sub
  End If
  With MyList
    .TypeId = Val(dco_Type.BoundText())
    .UseDate = Trim(txtDate)
    .ANo = Trim(dco_Acc.BoundText())
    .UseSum = Val(txtSum)
    .MemId = Val(dco_Mem.BoundText())
    .Memos = Trim(txtMemo)
    .Flag = cob_Flag.ListIndex
    If Modify = False Then
      .Insert
      MsgBox "添加成功"
    Else
      .Update (OriLId)
      MsgBox "修改成功"
    End If
  End With
  '对比现在的收支金额和原来的收支金额
  DSum = Val(txtSum) - OldSum
  '更改后将更新对应的帐户信息
  If cob_Flag.ListIndex = 0 Then  '收入
    MyAcc.UpdateSum Trim(dco_Acc.Text), 0, DSum
  Else  '支出
    MyAcc.UpdateSum Trim(dco_Acc.Text), 1, 0 - DSum
  End If
  Unload Me
End Sub

Private Sub cob_Flag_Click()
  '根据选择的收支类型读取对应的类别信息
  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 Sub

Private Sub Form_Load()
  cob_Flag.AddItem "收入", 0
  cob_Flag.AddItem "支出", 1
  cob_Flag.ListIndex = 0
  '载入分类信息
  Ado_Type.ConnectionString = Conn
  Ado_Type.RecordSource = "Select * From Types Where Flag=0 Order By TypeId"
  Ado_Type.Refresh
  Set dco_Type.RowSource = Ado_Type
  dco_Type.ListField = "TypeName"
  dco_Type.BoundColumn = "TypeId"
  '载入家庭成员信息
  Ado_Mem.ConnectionString = Conn
  Ado_Mem.RecordSource = "Select * From Members Order By MemId"
  Ado_Mem.Refresh
  Set dco_Mem.RowSource = Ado_Mem
  dco_Mem.ListField = "MemName"
  dco_Mem.BoundColumn = "MemId"
  '载入帐户信息
  Ado_Acc.ConnectionString = Conn
  Ado_Acc.RecordSource = "Select AccountNo From Account Order By AccountNo"
  Ado_Acc.Refresh
  Set dco_Acc.RowSource = Ado_Acc
  dco_Acc.ListField = "AccountNo"
  dco_Acc.BoundColumn = "AccountNo"
End Sub

⌨️ 快捷键说明

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