📄 frmfloor.frm
字号:
Sleep 500 '延时500毫秒
'更新员工工资福利各项统计表中该员工的收入总和,税收总和,工资总和
txtsql = "update pb_employeesum set sumIncome=" & SumIncome(tempNumber) & "," & "sumRevenue=" & Sumrevenue(tempNumber) & "," & "sumPay=" & sumPay(tempNumber) & Space(1) & "where employeeid =" & "'" & tempNumber & "'"
If mrc1.State = adStateOpen Then mrc1.Close
mrc1.Open txtsql, adoConn, adOpenDynamic, adLockPessimistic, adCmdText
Case "2" '支出项目
If .TextMatrix(.Row, 1) = "" Then '保存该支出项目
txtsql = "select * from pb_employeepayout"
If mrc1.State = adStateOpen Then mrc1.Close
mrc1.Open txtsql, adoConn, adOpenDynamic, adLockPessimistic, adCmdText
mrc1.AddNew
mrc1.Fields("employeeid").Value = tempNumber '员工编号
mrc1.Fields("payoutid").Value = .TextMatrix(.Row, 3) '支出序列号
mrc1.Fields("payoutvalue").Value = Val((Trim(txtValue.Text))) '支出值
mrc1.Update
mrc1.Close
.TextMatrix(.Row, 4) = Trim(txtValue.Text)
MsgBox "信息已保存", vbInformation, App.Title
Else '修改该项目
txtsql = "update pb_employeepayout set payoutvalue=" & Val(Trim(txtValue.Text)) & Space(1) & "where id =" & Val(.TextMatrix(.Row, 1)) & ""
If mrc1.State = adStateOpen Then mrc1.Close
mrc1.Open txtsql, adoConn, adOpenDynamic, adLockPessimistic, adCmdText
.TextMatrix(.Row, 4) = Trim(txtValue.Text)
MsgBox "信息已修改", vbInformation, App.Title
End If
Sleep 500 '延时500毫秒
'更新员工个人福利各项统计表中该员工的支出总和,税收总和,工资总和
txtsql = "update pb_employeesum set sumPayout=" & SumPayout(tempNumber) & "," & "sumRevenue=" & Sumrevenue(tempNumber) & "," & "sumPay=" & sumPay(tempNumber) & Space(1) & "where employeeid =" & "'" & tempNumber & "'"
If mrc1.State = adStateOpen Then mrc1.Close
mrc1.Open txtsql, adoConn, adOpenDynamic, adLockPessimistic, adCmdText
Case "3" '调整项目
If .TextMatrix(.Row, 1) = "" Then '保存该调整项目
txtsql = "select * from pb_employeepayadjust"
If mrc1.State = adStateOpen Then mrc1.Close
mrc1.Open txtsql, adoConn, adOpenDynamic, adLockPessimistic, adCmdText
mrc1.AddNew
mrc1.Fields("employeeid").Value = tempNumber '员工编号
mrc1.Fields("payadjustid").Value = .TextMatrix(.Row, 3) '调整工资序列号
mrc1.Fields("payadjustvalue").Value = Val((Trim(txtValue.Text))) '调整值
mrc1.Update
mrc1.Close
.TextMatrix(.Row, 4) = Trim(txtValue.Text)
MsgBox "信息已保存", vbInformation, App.Title
Else '修改该项目
txtsql = "update pb_employeepayadjust set payadjustvalue=" & Val(Trim(txtValue.Text)) & Space(1) & "where id =" & Val(.TextMatrix(.Row, 1)) & ""
If mrc1.State = adStateOpen Then mrc1.Close
mrc1.Open txtsql, adoConn, adOpenDynamic, adLockPessimistic, adCmdText
.TextMatrix(.Row, 4) = Trim(txtValue.Text)
MsgBox "信息已修改", vbInformation, App.Title
End If
End Select
End With
cmdSaveThird.Enabled = False
End Sub
Private Sub Command1_Click()
frmPayBoonSet.Show vbModal, Me
End Sub
Private Sub ManageView()
Dim mrc1 As New ADODB.Recordset '定义一个记录集
Dim empoyee As String '树状菜单中员工的key的前两个字符值
empoyee = "员工"
Dim intTemp(1) As Integer
Dim strTempNode() As String
Dim strTempName() As String
On Error GoTo ErrHandle
tvwManage.Visible = False
With adoEditLink
If .State = adStateOpen Then .Close
tvwManage.Nodes.Clear
tvwManage.Nodes.Add , , "A", gstrCro, 1
intTemp(0) = 1 '记录层次
intTemp(1) = 1
nodLong(0) = 1
strTemp(0) = "C"
strTemp(1) = "A"
intManage = 0
.Open "select * from 隶属部门 order by 层次,部门编号,id", adoConn, adOpenDynamic, adLockPessimistic, adCmdText
If .EOF = False Then
.MoveLast
intManage = .RecordCount
.MoveFirst
ReDim strTempNode(intManage): ReDim strTempName(intManage)
intCount = 1
Do Until .EOF
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
tvwManage.Nodes.Add strTemp(2), tvwChild, strTemp(0) & nodLong(0), Trim(!隶属部门), intTemp(0) + 1
' 在此处要添加该部门下的所有员工
txtsql = "select * from 员工详细资料 where 隶属部门=" & Val(.Fields("id")) & Space(1) & "order by 员工编号 "
If mrc1.State = adStateOpen Then mrc1.Close
mrc1.Open txtsql, adoConn, adOpenDynamic, adLockPessimistic, adCmdText
If mrc1.EOF = False Then
mrc1.MoveFirst
Do Until mrc1.EOF
tvwManage.Nodes.Add strTemp(0) & nodLong(0), tvwChild, empoyee & mrc1.Fields("员工编号"), mrc1.Fields("姓名"), 15
tvwManage.Nodes.Add empoyee & mrc1.Fields("员工编号"), tvwChild, , "收入项目"
tvwManage.Nodes.Add empoyee & mrc1.Fields("员工编号"), tvwChild, , "支出项目"
tvwManage.Nodes.Add empoyee & mrc1.Fields("员工编号"), tvwChild, , "调整项目"
tvwManage.Nodes.Add empoyee & mrc1.Fields("员工编号"), tvwChild, , "福利项目"
tvwManage.Nodes.Add empoyee & mrc1.Fields("员工编号"), tvwChild, , "税收项目"
mrc1.MoveNext
Loop
End If
mrc1.Close
nodLong(0) = nodLong(0) + 1
intTemp(1) = intTemp(1) + 1
intCount = intCount + 1
.MoveNext
Loop
tvwManage.Nodes("C1").Selected = True
End If
End With
tvwManage.Visible = True
Exit Sub
ErrHandle:
tvwManage.Visible = True
Call ErrMsg(Err.Number, Err.Description)
End Sub
Private Sub Form_Load()
tvwManage.ImageList = MDIMain.iltPic
Call ManageView
MSF3.Rows = 0
'设置右边表格的样式
With MSF1
.Cols = 5
.ColWidth(0) = 2000 '显示项目名称
.ColWidth(1) = 0 '显示id
.ColWidth(2) = 0 '显示该员工id
.ColWidth(3) = 0 '显示项目编号
.ColWidth(4) = 4200 '显示项目值
.Rows = 0
.ColAlignment(4) = flexAlignRightCenter
End With
End Sub
Private Sub MSF1_Click()
If MSF1.Rows <> 0 Then
cmdSaveThird.Enabled = True
cmdDelThird.Enabled = True
lblName.Caption = MSF1.TextMatrix(MSF1.Row, 0)
txtValue.Text = MSF1.TextMatrix(MSF1.Row, 4) & ""
txtValue.SelStart = Len(txtValue.Text)
txtValue.SetFocus
End If
End Sub
Private Sub MSF2_Click()
If MSF2.Rows <> 1 Then
cmdSave.Enabled = True
cmdDel.Enabled = True
lblBoon.Caption = MSF2.TextMatrix(MSF2.Row, 0)
txtBoon.Text = MSF2.TextMatrix(MSF2.Row, 7) & ""
txtBoon.SelStart = Len(txtBoon.Text)
txtBoon.SetFocus
End If
End Sub
Private Sub tvwManage_Click()
Dim mrc1 As New ADODB.Recordset
Dim mrc2 As New ADODB.Recordset
Dim txtsql2 As String
Dim mrc3 As New ADODB.Recordset
Dim txtsql3 As String
Dim tempNumber As String '用来临时存放当前节点的员工编号
Dim tempAdjustvalue As String '用来临时保存指定福利名称下的调整工资值
'当单击每个员工下的几个项目时执行的相应操作
If tvwManage.SelectedItem.Key = "" Then
tempNumber = Trim(Mid(tvwManage.SelectedItem.Parent.Key, 3)) '从它的上级目录的key中得出员工编号
Select Case tvwManage.SelectedItem.Text
Case "收入项目"
fraThird.Visible = True
fraBoon.Visible = False '先隐藏福利下的框架
fraRevenue.Visible = False '先隐藏税收下的框架
'初始化编辑栏中的信息
lblName.Caption = "收入项目名称"
txtValue.Text = ""
MSF1.Rows = 0
MSF1.Tag = "1"
'先取出所有的收入项目名称
txtsql = "select * from pb_income"
If mrc1.State = adStateOpen Then mrc1.Close
mrc1.Open txtsql, adoConn, adOpenDynamic, adLockPessimistic, adCmdText
If mrc1.EOF = False Then
mrc1.MoveFirst
Do While Not mrc1.EOF
'在结合该条收入项目编号及该节点的员工编号从员工收入明细表中查看是否有此条记录
txtsql2 = "select id,employeeid,incomeid,incomevalue from pb_employeeincome where employeeid=" & "'" & tempNumber & "'" & "and incomeid=" & mrc1.Fields("income_id")
If mrc2.State = adStateOpen Then mrc2.Close
mrc2.Open txtsql2, adoConn, adOpenDynamic, adLockPessimistic, adCmdText
If mrc2.EOF = False Then '如果已经存在则显示
mrc2.MoveFirst
With MSF1
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 0) = mrc1.Fields("income_name")
.TextMatrix(.Rows - 1, 1) = mrc2.Fields("id")
.TextMatrix(.Rows - 1, 2) = mrc2.Fields("employeeid")
.TextMatrix(.Rows - 1, 3) = mrc2.Fields("incomeid")
.TextMatrix(.Rows - 1, 4) = mrc2.Fields("incomevalue")
End With
Else '如果没有只显示项目有关的信息,值及id为空
With MSF1
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 0) = mrc1.Fields("income_name")
.TextMatrix(.Rows - 1, 1) = ""
.TextMatrix(.Rows - 1, 2) = tempNumber '当前员工编号保存在变量中tempNumber
.TextMatrix(.Rows - 1, 3) = mrc1.Fields("income_id")
.TextMatrix(.Rows - 1, 4) = ""
End With
End If
mrc1.MoveNext
Loop
End If
Case "支出项目"
fraThird.Visible = True
fraBoon.Visible = False '先隐藏福利下的框架
fraRevenue.Visible = False '先隐藏税收下的框架
'初始化编辑栏中的信息
lblName.Caption = "支出项目名称"
txtValue.Text = ""
MSF1.Rows = 0
MSF1.Tag = "2"
'先取出所有的支出项目名称
txtsql = "select * from pb_payout"
If mrc1.State = adStateOpen Then mrc1.Close
mrc1.Open txtsql, adoConn, adOpenDynamic, adLockPessimistic, adCmdText
If mrc1.EOF = False Then
mrc1.MoveFirst
Do While Not mrc1.EOF
'在结合该条支出项目编号及该节点的员工编号从员工支出明细表中查看是否有此条记录
txtsql2 = "select id,employeeid,payoutid,payoutvalue from pb_employeepayout where employeeid=" & "'" & tempNumber & "'" & "and payoutid=" & mrc1.Fields("payout_id")
If mrc2.State = adStateOpen Then mrc2.Close
mrc2.Open txtsql2, adoConn, adOpenDynamic, adLockPessimistic, adCmdText
If mrc2.EOF = False Then '如果已经存在则显示
mrc2.MoveFirst
With MSF1
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 0) = mrc1.Fields("payout_name")
.TextMatrix(.Rows - 1, 1) = mrc2.Fields("id")
.TextMatrix(.Rows - 1, 2) = mrc2.Fields("employeeid")
.TextMatrix(.Rows - 1, 3) = mrc2.Fields("payoutid")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -