📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
BorderStyle = 1 'Fixed Single
Caption = "工资结算"
ClientHeight = 4140
ClientLeft = 45
ClientTop = 330
ClientWidth = 6645
Icon = "Form2.frx":0000
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4140
ScaleWidth = 6645
StartUpPosition = 3 '窗口缺省
Begin 工程1.XPContainer XPContainer1
Height = 4095
Left = 0
TabIndex = 0
Top = 0
Width = 6615
_extentx = 13150
_extenty = 7223
headerlightcolor= 15526633
headerdarkcolor = 14276307
backlightcolor = 14737632
backdarkcolor = 15855598
bordercolor = 8421504
textcolor = 4867908
style = 1
theme = 10
Begin VB.TextBox Text7
Enabled = 0 'False
Height = 375
Left = 960
TabIndex = 18
Top = 2280
Width = 1695
End
Begin VB.TextBox Text6
Enabled = 0 'False
Height = 375
Left = 3600
TabIndex = 15
Top = 2280
Width = 1695
End
Begin 工程1.isButton isButton3
Height = 615
Left = 4200
TabIndex = 14
Top = 3120
Width = 1455
_extentx = 2566
_extenty = 1085
icon = "Form2.frx":038A
style = 8
caption = "退出"
iconalign = 1
inonthemestyle = 0
tooltiptitle = ""
tooltipicon = 0
tooltiptype = 0
ttforecolor = 0
font = "Form2.frx":0726
End
Begin 工程1.isButton isButton2
Height = 615
Left = 1800
TabIndex = 13
Top = 3120
Width = 2175
_extentx = 3836
_extenty = 1085
icon = "Form2.frx":074E
style = 8
caption = "保存该员工的工资"
iconalign = 1
inonthemestyle = 0
tooltiptitle = ""
tooltipicon = 0
tooltiptype = 0
ttforecolor = 0
font = "Form2.frx":0AEA
End
Begin VB.TextBox Text5
Enabled = 0 'False
Height = 375
Left = 3600
TabIndex = 9
Top = 1560
Width = 1695
End
Begin VB.TextBox Text4
Enabled = 0 'False
Height = 390
Left = 960
TabIndex = 8
Top = 1545
Width = 1695
End
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 375
Left = 3600
TabIndex = 5
Top = 1080
Width = 1695
End
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 375
Left = 960
TabIndex = 4
Top = 1080
Width = 1695
End
Begin 工程1.isButton isButton1
Height = 615
Left = 120
TabIndex = 3
Top = 3120
Width = 1455
_extentx = 2566
_extenty = 1085
icon = "Form2.frx":0B12
style = 8
caption = "显示金额"
iconalign = 1
inonthemestyle = 0
tooltiptitle = ""
tooltipicon = 0
tooltiptype = 0
ttforecolor = 0
font = "Form2.frx":0F66
End
Begin VB.ComboBox text1
Height = 300
Left = 2400
Style = 2 'Dropdown List
TabIndex = 1
Top = 240
Width = 2175
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "员工姓名"
Height = 255
Left = 120
TabIndex = 19
Top = 2400
Width = 735
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "计算10月份的工资"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
Left = 120
TabIndex = 17
Top = 600
Width = 3015
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "本月工资"
Height = 255
Left = 2880
TabIndex = 16
Top = 2400
Width = 735
End
Begin VB.Line Line3
BorderColor = &H00FFFFFF&
X1 = 0
X2 = 6600
Y1 = 2160
Y2 = 2160
End
Begin VB.Line Line2
BorderColor = &H00C0C0C0&
BorderWidth = 2
X1 = 0
X2 = 6600
Y1 = 2160
Y2 = 2160
End
Begin VB.Line Line1
BorderColor = &H00E0E0E0&
BorderWidth = 2
X1 = 6600
X2 = 6615
Y1 = 2160
Y2 = 2175
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "创造价值"
Height = 255
Left = 2880
TabIndex = 12
Top = 1680
Width = 735
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "提成金额"
Height = 255
Left = 120
TabIndex = 11
Top = 1680
Width = 855
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Height = 375
Left = 120
TabIndex = 10
Top = 1560
Width = 735
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "提成率"
Height = 255
Left = 2880
TabIndex = 7
Top = 1200
Width = 615
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "基本工资"
Height = 255
Left = 120
TabIndex = 6
Top = 1200
Width = 855
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "选择员工编号进行工资核算"
Height = 255
Left = 120
TabIndex = 2
Top = 240
Width = 2415
End
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn1 As New ADODB.Connection
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Form_Load()
st
End Sub
Sub st()
Dim i As Integer
Dim StrConnect As String '定义
StrConnect = App.Path
If Right(StrConnect, 1) <> "\" Then StrConnect = StrConnect + "\"
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & StrConnect & "\data\kq.mdb"
rs.Open "select ID,编号 from yggl", conn, 1, 1
i = 0
Do While Not rs.EOF
text1.AddItem rs("编号")
text1.ItemData(i) = rs("id")
i = i + 1
rs.MoveNext
Loop
rs.Close
conn.Close
End Sub
Private Sub isButton1_Click()
setup2
Text6.Text = Val(text2.Text) + Val(Text4.Text) & "元"
isButton1.Enabled = False
End Sub
Private Sub isButton2_Click()
Dim StrSQL
Dim conn2 As New ADODB.Connection
Dim rst1 As New ADODB.Recordset
conn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "\data\kq.mdb" + ";Persist Security Info=False;"
StrSQL = "SELECT * FROM [工资表]"
rst1.Open StrSQL, conn2, 1, 3
rst1.MoveLast
rst1.AddNew
rst1.Fields("姓名") = Trim("" & Text7.Text)
rst1.Fields("编号") = Trim("" & text1.Text)
rst1.Fields("本月总工资") = Trim("" & Text6.Text)
rst1.Fields("本月提成") = Trim("" & Text4.Text)
rst1.Fields("发放时间") = Trim("" & Format(Date, "yyyy-mm"))
rst1.Update
MsgBox "员工" & Text7.Text & "的工资设置成功 " & " 请继续添加下一位员工的工资 ", vbInformation
End Sub
Private Sub isButton3_Click()
Unload Me
End Sub
Private Sub text1_Click()
Dim name As String
Dim ssql As String
Dim cnn As New ADODB.Connection
Dim ret As New ADODB.Recordset
'连接数据库
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "\data\kq.mdb" + ";Persist Security Info=False;"
ssql = "select yggl.编号,yggl.姓名,yggl.基本工资,yggl.提成率 From 收银, yggl" + _
" Where yggl.编号=" + "'" + text1.Text + "'"
ret.Open ssql, cnn
If ret.BOF And ret.EOF Then
MsgBox "没有这个员工的记录", , "警告"
Else
text2.Text = ret.Fields("基本工资") & vbNullString
Text3.Text = ret.Fields("提成率") & vbNullString
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ret.Fields("姓名") & vbNullString
isButton1.Enabled = True
ret.Close
cnn.Close
End If
End Sub
Sub setup2()
Dim tc As Long
Dim ssql1 As String
Dim cnn1 As New ADODB.Connection
Dim ret1 As New ADODB.Recordset
Const a = "'"
Temp = Year(Date)
temp1 = Month(Date)
temp2 = Temp & "-" & temp1
'连接数据库1
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "\data\kq.mdb" + ";Persist Security Info=False;"
ssql1 = "select 编号,提成,月份,收取费用 From 收银 Where 月份 ='" & temp2 & "' And 编号 = '" & _
text1.Text & "'"
ret1.Open ssql1, cnn1, 1, 3
If ret1.BOF And ret1.EOF Then
MsgBox "没有这个员工的提成记录", , "警告"
Else
Do While Not ret1.EOF
Text5.Text = Val(Text5.Text) + Val(ret1.Fields("收取费用"))
Text4.Text = Val(Text4.Text) + Val(ret1.Fields("提成"))
ret1.MoveNext
Loop
ret1.Close
cnn1.Close
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -