frmgrwh.frm
来自「企业工资管理系统的具体实现」· FRM 代码 · 共 882 行 · 第 1/2 页
FRM
882 行
BeginProperty Column04
DataField = "gzhj"
Caption = "工资合计"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
ColumnWidth = 1395.213
EndProperty
BeginProperty Column01
ColumnWidth = 1395.213
EndProperty
BeginProperty Column02
ColumnWidth = 1395.213
EndProperty
BeginProperty Column03
ColumnWidth = 1395.213
EndProperty
BeginProperty Column04
ColumnWidth = 1395.213
EndProperty
EndProperty
End
Begin VB.TextBox Text2
Height = 330
Left = 3390
TabIndex = 7
Top = 510
Width = 2025
End
Begin VB.TextBox Text1
Height = 330
Left = 645
TabIndex = 5
Top = 510
Width = 1620
End
Begin VB.Label Label17
AutoSize = -1 'True
Caption = "辞职前请进行工资结算,再进行记录删除。"
Height = 180
Left = 1830
TabIndex = 41
Top = 225
Width = 3420
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "职工代号:"
Height = 180
Left = 2445
TabIndex = 6
Top = 600
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "姓名:"
Height = 180
Left = 90
TabIndex = 4
Top = 585
Width = 540
End
End
End
Attribute VB_Name = "frmgrwh"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim cnn As New ADODB.Recordset
Dim minyf As String, maxyf As String
Dim gs As Single, cpjs As Single, cdkc As Single, cpkc As Single, qtkc As Single, jtf As Single, gzhj As Single
fcancle = 0
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "请输入姓名或工人代号!", vbInformation, "提示"
Exit Sub
End If
frmgrcz.Show 1
If fcancle = 1 Then Exit Sub
With Adodc1
.ConnectionString = constr
.RecordSource = "select * from gzzjb where grdh='" & Trim(Text2.Text) & "' and xm='" & Trim(Text1.Text) & "'"
.Refresh
If (.Recordset.EOF And .Recordset.BOF) Then
MsgBox "表中没有此工人,请检查输入是否有误。", vbInformation, "提示"
Exit Sub
End If
With cnn
.ActiveConnection = constr
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockBatchOptimistic
.Open "select * from ygzqkb where grdh='" & Adodc1.Recordset.Fields("grdh").Value & "'"
If Not (.EOF And .BOF) Then
.MoveFirst
End If
Do While Not .EOF
gs = gs + .Fields("gs").Value
cpjs = cpjs + .Fields("cpjs").Value
cdkc = cdkc + .Fields("cdkc").Value
cpkc = cpkc + .Fields("cpkc").Value
qtkc = qtkc + .Fields("qtkc").Value
jtf = jtf + .Fields("jtf").Value
gzhj = gzhj + .Fields("gzhj").Value
.MoveNext
Loop
.Close
.Open "select min(yf) as minyf from ygzqkb "
minyf = .Fields("minyf").Value
.Close
.Open "select max(yf) as maxyf from ygzqkb"
maxyf = .Fields("maxyf").Value
.Close
End With
Set cnn = Nothing
.Recordset.Fields("qsny").Value = minyf
.Recordset.Fields("jsny").Value = maxyf
.Recordset.Fields("gs").Value = gs
.Recordset.Fields("cpjs").Value = cpjs
.Recordset.Fields("cdkc").Value = cdkc
.Recordset.Fields("cpkc").Value = cpkc
.Recordset.Fields("qtkc").Value = qtkc
.Recordset.Fields("jtf").Value = jtf
With cnn
.ActiveConnection = constr
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockBatchOptimistic
.Open "select ze from jzb where grdh='" & Adodc1.Recordset.Fields("grdh").Value & "' "
If Not .EOF And Not .BOF Then
Adodc1.Recordset.Fields("jz").Value = .Fields("ze").Value
Adodc1.Recordset.Fields("gzhj").Value = gzhj - .Fields("ze").Value
Else
Adodc1.Recordset.Fields("gzhj").Value = gzhj
End If
.Close
End With
Set cnn = Nothing
.Recordset.Update
End With
Set DataGrid1.DataSource = Adodc1
Command2.Enabled = True
MsgBox "工资合计完成!", vbInformation, "提示"
MsgBox "注意!不要忘记删除辞职的工人。", vbInformation, "注意"
With cnn
.ActiveConnection = constr
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockPessimistic
.Open "select * from temp"
.AddNew
.Fields("wscxm").Value = Trim(Text1.Text)
.Fields("wscgrdh").Value = Trim(Text2.Text)
.Update
.Close
End With
Set cnn = Nothing
End Sub
Private Sub Command2_Click()
Dim cnn As New ADODB.Recordset
Dim cnn1 As New ADODB.Connection
With cnn
.ActiveConnection = constr
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockPessimistic
.Open "select * from bmb where xm='" & Trim(Text1.Text) & "'"
If .RecordCount >= 2 Then
MsgBox "与此工人姓名相同的还有,请查看信息后选择要删除的记录。", vbCritical, "提示"
frmdelrecord.Show 1
Else
With cnn1
.Open constr
.Execute "delete * from grfpb where grdh='" & Trim(Text2.Text) & "'"
For j = 1 To 12
If Len(Trim(Str$(j))) = 1 Then
.Execute "delete from sbqkb" & Trim("0" & Trim(Str$(j))) & " where grdh='" & Trim(Text2.Text) & "'"
Else
.Execute "delete from sbqkb" & Trim(Str$(j)) & " where grdh='" & Trim(Text2.Text) & "'"
End If
Next j
.Execute "delete * from gzkcb where grdh='" & Trim(Text2.Text) & "'"
.Execute "delete * from jzb where grdh='" & Trim(Text2.Text) & "'"
.Execute "delete * from ygzqkb where grdh='" & Trim(Text2.Text) & "'"
.Execute "delete * from gzzjb where grdh='" & Trim(Text2.Text) & "'"
.Execute "delete * from temp where wscgrdh='" & Trim(Text2.Text) & "'"
.Execute "delete * from bmb where xm='" & Trim(Text1.Text) & "'"
.Close
End With
Set cnn2 = Nothing
End If
End With
With Adodc1
.ConnectionString = constr
.RecordSource = "select * from gzzjb where grdh='" & Trim(Text2.Text) & "' and xm='" & Trim(Text1.Text) & "'"
.Refresh
End With
Set DataGrid1.DataSource = Adodc1
MsgBox "记录删除成功!", vbInformation, "提示"
End Sub
Private Sub Command3_Click()
Dim cnn As New ADODB.Recordset
Dim cnn1 As New ADODB.Connection
Dim cjm As String, grdh As Integer
On Error GoTo err1
If Combo2.Text = "" Then
MsgBox "没有选择车间代号或没进行车间分配,不能进行求职工作。" & Chr(10) & Chr(13) & "建议先进行车间分配。", vbCritical, "求职"
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "姓名一栏不能为空。", vbInformation, "提示"
Exit Sub
End If
With cnn
.ActiveConnection = constr
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockPessimistic
.Open "select * from bmb"
.AddNew
If Text3.Text <> "" Then .Fields("xm").Value = Trim(Text3.Text)
If Combo1.Text <> "" Then .Fields("xb").Value = Trim(Combo1.Text)
If Text4.Text <> "" Then .Fields("mz").Value = Trim(Text4.Text)
If Text5.Text <> "" Then .Fields("csrq").Value = Trim(Text5.Text)
If Text7.Text <> "" Then .Fields("zz").Value = Trim(Text7.Text)
If Text6.Text <> "" Then .Fields("sfzh").Value = Trim(Text6.Text)
.Update
.Close
End With
Set cnn = Nothing
With cnn
.ActiveConnection = constr
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockPessimistic
.Open "select * from cjb where cjdh= '" & Combo2.Text & "'"
cjm = .Fields("cjm").Value
.Close
End With
Set cnn = Nothing
With cnn
.ActiveConnection = constr
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockPessimistic
.Open "select max(grdh) as maxgrdh from grfpb where cjdh= '" & Trim(Combo2.Text) & "'"
If Not .EOF And Not .BOF And Not IsNull(.Fields("maxgrdh").Value) Then
.MoveFirst
grdh = Val(Right(Trim(.Fields("maxgrdh").Value), 5))
Else
grdh = 9999 '第次分配时工人代号设为9999
End If
.Close
End With
Set cnn = Nothing
With cnn
.ActiveConnection = constr
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockPessimistic
.Open "select * from grfpb"
If Not (.EOF And .BOF) Then
.MoveFirst
End If
grdh = grdh + 1
.AddNew
.Fields("cjdh").Value = Trim(Combo2.Text)
.Fields("cjm").Value = Trim(cjm)
.Fields("xm").Value = Trim(Text3.Text)
.Fields("grdh").Value = Trim(Combo2.Text) & Trim(Str$(grdh))
.Update
.Close
End With
Set cnn = Nothing
With cnn1
.Open constr
For i = 1 To 12
If Len(Trim(Str$(i))) = 1 Then
.Execute "insert into sbqkb" & Trim("0" & Trim(Str$(i))) & "(cjdh,grdh,xm) select cjdh,grdh,xm from grfpb where grdh='" & Trim(Combo2.Text) & Trim(Str$(grdh)) & "'"
Else
.Execute "insert into sbqkb" & Trim(Str$(i)) & "(cjdh,grdh,xm) select cjdh,grdh,xm from grfpb where grdh='" & Trim(Combo2.Text) & Trim(Str$(grdh)) & "'"
End If
Next i
.Execute "insert into gzzjb(cjdh,grdh,xm) select cjdh,grdh,xm from grfpb where grdh='" & Trim(Combo2.Text) & Trim(Str$(grdh)) & "'"
.Close
End With
Set cnn1 = Nothing
Text3.Text = ""
'Combo1.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
MsgBox "求职成功!请查看报名查询。", vbInformation, "提示"
Exit Sub
err1:
If Err.Number = -2147467259 Then
MsgBox "身份证号为空或身份证号重复,请仔细检查。", vbInformation, "提示"
Text6.SetFocus
Exit Sub
ElseIf Err.Number = -2147217887 Then
MsgBox "出生日期格式错误,请改正!", vbInformation, "提示"
Text5.SetFocus
Exit Sub
End If
End Sub
Private Sub Command4_Click()
Text3.Text = ""
'Combo1.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
End Sub
Private Sub Command7_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim cnn As New ADODB.Recordset
With cnn
.ActiveConnection = constr
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockPessimistic
.Open "select * from temp "
If Not (.EOF And .BOF) Then
.MoveFirst
Do While Not .EOF
If IsNull(.Fields("wscxm").Value) = False Then
If MsgBox("系统发现有未删除的辞职工人,现在想要删除吗!", vbInformation + vbYesNo, "提示") = vbNo Then
Exit Sub
Else
frmdelrecord.Show 1
Exit Do
End If
End If
.MoveNext
Loop
End If
.Close
End With
Set cnn = Nothing
With cnn
.ActiveConnection = constr
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockPessimistic
.Open "select * from cjb"
If Not (.EOF And .BOF) Then .MoveFirst
Do While Not .EOF
Combo2.AddItem .Fields("cjdh").Value
.MoveNext
Loop
End With
Combo2.Text = Combo2.List(0)
End Sub
Private Sub Text1_LostFocus()
If Len(Trim(Text1.Text)) > 10 Then
MsgBox "输入的姓名过长,不符要求。", vbInformation, "提示"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
Command1.Enabled = True
End Sub
Private Sub Text2_LostFocus()
If Len(Trim(Text2.Text)) > 15 Then
MsgBox "输入的工人代号过长,不符要求。", vbInformation, "提示"
Text2.Text = ""
Text2.SetFocus
Exit Sub
End If
Command1.Enabled = True
End Sub
Private Sub Text6_LostFocus()
If Len(Trim(Text6.Text)) > 18 Then
MsgBox "输入的身份证号过长,不符要求。", vbInformation, "提示"
Text6.Text = ""
Text6.SetFocus
Exit Sub
End If
Command3.Enabled = True
Command4.Enabled = True
End Sub
Private Sub Text4_LostFocus()
If Len(Trim(Text4.Text)) > 10 Then
MsgBox "输入的民族过长,不符要求。", vbInformation, "提示"
Text4.Text = ""
Text4.SetFocus
Exit Sub
End If
Command3.Enabled = True
Command4.Enabled = True
End Sub
Private Sub Text3_LostFocus()
If Len(Trim(Text3.Text)) > 10 Then
MsgBox "输入的姓名过长,不符要求。", vbInformation, "提示"
Text3.Text = ""
Text3.SetFocus
Exit Sub
End If
Command3.Enabled = True
Command4.Enabled = True
End Sub
Private Sub Text7_LostFocus()
If Len(Trim(Text7.Text)) > 50 Then
MsgBox "输入住址过长,不符要求。", vbInformation, "提示"
Text7.Text = ""
Text7.SetFocus
Exit Sub
End If
Command3.Enabled = True
Command4.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?