📄 工资计算.frm
字号:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form 工资计算
BackColor = &H00C0E0FF&
Caption = "工资管理窗口"
ClientHeight = 6090
ClientLeft = 60
ClientTop = 600
ClientWidth = 14700
LinkTopic = "Form1"
ScaleHeight = 6090
ScaleWidth = 14700
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton ExitCommand
Caption = "返回"
Height = 495
Left = 12960
TabIndex = 14
Top = 4320
Width = 1335
End
Begin VB.CommandButton PrintCommand
Caption = "打印工资表"
Height = 495
Left = 12960
TabIndex = 13
Top = 3570
Width = 1335
End
Begin VB.CommandButton ClearCommand
Caption = "清除此月工资"
Height = 495
Left = 12960
TabIndex = 12
Top = 2820
Width = 1335
End
Begin VB.CommandButton SumCommand
Caption = "求合计"
Height = 495
Left = 12960
TabIndex = 11
Top = 2070
Width = 1335
End
Begin VB.CommandButton NewCommand
Caption = "新开工资"
Height = 495
Left = 12960
TabIndex = 10
Top = 1320
Width = 1335
End
Begin VB.VScrollBar VScroll2
Height = 255
Left = 2280
Max = 1
Min = 12
TabIndex = 9
Top = 960
Value = 1
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 255
Left = 1200
Max = 1999
Min = 3000
TabIndex = 8
Top = 960
Value = 1999
Width = 255
End
Begin MSDBGrid.DBGrid DBGrid1
Bindings = "工资计算.frx":0000
Height = 3255
Left = 240
OleObjectBlob = "工资计算.frx":0014
TabIndex = 0
Top = 1440
Width = 12495
End
Begin VB.Data Data4
Caption = "Data4"
Connect = "Access 2000;"
DatabaseName = "C:\大地科贸\大地数据库.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 11760
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 120
Visible = 0 'False
Width = 1140
End
Begin VB.Data Data3
Caption = "Data3"
Connect = "Access 2000;"
DatabaseName = "C:\大地科贸\大地数据库.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 285
Left = 11760
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "工资表"
Top = -120
Visible = 0 'False
Width = 1140
End
Begin VB.Data Data2
Caption = "Data2"
Connect = "Access 2000;"
DatabaseName = "C:\大地科贸\大地数据库.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 285
Left = 10440
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "安装记录表"
Top = 240
Visible = 0 'False
Width = 1335
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access 2000;"
DatabaseName = "C:\大地科贸\大地数据库.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 10440
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "人员信息表"
Top = -120
Visible = 0 'False
Width = 1335
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "工资发放表"
BeginProperty Font
Name = "隶书"
Size = 36
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000080FF&
Height = 855
Left = 4680
TabIndex = 15
Top = 360
Width = 3615
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "88888888"
DataField = "总计"
DataSource = "Data4"
Height = 375
Left = 7800
TabIndex = 7
Top = 5040
Width = 1335
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "88888888"
DataField = "总出勤工资"
DataSource = "Data4"
Height = 255
Left = 2040
TabIndex = 6
Top = 5040
Width = 1455
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "合计"
Height = 375
Left = 1080
TabIndex = 5
Top = 5040
Width = 615
End
Begin VB.Label Label4
Caption = "月"
Height = 255
Left = 2040
TabIndex = 4
Top = 960
Width = 255
End
Begin VB.Label Label3
Caption = "88"
Height = 255
Left = 1680
TabIndex = 3
Top = 960
Width = 255
End
Begin VB.Label Label2
Caption = "年"
Height = 255
Left = 840
TabIndex = 2
Top = 960
Width = 255
End
Begin VB.Label Label1
Caption = "8888"
Height = 255
Left = 360
TabIndex = 1
Top = 960
Width = 495
End
End
Attribute VB_Name = "工资计算"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Feicount()
mysql = "select 主安装人, count(*) as 安装台数 , sum(安装费) as 总安装费 " _
& " from 安装记录表 " _
& " where year(安装日期) = " & VScroll1.Value & " and month(安装日期) = " & VScroll2.Value _
& " group by 主安装人 "
Data2.RecordSource = mysql
Data2.Refresh
If Data2.Recordset.EOF Then Exit Sub
Data2.Recordset.MoveFirst
Do While Not Data2.Recordset.EOF
Data3.Recordset.FindFirst ("姓名 " & Data2.Recordset.Fields("主安装人").Value & "' ")
Data3.Recordset.Edit
Data3.Recordset.Fields("安装台数").Value = Data2.Recordset.Fields("安装台数").Value
Data3.Recordset.Fields("安装费").Value = Data2.Recordset.Fields("总安装费").Value
Data3.Recordset.Update
Data2.Recordset.MoveNext
Loop
End Sub
Private Sub Addnewrecords()
Data1.Recordset.MoveFirst
Do While Not Data1.Recordset.EOF
Data3.Recordset.AddNew
Data3.Recordset.Fields("编号").Value = Data1.Recordset.Fields("序号").Value
Data3.Recordset.Fields("姓名").Value = Data1.Recordset.Fields("姓名").Value
Data3.Recordset.Fields("日工资").Value = Data1.Recordset.Fields("日工资").Value
Data3.Recordset.Fields("出勤天数").Value = 25
Data3.Recordset.Fields("工资年度").Value = VScroll1.Value
Data3.Recordset.Fields("工资月份").Value = VScroll2.Value
Data3.Recordset.Update
Data1.Recordset.MoveNext
Loop
End Sub
Private Sub Datarefresh()
mysql = "select * " _
& " from 工资表 " _
& " where 工资年度 = " & VScroll1.Value & " and 工资月份 = " & VScroll2.Value
Data3.RecordSource = mysql
Data3.Refresh
mysql = " select sum(出勤工资) as 总出勤工资, sum(合计) as 总计 " _
& " from 工资表 " _
& " where 工资年度 = " & VScroll1.Value & " and 工资月份 = " & VScroll2.Value
Data4.RecordSource = mysql
Data4.Refresh
End Sub
Private Sub ClearCommand_Click()
With Data3.Recordset
If .RecordCount = 0 Then Exit Sub
.MoveFirst
Do While Not .EOF
.Delete
.MoveNext
Loop
End With
Datarefresh
End Sub
Private Sub ExitCommand_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Datarefresh
End Sub
Private Sub Form_Load()
VScroll1.Value = Year(Date)
Label1.Caption = Year(Date)
mymonth = Month(Date) - 1
If mymonth = 0 Then mymonth = 12
VScroll2.Value = mymonth
Label3.Caption = mymonth
End Sub
Private Sub NewCommand_Click()
If Data3.Recordset.RecordCount <> 0 Then Exit Sub
Addnewrecords
Feicount
DBGrid1.Refresh
End Sub
Private Sub SumCommand_Click()
With Data3.Recordset
If .RecordCount = 0 Then Exit Sub
.MoveFirst
Do While Not .EOF
.Edit
.Fields("出勤工资").Value = .Fields("日工资").Value & .Fields("出勤天数").Value
If IsNull(.Fields("出勤工资").Value) Then .Fields("出勤工资").Value = 0
If IsNull(.Fields("安装费").Value) Then .Fields("安装费").Value = 0
If IsNull(.Fields("奖金").Value) Then .Fields("奖金").Value = 0
.Fields("合计").Value = .Fields("出勤工资").Value + .Fields("安装费").Value + _
.Fields("奖金").Value
.Update
.MoveNext
Loop
End With
Datarefresh
End Sub
Private Sub VScroll1_Change()
Label1.Caption = VScroll1.Value
Datarefresh
End Sub
Private Sub VScroll2_Change()
Label3.Caption = VScroll2.Value
Datarefresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -