📄 frmgongzi.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmGongzi
Caption = "工资管理"
ClientHeight = 10620
ClientLeft = 165
ClientTop = 450
ClientWidth = 14955
LinkTopic = "Form3"
ScaleHeight = 10620
ScaleWidth = 14955
StartUpPosition = 3 '窗口缺省
WindowState = 2 'Maximized
Begin VB.Frame Frame1
Appearance = 0 'Flat
ForeColor = &H80000008&
Height = 9840
Left = 0
TabIndex = 0
Top = -60
Width = 14940
Begin VB.TextBox Text1
Appearance = 0 'Flat
BorderStyle = 0 'None
Height = 405
Left = 2490
TabIndex = 8
Top = 2025
Visible = 0 'False
Width = 1560
End
Begin MSFlexGridLib.MSFlexGrid msfDataShow
Height = 9630
Left = 105
TabIndex = 7
Top = 150
Width = 14700
_ExtentX = 25929
_ExtentY = 16986
_Version = 393216
AllowUserResizing= 3
Appearance = 0
End
End
Begin VB.Frame Frame2
Appearance = 0 'Flat
ForeColor = &H80000008&
Height = 930
Left = 0
TabIndex = 1
Top = 9690
Width = 14940
Begin VB.CommandButton Command5
Caption = "打 印(&P)"
Height = 450
Left = 12435
TabIndex = 12
Top = 285
Width = 1140
End
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 345
Left = 4455
TabIndex = 10
Top = 345
Visible = 0 'False
Width = 3555
_ExtentX = 6271
_ExtentY = 609
_Version = 393216
BorderStyle = 1
Appearance = 0
Scrolling = 1
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
Enabled = 0 'False
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 1575
TabIndex = 9
Top = 315
Width = 1620
End
Begin VB.CommandButton Command4
Caption = "刷 新(&F)"
Enabled = 0 'False
Height = 450
Left = 8925
TabIndex = 5
Top = 285
Width = 1140
End
Begin VB.CommandButton Command3
Caption = "退 出(&E)"
Height = 450
Left = 13605
TabIndex = 4
Top = 285
Width = 1140
End
Begin VB.CommandButton Command2
Caption = "删 除(&D)"
Height = 450
Left = 11265
TabIndex = 3
Top = 285
Width = 1140
End
Begin VB.CommandButton Command1
Caption = "保 存(&S)"
Height = 450
Left = 10095
TabIndex = 2
Top = 285
Width = 1140
End
Begin VB.Label Label2
Caption = "保存数据:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 3315
TabIndex = 11
Top = 390
Visible = 0 'False
Width = 1455
End
Begin VB.Label Label1
Caption = "工资月份:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 405
TabIndex = 6
Top = 390
Width = 1455
End
End
End
Attribute VB_Name = "frmGongzi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim strsql As String
Dim rsRet As New ADODB.Recordset
Dim gIp As String
Dim gFlag As Boolean
Dim gGwxs(0 To 14) As String
Dim Cellrow As Long, Cellcol As Long
Dim Scrolling, GoToNextGird, KeyDown As Boolean
Dim DeleteStr As String
Private Type ColNameLength
name As String
Length As Integer
align As Integer
End Type
Private Sub InitGird()
Dim rs As New ADODB.Recordset
Dim NameLen(22) As ColNameLength
NameLen(0).name = "月份"
NameLen(0).Length = 890
NameLen(0).align = 0
NameLen(1).name = "部门"
NameLen(1).Length = 890
NameLen(1).align = 1
NameLen(2).name = "工号"
NameLen(2).Length = 890
NameLen(2).align = 0
NameLen(3).name = "姓名"
NameLen(3).Length = 890
NameLen(3).align = 1
NameLen(4).name = "基本工资"
NameLen(4).Length = 890
NameLen(4).align = 0
NameLen(5).name = "岗位工资"
NameLen(5).Length = 890
NameLen(5).align = 1
NameLen(6).name = "试用工资"
NameLen(6).Length = 890
NameLen(6).align = 0
NameLen(7).name = "佣金"
NameLen(7).Length = 890
NameLen(7).align = 1
NameLen(8).name = "各种补贴"
NameLen(8).Length = 890
NameLen(8).align = 0
NameLen(9).name = "补发"
NameLen(9).Length = 890
NameLen(9).align = 1
NameLen(10).name = "应发工资"
NameLen(10).Length = 890
NameLen(10).align = 0
NameLen(11).name = "个调税"
NameLen(11).Length = 890
NameLen(11).align = 1
NameLen(12).name = "考勤扣款"
NameLen(12).Length = 890
NameLen(12).align = 0
NameLen(13).name = "社保基金"
NameLen(13).Length = 890
NameLen(13).align = 1
NameLen(14).name = "扣发"
NameLen(14).Length = 890
NameLen(14).align = 0
NameLen(15).name = "实发工资"
NameLen(15).Length = 890
NameLen(15).align = 1
gSQL = "select 月份,部门,工号,姓名,基本工资,岗位工资,试用工资,佣金,各种补贴,补发,应发工资,个调税,考勤扣款,社保基金,扣发,实发工资 from T_工资表 where 月份='" & Text2.Text & "' order by 工号"
rs.Open gSQL, gCnn, adOpenStatic, adLockReadOnly
Call WriteMSF(rs, NameLen(), 16, msfDataShow, 300)
rs.Close
Erase NameLen()
Set rs = Nothing
End Sub
Private Sub Command1_Click()
Dim rs As New ADODB.Recordset
Dim strSqll As String
Dim strYgxx(1 To 4) As String
Dim Values(4 To 22) As Double
Dim i As Long
Dim j As Long
If rs.State = 1 Then rs.Close
rs.Open "select top 1 * from T_工资表 where 月份='" & Format(Text2, "yyyy-mm") & "'", gCnn, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
If MsgBox("此月份的数据已存在,是否重新生成数据,选择是则删除原来数据,替换成新的数据!", vbYesNo) = vbYes Then
gCnn.Execute "delete from T_工资表 where 月份='" & Format(Text2, "yyyy-mm") & "'"
Else
Exit Sub
End If
End If
Label2.Visible = True
ProgressBar1.Visible = True
ProgressBar1.Value = 0
ProgressBar1.Max = msfDataShow.Rows - 1
For i = 1 To msfDataShow.Rows - 1
For j = 1 To 10
If msfDataShow.TextMatrix(i, j) = "" Then msfDataShow.TextMatrix(i, j) = 0
Next
strYgxx(1) = msfDataShow.TextMatrix(i, 1)
strYgxx(2) = msfDataShow.TextMatrix(i, 2)
strYgxx(3) = msfDataShow.TextMatrix(i, 3)
strYgxx(4) = msfDataShow.TextMatrix(i, 4)
'Values(4) = Val(msfDataShow.TextMatrix(i, 4))
Values(5) = Val(msfDataShow.TextMatrix(i, 5))
Values(6) = Val(msfDataShow.TextMatrix(i, 6))
Values(7) = Val(msfDataShow.TextMatrix(i, 7))
Values(8) = Val(msfDataShow.TextMatrix(i, 8))
Values(9) = Val(msfDataShow.TextMatrix(i, 9))
Values(10) = Val(msfDataShow.TextMatrix(i, 10))
Values(11) = Val(msfDataShow.TextMatrix(i, 11))
Values(12) = Val(msfDataShow.TextMatrix(i, 12))
Values(13) = Val(msfDataShow.TextMatrix(i, 13))
Values(14) = Val(msfDataShow.TextMatrix(i, 14))
Values(15) = Val(msfDataShow.TextMatrix(i, 15))
Values(16) = Val(msfDataShow.TextMatrix(i, 16))
strSqll = "insert into T_工资表(月份,部门,工号,姓名,基本工资,岗位工资,试用工资,佣金,各种补贴,补发,应发工资,个调税,考勤扣款,社保基金,扣发,实发工资) values('" & strYgxx(1) & "','" & strYgxx(2) & "','" & strYgxx(3) & "','"
strSqll = strSqll & strYgxx(4) & "'," & Val(Values(5)) & "," & Values(6) & "," & Values(7) & "," & Values(8) & "," & Values(9) & "," & Values(10) & "," & Values(11) & "," & Values(12) & "," & Values(13) & "," & Values(14) & "," & Values(15) & "," & Values(16) & ")"
gCnn.Execute strSqll
ProgressBar1.Value = ProgressBar1.Value + 1
Next
ProgressBar1.Value = ProgressBar1.Max
Set rs = Nothing
MsgBox "保存数据成功!", vbInformation, "系统提示"
ProgressBar1.Visible = False
Label2.Visible = False
End Sub
Private Sub Command2_Click()
If MsgBox("你确定要删除此人的工资数据么?", vbYesNo, "系统提示") = vbNo Then: Exit Sub
gCnn.Execute "delete T_工资表 where 工号='" & msfDataShow.TextMatrix(Cellrow, 1) & "' and 月份='" & msfDataShow.TextMatrix(Cellrow, 3) & "'"
MsgBox "删除成功!", vbInformation, "系统提示"
Call Form_Load
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
Call Form_Load
End Sub
Private Sub Command5_Click()
If msfDataShow.Rows <= 1 Then
MsgBox "没有数据可打印!", vbInformation, "系统提示"
Else
PrintGrid msfDataShow
End If
End Sub
Private Sub Form_Load()
'T_工资表 ID,工号,姓名,月份,基本工资,职称工资,职务工资,岗位工资,工龄工资,浮动工资,奖金一,奖金二,奖金三,过节费,其它,应发工资,扣养老金,医疗保险,失业金,公积金,个人所得税,扣其它,实发工资
Dim rs As New ADODB.Recordset
Dim i As Long
Text2.Text = gGzyf
Scrolling = False
GoToNextGird = False
KeyDown = False
DeleteStr = ""
InitGird
End Sub
Private Sub WriteMSF(rs As ADODB.Recordset, NameLength() As ColNameLength, count As Integer, MSFlex As MSFlexGrid, rowhead As Integer)
Dim i, j As Integer, rtn As Boolean
'清至只留两行
If MSFlex.Rows > 2 Then
MSFlex.Rows = 2
End If
MSFlex.FormatString = GetFormartString(NameLength(), count)
MSFlex.ColWidth(0) = 500
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -