main_gzgl_gzgl.frm
上传用户:wd52qq
上传日期:2022-07-24
资源大小:5366k
文件大小:28k
- VERSION 5.00
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
- Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
- Begin VB.Form main_gzgl_gzgl
- BorderStyle = 3 'Fixed Dialog
- Caption = "Form1"
- ClientHeight = 5880
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 10350
- Icon = "main_gzgl_gzgl.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 5880
- ScaleWidth = 10350
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 '屏幕中心
- Begin MSAdodcLib.Adodc Adodc1
- Height = 330
- Left = 60
- Top = 2040
- Visible = 0 'False
- Width = 2040
- _ExtentX = 3598
- _ExtentY = 582
- ConnectMode = 0
- CursorLocation = 3
- IsolationLevel = -1
- ConnectionTimeout= 15
- CommandTimeout = 30
- CursorType = 3
- LockType = 3
- CommandType = 1
- CursorOptions = 0
- CacheSize = 50
- MaxRecords = 0
- BOFAction = 0
- EOFAction = 0
- ConnectStringType= 1
- Appearance = 1
- BackColor = -2147483643
- ForeColor = -2147483640
- Orientation = 0
- Enabled = -1
- Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_manpowerinfo"
- OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_manpowerinfo"
- OLEDBFile = ""
- DataSourceName = ""
- OtherAttributes = ""
- UserName = ""
- Password = ""
- RecordSource = "select * from 工资表"
- Caption = "Adodc1"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin MSComctlLib.ImageList ImageList1
- Left = 1875
- Top = 2715
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 32
- ImageHeight = 32
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 9
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "main_gzgl_gzgl.frx":000C
- Key = ""
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "main_gzgl_gzgl.frx":0CE6
- Key = ""
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "main_gzgl_gzgl.frx":1460
- Key = ""
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "main_gzgl_gzgl.frx":1D3A
- Key = ""
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "main_gzgl_gzgl.frx":2614
- Key = ""
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "main_gzgl_gzgl.frx":2EEE
- Key = ""
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "main_gzgl_gzgl.frx":38E8
- Key = ""
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "main_gzgl_gzgl.frx":41C2
- Key = ""
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "main_gzgl_gzgl.frx":4A9C
- Key = ""
- EndProperty
- EndProperty
- End
- Begin MSComctlLib.Toolbar Toolbar1
- Align = 1 'Align Top
- Height = 795
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 10350
- _ExtentX = 18256
- _ExtentY = 1402
- ButtonWidth = 1455
- ButtonHeight = 1349
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 11
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "当前月份"
- Key = "all"
- ImageIndex = 1
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "查找"
- Key = "find"
- ImageIndex = 2
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "修改"
- Key = "modify"
- ImageIndex = 3
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "批量修改"
- Key = "allmodify"
- ImageIndex = 4
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "Excel"
- Key = "excel"
- ImageIndex = 6
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "工资台账"
- Key = "print"
- ImageIndex = 9
- EndProperty
- BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "工资条"
- Key = "printone"
- ImageIndex = 7
- EndProperty
- BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Enabled = 0 'False
- Style = 3
- EndProperty
- BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "关闭"
- Key = "close"
- ImageIndex = 8
- EndProperty
- EndProperty
- BorderStyle = 1
- End
- Begin MSDataGridLib.DataGrid DataGrid1
- Bindings = "main_gzgl_gzgl.frx":5776
- Height = 5010
- Left = 15
- TabIndex = 1
- Top = 825
- Width = 10290
- _ExtentX = 18150
- _ExtentY = 8837
- _Version = 393216
- AllowUpdate = 0 'False
- HeadLines = 1
- RowHeight = 15
- FormatLocked = -1 'True
- BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ColumnCount = 17
- BeginProperty Column00
- DataField = "所属工资月份"
- Caption = "所属工资月份"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column01
- DataField = "员工编号"
- Caption = "员工编号"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column02
- DataField = "员工姓名"
- Caption = "员工姓名"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column03
- DataField = "基本工资"
- Caption = "基本工资"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column04
- DataField = "加班费"
- Caption = "加班费"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column05
- DataField = "工龄工资"
- Caption = "工龄工资"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column06
- DataField = "全勤奖"
- Caption = "全勤奖"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column07
- DataField = "奖励总额"
- Caption = "奖励总额"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column08
- DataField = "职务津贴"
- Caption = "职务津贴"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column09
- DataField = "旷工费"
- Caption = "旷工费"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column10
- DataField = "惩罚总额"
- Caption = "惩罚总额"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column11
- DataField = "养老保险"
- Caption = "养老保险"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column12
- DataField = "失业保险"
- Caption = "失业保险"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column13
- DataField = "医疗保险"
- Caption = "医疗保险"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column14
- DataField = "应发工资"
- Caption = "应发工资"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column15
- DataField = "应扣工资"
- Caption = "应扣工资"
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column16
- DataField = "实发工资"
- 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
- MarqueeStyle = 4
- BeginProperty Column00
- ColumnWidth = 1154.835
- EndProperty
- BeginProperty Column01
- ColumnWidth = 780.095
- EndProperty
- BeginProperty Column02
- ColumnWidth = 840.189
- EndProperty
- BeginProperty Column03
- ColumnWidth = 1140.095
- EndProperty
- BeginProperty Column04
- ColumnWidth = 720
- EndProperty
- BeginProperty Column05
- ColumnWidth = 870.236
- EndProperty
- BeginProperty Column06
- ColumnWidth = 675.213
- EndProperty
- BeginProperty Column07
- ColumnWidth = 840.189
- EndProperty
- BeginProperty Column08
- ColumnWidth = 840.189
- EndProperty
- BeginProperty Column09
- ColumnWidth = 705.26
- EndProperty
- BeginProperty Column10
- ColumnWidth = 900.284
- EndProperty
- BeginProperty Column11
- ColumnWidth = 840.189
- EndProperty
- BeginProperty Column12
- ColumnWidth = 870.236
- EndProperty
- BeginProperty Column13
- ColumnWidth = 870.236
- EndProperty
- BeginProperty Column14
- EndProperty
- BeginProperty Column15
- ColumnWidth = 1170.142
- EndProperty
- BeginProperty Column16
- ColumnWidth = 1454.74
- EndProperty
- EndProperty
- End
- Begin MSAdodcLib.Adodc Adodc2
- Height = 330
- Left = 0
- Top = 0
- Visible = 0 'False
- Width = 2040
- _ExtentX = 3598
- _ExtentY = 582
- ConnectMode = 0
- CursorLocation = 3
- IsolationLevel = -1
- ConnectionTimeout= 15
- CommandTimeout = 30
- CursorType = 3
- LockType = 3
- CommandType = 2
- CursorOptions = 0
- CacheSize = 50
- MaxRecords = 0
- BOFAction = 0
- EOFAction = 0
- ConnectStringType= 1
- Appearance = 1
- BackColor = -2147483643
- ForeColor = -2147483640
- Orientation = 0
- Enabled = -1
- Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_manpowerinfo"
- OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_manpowerinfo"
- OLEDBFile = ""
- DataSourceName = ""
- OtherAttributes = ""
- UserName = ""
- Password = ""
- RecordSource = "工资公式表"
- Caption = "Adodc1"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- End
- Attribute VB_Name = "main_gzgl_gzgl"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Dim rs1 As New ADODB.Recordset
- Public newsql As String
- Private Sub Form_Activate()
- If sql1 <> "" Then
- Adodc1.RecordSource = "select * from " & sql1
- Adodc1.Refresh
- Else
- If Toolbar1.Buttons(1).Caption = "当前月份" Then
- Adodc1.RecordSource = "select * from 工资表 where 所属工资月份=(select 月份 from 月份表) order by 所属工资月份,员工编号"
- Adodc1.Refresh
- Else
- Adodc1.RecordSource = "select * from 工资表 order by 所属工资月份,员工编号"
- Adodc1.Refresh
- End If
- End If
- If Adodc1.Recordset.RecordCount > 0 Then
- Else
- MsgBox "没有找到符合条件的记录!", , "提示窗口"
- End If
- End Sub
- Private Sub Form_Load()
- Me.Caption = text
- Adodc1.RecordSource = "select * from 工资表 where 工资表.所属工资月份=(select 月份 from 月份表)"
- Adodc1.Refresh
- rs1.Open "select * from 工资表 where 工资表.所属工资月份=(select 月份 from 月份表)", Cnn, adOpenKeyset, adLockOptimistic
- If rs1.RecordCount > 0 Then
- Else
- Cnn.Execute ("insert into 工资表(员工编号,员工姓名) select 编号,姓名 from 人事表")
- Cnn.Execute ("update 工资表 set 所属工资月份=月份 from 月份表 where 所属工资月份 is null")
- Cnn.Execute ("update 工资表 set 基本工资=初始值 from 工资公式表 where 项目名称='基本工资'and 工资表.所属工资月份=(select 月份 from 月份表)")
- Cnn.Execute ("update 工资表 set 工龄工资=初始值 from 工资公式表 where 项目名称='工龄工资'and 工资表.所属工资月份=(select 月份 from 月份表)")
- Cnn.Execute ("update 工资表 set 加班费=初始值 from 工资公式表 where 项目名称='加班费'and 工资表.所属工资月份=(select 月份 from 月份表)")
- Cnn.Execute ("update 工资表 set 全勤奖=初始值 from 工资公式表 where 项目名称='全勤奖'and 工资表.所属工资月份=(select 月份 from 月份表)")
- Cnn.Execute ("update 工资表 set 奖励总额=奖励金额 from 员工奖励表 where 工资表.员工编号=员工奖励表.员工编号 and 工资表.所属工资月份=员工奖励表.所属工资月份")
- Cnn.Execute ("update 工资表 set 职务津贴=初始值 from 工资公式表 where 项目名称='职务津贴'and 工资表.所属工资月份=(select 月份 from 月份表)")
- Cnn.Execute ("update 工资表 set 旷工费=初始值 from 工资公式表 where 项目名称='旷工费'and 工资表.所属工资月份=(select 月份 from 月份表)")
- Cnn.Execute ("update 工资表 set 惩罚总额=惩罚金额 from 员工惩罚表 where 工资表.员工编号=员工惩罚表.员工编号 and 工资表.所属工资月份=员工惩罚表.所属工资月份")
- Cnn.Execute ("update 工资表 set 养老保险=初始值 from 工资公式表 where 项目名称='养老保险'and 工资表.所属工资月份=(select 月份 from 月份表)")
- Cnn.Execute ("update 工资表 set 失业保险=初始值 from 工资公式表 where 项目名称='失业保险'and 工资表.所属工资月份=(select 月份 from 月份表)")
- Cnn.Execute ("update 工资表 set 医疗保险=初始值 from 工资公式表 where 项目名称='医疗保险'and 工资表.所属工资月份=(select 月份 from 月份表)")
- Cnn.Execute ("update 工资表 set 应发工资=基本工资+工龄工资+加班费+全勤奖+奖励总额+职务津贴 where 工资表.所属工资月份=(select 月份 from 月份表)")
- Cnn.Execute ("update 工资表 set 应扣工资=旷工费+惩罚总额+养老保险+失业保险+医疗保险 where 工资表.所属工资月份=(select 月份 from 月份表)")
- Cnn.Execute ("update 工资表 set 实发工资=应发工资-应扣工资 where 工资表.所属工资月份=(select 月份 from 月份表)")
- Adodc1.Refresh
- End If
- rs1.Close
-
-
- Dim fld
- For Each fld In Adodc1.Recordset.Fields
- '如果字段类型为"货币",则格式化该列
- If fld.Type = 6 Then
- Dim f1 As StdDataFormat
- Set f1 = DataGrid1.Columns(fld.Name).DataFormat
- f1.Format = "##,##0.00"
- End If
- Next
- End Sub
- Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
- sql1 = ""
- End Sub
- Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
- Select Case Button.Key
- Case "all"
- If Toolbar1.Buttons(1).Caption = "当前月份" Then
- Toolbar1.Buttons(1).Caption = "所有月份"
- Else
- Toolbar1.Buttons(1).Caption = "当前月份"
- End If
- If Toolbar1.Buttons(1).Caption = "所有月份" Then
- If sql1 <> "" Then
- Adodc1.RecordSource = "select * from 工资表 " & sql1 & " order by 所属工资月份,员工编号"
- Adodc1.Refresh
- Else
- Adodc1.RecordSource = "select * from 工资表 order by 所属工资月份,员工编号"
- Adodc1.Refresh
- End If
- Else
- If sql1 <> "" Then
- Adodc1.RecordSource = "select * from 工资表 " & sql1 & "and 工资表.所属工资月份=(select 月份 from 月份表) order by 所属工资月份,员工编号"
- Adodc1.Refresh
- Else
- Adodc1.RecordSource = "select * from 工资表 where 工资表.所属工资月份=(select 月份 from 月份表) order by 所属工资月份,员工编号"
- Adodc1.Refresh
- End If
- End If
- Case "modify"
- If Adodc1.Recordset.RecordCount > 0 Then
- Load main_gzgl_gzgl_lr
- main_gzgl_gzgl_lr.Show 1
- Else
- MsgBox "系统没有要修改的数据!", , "提示窗口"
- End If
- Case "allmodify"
- If Adodc1.Recordset.RecordCount > 0 Then
- Load main_gzgl_gzgl_pl
- main_gzgl_gzgl_pl.Show 1
- Else
- MsgBox "系统没有要修改的数据!", , "提示窗口"
- End If
- Case "find"
- tb1 = "工资表"
- Load main_fzfind
- main_fzfind.Show 1
- Case "excel"
- Dim r As Integer, c As Integer
- Dim newxls As Excel.Application
- Dim newbook As Excel.Workbook
- Dim newsheet As Excel.Worksheet
- Set newxls = CreateObject("Excel.Application") '创建excel应用程序,打开excel2000
- Set newbook = newxls.Workbooks.Add '创建工作簿
- Set newsheet = newbook.Worksheets(1) '创建工作表
- If Toolbar1.Buttons(1).Caption = "所有月份" Then
- If sql1 <> "" Then
- Adodc1.RecordSource = "select * from " & sql1 & "order by 所属工资月份,员工编号"
- Adodc1.Refresh
- Else
- Adodc1.RecordSource = "select * from 工资表 order by 所属工资月份,员工编号"
- Adodc1.Refresh
- End If
- Else
- If sql1 <> "" Then
- Adodc1.RecordSource = "select * from " & sql1 & "and 所属工资月份=(select 月份 from 月份表) order by 所属工资月份,员工编号"
- Adodc1.Refresh
- Else
- Adodc1.RecordSource = "select * from 工资表 where 所属工资月份=(select 月份 from 月份表) order by 所属工资月份,员工编号"
- Adodc1.Refresh
- End If
- End If
- If Adodc1.Recordset.RecordCount > 0 Then
- newxls.Visible = True
- For i = 0 To DataGrid1.Columns.Count - 1
- newsheet.Cells(1, i + 1) = DataGrid1.Columns(i).Caption
- Next i
- '指定表格内容
- Adodc1.Recordset.MoveFirst
- Do Until Adodc1.Recordset.EOF
- r = Adodc1.Recordset.AbsolutePosition
- For c = 0 To DataGrid1.Columns.Count - 1
- newsheet.Cells(r + 1, c + 1) = DataGrid1.Columns(c)
- Next c
- Adodc1.Recordset.MoveNext
- Loop
- End If
- Case "print"
- If Toolbar1.Buttons(1).Caption = "所有月份" Then
- If sql1 <> "" Then
- DE1.rsCommand1.Open "select * from " & sql1 & " order by 所属工资月份,员工编号"
- Else
- DE1.rsCommand1.Open "select * from 工资表 order by 所属工资月份,员工编号"
- End If
- Else
- If sql1 <> "" Then
- DE1.rsCommand1.Open "select * from " & sql1 & " and 所属工资月份=(select 月份 from 月份表) order by 所属工资月份,员工编号"
- Else
- DE1.rsCommand1.Open "select * from 工资表 where 所属工资月份=(select 月份 from 月份表) order by 所属工资月份,员工编号"
- End If
- End If
- DR1_gzdy.Orientation = rptOrientLandscape
- DR1_gzdy.LeftMargin = 200
- DR1_gzdy.RightMargin = 200
- DR1_gzdy.Show 1
- Case "printone"
- If Toolbar1.Buttons(1).Caption = "所有月份" Then
- If sql1 <> "" Then
- DE1.rsCommand2.Open "select * from " & sql1 & " order by 所属工资月份,员工编号"
- Else
- DE1.rsCommand2.Open "select * from 工资表 order by 所属工资月份,员工编号"
- End If
- Else
- If sql1 <> "" Then
- DE1.rsCommand2.Open "select * from " & sql1 & " and 所属工资月份=(select 月份 from 月份表) order by 所属工资月份,员工编号"
- Else
- DE1.rsCommand2.Open "select * from 工资表 where 所属工资月份=(select 月份 from 月份表) order by 所属工资月份,员工编号"
- End If
- End If
- DR1_gzt.Orientation = rptOrientPortrait
- DR1_gzt.Show 1
- Case "close"
- Unload Me
- End Select
- End Sub