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

📄 frm_emp_add.frm

📁 一个完整的非接触IC卡会员管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Caption         =   "学历:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   3960
      TabIndex        =   6
      Top             =   720
      Width           =   972
   End
   Begin VB.Label Label6 
      Caption         =   "职务:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   492
      Left            =   3960
      TabIndex        =   5
      Top             =   240
      Width           =   972
   End
   Begin VB.Label Label5 
      Caption         =   "聘用时间:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   492
      Left            =   240
      TabIndex        =   4
      Top             =   2120
      Width           =   1212
   End
   Begin VB.Label Label4 
      Caption         =   "出生年月:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   492
      Left            =   240
      TabIndex        =   3
      Top             =   1680
      Width           =   1212
   End
   Begin VB.Label Label3 
      Caption         =   "性别:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   492
      Left            =   240
      TabIndex        =   2
      Top             =   1200
      Width           =   972
   End
   Begin VB.Label Label2 
      Caption         =   "员工姓名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   490
      Left            =   240
      TabIndex        =   1
      Top             =   720
      Width           =   1210
   End
   Begin VB.Label Label1 
      Caption         =   "员工编号:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   490
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   1210
   End
End
Attribute VB_Name = "frm_Emp_Add"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As New ADODB.Recordset
Dim strEmpID As String
Dim txt_Active As Integer

Dim str_deptid(50) As String

Private Sub cmdCencal_Click()
     cmdClose.Enabled = True
     cmdSave.Enabled = False
End Sub

Private Sub cmdClose_Click()
    
    Unload Me
End Sub

Private Sub cmdSave_Click()
txt_Active_Get
If txt_Active = 0 Then
   str_Msg = MsgBox("输入框信息不能为空,请核对!", vbInformation + vbOKOnly, "中芯德立提示信息")
   Exit Sub
End If
    
Dim str_Sex As String
If OptionSex(0).Value = True Then
   str_Sex = "男"
Else
   str_Sex = "女"
End If
'为了保证各字段值不为空,需增加条件

If str_Active = 0 Then
    Set rs = GetRecordset(maSys_db, "select * from 员工信息临时表 where 员工编号='" & txtEmpID.Text & "'")
    If Not rs.EOF Then  '该员工编号在数据库中已经存在!
       str_Msg = MsgBox("该员工编号在数据库中已经存在,请核对!", vbInformation + vbOKOnly, "中芯德立提示信息")
       Exit Sub
    End If
    maSys_db.Execute "insert into 员工信息临时表(员工编号,员工姓名,员工性别,出生年月," _
                               & "进入公司时间,职务,学历,联系电话," _
                               & "联系地址,部门,证件编号,IC卡号)" _
                   & "values(" _
                               & "'" & Trim(txtEmpID.Text) & "','" & Trim(txtEmpName.Text) & "','" & Trim(str_Sex) & "'," _
                               & "'" & Trim(DTP_Birth.Value) & "','" & Trim(DTP_Date.Value) & "','" & Trim(ComboDuty.Text) & "'," _
                               & "'" & Trim(ComboDiploma.Text) & "','" & Trim(txtPhone.Text) & "'," _
                               & "'" & Trim(txtAddress.Text) & "','" & Trim(ComboDept.Text) & "','" & Trim(txtIdCard.Text) & "','0')"

    cmdClose.Enabled = True
    cmdSave.Enabled = False
Else
'    If ComboDept.ListIndex < 0 Then
       maSys_db.Execute "update 员工信息临时表 set 员工编号='" & Trim(txtEmpID.Text) & "',员工姓名='" & Trim(txtEmpName.Text) & "'" _
                      & ",员工性别='" & Trim(str_Sex) & "',出生年月='" & Format(DTP_Birth.Value, "yyyy-mm-dd") & "'" _
                      & ",进入公司时间='" & Format(DTP_Date.Value, "yyyy-mm-dd") & "',职务='" & Trim(ComboDuty.Text) & "'" _
                      & ",学历='" & Trim(ComboDiploma.Text) & "',联系电话='" & Trim(txtPhone.Text) & "'" _
                      & ",联系地址='" & Trim(txtAddress.Text) & "'" _
                      & ",部门='" & Trim(ComboDept.Text) & "'" _
                      & ",证件编号='" & Trim(txtIdCard.Text) & "'" _
                      & " where 员工编号='" & Trim(strEmpID) & "'"
    
'    Else
'       maSys_db.Execute "update pos_Employee set field_EmployeeID='" & Trim(txtEmpID.Text) & "',field_EmployeeName='" & Trim(txtEmpName.Text) & "'" _
'                      & ",field_EmployeeSex='" & Trim(str_Sex) & "',field_EmployeeBirth='" & Trim(DTP_Birth.value) & "'" _
'                      & ",field_EmploymentDate='" & Trim(DTP_Date.value) & "',field_Duty='" & Trim(ComboDuty.Text) & "'" _
'                      & ",field_Diploma='" & Trim(ComboDiploma.Text) & "',field_Phone='" & Trim(txtPhone.Text) & "'" _
'                      & ",field_Email='" & Trim(txtEmail.Text) & "',field_Address='" & Trim(txtAddress.Text) & "'" _
'                      & ",field_Dept='" & Trim(ComboDept.Text) & "',field_deptid='" & Trim(str_deptid(ComboDept.ListIndex)) & "'" & ",field_Filiale='" & Trim(ComboFiliale.Text) & "'" _
'                      & ",field_Memo='" & Trim(txtMemo.Text) & "',field_IdCard='" & Trim(txtIdCard.Text) & "'" _
'                      & ",field_IdCard_Address='" & Trim(txtIdCardAddress.Text) & "' where field_EmployeeID='" & Trim(strEmpID) & "'"
'    End If
cmdClose.Enabled = True
cmdSave.Enabled = False

End If
End Sub

Private Sub ComboFiliale_Click()
     ComboDept_Get '更新combodept的选项
End Sub

Private Sub ComboDiploma_Get()
    ComboDiploma.AddItem "博士"
    ComboDiploma.AddItem "硕士"
    ComboDiploma.AddItem "大学本科"
    ComboDiploma.AddItem "大学专科"
    ComboDiploma.AddItem "高中"
    ComboDiploma.AddItem "中学"
    ComboDiploma.AddItem "小学"
    ComboDiploma.ListIndex = 2
End Sub
Private Sub ComboDuty_Get()
    Set rs = GetRecordset(maSys_db, "select * from 职务设置表 ")
    If Not rs.EOF Then
          ComboDuty.Clear
          Do While Not rs.EOF
             ComboDuty.AddItem Trim(rs!职务名称)
             rs.MoveNext
          Loop
          ComboDuty.ListIndex = 0
    Else
          ComboDuty.Clear
          str_Msg = MsgBox("请先增加职务信息!", vbInformation + vbOKOnly, "中芯德立提示信息")
    End If
End Sub
Private Sub ComboDept_Get()
    Dim i As Integer
    Set rs = GetRecordset(maSys_db, "select * from dept_dict")
    If Not rs.EOF Then
          ComboDept.Clear
          i = 0
          Do While Not rs.EOF
             ComboDept.AddItem Trim(rs!dept_name)
             str_deptid(i) = rs!DEPT_ID
             i = i + 1
             rs.MoveNext
          Loop
          ComboDept.ListIndex = 0
    Else
          ComboDept.Clear
          str_Msg = MsgBox("请先增加部门信息!", vbInformation + vbOKOnly, "中芯德立提示信息")
    End If
End Sub
'Private Sub ComboFiliale_Get()
'   Set rs = GetRecordset(goSys_DB, "select * from pos_Filiale")
'   If Not rs.EOF Then
'       rs.MoveFirst
'       ComboFiliale.Clear
'       Do While Not rs.EOF
'          ComboFiliale.AddItem Trim(rs!field_Filiale)
'          rs.MoveNext
'       Loop
'       ComboFiliale.ListIndex = 0
'    Else
'       str_Msg = MsgBox("请先增加分公司信息!", vbInformation + vbOKOnly, "中芯德立提示信息")
'    End If
'End Sub

Private Sub Form_Load()
    Me.Top = (Screen.Height - Me.Height) / 2
    Me.Left = (Screen.Width - Me.Width) / 2
    cmdClose.Enabled = False
    frm_Set
End Sub
Private Sub frm_Set()
    
'    ComboFiliale_Get '更新ComboFiliale的选项
    ComboDiploma_Get '更新combodiploma的选项
    ComboDuty_Get    '更新ComboDuty的选项
    ComboDept_Get
    
    If str_Active = 0 Then
       frm_Emp_Add.Caption = "员工信息增加"
       txt_MsgGet
       
       txtEmpID.Enabled = True
       'L.SubItems(1) = CStr(rs!员工编号)
