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

📄 frmday.frm

📁 个人财务管理系统 可以记录你每一天的详细支出 让你很方便了解你这个月的支出 对于我们这些刚毕业的大学生节约用钱很有好处 大家有什么意见很问题可以发到我邮箱 qiu.yin@163.com
💻 FRM
字号:
VERSION 5.00
Begin VB.Form fmDay 
   BackColor       =   &H00000000&
   Caption         =   "录入数据"
   ClientHeight    =   4680
   ClientLeft      =   60
   ClientTop       =   720
   ClientWidth     =   5130
   Icon            =   "frmDay.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   4680
   ScaleWidth      =   5130
   StartUpPosition =   1  '所有者中心
   Begin VB.ComboBox cbMon 
      Height          =   300
      Left            =   1200
      TabIndex        =   21
      Top             =   120
      Visible         =   0   'False
      Width           =   570
   End
   Begin VB.ComboBox cbDay 
      Height          =   300
      Left            =   2040
      TabIndex        =   20
      Top             =   120
      Visible         =   0   'False
      Width           =   570
   End
   Begin VB.CheckBox chkBuLogin 
      BackColor       =   &H00000000&
      Caption         =   "补录"
      ForeColor       =   &H0000FF00&
      Height          =   255
      Left            =   360
      TabIndex        =   19
      Top             =   120
      Width           =   735
   End
   Begin VB.CommandButton cmdCalc 
      Caption         =   "计算器"
      Height          =   315
      Left            =   4440
      TabIndex        =   18
      Top             =   0
      Width           =   735
   End
   Begin VB.CommandButton cmdAmend 
      Caption         =   "修  改"
      Height          =   300
      Left            =   1680
      TabIndex        =   17
      Top             =   4200
      Visible         =   0   'False
      Width           =   800
   End
   Begin VB.TextBox txtRemark 
      Appearance      =   0  'Flat
      Height          =   2375
      Left            =   2640
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   16
      ToolTipText     =   "您可以填写您今天的支出详细情况"
      Top             =   960
      Width           =   2055
   End
   Begin VB.TextBox txtDay 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      Height          =   270
      Index           =   5
      Left            =   960
      TabIndex        =   15
      ToolTipText     =   "其它"
      Top             =   3060
      Width           =   1350
   End
   Begin VB.TextBox txtDay 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      Height          =   270
      Index           =   4
      Left            =   960
      TabIndex        =   14
      ToolTipText     =   "公交"
      Top             =   2580
      Width           =   1350
   End
   Begin VB.TextBox txtDay 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      Height          =   270
      Index           =   3
      Left            =   960
      TabIndex        =   13
      ToolTipText     =   "购物"
      Top             =   2100
      Width           =   1350
   End
   Begin VB.TextBox txtDay 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      Height          =   270
      Index           =   2
      Left            =   960
      TabIndex        =   12
      ToolTipText     =   "晚餐"
      Top             =   1620
      Width           =   1350
   End
   Begin VB.TextBox txtDay 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      Height          =   270
      Index           =   1
      Left            =   960
      TabIndex        =   11
      ToolTipText     =   "中餐"
      Top             =   1140
      Width           =   1350
   End
   Begin VB.TextBox txtDay 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      Height          =   270
      Index           =   0
      Left            =   960
      TabIndex        =   10
      ToolTipText     =   "早餐"
      Top             =   660
      Width           =   1350
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "提  交"
      Height          =   300
      Left            =   2640
      TabIndex        =   7
      Top             =   4200
      Width           =   800
   End
   Begin VB.Label lblMon 
      AutoSize        =   -1  'True
      BackColor       =   &H00000000&
      Caption         =   "月"
      ForeColor       =   &H0000FF00&
      Height          =   180
      Left            =   1800
      TabIndex        =   23
      Top             =   165
      Visible         =   0   'False
      Width           =   180
   End
   Begin VB.Label lblDay 
      AutoSize        =   -1  'True
      BackColor       =   &H00000000&
      Caption         =   "日"
      ForeColor       =   &H0000FF00&
      Height          =   180
      Left            =   2640
      TabIndex        =   22
      Top             =   165
      Visible         =   0   'False
      Width           =   180
   End
   Begin VB.Label lblSum 
      AutoSize        =   -1  'True
      BackColor       =   &H00000000&
      Caption         =   "0"
      ForeColor       =   &H000000FF&
      Height          =   180
      Left            =   960
      TabIndex        =   9
      Top             =   3720
      Width           =   90
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00000000&
      Caption         =   "总计"
      ForeColor       =   &H000000FF&
      Height          =   180
      Index           =   7
      Left            =   360
      TabIndex        =   8
      Top             =   3720
      Width           =   360
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00000000&
      Caption         =   "备注:"
      ForeColor       =   &H0000FF00&
      Height          =   180
      Index           =   6
      Left            =   2640
      TabIndex        =   6
      Top             =   720
      Width           =   450
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00000000&
      Caption         =   "其它:"
      ForeColor       =   &H0000FF00&
      Height          =   180
      Index           =   5
      Left            =   360
      TabIndex        =   5
      Top             =   3120
      Width           =   450
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00000000&
      Caption         =   "公交:"
      ForeColor       =   &H0000FF00&
      Height          =   180
      Index           =   4
      Left            =   360
      TabIndex        =   4
      Top             =   2640
      Width           =   450
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00000000&
      Caption         =   "购物:"
      ForeColor       =   &H0000FF00&
      Height          =   180
      Index           =   3
      Left            =   360
      TabIndex        =   3
      Top             =   2160
      Width           =   450
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00000000&
      Caption         =   "晚餐:"
      ForeColor       =   &H0000FF00&
      Height          =   180
      Index           =   2
      Left            =   360
      TabIndex        =   2
      Top             =   1680
      Width           =   450
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00000000&
      Caption         =   "中餐:"
      ForeColor       =   &H0000FF00&
      Height          =   180
      Index           =   1
      Left            =   360
      TabIndex        =   1
      Top             =   1200
      Width           =   450
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00000000&
      Caption         =   "早餐:"
      ForeColor       =   &H0000FF00&
      Height          =   180
      Index           =   0
      Left            =   360
      TabIndex        =   0
      Top             =   720
      Width           =   450
   End
End
Attribute VB_Name = "fmDay"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim m_nDayIt, m_nMonIt As Integer

Private Function UpdateInfo()
     Dim i As Integer
    Dim tmpDD As DayDetail
   
    If g_bAmend Then
        Me.Caption = "详细信息"
        
        tmpDD = GetDayDetail(m_nMonIt, m_nDayIt)
        
        txtDay(0).Text = CStr(tmpDD.ZaoCan)
        txtDay(1).Text = CStr(tmpDD.WuCan)
        txtDay(2).Text = CStr(tmpDD.WanCan)
        txtDay(3).Text = CStr(tmpDD.GouWu)
        txtDay(4).Text = CStr(tmpDD.GongJiao)
        txtDay(5).Text = CStr(tmpDD.Other)
        
        lblSum.Caption = CStr(tmpDD.ZaoCan + tmpDD.WuCan + tmpDD.WanCan + tmpDD.GouWu + tmpDD.GongJiao + tmpDD.Other)
        
        For i = 0 To 5
            txtDay(i).Enabled = False
        Next
        
        txtRemark.Enabled = False
        
        cmdAmend.Left = Me.ScaleWidth \ 2 - cmdAmend.Width - 6
        cmdAmend.Visible = True
        cmdOk.Left = Me.ScaleWidth \ 2 + 6
    Else
        Me.Caption = "录入数据"
        
        For i = 0 To 5
            txtDay(i).Enabled = True
        Next
        
        txtRemark.Enabled = True
        
        cmdAmend.Visible = False
        cmdOk.Left = Me.ScaleWidth \ 2 - cmdAmend.Width \ 2
    End If
End Function

Public Function ChkInput() As Boolean
    Dim i As Integer
    
    ChkInput = False
    
    For i = 0 To 5
        If Not (Len(Trim(txtDay(i).Text)) = 0 Or (Len(Trim(txtDay(i).Text)) = 1 And Trim(txtDay(i).Text = "0"))) Then
            ChkInput = True
            Exit Function
        End If
    Next
End Function

Private Sub chkBuLogin_Click()
    Dim i As Integer
    
    cbMon.Visible = chkBuLogin.Value
    cbDay.Visible = chkBuLogin.Value
    lblMon.Visible = chkBuLogin.Value
    lblDay.Visible = chkBuLogin.Value
    
    If chkBuLogin.Value Then
        m_nMonIt = g_nMon
        m_nDayIt = g_nDay - 1
    Else
        m_nMonIt = g_nMon
        m_nDayIt = g_nDay
    End If
    
    UpdateInfo
End Sub

Private Sub cmdAmend_Click()
    Dim i As Integer
    
    For i = 0 To 5
        txtDay(i).Enabled = True
    Next
    
    txtRemark.Enabled = True
End Sub

Private Sub cmdCalc_Click()
    Shell "calc.exe"
End Sub

Private Sub cmdOk_Click()
    Dim i As Integer
    Dim fin As Double
    Dim remark As String
    Dim tmpDD As DayDetail
    
    If txtDay(0).Visible = True And ChkInput Then
        remark = txtRemark.Text
        remark = Replace(remark, vbCrLf, g_Rtn)    '处理换行
        
        '防止空数据
        For i = 0 To 5
            If Trim(txtDay(i).Text) = "" Then
                txtDay(i).Text = "0"
            End If
        Next
        
        tmpDD.ZaoCan = CDbl(txtDay(0).Text)
        tmpDD.WuCan = CDbl(txtDay(1).Text)
        tmpDD.WanCan = CDbl(txtDay(2).Text)
        tmpDD.GouWu = CDbl(txtDay(3).Text)
        tmpDD.GongJiao = CDbl(txtDay(4).Text)
        tmpDD.Other = CDbl(txtDay(5).Text)
        
        fin = 0
        For i = 0 To 5
            fin = fin + CDbl(txtDay(i).Text)
        Next
        
        SetDayFinance m_nMonIt, m_nDayIt, fin, remark
        
        lblSum.Caption = CStr(fin)
        
        SetDayDetail m_nMonIt, m_nDayIt, tmpDD
        
        g_bAmend = True
        
        UpdateInfo
    End If
End Sub

Private Sub cbDay_Click()
    If m_nDayIt <> cbDay.ListIndex + 1 Then
        m_nDayIt = cbDay.ListIndex + 1
        
        UpdateInfo
    End If
End Sub

Private Sub cbMon_Click()
    Dim i As Integer
    Dim maxDay As Integer
    
    If m_nMonIt <> cbMon.ListIndex + 1 Then
        m_nMonIt = cbMon.ListIndex + 1
        
        '根据月重新设置当前可选的日
        Select Case m_nMonIt
            Case 1, 3, 5, 7, 8, 10, 12:
                maxDay = 31
            Case 4, 6, 9, 11:
                maxDay = 30
            Case 2:
                If (g_nYear Mod 4 = 0 And g_nYear Mod 100 <> 0) Or (g_nYear Mod 400 = 0) Then   '判断是否闰年
                    maxDay = 29
                Else
                    maxDay = 28
                End If
            Case Else:
                maxDay = 0
        End Select
        
        '下拉框最大值不能超过当前天数
        If maxDay > g_nDay Then
            maxDay = g_nDay
        End If
        
        cbDay.Clear
        For i = 1 To maxDay
            cbDay.AddItem CStr(i)
        Next
        cbDay.ListIndex = 0
        
        UpdateInfo
    End If
    
End Sub


Private Sub Form_Load()
    Dim i As Integer
    
    Me.ScaleMode = 3
    
    cbMon.Clear
    For i = 1 To g_nMon
        cbMon.AddItem i
    Next i
    cbMon.ListIndex = g_nMon - 1
    
    cbDay.Clear
    For i = 1 To g_nDay - 1     '只加到前一天
        cbDay.AddItem i
    Next
    cbDay.ListIndex = g_nDay - 2
    
    m_nMonIt = g_nMon
    m_nDayIt = g_nDay
    
    UpdateInfo
End Sub

'实时更新总额
Private Sub txtDay_Change(Index As Integer)
    Dim i As Integer
    Dim daySum As Double
    
    daySum = 0
    For i = 0 To 5
        If Len(Trim(txtDay(i).Text)) > 0 Then
            daySum = daySum + CDbl(Trim(txtDay(i).Text))
        End If
    Next
    
    lblSum.Caption = CStr(daySum)
End Sub

Private Sub txtDay_KeyPress(Index As Integer, KeyAscii As Integer)
    Dim strLen As Integer
    
    strLen = Len(Trim(txtDay(Index).Text))
    
    If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 46) Then
        KeyAscii = 0
        Exit Sub
    End If
    
    If KeyAscii > 48 And KeyAscii <= 57 Then
        If strLen = 1 And Trim(txtDay(Index).Text) = "0" Then
            txtDay(Index).Text = ""
        End If
    End If
    
    If KeyAscii = 48 Then       '如果开头为0则第2个不能为0
        If strLen = 1 And Trim(txtDay(Index).Text) = "0" Then
            KeyAscii = 0
        End If
    End If
    
    If KeyAscii = 46 Then       '处理开头不能为点
        If Len(Trim(txtDay(Index).Text)) = 0 Then
            KeyAscii = 0
        End If
        
        If KeyAscii = 46 And InStr(1, txtDay(Index).Text, ".") > 0 Then        '数字中只能含有1个点
            KeyAscii = 0
        End If
    End If
End Sub

⌨️ 快捷键说明

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