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

📄 dayin.vb

📁 人事管理系统,用VB+SQL编译的
💻 VB
字号:
Public Class dayin
    Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写 dispose 以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意: 以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
    Friend WithEvents CheckBox2 As System.Windows.Forms.CheckBox
    Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
    Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
    Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents PrintDocument1 As System.Drawing.Printing.PrintDocument
    Friend WithEvents PrintPreviewDialog1 As System.Windows.Forms.PrintPreviewDialog
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(dayin))
        Me.CheckBox1 = New System.Windows.Forms.CheckBox
        Me.CheckBox2 = New System.Windows.Forms.CheckBox
        Me.ComboBox1 = New System.Windows.Forms.ComboBox
        Me.RadioButton1 = New System.Windows.Forms.RadioButton
        Me.RadioButton2 = New System.Windows.Forms.RadioButton
        Me.Button1 = New System.Windows.Forms.Button
        Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument
        Me.PrintPreviewDialog1 = New System.Windows.Forms.PrintPreviewDialog
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'CheckBox1
        '
        Me.CheckBox1.BackColor = System.Drawing.Color.Transparent
        Me.CheckBox1.Location = New System.Drawing.Point(40, 72)
        Me.CheckBox1.Name = "CheckBox1"
        Me.CheckBox1.Size = New System.Drawing.Size(80, 32)
        Me.CheckBox1.TabIndex = 0
        Me.CheckBox1.Text = "员工编号"
        '
        'CheckBox2
        '
        Me.CheckBox2.BackColor = System.Drawing.Color.Transparent
        Me.CheckBox2.Location = New System.Drawing.Point(40, 144)
        Me.CheckBox2.Name = "CheckBox2"
        Me.CheckBox2.Size = New System.Drawing.Size(56, 24)
        Me.CheckBox2.TabIndex = 1
        Me.CheckBox2.Text = "奖惩"
        '
        'ComboBox1
        '
        Me.ComboBox1.Location = New System.Drawing.Point(120, 80)
        Me.ComboBox1.Name = "ComboBox1"
        Me.ComboBox1.Size = New System.Drawing.Size(136, 20)
        Me.ComboBox1.TabIndex = 2
        Me.ComboBox1.Text = "选择员工编号"
        '
        'RadioButton1
        '
        Me.RadioButton1.Location = New System.Drawing.Point(16, 16)
        Me.RadioButton1.Name = "RadioButton1"
        Me.RadioButton1.Size = New System.Drawing.Size(56, 24)
        Me.RadioButton1.TabIndex = 3
        Me.RadioButton1.Text = "奖"
        '
        'RadioButton2
        '
        Me.RadioButton2.Location = New System.Drawing.Point(88, 16)
        Me.RadioButton2.Name = "RadioButton2"
        Me.RadioButton2.Size = New System.Drawing.Size(56, 24)
        Me.RadioButton2.TabIndex = 4
        Me.RadioButton2.Text = "惩"
        '
        'Button1
        '
        Me.Button1.BackColor = System.Drawing.Color.Snow
        Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Button1.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Button1.Location = New System.Drawing.Point(104, 192)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(96, 32)
        Me.Button1.TabIndex = 5
        Me.Button1.Text = "打印预览"
        '
        'PrintDocument1
        '
        '
        'PrintPreviewDialog1
        '
        Me.PrintPreviewDialog1.AutoScrollMargin = New System.Drawing.Size(0, 0)
        Me.PrintPreviewDialog1.AutoScrollMinSize = New System.Drawing.Size(0, 0)
        Me.PrintPreviewDialog1.ClientSize = New System.Drawing.Size(400, 300)
        Me.PrintPreviewDialog1.Enabled = True
        Me.PrintPreviewDialog1.Icon = CType(resources.GetObject("PrintPreviewDialog1.Icon"), System.Drawing.Icon)
        Me.PrintPreviewDialog1.Location = New System.Drawing.Point(137, 10)
        Me.PrintPreviewDialog1.MinimumSize = New System.Drawing.Size(375, 250)
        Me.PrintPreviewDialog1.Name = "PrintPreviewDialog1"
        Me.PrintPreviewDialog1.TransparencyKey = System.Drawing.Color.Empty
        Me.PrintPreviewDialog1.Visible = False
        '
        'GroupBox1
        '
        Me.GroupBox1.BackColor = System.Drawing.Color.Transparent
        Me.GroupBox1.Controls.Add(Me.RadioButton2)
        Me.GroupBox1.Controls.Add(Me.RadioButton1)
        Me.GroupBox1.Location = New System.Drawing.Point(104, 128)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(160, 48)
        Me.GroupBox1.TabIndex = 6
        Me.GroupBox1.TabStop = False
        '
        'Label1
        '
        Me.Label1.BackColor = System.Drawing.Color.Transparent
        Me.Label1.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label1.ForeColor = System.Drawing.Color.Firebrick
        Me.Label1.Location = New System.Drawing.Point(40, 32)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(184, 16)
        Me.Label1.TabIndex = 7
        Me.Label1.Text = "不选择则默认是全部的员工编号"
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(120, 80)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(136, 21)
        Me.TextBox1.TabIndex = 8
        Me.TextBox1.Text = ""
        '
        'dayin
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
        Me.ClientSize = New System.Drawing.Size(328, 245)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.ComboBox1)
        Me.Controls.Add(Me.CheckBox2)
        Me.Controls.Add(Me.CheckBox1)
        Me.Controls.Add(Me.GroupBox1)
        Me.MaximizeBox = False
        Me.Name = "dayin"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "预览奖惩"
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        myds.Clear()
        If CheckBox1.Checked = True Then
            ComboBox1.Enabled = True
            Me.ComboBox1.Items.Clear()
            Dim sqlstr As String
            sqlstr = "select distinct 员工编号 from jiangcheng "
            execsql(sqlstr, "jiangcheng")
            Dim i, j As Integer
            i = myds.Tables("jiangcheng").Rows.Count
            Do While j <= i - 1
                Me.ComboBox1.Items.Add(myds.Tables("jiangcheng").Rows(j).Item(0))
                j = j + 1
            Loop
        Else
            ComboBox1.Enabled = False
        End If
    End Sub
    Private Sub dayin_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.GroupBox1.Enabled = False
        If myyh2 = "adm" Then
            ComboBox1.Enabled = False
            Me.TextBox1.Visible = False
        Else
            TextBox1.Text = myyh2
            Me.ComboBox1.Visible = False
            Me.Label1.Visible = False
            Me.CheckBox1.Enabled = False
        End If
    End Sub
    Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
        If CheckBox2.Checked = True Then
            Me.GroupBox1.Enabled = True
        Else
            Me.GroupBox1.Enabled = False
            Me.RadioButton1.Checked = False
            Me.RadioButton2.Checked = False
        End If
    End Sub
    Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        Dim p(6) As Point
        Dim myb As New SolidBrush(System.Drawing.Color.Black)
        Dim myf = New Font("宋体", 15)
        Dim i As Integer
        For i = 1 To 6
            p(i) = New Point(100 + (i - 1) * 110, 100)
        Next
        Dim myp As Pen = New Pen(System.Drawing.Color.Black)
        e.Graphics.DrawLine(myp, p(1), p(6))
        For i = 1 To 6
            p(0).X = p(i).X
            p(0).Y = p(i).Y + 30
            e.Graphics.DrawLine(myp, p(i), p(0))
            p(0).Y = p(0).Y - 23
            Select Case i
                Case 1
                    e.Graphics.DrawString("员工编号", myf, myb, p(0).X, p(0).Y)
                Case 2
                    e.Graphics.DrawString("姓名", myf, myb, p(0).X, p(0).Y)
                Case 3
                    e.Graphics.DrawString("奖惩", myf, myb, p(0).X, p(0).Y)
                Case 4
                    e.Graphics.DrawString("奖惩原因", myf, myb, p(0).X, p(0).Y)
                Case 5
                    e.Graphics.DrawString("日期", myf, myb, p(0).X, p(0).Y)
            End Select
        Next
        For i = 1 To 6
            p(i).Y = p(i).Y + 30
        Next
        e.Graphics.DrawLine(myp, p(1), p(6))
        myds.Clear()
        mycon.Close()
        Dim j, k As Integer
        Dim sqlstr As String
        sqlstr = "select * from jiangcheng" & dy
        If execsql(sqlstr, "jiangcheng") Then
            j = myds.Tables("jiangcheng").Rows.Count - 1
            For k = 0 To myds.Tables("jiangcheng").Rows.Count - 1
                For i = 1 To 6
                    p(0).X = p(i).X
                    p(0).Y = p(i).Y + 30
                    e.Graphics.DrawLine(myp, p(i), p(0))
                    p(0).Y = p(0).Y - 23
                    Select Case i
                        Case 1
                            e.Graphics.DrawString(myds.Tables("jiangcheng").Rows(k).Item("员工编号"), myf, myb, p(0).X, p(0).Y)
                        Case 2
                            e.Graphics.DrawString(myds.Tables("jiangcheng").Rows(k).Item("姓名"), myf, myb, p(0).X, p(0).Y)
                        Case 3
                            e.Graphics.DrawString(myds.Tables("jiangcheng").Rows(k).Item("奖惩"), myf, myb, p(0).X, p(0).Y)
                        Case 4
                            e.Graphics.DrawString(myds.Tables("jiangcheng").Rows(k).Item("奖惩原因"), myf, myb, p(0).X, p(0).Y)
                        Case 5
                            e.Graphics.DrawString(myds.Tables("jiangcheng").Rows(k).Item("日期"), myf, myb, p(0).X, p(0).Y)
                    End Select
                Next
                For i = 1 To 6
                    p(i).Y = p(i).Y + 30
                Next
                e.Graphics.DrawLine(myp, p(1), p(6))
            Next
        End If
        myds.Clear()
        mycon.Close()
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If myyh2 = "adm" Then
            If Me.ComboBox1.Text <> "选择员工编号" Or Me.RadioButton1.Checked = True Or Me.RadioButton2.Checked = True Then
                dy = " where "
            End If
            If Me.ComboBox1.Text <> "选择员工编号" Then
                dy = dy & "员工编号 ='" & Trim(Me.ComboBox1.Text) & "'"
            End If
            If Me.RadioButton1.Checked = True Then
                If Me.ComboBox1.Text <> "选择员工编号" Then
                    dy = dy & " and 奖惩='" & Trim(Me.RadioButton1.Text) & "'"
                Else
                    dy = dy & "奖惩='" & Trim(Me.RadioButton1.Text) & "'"
                End If
            End If
            If Me.RadioButton2.Checked = True Then
                If Me.ComboBox1.Text <> "选择员工编号" Then
                    dy = dy & " and 奖惩='" & Trim(Me.RadioButton2.Text) & "'"
                Else
                    dy = dy & "奖惩='" & Trim(Me.RadioButton2.Text) & "'"
                End If

            End If
        Else
            If Me.TextBox1.Text <> "选择员工编号" Or Me.RadioButton1.Checked = True Or Me.RadioButton2.Checked = True Then
                dy = " where "
            End If
            If Me.TextBox1.Text <> "选择员工编号" Then
                dy = dy & "员工编号 ='" & Trim(Me.TextBox1.Text) & "'"
            End If
            If Me.RadioButton1.Checked = True Then
                If Me.TextBox1.Text <> "选择员工编号" Then
                    dy = dy & " and 奖惩='" & Trim(Me.RadioButton1.Text) & "'"
                Else
                    dy = dy & "奖惩='" & Trim(Me.RadioButton1.Text) & "'"
                End If
            End If
            If Me.RadioButton2.Checked = True Then
                If Me.TextBox1.Text <> "选择员工编号" Then
                    dy = dy & " and 奖惩='" & Trim(Me.RadioButton2.Text) & "'"
                Else
                    dy = dy & "奖惩='" & Trim(Me.RadioButton2.Text) & "'"
                End If
            End If

        End If
        myds.Clear()
        mycon.Close()
        Dim j, k As Integer
        Dim sqlstr As String
        sqlstr = "select * from jiangcheng" & dy
        If Not execsql(sqlstr, "jiangcheng") Then
            MsgBox("无信息")
            Exit Sub
        End If
        Me.PrintPreviewDialog1.Document = Me.PrintDocument1
        Me.PrintPreviewDialog1.ShowDialog()
    End Sub
End Class

⌨️ 快捷键说明

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