📄 timewage.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmTime_Piece_LiftWage
Caption = "计时工资管理"
ClientHeight = 7770
ClientLeft = 60
ClientTop = 450
ClientWidth = 9855
LinkTopic = "Form1"
ScaleHeight = 7770
ScaleWidth = 9855
StartUpPosition = 3 '窗口缺省
WindowState = 2 'Maximized
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 570
Left = 0
TabIndex = 0
Top = 0
Width = 9855
_ExtentX = 17383
_ExtentY = 1005
ButtonWidth = 2090
ButtonHeight = 953
Wrappable = 0 'False
Appearance = 1
Style = 1
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 16
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "隐藏部门栏"
Key = "Hide"
Style = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "查找"
Key = "Select"
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "全部"
Key = "All"
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "全部工资信息"
Key = "ShowAll"
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "新增"
Key = "Add"
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
Key = "Update"
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
Key = "Delete"
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Excel"
Key = "Excel"
EndProperty
BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "打印"
Key = "Print"
EndProperty
BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "工资条"
Key = "PieceWage"
EndProperty
BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "Back"
EndProperty
EndProperty
BorderStyle = 1
End
Begin MSComctlLib.TreeView TreePartment
Height = 10485
Left = 0
TabIndex = 1
Top = 600
Width = 2175
_ExtentX = 3836
_ExtentY = 18494
_Version = 393217
Style = 7
Appearance = 1
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 5955
Left = 2280
TabIndex = 2
Top = 600
Width = 12915
_ExtentX = 22781
_ExtentY = 10504
_Version = 393216
Cols = 40
ScrollTrack = -1 'True
SelectionMode = 1
End
End
Attribute VB_Name = "frmTime_Piece_LiftWage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Dim adors As New Recordset '定义一个记录集,记录科目类型
Dim rsPartment As New Recordset '定义一个记录集,记录每种科目类型中的科目
Dim strSQL As String '定义一个字符串,将查询科目类型的sql语句付给它
Dim strSQLQuery As String '定义一个字符串,将查询每种科目类型下的科目的sql语句付给它
Dim strPartmentType(10) As String '定义一个数组,存储科目类型
Dim strPartment As String '定义字符串,将每种科目类型下的科目附值给它
Dim intIndex(10) As Integer '定义一个数组,记录根节点index
Dim i As Integer '定义一个整数,存储是第i个根节点
'/***********************************TreeVeiwStart********************************************/
TreePartment.Sorted = True '主目录
Set mNode = TreePartment.Nodes.Add()
mNode.Text = "我的公司/单位"
Set adors.ActiveConnection = ADOcn '添加一级目录
strSQL = "Select distinct 名称 from 部门类型 where 级别=1 "
adors.Open strSQL
Do Until adors.EOF
Set mNode = TreePartment.Nodes.Add(1, tvwChild)
strPartmentType(i) = adors.Fields("名称")
mNode.Text = strPartmentType(i)
intIndex(i) = mNode.Index
i = i + 1
adors.MoveNext
Loop
Set mNode = TreePartment.Nodes.Add(1, tvwChild)
mNode.Text = "工种"
intIndex(i) = mNode.Index
i = i + 1
Set mNode = TreePartment.Nodes.Add(1, tvwChild)
mNode.Text = "职务"
intIndex(i) = mNode.Index
i = i + 1
Set mNode = TreePartment.Nodes.Add(1, tvwChild)
mNode.Text = "职称"
intIndex(i) = mNode.Index
i = i + 1
Set mNode = TreePartment.Nodes.Add(1, tvwChild)
mNode.Text = "所有员工列表"
intIndex(i) = mNode.Index
i = i + 1
adors.Close
Set rsPartment.ActiveConnection = ADOcn '添加部门子目录
For i = 0 To i - 4
strSQLQuery = "Select 名称 from 部门类型 where 上级='" + strPartmentType(i) + "'"
rsPartment.Open strSQLQuery
Do Until rsPartment.EOF
Set mNode = TreePartment.Nodes.Add(intIndex(i), tvwChild)
strPartment = rsPartment.Fields("名称")
mNode.Text = strPartment
rsPartment.MoveNext
Loop
rsPartment.Close '关闭记录集,一定要记住。
Next i
Set rsPartment.ActiveConnection = ADOcn '添加工种的子目录
strSQLQuery = "Select 工种 from 工种"
rsPartment.Open strSQLQuery
Do Until rsPartment.EOF
Set mNode = TreePartment.Nodes.Add(intIndex(i - 1), tvwChild)
strPartment = rsPartment.Fields("工种")
mNode.Text = strPartment
rsPartment.MoveNext
Loop
rsPartment.Close
Set rsPartment.ActiveConnection = ADOcn '添加职务的子目录
strSQLQuery = "Select 职务 from 职务"
rsPartment.Open strSQLQuery
Do Until rsPartment.EOF
Set mNode = TreePartment.Nodes.Add(intIndex(i), tvwChild)
strPartment = rsPartment.Fields("职务")
mNode.Text = strPartment
rsPartment.MoveNext
Loop
rsPartment.Close
i = i + 1
Set rsPartment.ActiveConnection = ADOcn '添加职称的子目录
strSQLQuery = "Select 职称 from 职称"
rsPartment.Open strSQLQuery
Do Until rsPartment.EOF
Set mNode = TreePartment.Nodes.Add(intIndex(i), tvwChild)
strPartment = rsPartment.Fields("职称")
mNode.Text = strPartment
rsPartment.MoveNext
Loop
rsPartment.Close
i = i + 1
Set rsPartment.ActiveConnection = ADOcn '添加人员的子目录
strSQLQuery = "Select 姓名 from 人事档案"
rsPartment.Open strSQLQuery
Do Until rsPartment.EOF
Set mNode = TreePartment.Nodes.Add(intIndex(i), tvwChild)
strPartment = rsPartment.Fields("姓名")
mNode.Text = strPartment
rsPartment.MoveNext
Loop
rsPartment.Close
'/***********************************TreeVeiwStart********************************************/
Dim colWidth As Integer
colWidth = MSFlexGrid1.Width / 8
MSFlexGrid1.colWidth(0) = colWidth * 0.1
For i = 1 To 8
MSFlexGrid1.colWidth(i) = colWidth * 0.8
Next
End Sub
Private Sub MSFlexGrid1_DblClick()
Appear = 0
Dim mystr As String
MSFlexGrid1.Col = 0
mystr = MSFlexGrid1.Text
frmTime_Piece_LiftInfo.lblID = mystr
frmReward_PunishInfo.lblID = mystr
If WageType = "time" Then
frmTime_Piece_LiftInfo.Show
ElseIf WageType = "piece" Then
frmTime_Piece_LiftInfo.Show
frmTime_Piece_LiftInfo.Caption = "员工计件信息"
frmTime_Piece_LiftInfo.Label11.Caption = "件"
ElseIf WageType = "lift" Then
frmTime_Piece_LiftInfo.Show
frmTime_Piece_LiftInfo.Caption = "员工提成信息"
frmTime_Piece_LiftInfo.Label11.Caption = "%"
frmTime_Piece_LiftInfo.Label3.Caption = "提成项目:"
frmTime_Piece_LiftInfo.Label4.Caption = "业务量:"
frmTime_Piece_LiftInfo.Label5.Caption = "提成率:"
frmTime_Piece_LiftInfo.Label6.Caption = "提成金额:"
ElseIf WageType = "reward" Then
frmReward_PunishInfo.Show
ElseIf WageType = "punish" Then
frmReward_PunishInfo.Show
End If
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error Resume Next
Select Case Button.Key
Case "Hide"
'应做:添加 '新建' 按钮代码。
TreePartment.Visible = False
Button.Caption = "显示部门栏"
Button.Key = "Show"
Case "Show"
TreePartment.Visible = True
Button.Caption = "隐藏部门栏"
Button.Key = "Hide"
Case "Select"
Search = 8 '标志查询工时
ComboAddItem
frmSelect.Show
Case "All"
If WageType = "time" Then
MyRefresh_frmTimeWage
ElseIf WageType = "piece" Then
MyRefresh_frmPieceWage
ElseIf WageType = "lift" Then
MyRefresh_frmLiftWage
ElseIf WageType = "reward" Then
MyRefresh_frmRewardWage
ElseIf WageType = "punish" Then
MyRefresh_frmRewardWage
End If
Case "ShowMonth"
All = False
Button.Caption = "全部工资信息"
Button.Key = "ShowAll"
If WageType = "time" Then
MyRefresh_frmTimeWage
ElseIf WageType = "piece" Then
MyRefresh_frmPieceWage
ElseIf WageType = "lift" Then
MyRefresh_frmLiftWage
ElseIf WageType = "reward" Then
MyRefresh_frmRewardWage
ElseIf WageType = "punish" Then
MyRefresh_frmRewardWage
End If
Case "ShowAll"
All = True
Button.Caption = "当月工资信息"
Button.Key = "ShowMonth"
If WageType = "time" Then
MyRefresh_frmTimeWage
ElseIf WageType = "piece" Then
MyRefresh_frmPieceWage
ElseIf WageType = "lift" Then
MyRefresh_frmLiftWage
ElseIf WageType = "reward" Then
MyRefresh_frmRewardWage
ElseIf WageType = "punish" Then
MyRefresh_frmRewardWage
End If
Case "Add"
frmHumanList.Show
Case "Update"
MSFlexGrid1_DblClick
Case "Delete"
Delete
Case "Back"
Unload Me
End Select
End Sub
Private Sub ComboAddItem()
frmSelect.comboyiju.AddItem ("工序名称")
frmSelect.comboyiju.AddItem ("单价")
frmSelect.comboyiju.AddItem ("数量")
frmSelect.comboyiju.AddItem ("小计")
frmSelect.comboyiju.AddItem ("登记日期")
frmSelect.comboyiju.AddItem ("所属工资月份")
End Sub
Private Sub Delete()
Dim strSQL As String
Dim mystr As String
MSFlexGrid1.Col = 0
mystr = MSFlexGrid1.Text
If MsgBox("你真的要删除它吗?", vbInformation + vbYesNo) = vbYes Then
If WageType = "time" Then
strSQL = "Delete From 计时工资表 Where ID=" + mystr
ADOcn.Execute strSQL
MyRefresh_frmTimeWage
ElseIf WageType = "piece" Then
strSQL = "Delete From 计件工资表 Where ID=" + mystr
ADOcn.Execute strSQL
MyRefresh_frmPieceWage
ElseIf WageType = "lift" Then
strSQL = "Delete From 提成工资表 Where ID=" + mystr
ADOcn.Execute strSQL
MyRefresh_frmLiftWage
ElseIf WageType = "reward" Then
strSQL = "Delete From 员工奖励表 Where ID=" + mystr
ADOcn.Execute strSQL
MyRefresh_frmRewardWage
ElseIf WageType = "punish" Then
strSQL = "Delete From 员工惩罚表 Where ID=" + mystr
ADOcn.Execute strSQL
MyRefresh_frmPunishWage
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -