www.pudn.com > 考勤管理系统源码(VB含串口接口程序).zip > frmEmpFind.FRM


VERSION 5.00 
Begin VB.Form frmEmpFind  
   BorderStyle     =   3  'Fixed Dialog 
   Caption         =   "员工查询" 
   ClientHeight    =   3675 
   ClientLeft      =   45 
   ClientTop       =   330 
   ClientWidth     =   6855 
   BeginProperty Font  
      Name            =   "宋体" 
      Size            =   12 
      Charset         =   134 
      Weight          =   400 
      Underline       =   0   'False 
      Italic          =   0   'False 
      Strikethrough   =   0   'False 
   EndProperty 
   Icon            =   "frmEmpFind.frx":0000 
   KeyPreview      =   -1  'True 
   LinkTopic       =   "Form1" 
   LockControls    =   -1  'True 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   3675 
   ScaleWidth      =   6855 
   ShowInTaskbar   =   0   'False 
   StartUpPosition =   2  '屏幕中心 
   Begin VB.ComboBox cboEmp  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   330 
      Index           =   3 
      Left            =   3720 
      Style           =   2  'Dropdown List 
      TabIndex        =   7 
      Top             =   2265 
      Width           =   1425 
   End 
   Begin VB.TextBox txtEmp  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   360 
      Index           =   4 
      Left            =   1050 
      MaxLength       =   10 
      TabIndex        =   0 
      Top             =   285 
      Width           =   1410 
   End 
   Begin VB.TextBox txtEmp  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   360 
      Index           =   2 
      Left            =   1050 
      MaxLength       =   3 
      TabIndex        =   4 
      Top             =   1605 
      Width           =   1410 
   End 
   Begin VB.TextBox txtEmp  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   360 
      Index           =   1 
      Left            =   1050 
      MaxLength       =   10 
      TabIndex        =   2 
      Top             =   945 
      Width           =   1410 
   End 
   Begin VB.TextBox txtEmp  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   360 
      Index           =   0 
      Left            =   3735 
      MaxLength       =   4 
      TabIndex        =   1 
      Top             =   285 
      Width           =   1410 
   End 
   Begin VB.ComboBox cboEmp  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   330 
      Index           =   0 
      ItemData        =   "frmEmpFind.frx":000C 
      Left            =   3750 
      List            =   "frmEmpFind.frx":000E 
      Style           =   2  'Dropdown List 
      TabIndex        =   3 
      Top             =   945 
      Width           =   1425 
   End 
   Begin VB.ComboBox cboEmp  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   330 
      Index           =   1 
      Left            =   3735 
      Style           =   2  'Dropdown List 
      TabIndex        =   5 
      Top             =   1605 
      Width           =   1425 
   End 
   Begin VB.ComboBox cboEmp  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   330 
      Index           =   2 
      Left            =   1050 
      Style           =   2  'Dropdown List 
      TabIndex        =   6 
      Top             =   2265 
      Width           =   1425 
   End 
   Begin VB.TextBox txtEmp  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   360 
      Index           =   3 
      Left            =   1020 
      MaxLength       =   50 
      TabIndex        =   8 
      Top             =   2940 
      Width           =   4155 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "返回(R)" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   450 
      Index           =   1 
      Left            =   5565 
      TabIndex        =   10 
      Top             =   945 
      Width           =   1050 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "确定(&Y)" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   450 
      Index           =   0 
      Left            =   5565 
      TabIndex        =   9 
      Top             =   285 
      Width           =   1050 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "卡 态:" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   210 
      Index           =   7 
      Left            =   2970 
      TabIndex        =   19 
      Top             =   2325 
      Width           =   630 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "拼 音:" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   210 
      Index           =   6 
      Left            =   300 
      TabIndex        =   18 
      Top             =   330 
      Width           =   630 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "性 别:" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   210 
      Index           =   2 
      Left            =   2970 
      TabIndex        =   17 
      Top             =   1020 
      Width           =   630 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "姓 名:" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   210 
      Index           =   1 
      Left            =   300 
      TabIndex        =   16 
      Top             =   1020 
      Width           =   630 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "部 门:" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   210 
      Index           =   9 
      Left            =   2970 
      TabIndex        =   15 
      Top             =   1680 
      Width           =   630 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "职 务:" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   210 
      Index           =   4 
      Left            =   300 
      TabIndex        =   14 
      Top             =   2340 
      Width           =   630 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "年 龄:" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   210 
      Index           =   3 
      Left            =   300 
      TabIndex        =   13 
      Top             =   1680 
      Width           =   630 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "工 号:" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   210 
      Index           =   0 
      Left            =   2970 
      TabIndex        =   12 
      Top             =   345 
      Width           =   630 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "备 注:" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   210 
      Index           =   5 
      Left            =   300 
      TabIndex        =   11 
      Top             =   3000 
      Width           =   630 
   End 
End 
Attribute VB_Name = "frmEmpFind" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
Const mstrAllSex = "所有性别" 
 
Const mstrNoCard = "未发" 
Const mstrHasCard = "正常" 
Const mstrMissCard = "已挂失" 
 
'***txtEmp 
Const mWorkNo = 0 
Const mName = 1 
Const mAge = 2 
Const mNote = 3 
Const mSpell = 4 
 
'*****cboEmp 
Const mSex = 0 
Const mDept = 1 
Const mTitle = 2 
Const mStatus = 3 
 
Private Sub cboEmp_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) 
    If KeyCode = 13 Then 
        SendKeyTab KeyCode 
    End If 
End Sub 
 
Private Sub Command1_Click(Index As Integer) 
    If Index = 0 Then 
        FindEmp 
    End If 
    Unload Me 
End Sub 
 
Private Sub Form_Load() 
    With cboEmp(mDept) 
        .Clear 
        FillCbo cboEmp(mDept), aDepartment, 0 
    End With 
    With cboEmp(mTitle) 
        .Clear 
        FillCbo cboEmp(mTitle), aTitle, 0 
    End With 
     
    With cboEmp(mStatus) 
        .AddItem "所有卡态" 
        .ItemData(.NewIndex) = gMAXITEM 
        .AddItem mstrNoCard 
        .ItemData(.NewIndex) = gNoCard 
        .AddItem mstrHasCard 
        .ItemData(.NewIndex) = gHasCard 
        .AddItem mstrMissCard 
        .ItemData(.NewIndex) = gMissCard 
        .ListIndex = 0 
    End With 
     
    With cboEmp(mSex) 
        '所有性别 男 女 
        .AddItem mstrAllSex 
        .AddItem "男" 
        .AddItem "女" 
        If .ListCount > 0 Then .ListIndex = 0 
    End With 
     
End Sub 
 
 
Private Sub FindEmp() 
    Dim Sql As String 
    Dim WhereFlag As Boolean 
    Dim Str As String 
    Dim TempRst As Recordset 
     
    Dim strWorkNo As String 
    Dim strSpell As String 
    Dim strName As String 
    Dim strSex As String 
    Dim strAge As String 
    Dim intDept As Integer 
    Dim intTitle As Integer 
    Dim intStatus As Integer 
    Dim strNote As String 
     
    strSpell = Trim(txtEmp(mSpell)) 
    strWorkNo = Trim(txtEmp(mWorkNo)) 
    strName = Trim(txtEmp(mName)) 
    strSex = Trim(cboEmp(mSex).Text) 
    strAge = Trim(txtEmp(mAge)) 
    strNote = Trim(txtEmp(mNote)) 
    getItemData cboEmp(mDept), intDept 
    getItemData cboEmp(mTitle), intTitle 
    getItemData cboEmp(mStatus), intStatus 
     
    Sql = " Select WorkNo from Employee " 
     
    If strWorkNo <> Empty Then 
        Sql = Sql & " where " & "InStr(1,WorkNo,'" & strWorkNo & "',0)>0 " 
        WhereFlag = True 
    End If 
     
    Sql = Sql & JoinSqlStr(strName, WhereFlag, "Name", True) 
    Sql = Sql & JoinSqlStr(UCase(strSpell), WhereFlag, "Spell", True) 
    If Not isEmpty(strAge) Then Sql = Sql & JoinSqlStr(strAge, WhereFlag, "Age", False) 
    If strSex <> mstrAllSex Then Sql = Sql & JoinSqlStr(strSex, WhereFlag, "Sex", True) 
    If intDept <> gMAXITEM Then Sql = Sql & JoinSqlStr(intDept, WhereFlag, "DeptID", False) 
    If intTitle <> gMAXITEM Then Sql = Sql & JoinSqlStr(intTitle, WhereFlag, "TitleID", False) 
    If intStatus <> gMAXITEM Then Sql = Sql & JoinSqlStr(intStatus, WhereFlag, "CardStatus", False) 
    Sql = Sql & JoinSqlStr(strNote, WhereFlag, "Note", True) 
     
    Sql = Sql & " order  by WorkNo " 
    Set TempRst = gDataBase.OpenRecordset(Sql) 
'    Dim myFrm As New frmEmploy 
'    Set myFrm = New frmEmploy 
    If TempRst.RecordCount > 0 Then 
        Do While Not TempRst.EOF 
            With frmEmploy.mcolWorkno 
                .Add Trim(TempRst!WorkNo), Trim(TempRst!WorkNo) 
                TempRst.MoveNext 
            End With 
        Loop 
        TempRst.Close 
        Unload Me 
    Else 
        MsgBox "没有符合条件的记录", vbInformation, gTitle 
    End If 
                 
End Sub 
 
 
' 
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) 
    If KeyCode = 27 Then 
        Command1_Click 1 
    End If 
End Sub 
 
Private Sub txtEmp_GotFocus(Index As Integer) 
    GotFocus txtEmp(Index) 
End Sub 
 
Private Sub txtEmp_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) 
    If KeyCode = 13 Then 
        SendKeyTab KeyCode 
    End If 
End Sub 
 
Private Sub txtEmp_KeyPress(Index As Integer, KeyAscii As Integer) 
    Select Case Index 
        Case mWorkNo, mAge 
            KeyAscii = ValiText(KeyAscii, "0123456789", True) 
    End Select 
End Sub