📄 jmpa_rpt.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form9
BorderStyle = 3 'Fixed Dialog
Caption = "工资发放表"
ClientHeight = 8925
ClientLeft = 45
ClientTop = 435
ClientWidth = 13545
Icon = "JmPa_rpt.frx":0000
LinkTopic = "Form9"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 8925
ScaleWidth = 13545
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 8295
Left = 120
TabIndex = 1
Top = 600
Width = 13335
Begin VB.PictureBox Cell1
Height = 8055
Left = 120
ScaleHeight = 7995
ScaleWidth = 13035
TabIndex = 2
Top = 120
Width = 13095
End
End
Begin MSComctlLib.ImageList ImageList1
Left = 4080
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 3
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "JmPa_rpt.frx":5F32
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "JmPa_rpt.frx":608C
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "JmPa_rpt.frx":761E
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 570
Left = 0
TabIndex = 0
Top = 0
Width = 13545
_ExtentX = 23892
_ExtentY = 1005
ButtonWidth = 820
ButtonHeight = 953
Appearance = 1
Style = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 5
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "打印"
Key = "fprt"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "引出"
Key = "fout"
ImageIndex = 2
Style = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "fexit"
ImageIndex = 3
EndProperty
EndProperty
BorderStyle = 1
End
End
Attribute VB_Name = "Form9"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Me.Cell1.Login "whjminf", "whjminf", "aaa"
With Me.Cell1
.ShowPageBreak 0
.ShowSheetLabel 0, 0
.ShowSideLabel 0, 0
End With
'SetCellInput
'参数说明
'
'Col 列号
'Row 行号
'sheet 页号
'para 为输入控制方式参数
'0 缺省(与1同);
'1 无控制;
'2 数值;
'3 整数;
'4 电话号码;
'5 只读?69808609
'说明
'
'设置指定单元格的输入控制方式?
Call fload_Pa
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 1
'打印
Me.Cell1.Login "whjminf", "whjminf", "aaa"
Me.Cell1.PrintPreview 1, 0
Case 3
'引出
Case 5
'退出
If MsgBox("您是否要退出本窗口!", vbYesNo + vbQuestion, "提示") = vbYes Then
Unload Me
End If
End Select
End Sub
'**********工资报表过程****************'
Sub fload_Pa()
Dim fmonthstring As String
Dim i As Integer, j As Integer
Dim browsersql As String
i = 0
j = 0
Set fload_pa_conn = CreateObject("adodb.connection")
fload_pa_conn.Open connstring
fmonthstring = InputBox("请录入要查询工资数据的期间(月份),年度为当前年!", "录入")
If Trim(fmonthstring) = "" Then
MsgBox "请正确录入您要查找的工资月份!", vbOKOnly + vbInformation, "提示"
Exit Sub
End If
Set rs_load_paset = fload_pa_conn.Execute("select * from Pa_set")
Set rs_load_emp = fload_pa_conn.Execute("select count(*) as fnumber from Pa_emp")
Set rs_load_item = fload_pa_conn.Execute("select count(*) as fcolsnum from Pa_item")
Set rs_sel_emp = fload_pa_conn.Execute("select * from Pa_emp")
browsersql = "SELECT [pa_data].[fyear] AS 年, [pa_data].[Fperiod] AS 月, [pa_emp].[fempname] AS 职员名称, [pa_item].[fitemname] AS 工资项目, [pa_data].[fdata] AS 工资金额" _
& " From pa_data, pa_emp, pa_item WHERE [pa_data].[fempid]=[pa_emp].[fempid] And [pa_data].[fitemid]=[pa_item].[fitemid]"
Me.Cell1.SetRows Val(rs_load_emp.Fields!fnumber) * 3, 0
Me.Cell1.SetCols Val(rs_load_item.Fields!fcolsnum) + 5, 0
rs_load_item.Close
i = 2
j = 1
On Error GoTo errpa
Do While rs_sel_emp.EOF <> True
j = 1
Set rs_load_pa = fload_pa_conn.Execute(browsersql & " and pa_data.fyear=" & "'" & rs_load_paset.Fields!fyear & "'" & " and pa_data.fperiod=" & "'" & fmonthstring & "'" & " and pa_emp.fempname=" & "'" & rs_sel_emp.Fields!Fempname & "'")
Do While rs_load_pa.EOF <> True
Me.Cell1.SetCellString 1, i - 1, 0, "年"
Me.Cell1.SetCellString 2, i - 1, 0, "月"
Me.Cell1.SetCellString 3, i - 1, 0, "职员名称"
Me.Cell1.SetCellString 1, i, 0, rs_load_pa.Fields!年
Me.Cell1.SetCellString 2, i, 0, rs_load_pa.Fields!月
Me.Cell1.SetCellString 3, i, 0, rs_load_pa.Fields!职员名称
Me.Cell1.SetCellString 3 + j, i - 1, 0, rs_load_pa.Fields!工资项目
Me.Cell1.SetCellString 3 + j, i, 0, rs_load_pa.Fields!工资金额
rs_load_pa.MoveNext
j = j + 1
Loop
rs_sel_emp.MoveNext
i = i + 3
Loop
rs_load_pa.Close
rs_load_emp.Close
rs_sel_emp.Close
rs_load_paset.Close
fload_pa_conn.Close
Exit Sub
errpa:
MsgBox Err.Description, vbCritical, "错误"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -