📄 main_xtgl_qxgl.frm
字号:
EndProperty
BeginProperty Column01
ColumnWidth = 1814.74
EndProperty
BeginProperty Column02
ColumnWidth = 1425.26
EndProperty
BeginProperty Column03
ColumnWidth = 14.74
EndProperty
BeginProperty Column04
ColumnWidth = 14.74
EndProperty
EndProperty
End
End
Begin VB.Frame Frame5
Height = 3300
Left = 5385
TabIndex = 12
Top = 1350
Width = 2850
Begin VB.CheckBox Check1
Caption = "应收应付帐款管理"
Height = 285
Index = 7
Left = 300
TabIndex = 28
Top = 2910
Width = 2400
End
Begin VB.CheckBox Check1
Caption = "财政管理"
Height = 285
Index = 6
Left = 300
TabIndex = 27
Top = 2520
Width = 2400
End
Begin VB.CheckBox Check1
Caption = "后台管理"
Height = 285
Index = 5
Left = 300
TabIndex = 26
Top = 2130
Width = 2400
End
Begin VB.CheckBox Check1
Caption = "前台管理"
Height = 285
Index = 4
Left = 300
TabIndex = 25
Top = 1755
Width = 2400
End
Begin VB.CheckBox Check1
Caption = "结帐分析"
Height = 285
Index = 3
Left = 300
TabIndex = 24
Top = 1395
Width = 2400
End
Begin VB.CheckBox Check1
Caption = "日结算管理"
Height = 285
Index = 2
Left = 300
TabIndex = 23
Top = 1020
Width = 2400
End
Begin VB.CheckBox Check1
Caption = "收银管理"
Height = 285
Index = 1
Left = 300
TabIndex = 22
Top = 615
Width = 2400
End
Begin VB.CheckBox Check1
Caption = "开台管理"
Height = 285
Index = 0
Left = 300
TabIndex = 21
Top = 240
Width = 2400
End
End
Begin VB.Frame Frame6
Height = 720
Left = 30
TabIndex = 13
Top = 4590
Width = 5280
Begin VB.CommandButton Comdel
Caption = "删除操作员"
Height = 330
Left = 3390
TabIndex = 16
Top = 240
Width = 1605
End
Begin VB.CommandButton Commod
Caption = "修改操作员"
Height = 330
Left = 1740
TabIndex = 15
Top = 240
Width = 1605
End
Begin VB.CommandButton Comadd
Caption = "添加新操作员"
Height = 330
Left = 90
TabIndex = 14
Top = 240
Width = 1605
End
End
End
Attribute VB_Name = "main_xtgl_qxgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'定义数据集对象
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Dim rs4 As New ADODB.Recordset
Dim myval, str1 As String '定义字符串变量
Dim i As Integer '定义整型变量
Private Sub Form_Activate()
Option1.Value = True
'添加员工列表
rs1.Open "select 员工姓名 from 员工信息表 group by 员工姓名", cnn, adOpenKeyset, adLockOptimistic
If rs1.BOF = False Then rs1.MoveFirst
For i = 0 To rs1.RecordCount - 1
Combo1.AddItem (Trim(rs1.Fields("员工姓名")))
rs1.MoveNext
Next i
If Combo1.ListCount > 0 Then Combo1.ListIndex = 0
rs1.Close
'添加员工级别列表
rs2.Open "select 级别名称 from 员工级别表 group by 级别名称", cnn, adOpenKeyset, adLockOptimistic
If rs2.BOF = False Then rs2.MoveFirst
For i = 0 To rs2.RecordCount - 1
Combo2.AddItem (Trim(rs2.Fields("级别名称")))
rs2.MoveNext
Next i
If Combo2.ListCount > 0 Then Combo2.ListIndex = 0
rs2.Close
For i = 0 To 7
Check1(i).Enabled = False
Next i
Me.Caption = Me.Caption & " " & frm_main.St1.Panels(3).text
End Sub
Private Sub Combo1_Click()
rs3.Open "select * from 员工信息表 where 员工姓名='" + Trim(Combo1.text) + "'", cnn, adOpenKeyset, adLockOptimistic
If rs3.RecordCount > 0 Then
Text1.text = Trim(rs3.Fields("员工编号"))
Combo2.text = Trim(rs3.Fields("员工级别"))
End If
rs3.Close
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text2.SetFocus
End Sub
Private Sub Option1_Click() '选择基本操作员
If Option1.Value = True Then
For i = 0 To 7
Check1(i).Enabled = False
Next i
End If
End Sub
Private Sub Option2_Click() '选择高级操作员
If Option2.Value = True Then
For i = 0 To 7
Check1(i).Enabled = False
Next i
End If
End Sub
Private Sub Option3_Click() '选择自定义
If Option3.Value = True Then
For i = 0 To 7
Check1(i).Enabled = True
Next i
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Combo2.SetFocus '回车combo2获得焦点
End Sub
Private Sub ComSave_Click() '保存操作员信息
rs4.Open "select * from 权限信息表 where 操作员姓名='" + Trim(Combo1.text) + "'", cnn, adOpenKeyset, adLockOptimistic
If rs4.RecordCount > 0 Then
myval = MsgBox("确定要修改该操作员吗?", vbYesNo)
If myval = vbYes Then
rs4.Fields("操作员姓名") = Trim(Combo1.text)
rs4.Fields("编号") = Trim(Text1.text)
rs4.Fields("密码") = Trim(Text2.text)
rs4.Fields("员工级别") = Trim(Combo2.text)
rs4.Update '更新数据库
Adodc1.Refresh
End If
Else
If Combo1.text <> "" Then
myval = MsgBox("确定要保存该操作员吗?", vbYesNo)
If myval = vbYes Then
rs4.AddNew
rs4.Fields("操作员姓名") = Trim(Combo1.text)
rs4.Fields("编号") = Trim(Text1.text)
rs4.Fields("密码") = Trim(Text2.text)
rs4.Fields("员工级别") = Trim(Combo2.text)
rs4.Update '更新数据库
Adodc1.Refresh
End If
End If
End If
rs4.Close
Frame1.Visible = False
End Sub
Private Sub ComAdd_Click() '允许添加
Frame1.Visible = True: Combo1.Enabled = True
Text1.Enabled = True: Text2.Enabled = True
End Sub
Private Sub Comcancel_Click() '取消操作
Frame1.Visible = False
End Sub
Private Sub Comdel_Click() '删除操作员
If Adodc1.Recordset.RecordCount > 0 Then
myval = MsgBox("确定要删除该操作员吗?", vbYesNo)
If myval = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Refresh
End If
Else
MsgBox "没有要删除的记录!"
End If
End Sub
Private Sub Commod_Click() '修改操作员信息
If Adodc1.Recordset.RecordCount > 0 Then
Frame1.Visible = True
Combo1.text = Trim(Adodc1.Recordset.Fields("操作员姓名"))
Text1.text = Trim(Adodc1.Recordset.Fields("编号"))
Text2.text = Trim(Adodc1.Recordset.Fields("密码"))
Combo2.text = Trim(Adodc1.Recordset.Fields("员工级别"))
Else
MsgBox "没有要修改的记录!"
End If
End Sub
Private Sub cmdOK_Click() '为操作员设置权限
If Adodc1.Recordset.RecordCount > 0 Then
If Check1(0).Value = 1 Then str1 = str1 & "K"
If Check1(1).Value = 1 Then str1 = str1 & "S"
If Check1(2).Value = 1 Then str1 = str1 & "R"
If Check1(3).Value = 1 Then str1 = str1 & "J"
If Check1(4).Value = 1 Then str1 = str1 & "Q"
If Check1(5).Value = 1 Then str1 = str1 & "H"
If Check1(6).Value = 1 Then str1 = str1 & "C"
If Check1(7).Value = 1 Then str1 = str1 & "Y"
rs1.Open "select * from 权限信息表 where 编号='" + Trim(Adodc1.Recordset.Fields("编号")) + "'", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
If Option1.Value = True Then
rs1.Fields("权限") = "A"
rs1.Update
End If
If Option2.Value = True Then
rs1.Fields("权限") = "B"
rs1.Update
End If
If Option3.Value = True Then
rs1.Fields("权限") = str1
rs1.Update
End If
MsgBox "设置权限已成功完成!"
Else
MsgBox "请添加操作员并设置权限!"
End If
rs1.Close
Else
MsgBox "系统当前无记录!"
End If
End Sub
Private Sub comend_Click()
frm_main.Enabled = True
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -