📄 frmbasicsetting.frm
字号:
VERSION 5.00
Begin VB.Form frmbasicsetting
Caption = "设置基本工资"
ClientHeight = 4725
ClientLeft = 60
ClientTop = 450
ClientWidth = 6720
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4725
ScaleWidth = 6720
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox composition
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 3120
TabIndex = 8
Top = 1920
Width = 2175
End
Begin VB.ComboBox comstuffid
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 3120
TabIndex = 0
Top = 840
Width = 2175
End
Begin VB.CommandButton cmdcancel
Caption = "取 消"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3840
TabIndex = 7
Top = 3840
Width = 1335
End
Begin VB.CommandButton cmdok
Caption = "确 认"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1200
TabIndex = 6
Top = 3840
Width = 1335
End
Begin VB.OptionButton optionposition
Caption = "员工职务"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1200
TabIndex = 5
Top = 1800
Width = 1575
End
Begin VB.OptionButton optionid
Caption = "员工编号"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1200
TabIndex = 4
Top = 720
Width = 1575
End
Begin VB.TextBox textmoney
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3120
TabIndex = 1
Top = 3000
Width = 1575
End
Begin VB.Label Label2
Caption = "(元/小时)"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4920
TabIndex = 3
Top = 3000
Width = 1455
End
Begin VB.Label Label1
Caption = "工资金额"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1440
TabIndex = 2
Top = 3000
Width = 1335
End
End
Attribute VB_Name = "frmbasicsetting"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private id As String
Private Sub cmdcancel_Click()
Unload Me
Exit Sub
End Sub
Private Sub init()
Me.composition.ListIndex = 0
Me.comstuffid.ListIndex = 0
Me.textmoney = ""
Me.optionid.Value = True
End Sub
Private Sub addrecord() '添加记录
Dim sql As String
Dim rs As New ADODB.Recordset
sql = "select * from salarysetting"
Set rs = getrs(sql, "salary")
rs.AddNew
rs.Fields(1) = Trim(id)
rs.Fields(2) = Trim(Me.composition.Text)
rs.Fields(3) = Trim(Me.textmoney)
rs.Update
rs.Close
End Sub
Private Sub cmdok_Click()
Dim sql As String
Dim rs As New ADODB.Recordset
If ichangeflag = 1 Then
If Me.optionid.Value = True Then
If Me.comstuffid.Text = "" Then
MsgBox "请选择员工编号", vbOKOnly + vbExclamation, "提示"
ElseIf IsEmpty(Me.textmoney) = True Then
MsgBox "请输入基本工资", vbOKOnly + vbExclamation, "提示"
Me.textmoney.SetFocus
ElseIf IsNumeric(Me.textmoney) = False Then
MsgBox "请输入数字", vbOKOnly + vbExclamation, "提示"
Me.textmoney = ""
Me.textmoney.SetFocus
Else
sql = "select * from salarysetting where stuffid='" & Me.comstuffid.Text & "'"
Set rs = getrs(sql, "salary")
If rs.EOF = False Then
sql = "delete from salarysetting where stuffid='" & Me.comstuffid.Text & "'"
Call transactsql(sql, "salary")
End If
rs.Close
id = Me.comstuffid.Text
Call addrecord
MsgBox "已经设置基本工资", vbOKOnly + vbExclamation, "添加结果"
Call init
sql = "select * from salarysetting"
Call frmresult.basictopic
Call frmresult.showbasic(sql)
frmresult.Show
frmresult.ZOrder 0
Me.ZOrder 0
End If
End If
If Me.optionposition.Value = True Then
If Me.composition.Text = "" Then
MsgBox "请输入职务", vbOKOnly + vbExclamation, "提示"
ElseIf IsEmpty(Me.textmoney) = True Then
MsgBox "请输入基本工资", vbOKOnly + vbExclamation, "提示"
Me.textmoney.SetFocus
ElseIf IsNumeric(Me.textmoney) = False Then
MsgBox "请输入数字", vbOKOnly + vbExclamation, "提示"
Me.textmoney = ""
Me.textmoney.SetFocus
Else
sql = "select * from salarysetting where sposition='" & Me.composition.Text & "'"
Set rs = getrs(sql, "salary")
If rs.EOF = False Then
sql = "delete from salarysetting where sposition='" & Me.composition.Text & "'"
Call transactsql(sql, "salary")
End If
rs.Close
sql = "select * from stuffinfo where sposition='" & Me.composition.Text & "'"
Set rs = getrs(sql, "salary")
While Not rs.EOF
id = rs(0)
Call addrecord
rs.MoveNext
Wend
rs.Close
MsgBox "已经设置基本工资", vbOKOnly + vbExclamation, "添加结果"
Call init
sql = "select * from salarysetting"
Call frmresult.basictopic
Call frmresult.showbasic(sql)
frmresult.Show
frmresult.ZOrder 0
Me.ZOrder 0
End If
End If
Else
sql = "update salarysetting set salary=" & Me.textmoney & " where stuffid='"
sql = sql & Me.comstuffid & "'"
Call transactsql(sql, "salary")
MsgBox "已经修改基本工资设置", vbOKOnly + vbExclamation, "提示"
Unload Me
sql = "select * from salarysetting"
Call frmresult.basictopic
Call frmresult.showbasic(sql)
frmresult.Show
frmresult.ZOrder 0
Call frmsumsalary.resumsalary(Date)
End If
End Sub
Private Sub Form_Load()
Dim sql As String
Dim rs As New ADODB.Recordset
If ichangeflag = 1 Then '添加信息
sql = "select sid from stuffinfo order by sid"
Set rs = getrs(sql, "salary")
If rs.EOF = False Then
While Not rs.EOF
Me.comstuffid.AddItem rs(0)
rs.MoveNext
Wend
rs.Close
Me.comstuffid.ListIndex = 0
End If
sql = "select distinct sposition from stuffinfo"
Set rs = getrs(sql, "salary")
If rs.EOF = False Then
While Not rs.EOF
Me.composition.AddItem rs(0)
rs.MoveNext
Wend
rs.Close
Me.composition.ListIndex = 0
End If
Me.optionid.Value = True
Else '修改信息
Me.Caption = "修改基本工资设置"
Set rs = getrs(strpublicsql, "salary")
Me.comstuffid.Text = rs(1)
Me.composition.Text = rs(2)
Me.textmoney = rs(3)
Me.comstuffid.Enabled = False
Me.composition.Enabled = False
rs.Close
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -