资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:42k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{D76D7128-4A96-11D3-BD95-D296DC2DD072}#1.0#0"; "VSOCX7.OCX"
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
- Begin VB.Form Rep_BankPay_Frm
- Caption = "自定义报表"
- ClientHeight = 8595
- ClientLeft = 315
- ClientTop = 390
- ClientWidth = 11820
- HelpContextID = 2213006
- Icon = "报表_银行代发.frx":0000
- KeyPreview = -1 'True
- LinkTopic = "Form1"
- MDIChild = -1 'True
- ScaleHeight = 8595
- ScaleWidth = 11820
- WindowState = 2 'Maximized
- Begin VB.Frame Fm_Proc
- Caption = "正在读取信息..."
- Height = 660
- Left = 2310
- TabIndex = 12
- Top = 3495
- Visible = 0 'False
- Width = 5250
- Begin MSComctlLib.ProgressBar PB_Proc
- Height = 330
- Left = 75
- TabIndex = 13
- Top = 225
- Width = 5085
- _ExtentX = 8969
- _ExtentY = 582
- _Version = 393216
- Appearance = 1
- Scrolling = 1
- End
- End
- Begin VB.PictureBox Pic_Title
- BackColor = &H00FFFFFF&
- Height = 1035
- Left = -45
- Picture = "报表_银行代发.frx":1042
- ScaleHeight = 975
- ScaleWidth = 11715
- TabIndex = 2
- Top = 615
- Width = 11775
- Begin MSComDlg.CommonDialog Dlg_Save
- Left = 11085
- Top = 15
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- End
- Begin VB.Label Lab_Value
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Lab_Value3"
- Height = 180
- Index = 3
- Left = 9360
- TabIndex = 11
- Top = 645
- Width = 900
- End
- Begin VB.Label Lab_Value
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Lab_Value2"
- Height = 180
- Index = 2
- Left = 7395
- TabIndex = 10
- Top = 645
- Width = 900
- End
- Begin VB.Label Lab_Value
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Lab_Value1"
- Height = 180
- Index = 1
- Left = 4155
- TabIndex = 9
- Top = 660
- Width = 900
- End
- Begin VB.Label Lab_Value
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Lab_Value0"
- Height = 180
- Index = 0
- Left = 1755
- TabIndex = 8
- Top = 660
- Width = 900
- End
- Begin VB.Label Lab_Mark
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "人数:"
- Height = 180
- Index = 3
- Left = 8850
- TabIndex = 7
- Top = 660
- Width = 450
- End
- Begin VB.Label Lab_Mark
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "会计期间:"
- Height = 180
- Index = 2
- Left = 6555
- TabIndex = 6
- Top = 645
- Width = 810
- End
- Begin VB.Label Lab_Mark
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "银行名称:"
- Height = 180
- Index = 1
- Left = 3225
- TabIndex = 5
- Top = 675
- Width = 810
- End
- Begin VB.Label Lab_Mark
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "工资类别:"
- Height = 180
- Index = 0
- Left = 945
- TabIndex = 4
- Top = 675
- Width = 810
- End
- Begin VB.Label Lab_Title
- AutoSize = -1 'True
- BackColor = &H80000018&
- BackStyle = 0 'Transparent
- Caption = "自定义报表"
- BeginProperty Font
- Name = "宋体"
- Size = 12
- Charset = 134
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 240
- Left = 495
- TabIndex = 3
- Top = 180
- Width = 1275
- End
- End
- Begin VB.Timer Timer1
- Enabled = 0 'False
- Interval = 1
- Left = 7620
- Top = 90
- End
- Begin VSFlex8Ctl.VSFlexGrid CxbbGrid
- Height = 7185
- Left = -135
- TabIndex = 0
- Top = 1785
- Width = 11775
- _ExtentX = 20770
- _ExtentY = 12674
- Appearance = 1
- BorderStyle = 1
- Enabled = -1 'True
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- MousePointer = 0
- BackColor = 16777215
- ForeColor = -2147483640
- BackColorFixed = 13826538
- ForeColorFixed = -2147483630
- BackColorSel = -2147483635
- ForeColorSel = -2147483634
- BackColorBkg = -2147483636
- BackColorAlternate= 16777215
- GridColor = -2147483633
- GridColorFixed = -2147483632
- TreeColor = -2147483632
- FloodColor = 192
- SheetBorder = -2147483642
- FocusRect = 1
- HighLight = 1
- AllowSelection = -1 'True
- AllowBigSelection= -1 'True
- AllowUserResizing= 0
- SelectionMode = 0
- GridLines = 1
- GridLinesFixed = 2
- GridLineWidth = 1
- Rows = 50
- Cols = 10
- FixedRows = 1
- FixedCols = 1
- RowHeightMin = 0
- RowHeightMax = 0
- ColWidthMin = 0
- ColWidthMax = 0
- ExtendLastCol = 0 'False
- FormatString = ""
- ScrollTrack = 0 'False
- ScrollBars = 3
- ScrollTips = 0 'False
- MergeCells = 0
- MergeCompare = 0
- AutoResize = -1 'True
- AutoSizeMode = 0
- AutoSearch = 0
- MultiTotals = -1 'True
- SubtotalPosition= 1
- OutlineBar = 0
- OutlineCol = 0
- Ellipsis = 0
- ExplorerBar = 0
- PicturesOver = 0 'False
- FillStyle = 0
- RightToLeft = 0 'False
- PictureType = 0
- TabBehavior = 0
- OwnerDraw = 0
- Editable = 0 'False
- ShowComboButton = -1 'True
- WordWrap = 0 'False
- TextStyle = 0
- TextStyleFixed = 0
- OleDragMode = 0
- OleDropMode = 0
- DataMode = 0
- VirtualData = -1 'True
- End
- Begin MSComctlLib.Toolbar SzToolbar
- Align = 1 'Align Top
- Height = 570
- Left = 0
- TabIndex = 1
- Top = 0
- Width = 11820
- _ExtentX = 20849
- _ExtentY = 1005
- ButtonWidth = 820
- ButtonHeight = 953
- AllowCustomize = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 9
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "设置"
- Key = "ymsz"
- Object.ToolTipText = "设置打印参数"
- ImageKey = "sz"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "打印"
- Key = "dy"
- Object.ToolTipText = "打印当前数据"
- ImageKey = "dy"
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "预览"
- Key = "yl"
- Object.ToolTipText = "显示当前数据的打印模式"
- ImageKey = "yl"
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "查询"
- Key = "cx"
- Object.ToolTipText = "以某种条件取得数据"
- ImageKey = "cx"
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "导出"
- Key = "Export"
- ImageKey = "Export"
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "帮助"
- Key = "bz"
- Object.ToolTipText = "显示帮助信息"
- ImageKey = "bz"
- EndProperty
- BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- Object.ToolTipText = "退出本报表"
- ImageKey = "tc"
- EndProperty
- EndProperty
- BorderStyle = 1
- Begin MSComctlLib.ImageList ImageList1
- Left = 5280
- Top = 0
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 36
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":35106
- Key = "sz"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":354A0
- Key = "dy"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3583A
- Key = "yl"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":35BD4
- Key = "xg"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":35F6E
- Key = "zh"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":36308
- Key = "sh"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":366A2
- Key = "bc"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":36A3C
- Key = "fq"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":36DD6
- Key = "bz"
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":37170
- Key = "tc"
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3750A
- Key = "bcgs"
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":378A4
- Key = "mrlk"
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":37C3E
- Key = "xsxm"
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":37FD8
- Key = "first"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":38372
- Key = "prev"
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3870C
- Key = "next"
- EndProperty
- BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":38AA6
- Key = "last"
- EndProperty
- BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":38E40
- Key = "xx"
- EndProperty
- BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":391DA
- Key = "define"
- EndProperty
- BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":39574
- Key = "exec"
- EndProperty
- BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3990E
- Key = "xz"
- EndProperty
- BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":39CA8
- Key = "sc"
- EndProperty
- BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3A042
- Key = "sx"
- EndProperty
- BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3A3DC
- Key = "cx"
- EndProperty
- BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3A776
- Key = "zd"
- EndProperty
- BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3AB10
- Key = "dz"
- EndProperty
- BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3AEAA
- Key = "ph"
- EndProperty
- BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3B244
- Key = "fz"
- EndProperty
- BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3B5DE
- Key = "Locate"
- EndProperty
- BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3B978
- Key = "hf"
- EndProperty
- BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3BD12
- Key = "pz"
- EndProperty
- BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3C0AC
- Key = "check"
- EndProperty
- BeginProperty ListImage33 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3C446
- Key = "Sum"
- EndProperty
- BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3C7E0
- Key = "Total"
- EndProperty
- BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3CB7A
- Key = "Detail"
- EndProperty
- BeginProperty ListImage36 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "报表_银行代发.frx":3CF14
- Key = "Export"
- EndProperty
- EndProperty
- End
- End
- End
- Attribute VB_Name = "Rep_BankPay_Frm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '**************************************************************************
- '* 模 块 名 称 :银行代发
- '* 功 能 描 述 :
- '* 程序员姓名 :苗鹏
- '* 最后修改人 :苗鹏
- '* 最后修改时间:2001/10/06
- '* 备 注:程序中所有依实际情况自定义部分均用[>> <<]括起
- '**************************************************************************
- Dim ReportTitle As String '报表主标题
- Public sSqlWhere As String
- Public sSqlFrom As String
- Public sSortID As String
- Public sSortName As String
- Public sBankCode As String
- Public sBankName As String
- Public sBankID As String
- Public iPeriod As Integer
- Dim bColTitle As Integer
- Dim iBkSepType As Integer
- Dim iFileType As Integer
- Dim Str_RightEdit As String '编辑(新增、修改、删除)权限索引
- '以下为固定使用变量
- Dim Dyymctbl As New DY_Dyymsz '打印页面窗体变量
- Dim GridCode As String '显示网格网格代码
- Dim GridInf() As Variant '整个网格设置信息
- Dim Tsxx As String '系统提示信息
- Dim Qslz As Long '网格隐藏(非操作显示)列数
- Dim Sjhgd As Double '网格数据行高度
- Dim Sfxshjwg As Boolean '是否显示合计网格
- Dim GridBoolean() As Boolean '网格列信息(布尔型)
- Dim GridStr() As String '网格列信息(字符型)
- Dim GridInt() As Integer '网格列信息(整型)
- Dim Szzls As Integer '数组总列数(网格列数-1)
- Private Sub CxbbGrid_AfterMoveColumn(ByVal Col As Long, Position As Long) '重新刷新控制数组
- On Error Resume Next
- Dim i As Integer
- With Me.CxbbGrid
- ReDim sFieldValue(.Cols - 1)
- For i = 0 To .Cols - 1
- sFieldValue(i).FieldName = Trim(.TextMatrix(1, i))
- Next i
- End With
- End Sub
- Private Sub Form_Resize() '根据窗体大小来调整网格,标题栏大小(Fixed)
- On Error Resume Next
- With CxbbGrid
- .Width = Me.Width - 160
- .Height = Me.Height - .Top - 400
- End With
- With Pic_Title
- .Width = Me.Width - 160
- End With
- GsToolbar.Left = Me.Width - GsToolbar.Width - 140
- With Me.PB_Proc
- .Left = (Me.Width - .Width) / 2
- .Top = Me.Height / 2
- End With
- End Sub
- Private Sub Form_Load() '窗体装入
- On Error GoTo ErrCtrl
- '清空显示值
- Dim i As Integer
- For i = 0 To Me.Lab_Value.Count - 1
- Me.Lab_Value(i).Caption = ""
- Next i
- '调入打印页面设置窗体
- ReportTitle = "银行代发"
- XtReportCode = "PM_BankPay"
- Load Dyymctbl
- Me.Caption = ReportTitle
- Me.Lab_Title = ReportTitle
- '调整标题栏及网格、格式工具条位置(Fixed)
- Pic_Title.Left = 40
- Pic_Title.Top = SzToolbar.Top + SzToolbar.Height - 10
- CxbbGrid.Left = Pic_Title.Left
- CxbbGrid.Top = Pic_Title.Top + Pic_Title.Height + 20
- '调 入 网 格(Fixed)
- GridCode = "Pm_RepBankPay"
- Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
- Qslz = GridInf(1)
- Sjhgd = GridInf(2)
- Sfxshjwg = GridInf(7)
- Szzls = CxbbGrid.Cols - 1
- '编辑(新增、修改、删除)权限索引
- Str_RightEdit = "Pm_BankPayOff_edit"
- Exit Sub
- ErrCtrl:
- MsgBox "初始化错误!", vbOKOnly + vbCritical
- Set Dyymctbl = Nothing
- Unload Me
- End Sub
- Private Sub Form_Unload(Cancel As Integer) '窗体卸载
- '卸载打印页面设置窗体
- Unload Dyymctbl
- Set Dyymctbl = Nothing
- Unload Query_BankPay_Frm
- Security_Log "Pm_BankPayOff", Xtczybm, 2, False '用户退出时写上机日志
- End Sub
- Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
- Select Case Button.Key
- Case "ymsz" '页面设置
- Dyymctbl.Show 1
- Case "yl" '预 览
- bbyl (True)
- Case "dy" '打 印
- bbyl (False)
- Case "cx" '查 询
- Query_BankPay_Frm.Show 1
- Case "Export"
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
- Exit Sub
- End If
- With Me.CxbbGrid
- If .Rows > .FixedRows Then
- '去掉合计行
- Dim sSum() As String
- Dim i As Integer
- ReDim sSum(.Cols - 1)
- For i = 0 To .Cols - 1
- sSum(i) = .TextMatrix(.Rows - 1, i)
- Next i
- .RemoveItem (.Rows - 1)
- '导出数据
- ExportGrid
- '恢复合计
- .AddItem ""
- For i = 0 To .Cols - 1
- .TextMatrix(.Rows - 1, i) = sSum(i)
- Next i
- .RowHeight(.Rows - 1) = .RowHeight(.FixedRows)
- End If
- End With
- Case "bz" '帮 助
- Call F1bz
- Case "fh" '退 出
- Unload Me
- End Select
- End Sub
- Private Function ExportGrid() '导出数据
- On Error GoTo ErrCtrl
- Dim i As Long, j As Long, lStartRow As Long
- Dim s As String
- Dim rs As New ADODB.Recordset
- Dim sPath As String
- Dim sFileName As String
- Dim iFileNum As Integer
- Dim sSep As String
- Dim sData As String
- Dim bBeginTrans As Boolean
- '取得路径
- s = "select FilePath ,FileName from PM_BankPara WHERE SortID='" & Me.sSortID & "' AND BankCode='" & Me.sBankCode & "' AND Czybm='" & Xtczybm & "'"
- Set rs = Cw_DataEnvi.DataConnect.Execute(s)
- If Not rs.EOF() Then
- sPath = Trim(rs!filepath & "")
- End If
- rs.Close
- Set rs = Nothing
- '读取分隔符
- Select Case iBkSepType
- Case 1 '","
- sSep = ","
- Case 2 '"|"
- sSep = "|"
- Case 3 '"Tab"
- sSep = Chr(9)
- End Select
- '读取数据
- With Me.CxbbGrid
- If .FixedRows = .Rows Then
- Exit Function
- End If
- If bColTitle = True Then
- lStartRow = 0
- Else
- lStartRow = .FixedRows
- End If
- For i = lStartRow To .Rows - 1
- s = ""
- For j = GridInf(1) To .Cols - 1
- s = s & .TextMatrix(i, j) & sSep
- Next j
- If sSep <> "" Then
- s = Left(s, Len(s) - 1)
- End If
- s = s & Chr(13) & Chr(10)
- sData = sData & s
- Next i
- End With
- '导出文件格式
- With Me.Dlg_Save
- Select Case iFileType
- Case 0 'txt
- .Filter = "Text文件(*.txt)|*.txt"
- Case 1 'xls
- .Filter = "Excel文件(*.xls)|*.xls"
- Case 2 'doc
- .Filter = "Word文件(*.doc)|*.doc"
- End Select
- .DialogTitle = "导出文件"
- .FileName = sPath
- .Flags = cdlOFNOverwritePrompt + cdlOFNNoReadOnlyReturn
- .CancelError = True
- .Action = 2
- If .FileName <> "" Then
- sFileName = .FileName
- If iFileType = 1 Then 'Excel文件
- If bColTitle = True Then
- Me.CxbbGrid.SaveGrid Me.Dlg_Save.FileName, flexFileTabText, True
- Else
- Me.CxbbGrid.SaveGrid Me.Dlg_Save.FileName, flexFileTabText, False
- End If
- Else '其他
- iFileNum = FreeFile()
- Open sFileName For Output As #iFileNum
- Print #iFileNum, sData
- Close #iFileNum
- End If
- '保存路径
- Cw_DataEnvi.DataConnect.BeginTrans
- bBeginTrans = True
- Cw_DataEnvi.DataConnect.Execute ("DELETE pm_bankpara WHERE SortID='" & sSortID & "' AND BankCode='" & sBankCode & "'")
- s = "INSERT INTO PM_BankPara (Czybm ,SortID,BankCode ,FilePath) VALUES ('" & Xtczybm & "','" & Me.sSortID & "','" & Me.sBankCode & "','" & sFileName & "')"
- Cw_DataEnvi.DataConnect.Execute (s)
- Cw_DataEnvi.DataConnect.CommitTrans
- bBeginTrans = False
- Call Xtxxts("导出成功!", 0, 4)
- Else
- MsgBox "请输入文件名!", vbOKOnly + vbCritical
- GoTo ErrCtrl
- End If
- End With
- Exit Function
- ErrCtrl:
- If rs.State = 1 Then
- rs.Close
- End If
- Set rs = Nothing
- If bBeginTrans = True Then
- Cw_DataEnvi.DataConnect.RollbackTrans
- End If
- If Err.Number <> cdlCancel Then '用户按取消按钮
- MsgBox "导出失败!", vbOKOnly + vbCritical
- End If
- End Function
- Public Function ShowRecord(sWhere As String, sFrom As String) '生成查询结果(Define)
- On Error GoTo ErrCtrl
- Dim rs As New ADODB.Recordset
- Dim s As String
- Dim sField()
- Dim sBank()
- Dim bNoRecord As Boolean
- Dim sData() As String
- Dim iPos() As Long
- Dim i As Long
- Dim j As Long
- Dim m As Long
- Dim n As Integer
- Dim lValue As Long
- Me.MousePointer = 11
- '初始化数组
- ReDim iPos(0)
- iPos(0) = -1
- '设置标签
- Me.Lab_Value(0).Caption = Me.sSortName
- Me.Lab_Value(1).Caption = Me.sBankName
- Me.Lab_Value(2).Caption = Xtyear & "年" & Me.iPeriod & "月"
- '设置默认网格属性
- With Me.CxbbGrid
- .Rows = .FixedRows
- .Cols = 1
- End With
- '读取银行设置
- s = "select FileType,BKDot,BkThous,BkBitChar,BKCharType,BkBitVal,BkValType,BkSep,BkSepType,ColTitle" & Chr(10) _
- & " from PM_Bank WHERE BankCode='" & Me.sBankCode & "'"
- Set rs = Cw_DataEnvi.DataConnect.Execute(s)
- With rs
- If .EOF() Then
- Me.Lab_Value(3).Caption = 0
- MsgBox "没有银行信息!", vbOKOnly + vbCritical
- GoTo ErrCtrl
- Else
- ReDim sBank(.Fields.Count - 1)
- For j = 0 To .Fields.Count - 1
- sBank(j) = .Fields(j)
- Next j
- iFileType = !FileType
- bColTitle = !ColTitle
- iBkSepType = !bkseptype
- End If
- .Close
- End With
- '读取字段信息
- s = "select ColumnName,DataType,DataLen,DotLen,DataContent,Single,BkRoundType,AutoAdd1,SourceField " & Chr(10) _
- & " from PM_BankItem WHERE SortId='" & Me.sSortID & "' AND BankCode='" & Me.sBankCode & "' order by OrderNo"
- Set rs = Cw_DataEnvi.DataConnect.Execute(s)
- With rs
- If rs.EOF() Then
- Me.Lab_Value(3).Caption = 0
- MsgBox "没有设置代发项目!", vbOKOnly + vbCritical
- GoTo ErrCtrl
- Else
- ReDim sField(.RecordCount - 1, .Fields.Count - 1)
- For i = 0 To .RecordCount - 1
- For j = 0 To .Fields.Count - 1
- sField(i, j) = Trim(.Fields(j) & "")
- Next j
- .MoveNext
- Next i
- End If
- .Close
- End With
- '读取数据信息
- s = ""
- For i = 0 To UBound(sField)
- If Trim(sField(i, 8)) <> "" Then
- ReDim Preserve iPos(UBound(iPos) + 1)
- iPos(UBound(iPos)) = i
- s = s & "," & Trim(sField(i, 8)) & " as " & Replace(Trim(sField(i, 8)), ".", "#") & Chr(10)
- End If
- Next i
- s = Trim(s)
- If s <> "" Then
- s = Mid(s, 2, Len(s) - 1)
- s = " select " & s & sSqlFrom & sSqlWhere
- Set rs = Cw_DataEnvi.DataConnect.Execute(s)
- With rs
- If .EOF() Then
- bNoRecord = True
- Me.Lab_Value(3) = 0
- Else
- Me.Lab_Value(3) = .RecordCount
- ReDim sData(.RecordCount, .Fields.Count - 1)
- For i = 0 To .RecordCount - 1
- For j = 0 To .Fields.Count - 1
- sData(i, j) = Trim(.Fields(j) & "")
- sData(UBound(sData), j) = Val(sData(UBound(sData), j)) + Val(Trim(.Fields(j) & ""))
- Next j
- .MoveNext
- Next i
- End If
- .Close
- End With
- End If
- '初始化网格
- With Me.CxbbGrid
- .Rows = .FixedRows
- .Cols = GridInf(1) + UBound(sField) + 1
- For i = GridInf(1) To .Cols - 1
- .TextMatrix(.FixedRows - 1, i) = sField(i - GridInf(1), 0)
- .FixedAlignment(i) = flexAlignCenterCenter
- .ColWidth(i) = (sField(i - GridInf(1), 2) + 2) * 105
- If sField(i - GridInf(1), 1) = DATA_NUMERIC Then
- .ColAlignment(i) = flexAlignRightCenter
- Else
- .ColAlignment(i) = flexAlignLeftCenter
- End If
- Next i
- End With
- '初始化进度条
- Me.Fm_Proc.Visible = True
- Me.Fm_Proc.Caption = "正在格式化系统数据..."
- Me.PB_Proc.Min = 0
- If bNoRecord = False Then
- Me.PB_Proc.Max = UBound(iPos) * (UBound(sData) + 1) + 1
- Else
- Me.PB_Proc.Max = 1
- End If
- Me.PB_Proc.Value = 0
- '格式化数据
- If bNoRecord = False Then
- For i = 1 To UBound(iPos)
- If sField(iPos(i), 1) = DATA_NUMERIC Then '数字类型
- For j = 0 To UBound(sData)
- Me.PB_Proc.Value = (Me.PB_Proc.Value + 1) Mod Me.PB_Proc.Max
- If Val(sField(iPos(i), 3)) = 0 Then '小数位数为0
- sData(j, i - 1) = Format(sData(j, i - 1), "###0")
- Else
- sData(j, i - 1) = Format(sData(j, i - 1), "###0." & String(Val(sField(iPos(i), 3)), "0"))
- End If
- If sBank(2) = True Then '数据类型输出千分符
- If Val(sField(iPos(i), 3)) = 0 Then '小数位数为0
- sData(j, i - 1) = Format(sData(j, i - 1), "#,##0")
- Else
- sData(j, i - 1) = Format(sData(j, i - 1), "#,##0." & String(Val(sField(iPos(i), 3)), "0"))
- End If
- End If
- If sBank(1) = False Then '数据类型不输出小数点
- sData(j, i - 1) = Replace(sData(j, i - 1), ".", "")
- End If
- If sBank(5) = True Then '数字型数据有补位符
- n = IIf(sField(iPos(i), 2) - Len(sData(j, i - 1)) > 0, sField(iPos(i), 2) - Len(sData(j, i - 1)), 0)
- If sBank(6) = 1 Then ' 补空格
- sData(j, i - 1) = String(n, " ") & sData(j, i - 1)
- Else
- sData(j, i - 1) = String(n, "0") & sData(j, i - 1)
- End If
- End If
- '括项目的符号类型
- sData(j, i - 1) = sField(iPos(i), 6) & sData(j, i - 1) & sField(iPos(i), 6)
- Next j
- Else '字符型
- For j = 0 To UBound(sData)
- Me.PB_Proc.Value = (Me.PB_Proc.Value + 1) Mod Me.PB_Proc.Max
- If sBank(3) = True Then '数字型数据有补位符
- n = IIf(sField(iPos(i), 2) - LenByte(sData(j, i - 1)) > 0, sField(iPos(i), 2) - LenByte(sData(j, i - 1)), 0)
- If sBank(4) = 1 Then ' 补空格
- sData(j, i - 1) = sData(j, i - 1) & String(n, " ")
- Else
- sData(j, i - 1) = sData(j, i - 1) & String(n, "0")
- End If
- End If
- '括项目的符号类型
- sData(j, i - 1) = sField(iPos(i), 6) & sData(j, i - 1) & sField(iPos(i), 6)
- Next j
- End If
- Next i
- End If
- '初始化进度条
- Me.Fm_Proc.Visible = True
- Me.Fm_Proc.Caption = "正在填充数据..."
- Me.PB_Proc.Min = 0
- If bNoRecord = False Then
- Me.PB_Proc.Max = (UBound(sData) + 1) * (UBound(sField) + 1)
- Else
- Me.PB_Proc.Max = 1
- End If
- Me.PB_Proc.Value = 0
- '填充数据
- With Me.CxbbGrid
- If bNoRecord = True Then
- GoTo ErrCtrl
- End If
- .Rows = .FixedRows + UBound(sData) + 1
- For i = .FixedRows To .Rows - 1
- .RowHeight(i) = Sjhgd
- Next i
- For i = 0 To UBound(sField)
- m = IsInclude(iPos, i)
- If m > 0 Then '从字段取得的数据
- For j = .FixedRows To .Rows - 2
- Me.PB_Proc.Value = (Me.PB_Proc.Value + 1) Mod Me.PB_Proc.Max
- .TextMatrix(j, i + GridInf(1)) = sData(j - .FixedRows, m - 1)
- Next j
- If sField(i, 1) = DATA_NUMERIC Then
- .TextMatrix(.Rows - 1, i + GridInf(1)) = sData(UBound(sData), m - 1)
- End If
- Else '用户定义的数据
- If sField(i, 7) = True Then '自动加1
- For j = .FixedRows To .Rows - 2
- Me.PB_Proc.Value = (Me.PB_Proc.Value + 1) Mod Me.PB_Proc.Max
- s = j - .FixedRows + 1
- If sBank(2) = True Then '数据类型输出千分符
- If Val(sField(i, 3)) = 0 Then '小数位数为0
- s = Format(s, "#,##0")
- Else
- s = Format(s, "#,##0." & String(Val(sField(i, 3)), "0"))
- End If
- End If
- If sBank(1) = False Then '数据类型不输出小数点
- s = Replace(s, ".", "")
- End If
- If sBank(5) = True Then '字符型数据有补位符
- n = IIf(sField(i, 2) - Len(s) > 0, sField(i, 2) - Len(s), 0)
- If sBank(6) = 1 Then ' 补空格
- s = String(n, " ") & s
- Else
- s = String(n, "0") & s
- End If
- End If
- '括项目的符号类型
- s = sField(i, 6) & s & sField(i, 6)
- .TextMatrix(j, GridInf(1) + i) = s
- Next j
- Else '不是自动加1
- s = sField(i, 4)
- If sField(i, 1) = DATA_NUMERIC Then '用户录入数字型数据
- If Val(sField(i, 3)) = 0 Then '小数位数为0
- s = Format(s, "###0")
- Else
- s = Format(s, "###0." & String(Val(sField(iPos(i), 3)), "0"))
- End If
- If sBank(2) = True Then '数据类型输出千分符
- If Val(sField(i, 3)) = 0 Then '小数位数为0
- s = Format(s, "#,##0")
- Else
- s = Format(s, "#,##0." & String(Val(sField(i, 3)), "0"))
- End If
- End If
- If sBank(1) = False Then '数据类型不输出小数点
- s = Replace(s, ".", "")
- End If
- If sBank(5) = True Then '数字型数据有补位符
- n = IIf(sField(i, 2) - Len(s) > 0, sField(i, 2) - Len(s), 0)
- If sField(i, 6) = 1 Then ' 补空格
- s = String(n, " ") & s
- Else
- s = String(n, "0") & s
- End If
- End If
- '括项目的符号类型
- s = sField(i, 6) & s & sField(i, 6)
- For j = .FixedRows To .Rows - 2
- Me.PB_Proc.Value = (Me.PB_Proc.Value + 1) Mod Me.PB_Proc.Max
- .TextMatrix(j, GridInf(1) + i) = s
- Next j
- Else '用户录入字符型值
- s = sField(i, 4) '数据内容
- If sBank(3) = True Then '字符型数据有补位符
- n = IIf(sField(i, 2) - LenByte(s) >= 0, sField(i, 2) - LenByte(s), 0)
- If sBank(4) = 1 Then ' 补空格
- s = s & String(n, " ")
- Else
- s = s & String(n, "0")
- End If
- End If
- '括项目的符号类型
- s = sField(i, 6) & s & sField(i, 6)
- For j = 0 To UBound(sData) - 1
- Me.PB_Proc.Value = (Me.PB_Proc.Value + 1) Mod Me.PB_Proc.Max
- .TextMatrix(.FixedRows + j, i + GridInf(1)) = s
- Next j
- End If
- End If
- End If
- Next i
- If .Rows > .FixedRows And .Cols > .FixedCols And Val(GridInf(1)) >= 0 Then
- If Trim(.TextMatrix(.Rows - 1, Val(GridInf(1)))) = "" Then
- .TextMatrix(.Rows - 1, Val(GridInf(1))) = "合计:"
- End If
- .Cell(flexcpBackColor, .Rows - 1, 0, .Rows - 1, .Cols - 1) = &HF7F3EC
- End If
- End With
- Me.MousePointer = 0
- Me.Fm_Proc.Visible = False
- If rs.State = 1 Then
- rs.Close
- End If
- Set rs = Nothing
- Exit Function
- ErrCtrl:
- Me.Fm_Proc.Visible = False
- Me.MousePointer = 0
- If rs.State = 1 Then
- rs.Close
- End If
- Set rs = Nothing
- End Function
- Private Function IsInclude(iArr() As Long, iValue As Long) As Long
- '数组iArr是否包涵iValue
- Dim i As Long
- For i = LBound(iArr) To UBound(iArr)
- If iArr(i) = iValue Then
- IsInclude = i
- Exit Function
- End If
- Next i
- If i > UBound(iArr) Then
- IsInclude = -1
- End If
- End Function
- Private Sub bbyl(bbylte As Boolean) '报表打印预览
- Dim i As Integer
- Dim s As String
- Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
- Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
- Bbxbtgs = 2 '报 表 小 标 题 行 数
- Bbbwhgs = 0 '报 表 表 尾 行 数
- ReDim Bbxbt(1 To Bbxbtgs)
- ReDim bbxbtzzxs(1 To Bbxbtgs)
- If Bbbwhgs <> 0 Then
- ReDim Bbbwh(1 To Bbbwhgs)
- ReDim Bbbwhzzxs(1 To Bbbwhgs)
- End If
- Bbzbt = ReportTitle
- For i = 0 To Me.Lab_Mark.Count - 1
- s = s & Me.Lab_Mark(i).Caption & Me.Lab_Value(i).Caption & " "
- Next i
- Bbxbt(2) = s
- bbxbtzzxs(1) = 0 '报表行组织形式(0-居左 1-居中 2-居右)
- Call Scyxsjb(CxbbGrid) '生成报表数据
- Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
- If Not bbylte Then
- Unload DY_Tybbyldy
- End If
- End Sub