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

📄 form5.vb

📁 大学生记帐管理系统
💻 VB
📖 第 1 页 / 共 2 页
字号:
        Me.Label9.TabIndex = 24
        Me.Label9.Text = "月"
        Me.Label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Label11
        '
        Me.Label11.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label11.Location = New System.Drawing.Point(96, 48)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(24, 23)
        Me.Label11.TabIndex = 23
        Me.Label11.Text = "年"
        Me.Label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'ComboBox4
        '
        Me.ComboBox4.Items.AddRange(New Object() {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"})
        Me.ComboBox4.Location = New System.Drawing.Point(128, 48)
        Me.ComboBox4.Name = "ComboBox4"
        Me.ComboBox4.Size = New System.Drawing.Size(48, 20)
        Me.ComboBox4.TabIndex = 22
        '
        'ComboBox5
        '
        Me.ComboBox5.Items.AddRange(New Object() {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"})
        Me.ComboBox5.Location = New System.Drawing.Point(216, 48)
        Me.ComboBox5.Name = "ComboBox5"
        Me.ComboBox5.Size = New System.Drawing.Size(48, 20)
        Me.ComboBox5.TabIndex = 25
        '
        'Label13
        '
        Me.Label13.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label13.Location = New System.Drawing.Point(272, 48)
        Me.Label13.Name = "Label13"
        Me.Label13.Size = New System.Drawing.Size(24, 23)
        Me.Label13.TabIndex = 26
        Me.Label13.Text = "日"
        Me.Label13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Label14
        '
        Me.Label14.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label14.Location = New System.Drawing.Point(272, 80)
        Me.Label14.Name = "Label14"
        Me.Label14.Size = New System.Drawing.Size(24, 23)
        Me.Label14.TabIndex = 32
        Me.Label14.Text = "日"
        Me.Label14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'ComboBox6
        '
        Me.ComboBox6.Items.AddRange(New Object() {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"})
        Me.ComboBox6.Location = New System.Drawing.Point(216, 80)
        Me.ComboBox6.Name = "ComboBox6"
        Me.ComboBox6.Size = New System.Drawing.Size(48, 20)
        Me.ComboBox6.TabIndex = 31
        '
        'Label15
        '
        Me.Label15.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label15.Location = New System.Drawing.Point(184, 80)
        Me.Label15.Name = "Label15"
        Me.Label15.Size = New System.Drawing.Size(24, 23)
        Me.Label15.TabIndex = 30
        Me.Label15.Text = "月"
        Me.Label15.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Label16
        '
        Me.Label16.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label16.Location = New System.Drawing.Point(96, 80)
        Me.Label16.Name = "Label16"
        Me.Label16.Size = New System.Drawing.Size(24, 23)
        Me.Label16.TabIndex = 29
        Me.Label16.Text = "年"
        Me.Label16.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'ComboBox7
        '
        Me.ComboBox7.Items.AddRange(New Object() {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"})
        Me.ComboBox7.Location = New System.Drawing.Point(128, 80)
        Me.ComboBox7.Name = "ComboBox7"
        Me.ComboBox7.Size = New System.Drawing.Size(48, 20)
        Me.ComboBox7.TabIndex = 28
        '
        'ComboBox8
        '
        Me.ComboBox8.Items.AddRange(New Object() {"2004", "2005"})
        Me.ComboBox8.Location = New System.Drawing.Point(48, 80)
        Me.ComboBox8.Name = "ComboBox8"
        Me.ComboBox8.Size = New System.Drawing.Size(48, 20)
        Me.ComboBox8.TabIndex = 27
        Me.ComboBox8.Text = "2004"
        '
        'Label17
        '
        Me.Label17.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label17.Location = New System.Drawing.Point(32, 232)
        Me.Label17.Name = "Label17"
        Me.Label17.Size = New System.Drawing.Size(120, 23)
        Me.Label17.TabIndex = 33
        Me.Label17.Text = "本月计划花费:"
        Me.Label17.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Label18
        '
        Me.Label18.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label18.ForeColor = System.Drawing.Color.Red
        Me.Label18.Location = New System.Drawing.Point(136, 232)
        Me.Label18.Name = "Label18"
        Me.Label18.Size = New System.Drawing.Size(64, 24)
        Me.Label18.TabIndex = 34
        Me.Label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Form5
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.BackColor = System.Drawing.Color.Moccasin
        Me.ClientSize = New System.Drawing.Size(352, 300)
        Me.Controls.Add(Me.Label18)
        Me.Controls.Add(Me.Label17)
        Me.Controls.Add(Me.Label14)
        Me.Controls.Add(Me.ComboBox6)
        Me.Controls.Add(Me.Label15)
        Me.Controls.Add(Me.Label16)
        Me.Controls.Add(Me.ComboBox7)
        Me.Controls.Add(Me.ComboBox8)
        Me.Controls.Add(Me.Label13)
        Me.Controls.Add(Me.ComboBox5)
        Me.Controls.Add(Me.Label9)
        Me.Controls.Add(Me.Label11)
        Me.Controls.Add(Me.ComboBox4)
        Me.Controls.Add(Me.ComboBox3)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.ComboBox2)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Label10)
        Me.Controls.Add(Me.Label12)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.ComboBox1)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "Form5"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "查询统计"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.Close()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Me.ComboBox4.Text = "" Then
            MessageBox.Show("请选择统计的开始月份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)
        ElseIf Me.ComboBox5.Text = "" Then
            MessageBox.Show("请选择统计的开始日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)
        ElseIf Me.ComboBox7.Text = "" Then
            MessageBox.Show("请选择统计的终止月份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)
        ElseIf Me.ComboBox6.Text = "" Then
            MessageBox.Show("请选择统计的终止日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)
        Else
            Label7.Text = 0
            Dim str As String
            str = "select 今天总花费 from 用户帐目 where 用户ID = " + UserId + " and (日期 between " + "'" + ComboBox3.Text + "-" + ComboBox4.SelectedItem + "-" + ComboBox5.SelectedItem + "' and  '" + ComboBox8.Text + "-" + ComboBox7.SelectedItem + "-" + ComboBox6.SelectedItem + "')"
            MoneyRs.Open(str, MyCnn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
            If MoneyRs.RecordCount = 0 Then
                MessageBox.Show("该时间段没有记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)
                Label7.Text = ""
            Else
                MoneyRs.MoveFirst()
                Dim i As Integer
                For i = 0 To MoneyRs.RecordCount - 1
                    Label7.Text = Format(Val(Label7.Text) + MoneyRs.Fields(0).Value, "#.##")
                    MoneyRs.MoveNext()
                Next
            End If
            MoneyRs.Close()
        End If
    End Sub

    Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.Items.Add("01")
        ComboBox1.Items.Add("02")
        ComboBox1.Items.Add("03")
        ComboBox1.Items.Add("04")
        ComboBox1.Items.Add("05")
        ComboBox1.Items.Add("06")
        ComboBox1.Items.Add("07")
        ComboBox1.Items.Add("08")
        ComboBox1.Items.Add("09")
        ComboBox1.Items.Add("10")
        ComboBox1.Items.Add("11")
        ComboBox1.Items.Add("12")
        ComboBox2.Items.Add("2004")
        ComboBox2.Items.Add("2005")
        MoneyRs = New ADODB.Recordset
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If Me.ComboBox1.Text = "" Then
            MessageBox.Show("请选择需要统计的月份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)
        Else
            Label10.Text = 0
            Dim str As String
            str = "select * from 月份管理 where 用户ID = " + UserId + " and 月份=" + "'" + ComboBox2.Text + "-" + ComboBox1.SelectedItem + " '"
            MoneyRs.Open(str, MyCnn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
            If MoneyRs.RecordCount = 0 Or MoneyRs.Fields(3).Value = 0 Then
                Me.Label18.Text = MoneyRs.Fields(2).Value
                Label10.Text = 0
                MoneyRs.Close()
                str = "select 今天总花费 from 用户帐目 where 用户ID = " + UserId + " and 日期 like " + "'" + ComboBox2.Text + "-" + ComboBox1.Text + "%'"
                MoneyRs.Open(str, MyCnn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
                If MoneyRs.RecordCount = 0 Then
                    Me.Label10.Text = ""
                    Me.Label18.Text = ""
                    MessageBox.Show("该月没有记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)
                Else
                    MoneyRs.MoveFirst()
                    Dim i As Integer
                    For i = 0 To MoneyRs.RecordCount - 1
                        Label10.Text = Format(Val(Label10.Text) + MoneyRs.Fields(0).Value, "#.##")
                        MoneyRs.MoveNext()
                    Next
                    If Me.Label18.Text = "" Then
                        Me.Label18.Text = " No Plan"
                    End If
                End If
            Else
                    Label10.Text = MoneyRs.Fields(3).Value
                    Label18.Text = MoneyRs.Fields(2).Value
            End If
            MoneyRs.Close()
            End If
    End Sub
End Class

⌨️ 快捷键说明

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