'L.SubItems(2) = CStr(rs!员工姓名)
'L.SubItems(3) = CStr(rs!员工性别)
'L.SubItems(4) = CStr(rs!出生年月)
'L.SubItems(5) = CStr(rs!进入公司时间)
'L.SubItems(6) = CStr(rs!部门)
'L.SubItems(7) = CStr(rs!学历)
'L.SubItems(8) = CStr(rs!联系电话)
'L.SubItems(9) = CStr(rs!证件编号)
'L.SubItems(10) = CStr(rs!联系地址)
'L.SubItems(11) = CStr(rs!职务)
    Else
       frm_Emp_Add.Caption = "员工信息修改"
       Dim i As Integer
       i = frm_employee.ListViewEmp.SelectedItem
       txtEmpID.Text = frm_employee.ListViewEmp.ListItems(i).SubItems(1)   '员工编号
       txtEmpName.Text = frm_employee.ListViewEmp.ListItems(i).SubItems(2) '员工姓名
       If frm_employee.ListViewEmp.ListItems(i).SubItems(3) = "男" Then    '性别
           OptionSex(0).Value = True
       Else
           OptionSex(1).Value = True
       End If
       DTP_Date.Value = frm_employee.ListViewEmp.ListItems(i).SubItems(4)        '聘用时间
       DTP_Birth.Value = frm_employee.ListViewEmp.ListItems(i).SubItems(5) '出生日期
       
       ComboDuty.Text = frm_employee.ListViewEmp.ListItems(i).SubItems(11)  '职务
       ComboDiploma.Text = frm_employee.ListViewEmp.ListItems(i).SubItems(7) '学历
       txtPhone.Text = frm_employee.ListViewEmp.ListItems(i).SubItems(8)     '电话
       

       ComboDept.Text = frm_employee.ListViewEmp.ListItems(i).SubItems(6)   '部门
       
       txtIdCard.Text = frm_employee.ListViewEmp.ListItems(i).SubItems(9)   '身份证号码
       
       txtAddress.Text = frm_employee.ListViewEmp.ListItems(i).SubItems(10)  '联系地址
      
    
       txtEmpID.Enabled = False
       strEmpID = txtEmpID.Text
    End If
End Sub
Private Sub txt_Active_Get()
   txt_Active = 1
   txt_Active = txt_Active * IIf(Len(Trim(txtEmpID.Text)) = 0, 0, 1)
   txt_Active = txt_Active * IIf(Len(Trim(txtEmpName.Text)) = 0, 0, 1)
'   txt_Active = txt_Active * IIf(Len(Trim(ComboDuty.Text)) = 0, 0, 1)
'   txt_Active = txt_Active * IIf(Len(Trim(ComboDiploma.Text)) = 0, 0, 1)
'   txt_Active = txt_Active * IIf(Len(Trim(ComboFiliale.Text)) = 0, 0, 1)
   txt_Active = txt_Active * IIf(Len(Trim(ComboDept.Text)) = 0, 0, 1)
   If txtPhone = "" Then txtPhone = "0"
   If DTP_Birth.Value = "" Then DTP_Birth.Value = Now
   If DTP_Date.Value = "" Then DTP_Date.Value = Now
   If txtIdCard = "" Then txtIdCard = "0"
   If txtAddress = "" Then txtAddress = "#"
   If ComboDuty = "" Then ComboDuty = "#"
   If ComboDiploma = "" Then ComboDiploma = "#"
   
   
End Sub
Private Sub txt_MsgGet()
    
    txtEmpID.Text = ""
    txtEmpName.Text = ""
    ComboDuty.Text = ""
    ComboDiploma.Text = ""
    ComboDept.Text = ""
    
End Sub
Private Sub Form_Resize()
'    Me.Top = 1800
'    Me.Left = 4800
End Sub
Private Sub txtEmpID_KeyPress(KeyAscii As Integer)
If KeyAscii > 57 Or KeyAscii < 48 And KeyAscii <> 8 Then
        KeyAscii = 0
End If
End Sub

Private Sub txtEmpID_LostFocus()
txtEmpID = Format(txtEmpID, "00000000")
End Sub

⌨️ 快捷键说明

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