📄 frminfo.frm
字号:
Begin VB.CheckBox chkCount
Caption = "显示人数"
Height = 255
Left = 480
TabIndex = 16
Top = 240
Value = 1 'Checked
Width = 1095
End
Begin VB.Image imgPic
Height = 255
Index = 0
Left = 60
Top = 200
Width = 255
End
End
Begin VB.Frame fraFind
Height = 600
Left = 0
TabIndex = 8
Top = 600
Width = 9495
Begin VB.ComboBox cboFind
Height = 300
Index = 0
ItemData = "frmInfo.frx":59C8
Left = 360
List = "frmInfo.frx":59D5
Style = 2 'Dropdown List
TabIndex = 14
Top = 200
Width = 1815
End
Begin VB.ComboBox cboFind
Height = 300
Index = 2
ItemData = "frmInfo.frx":5A01
Left = 4080
List = "frmInfo.frx":5A1A
Style = 2 'Dropdown List
TabIndex = 13
Top = 200
Width = 1695
End
Begin VB.TextBox txtFind
Height = 300
Left = 5820
TabIndex = 11
Top = 200
Width = 2775
End
Begin VB.CommandButton cmdFind
Caption = "查询"
Height = 350
Left = 8640
TabIndex = 10
Top = 180
Width = 735
End
Begin VB.ComboBox cboFind
Height = 300
Index = 1
Left = 2220
Style = 2 'Dropdown List
TabIndex = 9
Top = 200
Width = 1815
End
Begin VB.Image imgPic
Height = 255
Index = 1
Left = 60
Top = 200
Width = 255
End
End
Begin VB.Menu mnuPopUp
Caption = "popMenu"
Index = 0
Visible = 0 'False
Begin VB.Menu mnuPopMenuA
Caption = "部门编辑(&E)..."
Index = 0
End
Begin VB.Menu mnuPopMenuA
Caption = "属性(&R)"
Index = 1
End
End
Begin VB.Menu mnuPopUp
Caption = "popMenu"
Index = 1
Visible = 0 'False
Begin VB.Menu mnuPopMenuB
Caption = "企业属性(&R)..."
Index = 0
End
Begin VB.Menu mnuPopMenuB
Caption = "部门编辑(&E)..."
Index = 1
End
End
Begin VB.Menu mnuSys
Caption = "系统(&S)"
Begin VB.Menu mnuUser
Caption = "用户..."
Shortcut = ^U
End
Begin VB.Menu mnuLine1
Caption = "-"
End
Begin VB.Menu mnuPrint
Caption = "打印..."
Shortcut = ^P
End
Begin VB.Menu mnuLine3
Caption = "-"
End
Begin VB.Menu mnuExit
Caption = "注销..."
Index = 0
Shortcut = ^L
End
Begin VB.Menu mnuExit
Caption = "退出"
Index = 1
Shortcut = ^X
End
End
Begin VB.Menu mnuArchives
Caption = "人事档案(&F)"
Begin VB.Menu mnuEdit
Caption = "企业信息"
Index = 0
End
Begin VB.Menu mnuEdit
Caption = "隶属部门"
Index = 1
End
Begin VB.Menu mnuLine4
Caption = "-"
End
Begin VB.Menu mnuBasic
Caption = "基本数据"
End
End
Begin VB.Menu mnuManage
Caption = "数据管理(&M)"
Begin VB.Menu mnuOut
Caption = "备份与恢复..."
Index = 0
End
Begin VB.Menu mnuOut
Caption = "导出资料..."
Index = 1
End
End
Begin VB.Menu mnuHelp
Caption = "帮助(&H)"
Begin VB.Menu mnuSubHelp
Caption = "帮助主题..."
Shortcut = {F1}
End
Begin VB.Menu mnuAbout
Caption = "关于"
Shortcut = ^A
End
End
End
Attribute VB_Name = "frmInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim adoCallLink As New ADODB.Recordset '连接选择框中显示的数据
Dim adoTempLink As New ADODB.Recordset
Dim intPopulace As Integer
Dim strHead As String
Dim intTemp As Integer
Dim intButton As Integer
Dim intLine(1) As Integer
Dim strColName As String
Dim strSelect As String
Dim strFrm As String
Dim blnChk As Boolean
Private Sub cboFind_Click(Index As Integer)
If Index <> 0 Then Exit Sub
On Error GoTo errNext
cboFind(1).Clear
Select Case cboFind(0).ListIndex
Case 0: '详细资料
cboFind(2).Visible = True
txtFind.ToolTipText = "请输入查询内容"
intLine(0) = 5820
intLine(1) = 6760
Dim intTemp As Integer
With adoTempLink
If .State = adStateOpen Then .Close
.Open "select * from v员工详细资料", adoConn, adOpenDynamic, adLockPessimistic, adCmdText
intTemp = .Fields.Count - 1
For intCount = 0 To intTemp
cboFind(1).AddItem .Fields(intCount).Name, intCount
Next
End With
Case 1: '合同
cboFind(2).Visible = False
intLine(0) = 4080
intLine(1) = 5020
txtFind.ToolTipText = "请输入终止年份"
'txtFind.Text = intHYear & "-" & intHMonth & "-" & intHday
cboFind(1).AddItem "到期", 0
cboFind(1).AddItem "所有", 1
txtFind.Text = CDate(Year(Now) & "-" & Month(Now) & "- " & Day(Now))
Case 2: '试用期
cboFind(2).Visible = False
intLine(0) = 4080
intLine(1) = 5020
txtFind.ToolTipText = "请输入试用月数"
'txtFind.Text = intMonth
cboFind(1).AddItem "到期", 0
cboFind(1).AddItem "所有", 1
txtFind.Text = 1
End Select
cboFind(1).ListIndex = 0
cboFind(2).ListIndex = 0
txtFind.Left = intLine(0)
txtFind.Width = fraFind.Width - intLine(1)
'txtFind.Text = ""
Exit Sub
errNext:
MsgBox "错误:" & Err.Number & vbCrLf & Err.Description, vbOKOnly + vbExclamation, "运行错误"
End Sub
Private Sub chkCount_Click()
If chkCount.Value = 0 Then
blnChk = False
Else
blnChk = True
End If
Call AddTreeView
End Sub
Private Sub cmdButton_Click(Index As Integer)
Select Case Index
Case 0:
frmEdit.Show
Call frmEdit.cmdEdit_Click(0)
Case 1:
Call dgdmain_DblClick
Case 2:
If MsgBox("确认要删除吗?", vbInformation + vbYesNo, App.Title) = vbYes Then
If adoCallLink.EOF = True Then Exit Sub
With adoTempLink
If .State = adStateOpen Then .Close
.Open "select 员工编号 from 员工详细资料 where 员工编号='" & Trim(adoCallLink.Fields("员工编号")) & "'", adoConn, adOpenDynamic, adLockPessimistic, adCmdText
If .EOF = False Then
.Delete
.MoveNext
intPopulace = intPopulace - 1
If intPopulace = 0 Then cmdButton(1).Enabled = False: cmdButton(2).Enabled = False
If intTemp = 0 Then tvwManage.Nodes(nodName.Key).Text = strTvwName & "(" & intPopulace & ")"
adoCallLink.Requery
staInfo.Panels(1).Text = "[" & strTvwName & "]共有" & intPopulace & "个人"
intPalCount(1) = intPalCount(1) - 1
staInfo.Panels(3).Text = "公司员工数:" & intPalCount(1) & "个"
MsgBox "删除成功!", vbInformation, App.Title
Else
MsgBox "发生错误,在数据库中未找该编号的员工!", vbInformation + vbYesNo, App.Title
End If
End With
End If
Case 3:
Unload Me
End Select
End Sub
Private Sub dgdmain_DblClick()
If adoCallLink.EOF = True Then Exit Sub
strString = Trim(adoCallLink.Fields("员工编号"))
frmEdit.Show
Call frmEdit.subLoad
End Sub
Private Sub dgdmain_HeadClick(ByVal ColIndex As Integer)
strHead = dgdmain.Columns(ColIndex).Caption
Call ManageLoad(intTemp)
End Sub
Private Sub dgdmain_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call dgdmain_DblClick
End Sub
Private Sub Form_Load()
On Error Resume Next
Me.Caption = App.Title & " Ver " & App.Major & "." & App.Minor
Me.Move GetSetting(App.Title, "Settings", "MainLeft", 1000), _
GetSetting(App.Title, "Settings", "MainTop", 1000), _
GetSetting(App.Title, "Settings", "MainWidth", 6500), _
GetSetting(App.Title, "Settings", "MainHeight", 6500)
imgPic(0).Picture = iltPic.ListImages(6).Picture
imgPic(1).Picture = iltPic.ListImages(13).Picture
imgPic(2).Picture = iltPic.ListImages(14).Picture
blnLogout = True
blnInfo = True
tvwManage.ImageList = iltPic
blnChk = True
strHead = "员工编号"
intButton = 2
cboFind(0).ListIndex = 0
strSelect = "*"
strColName = "隶属部门"
Call AddTreeView
End Sub
Public Sub AddTreeView()
Dim intTemp(1) As Integer
Dim strTempNode() As String
Dim strTempName() As String
Dim intCount As Integer
Dim intRecordCount As Integer
On Error GoTo ErrHandle
tvwManage.Visible = False
intPalCount(0) = 0
intPalCount(1) = 0
With adoLink
If .State = adStateOpen Then .Close
tvwManage.Nodes.Clear
.Open "select * from 公司信息", adoConn, adOpenDynamic, adLockPessimistic, adCmdText
If .EOF = False And Len(Trim(.Fields("公司名称"))) <> 0 Then
tvwManage.Nodes.Add , , "A", .Fields("公司名称"), 1
Else
tvwManage.Nodes.Add , , "A", "公司", 1
End If
.Close
intTemp(0) = 1
intTemp(1) = 1
nodLong(0) = 1
strTemp(0) = "C"
strTemp(1) = "A"
.Open "select * from 隶属部门 order by 层次,id", adoConn, adOpenDynamic, adLockPessimistic, adCmdText
nodLong(0) = 1
If .EOF = False Then ReDim strTempNode(.RecordCount): ReDim strTempName(.RecordCount)
Do Until .EOF
intPalCount(0) = intPalCount(0) + 1
If intTemp(0) <> .Fields("层次") Then
nodLong(0) = 1
strTemp(0) = strTemp(0) & "C"
strTemp(1) = strTemp(0) & (nodLong(0))
intTemp(0) = intTemp(0) + 1
End If
strTempNode(intTemp(1)) = strTemp(0) & nodLong(0)
strTempName(intTemp(1)) = .Fields("隶属部门")
For intCount = 1 To intTemp(1)
If .Fields("上层部门") = strTempName(intCount) Then
strTemp(2) = strTempNode(intCount)
Exit For
Else
strTemp(2) = strTemp(1)
End If
Next
If blnChk = True Then
With adoTempLink '读取有多少员工在这个部门
If .State = adStateOpen Then .Close
.Open "select 员工编号,隶属部门,姓名 from v员工详细资料 where 隶属部门='" & adoLink.Fields("隶属部门") & "'", adoConn, adOpenDynamic, adLockPessimistic, adCmdText
If .EOF = True Then
intRecordCount = 0
Else
.MoveLast
intRecordCount = .RecordCount
End If
End With
tvwManage.Nodes.Add strTemp(2), tvwChild, strTemp(0) & nodLong(0), Trim(!隶属部门) & "(" & intRecordCount & ")", intTemp(0) + 1
Else
tvwManage.Nodes.Add strTemp(2), tvwChild, strTemp(0) & nodLong(0), Trim(!隶属部门), intTemp(0) + 1
End If
nodLong(0) = nodLong(0) + 1
intTemp(1) = intTemp(1) + 1
.MoveNext
Loop
With adoTempLink
If .State = adStateOpen Then .Close
.Open "select 员工编号 from v员工详细资料", adoConn, adOpenDynamic, adLockPessimistic, adCmdText
If .EOF = False Then
.MoveLast
intPalCount(1) = .RecordCount
End If
End With
tvwManage.Nodes("A").Expanded = True
staInfo.Panels(2).Text = "公司部门数:" & intPalCount(0) & "个"
staInfo.Panels(3).Text = "公司员工数:" & intPalCount(1) & "个"
End With
Call frmInfo.ManageLoad(1)
tvwManage.Visible = True
Exit Sub
ErrHandle:
tvwManage.Visible = True
MsgBox "错误:" & Err.Number & vbCrLf & Err.Description, vbOKOnly + vbExclamation, "运行错误"
End Sub
Private Sub cmdFind_Click()
Dim strTemp As String
On Error GoTo errNext
Select Case cboFind(0).ListIndex
Case 0: '详细资料
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -