上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:34k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{BEEECC20-4D5F-4F8B-BFDC-5D9B6FBDE09D}#1.0#0"; "vsflex8.ocx"
  3. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  4. Begin VB.Form Bbfx_FrmBalFx 
  5.    Caption         =   "资产负债表分析"
  6.    ClientHeight    =   7095
  7.    ClientLeft      =   315
  8.    ClientTop       =   390
  9.    ClientWidth     =   9375
  10.    Icon            =   "报表分析_资产负债表分析.frx":0000
  11.    KeyPreview      =   -1  'True
  12.    LinkTopic       =   "Form1"
  13.    MDIChild        =   -1  'True
  14.    ScaleHeight     =   7095
  15.    ScaleWidth      =   9375
  16.    Begin VB.PictureBox Pic_Title 
  17.       Height          =   1020
  18.       Left            =   -30
  19.       Picture         =   "报表分析_资产负债表分析.frx":1042
  20.       ScaleHeight     =   960
  21.       ScaleWidth      =   9345
  22.       TabIndex        =   1
  23.       Top             =   570
  24.       Width           =   9405
  25.       Begin VB.Label Label_Bfb 
  26.          AutoSize        =   -1  'True
  27.          BackStyle       =   0  'Transparent
  28.          Caption         =   "单位:百分比"
  29.          Height          =   195
  30.          Left            =   7380
  31.          TabIndex        =   9
  32.          Top             =   735
  33.          Visible         =   0   'False
  34.          Width           =   945
  35.       End
  36.       Begin VB.Label lab_Fxq 
  37.          AutoSize        =   -1  'True
  38.          BackStyle       =   0  'Transparent
  39.          Caption         =   "从:"
  40.          Height          =   195
  41.          Left            =   750
  42.          TabIndex        =   8
  43.          Top             =   765
  44.          Width           =   225
  45.       End
  46.       Begin VB.Label lab_Bjq 
  47.          AutoSize        =   -1  'True
  48.          BackStyle       =   0  'Transparent
  49.          Caption         =   "到:"
  50.          Height          =   195
  51.          Left            =   3870
  52.          TabIndex        =   7
  53.          Top             =   765
  54.          Width           =   225
  55.       End
  56.       Begin VB.Label lab_fx 
  57.          AutoSize        =   -1  'True
  58.          BackStyle       =   0  'Transparent
  59.          Caption         =   "------"
  60.          Height          =   180
  61.          Left            =   1050
  62.          TabIndex        =   6
  63.          Top             =   765
  64.          Width           =   540
  65.       End
  66.       Begin VB.Label lab_bj 
  67.          AutoSize        =   -1  'True
  68.          BackStyle       =   0  'Transparent
  69.          Caption         =   "------"
  70.          Height          =   180
  71.          Left            =   4230
  72.          TabIndex        =   5
  73.          Top             =   780
  74.          Width           =   540
  75.       End
  76.       Begin VB.Label TsLabel 
  77.          AutoSize        =   -1  'True
  78.          BackColor       =   &H80000018&
  79.          BackStyle       =   0  'Transparent
  80.          Caption         =   "资产负债表分析"
  81.          BeginProperty Font 
  82.             Name            =   "宋体"
  83.             Size            =   12
  84.             Charset         =   134
  85.             Weight          =   700
  86.             Underline       =   0   'False
  87.             Italic          =   0   'False
  88.             Strikethrough   =   0   'False
  89.          EndProperty
  90.          ForeColor       =   &H00000000&
  91.          Height          =   240
  92.          Index           =   4
  93.          Left            =   600
  94.          TabIndex        =   2
  95.          Top             =   210
  96.          Width           =   1785
  97.       End
  98.    End
  99.    Begin MSComctlLib.Toolbar GsToolbar 
  100.       Height          =   525
  101.       Left            =   7695
  102.       TabIndex        =   0
  103.       Top             =   15
  104.       Width           =   1665
  105.       _ExtentX        =   2937
  106.       _ExtentY        =   926
  107.       ButtonWidth     =   1455
  108.       ButtonHeight    =   926
  109.       AllowCustomize  =   0   'False
  110.       Appearance      =   1
  111.       Style           =   1
  112.       ImageList       =   "ImageList1"
  113.       _Version        =   393216
  114.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  115.          NumButtons      =   2
  116.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  117.             Caption         =   "保存格式"
  118.             Key             =   "bcgs"
  119.             ImageKey        =   "bcgs"
  120.          EndProperty
  121.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  122.             Caption         =   "默认列宽"
  123.             Key             =   "hfmrgs"
  124.             ImageKey        =   "mrlk"
  125.          EndProperty
  126.       EndProperty
  127.    End
  128.    Begin VSFlex8Ctl.VSFlexGrid CxbbGrid 
  129.       Height          =   5475
  130.       Left            =   -30
  131.       TabIndex        =   3
  132.       Top             =   1620
  133.       Width           =   9405
  134.       _cx             =   5080
  135.       _cy             =   5080
  136.       Appearance      =   1
  137.       BorderStyle     =   1
  138.       Enabled         =   -1  'True
  139.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  140.          Name            =   "宋体"
  141.          Size            =   9
  142.          Charset         =   134
  143.          Weight          =   400
  144.          Underline       =   0   'False
  145.          Italic          =   0   'False
  146.          Strikethrough   =   0   'False
  147.       EndProperty
  148.       MousePointer    =   0
  149.       BackColor       =   16777215
  150.       ForeColor       =   -2147483640
  151.       BackColorFixed  =   12632256
  152.       ForeColorFixed  =   -2147483630
  153.       BackColorSel    =   -2147483635
  154.       ForeColorSel    =   -2147483634
  155.       BackColorBkg    =   -2147483636
  156.       BackColorAlternate=   16777215
  157.       GridColor       =   -2147483633
  158.       GridColorFixed  =   -2147483632
  159.       TreeColor       =   -2147483632
  160.       FloodColor      =   192
  161.       SheetBorder     =   -2147483642
  162.       FocusRect       =   1
  163.       HighLight       =   1
  164.       AllowSelection  =   -1  'True
  165.       AllowBigSelection=   -1  'True
  166.       AllowUserResizing=   0
  167.       SelectionMode   =   0
  168.       GridLines       =   1
  169.       GridLinesFixed  =   2
  170.       GridLineWidth   =   1
  171.       Rows            =   50
  172.       Cols            =   10
  173.       FixedRows       =   1
  174.       FixedCols       =   0
  175.       RowHeightMin    =   0
  176.       RowHeightMax    =   0
  177.       ColWidthMin     =   0
  178.       ColWidthMax     =   0
  179.       ExtendLastCol   =   0   'False
  180.       FormatString    =   ""
  181.       ScrollTrack     =   0   'False
  182.       ScrollBars      =   3
  183.       ScrollTips      =   0   'False
  184.       MergeCells      =   0
  185.       MergeCompare    =   0
  186.       AutoResize      =   -1  'True
  187.       AutoSizeMode    =   0
  188.       AutoSearch      =   0
  189.       AutoSearchDelay =   2
  190.       MultiTotals     =   -1  'True
  191.       SubtotalPosition=   1
  192.       OutlineBar      =   0
  193.       OutlineCol      =   0
  194.       Ellipsis        =   0
  195.       ExplorerBar     =   0
  196.       PicturesOver    =   0   'False
  197.       FillStyle       =   0
  198.       RightToLeft     =   0   'False
  199.       PictureType     =   0
  200.       TabBehavior     =   0
  201.       OwnerDraw       =   0
  202.       Editable        =   0
  203.       ShowComboButton =   1
  204.       WordWrap        =   0   'False
  205.       TextStyle       =   0
  206.       TextStyleFixed  =   0
  207.       OleDragMode     =   0
  208.       OleDropMode     =   0
  209.       DataMode        =   0
  210.       VirtualData     =   -1  'True
  211.       DataMember      =   ""
  212.       ComboSearch     =   3
  213.       AutoSizeMouse   =   -1  'True
  214.       FrozenRows      =   0
  215.       FrozenCols      =   0
  216.       AllowUserFreezing=   0
  217.       BackColorFrozen =   0
  218.       ForeColorFrozen =   0
  219.       WallPaperAlignment=   9
  220.       AccessibleName  =   ""
  221.       AccessibleDescription=   ""
  222.       AccessibleValue =   ""
  223.       AccessibleRole  =   24
  224.    End
  225.    Begin MSComctlLib.Toolbar SzToolbar 
  226.       Align           =   1  'Align Top
  227.       Height          =   555
  228.       Left            =   0
  229.       TabIndex        =   4
  230.       Top             =   0
  231.       Width           =   9375
  232.       _ExtentX        =   16536
  233.       _ExtentY        =   979
  234.       ButtonWidth     =   820
  235.       ButtonHeight    =   926
  236.       AllowCustomize  =   0   'False
  237.       Appearance      =   1
  238.       Style           =   1
  239.       ImageList       =   "ImageList1"
  240.       _Version        =   393216
  241.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  242.          NumButtons      =   10
  243.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  244.             Caption         =   "设置"
  245.             Key             =   "ymsz"
  246.             ImageKey        =   "sz"
  247.          EndProperty
  248.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  249.             Caption         =   "打印"
  250.             Key             =   "dy"
  251.             ImageKey        =   "dy"
  252.          EndProperty
  253.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  254.             Caption         =   "预览"
  255.             Key             =   "yl"
  256.             ImageKey        =   "yl"
  257.          EndProperty
  258.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  259.             Style           =   3
  260.          EndProperty
  261.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  262.             Caption         =   "查询"
  263.             Key             =   "cx"
  264.             ImageKey        =   "cx"
  265.          EndProperty
  266.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  267.             Object.Visible         =   0   'False
  268.             Style           =   3
  269.          EndProperty
  270.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  271.             Object.Visible         =   0   'False
  272.             Caption         =   "累计"
  273.             Key             =   "lj"
  274.             ImageKey        =   "lj"
  275.             Style           =   1
  276.          EndProperty
  277.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  278.             Style           =   3
  279.          EndProperty
  280.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  281.             Caption         =   "帮助"
  282.             Key             =   "bz"
  283.             ImageKey        =   "bz"
  284.          EndProperty
  285.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  286.             Caption         =   "退出"
  287.             Key             =   "fh"
  288.             ImageKey        =   "tc"
  289.          EndProperty
  290.       EndProperty
  291.       BorderStyle     =   1
  292.       Begin MSComctlLib.ImageList ImageList1 
  293.          Left            =   6450
  294.          Top             =   30
  295.          _ExtentX        =   1005
  296.          _ExtentY        =   1005
  297.          BackColor       =   -2147483643
  298.          ImageWidth      =   16
  299.          ImageHeight     =   16
  300.          MaskColor       =   12632256
  301.          _Version        =   393216
  302.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  303.             NumListImages   =   35
  304.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  305.                Picture         =   "报表分析_资产负债表分析.frx":35106
  306.                Key             =   "sz"
  307.             EndProperty
  308.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  309.                Picture         =   "报表分析_资产负债表分析.frx":354A0
  310.                Key             =   "dy"
  311.             EndProperty
  312.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  313.                Picture         =   "报表分析_资产负债表分析.frx":3583A
  314.                Key             =   "yl"
  315.             EndProperty
  316.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  317.                Picture         =   "报表分析_资产负债表分析.frx":35BD4
  318.                Key             =   "xg"
  319.             EndProperty
  320.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  321.                Picture         =   "报表分析_资产负债表分析.frx":35F6E
  322.                Key             =   "zh"
  323.             EndProperty
  324.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  325.                Picture         =   "报表分析_资产负债表分析.frx":36308
  326.                Key             =   "sh"
  327.             EndProperty
  328.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  329.                Picture         =   "报表分析_资产负债表分析.frx":366A2
  330.                Key             =   "bc"
  331.             EndProperty
  332.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  333.                Picture         =   "报表分析_资产负债表分析.frx":36A3C
  334.                Key             =   "fq"
  335.             EndProperty
  336.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  337.                Picture         =   "报表分析_资产负债表分析.frx":36DD6
  338.                Key             =   "bz"
  339.             EndProperty
  340.             BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  341.                Picture         =   "报表分析_资产负债表分析.frx":37170
  342.                Key             =   "tc"
  343.             EndProperty
  344.             BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  345.                Picture         =   "报表分析_资产负债表分析.frx":3750A
  346.                Key             =   "bcgs"
  347.             EndProperty
  348.             BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  349.                Picture         =   "报表分析_资产负债表分析.frx":378A4
  350.                Key             =   "mrlk"
  351.             EndProperty
  352.             BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  353.                Picture         =   "报表分析_资产负债表分析.frx":37C3E
  354.                Key             =   "xsxm"
  355.             EndProperty
  356.             BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  357.                Picture         =   "报表分析_资产负债表分析.frx":37FD8
  358.                Key             =   "first"
  359.             EndProperty
  360.             BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  361.                Picture         =   "报表分析_资产负债表分析.frx":38372
  362.                Key             =   "prev"
  363.             EndProperty
  364.             BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  365.                Picture         =   "报表分析_资产负债表分析.frx":3870C
  366.                Key             =   "next"
  367.             EndProperty
  368.             BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  369.                Picture         =   "报表分析_资产负债表分析.frx":38AA6
  370.                Key             =   "last"
  371.             EndProperty
  372.             BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  373.                Picture         =   "报表分析_资产负债表分析.frx":38E40
  374.                Key             =   "xx"
  375.             EndProperty
  376.             BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  377.                Picture         =   "报表分析_资产负债表分析.frx":391DA
  378.                Key             =   "define"
  379.             EndProperty
  380.             BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  381.                Picture         =   "报表分析_资产负债表分析.frx":39574
  382.                Key             =   "exec"
  383.             EndProperty
  384.             BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  385.                Picture         =   "报表分析_资产负债表分析.frx":3990E
  386.                Key             =   "xz"
  387.             EndProperty
  388.             BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  389.                Picture         =   "报表分析_资产负债表分析.frx":39CA8
  390.                Key             =   "sc"
  391.             EndProperty
  392.             BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  393.                Picture         =   "报表分析_资产负债表分析.frx":3A042
  394.                Key             =   "sx"
  395.             EndProperty
  396.             BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  397.                Picture         =   "报表分析_资产负债表分析.frx":3A3DC
  398.                Key             =   "cx"
  399.             EndProperty
  400.             BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  401.                Picture         =   "报表分析_资产负债表分析.frx":3A776
  402.                Key             =   "zd"
  403.             EndProperty
  404.             BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  405.                Picture         =   "报表分析_资产负债表分析.frx":3AB10
  406.                Key             =   "dz"
  407.             EndProperty
  408.             BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  409.                Picture         =   "报表分析_资产负债表分析.frx":3AEAA
  410.                Key             =   "ph"
  411.             EndProperty
  412.             BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  413.                Picture         =   "报表分析_资产负债表分析.frx":3B244
  414.                Key             =   "fz"
  415.             EndProperty
  416.             BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  417.                Picture         =   "报表分析_资产负债表分析.frx":3B5DE
  418.                Key             =   "dw"
  419.             EndProperty
  420.             BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  421.                Picture         =   "报表分析_资产负债表分析.frx":3B978
  422.                Key             =   "hf"
  423.             EndProperty
  424.             BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  425.                Picture         =   "报表分析_资产负债表分析.frx":3BD12
  426.                Key             =   "pz"
  427.             EndProperty
  428.             BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  429.                Picture         =   "报表分析_资产负债表分析.frx":3C0AC
  430.                Key             =   "check"
  431.             EndProperty
  432.             BeginProperty ListImage33 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  433.                Picture         =   "报表分析_资产负债表分析.frx":3C446
  434.                Key             =   "zz"
  435.             EndProperty
  436.             BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  437.                Picture         =   "报表分析_资产负债表分析.frx":3C7E0
  438.                Key             =   "mx"
  439.             EndProperty
  440.             BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  441.                Picture         =   "报表分析_资产负债表分析.frx":3CB7A
  442.                Key             =   "lj"
  443.             EndProperty
  444.          EndProperty
  445.       End
  446.    End
  447. End
  448. Attribute VB_Name = "Bbfx_FrmBalFx"
  449. Attribute VB_GlobalNameSpace = False
  450. Attribute VB_Creatable = False
  451. Attribute VB_PredeclaredId = True
  452. Attribute VB_Exposed = False
  453. '*************************************************************
  454. '*    模 块 名 称 :资产负债表分析
  455. '*    功 能 描 述 :对资产负债表的各种分析
  456. '*    程序员姓名  : 魏永生
  457. '*    最后修改人  :
  458. '*    最后修改时间:2002/1/15
  459. '*    备        注:
  460. '*    资产负债表分析/绝对数分析
  461. '*    资产负债表分析/定基分析
  462. '*    资产负债表分析/环比分析
  463. '*************************************************************
  464. Option Explicit
  465. Private Const DATE_FIX = "/"             '日期分隔符
  466. Public intType As Integer                '查询类型
  467. Public strBegin As String                '开始时间字符串
  468. Public strEnd As String                  '结束时间字符串
  469. Public strItem As String                 '资产负债表的分枝类别,与树型菜单一致
  470. Private myclsBal As New clsBal           '资产负债表类
  471. Private Rs As New ADODB.Recordset
  472. Public bSeach As Boolean
  473. Private GridStarCol As Integer           ' = 2网格起始数据列
  474. Private Const COL_WIDTH = 1500
  475. Dim itype As Integer
  476. Dim iYear As Integer
  477. Dim iExYear As Integer
  478. Dim iBeginMonth As Integer
  479. Dim iEndMonth As Integer
  480. Dim iWriteCols As Integer                '循环写入列数(用于写数据到网格)
  481. Dim iWriteRows As Integer                '循环写入行数
  482. Dim ReportTitle As String                '报表主标题
  483. '以下为固定使用变量
  484. Dim Dyymctbl As New DY_Dyymsz            '打印页面窗体变量
  485. Dim GridCode As String                   '显示网格网格代码
  486. Dim GridInf() As Variant                 '整个网格设置信息
  487. Dim Tsxx As String                       '系统提示信息
  488. Dim Qslz As Long                         '网格隐藏(非操作显示)列数
  489. Dim Sjhgd As Double                      '网格数据行高度
  490. Dim Sfxshjwg As Boolean                  '是否显示合计网格
  491. Dim GridBoolean() As Boolean             '网格列信息(布尔型)
  492. Dim GridStr()  As String                 '网格列信息(字符型)
  493. Dim GridInt() As Integer                 '网格列信息(整型)
  494. Dim Szzls As Integer                     '数组总列数(网格列数-1)
  495. Dim Bln_Stop As Boolean                  '停止输出查询结果
  496. Private Sub Form_Resize()                '根据窗体大小来调整网格,标题栏大小
  497.     On Error Resume Next
  498.     With CxbbGrid
  499.         .Width = Me.Width - 160
  500.         .Height = Me.Height - .Top - 400
  501.     End With
  502.     With Pic_Title
  503.         .Width = Me.Width - 160
  504.     End With
  505.     
  506.     GsToolbar.Left = Me.Width - GsToolbar.Width - 160
  507. End Sub
  508. Private Sub Form_Load()                  '窗体装入
  509.     If DEBUG_FLAG = False Then On Error Resume Next
  510.     '调入打印页面设置窗体
  511.     XtReportCode = "Cwfx_BalAnalysis"
  512.     Load Dyymctbl
  513.     
  514.     Me.bSeach = False
  515. End Sub
  516. Public Sub FormInit()                   '窗体初始化
  517.     If DEBUG_FLAG = False Then On Error Resume Next
  518.     ReportTitle = Me.TsLabel(4).Caption '打印标题
  519.     
  520.     Call FormatHead                     '初始化参数
  521.     myclsBal.Init Cw_DataEnvi.DataConnect '初始化资产负债表类
  522.     
  523.     GridCode = "cwfx_BalFx"
  524.     Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  525.     
  526.     Qslz = GridInf(1)
  527.     Sjhgd = GridInf(2)
  528.     Sfxshjwg = GridInf(7)
  529.     Szzls = CxbbGrid.Cols - 1
  530.     
  531.     Select Case intType
  532.     Case 0 '月
  533.         lab_fx.Caption = CStr(iYear) & "." & CStr(iBeginMonth)
  534.         lab_bj.Caption = CStr(iYear) & "." & CStr(iEndMonth)
  535.     Case 1 '季
  536.         lab_fx.Caption = strBegin
  537.         lab_bj.Caption = strEnd
  538.     Case 2 '年
  539.         lab_fx.Caption = CStr(iYear)
  540.         lab_bj.Caption = CStr(iExYear)
  541.     End Select
  542.     
  543.     
  544.     
  545.     '--------------填充表格-----------------------------
  546.     CxbbGrid.Redraw = False
  547.     Call GetBalZiChan
  548.     Call AddGridCol
  549.     GridStarCol = 2
  550.     
  551.     Call FillGrid                       '写入数据
  552.     
  553.     
  554.     GridStarCol = CxbbGrid.Cols + 1
  555.     
  556.     Call GetBalFuZhai
  557.     Call AddGridCol
  558.     Call FillGrid                       '写入数据
  559.     CxbbGrid.Redraw = True
  560.     '------------------------------------------------
  561. End Sub
  562. Private Sub Form_Unload(Cancel As Integer)                                  '窗体卸载
  563.     On Error Resume Next
  564.     '卸载打印页面设置窗体
  565.     Unload Dyymctbl
  566.     Unload mySeachForm                                  '卸载查询窗体
  567.     Set myclsBal = Nothing
  568. End Sub
  569. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)       '网格格式调整
  570.     If DEBUG_FLAG = False Then On Error Resume Next
  571.     Select Case Button.Key
  572.     Case "bcgs"                                          '保存表格格式
  573.         Call Bcwggs(CxbbGrid, GridCode, GridStr())
  574.     Case "hfmrgs"                                        '恢复默认格式
  575.         Call Hfmrgs(CxbbGrid, GridCode, GridStr())
  576.     Case "szxsxm"                                        '设置显示项目
  577.         Call Szxsxm(CxbbGrid, GridCode)
  578.     End Select
  579. End Sub
  580. Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
  581.     If DEBUG_FLAG = False Then On Error Resume Next
  582.     Select Case Button.Key
  583.     Case "ymsz"                                          '页面设置
  584.         Dyymctbl.Show 1
  585.     Case "yl"                                            '预 览
  586.         Call bbyl(True)
  587.     Case "dy"                                            '打 印
  588.         Call bbyl(False)
  589.     Case "cx"                                            '查 询
  590.         Call BalFx(strItem)
  591.         If mySeachForm.bSeach = True Then
  592.             Call FormInit
  593.         End If
  594.     Case "bz"                                            '帮 助
  595.         Call F1bz
  596.     Case "fh"                                            '退 出
  597.         Unload Me
  598.     Case "xx"
  599.         Call Form_Load
  600.     End Select
  601. End Sub
  602. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  603.     If DEBUG_FLAG = False Then On Error Resume Next
  604.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  605.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  606.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  607.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  608.     ReDim Bbxbt(1 To Bbxbtgs)
  609.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  610.     If Bbbwhgs <> 0 Then
  611.         ReDim Bbbwh(1 To Bbbwhgs)
  612.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  613.     End If
  614.     Bbzbt = ReportTitle
  615.     
  616.     
  617.     If strItem = "cwfx_BalJds" Then
  618.         Bbxbt(1) = "查询日期" & Space(2) & lab_Fxq.Caption & lab_fx.Caption & Space(20) & lab_Bjq.Caption & lab_bj.Caption
  619.     Else
  620.         Bbxbt(1) = "查询日期" & Space(2) & lab_Fxq.Caption & lab_fx.Caption & Space(20) & lab_Bjq.Caption & lab_bj.Caption & Space(20) & Label_Bfb.Caption
  621.     End If
  622.     
  623.     bbxbtzzxs(1) = 0                                    '报表行组织形式(0-居左 1-居中 2-居右)
  624.     Call Scyxsjb(CxbbGrid)                               '生成报表数据
  625.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  626.     If Not bbylte Then
  627.         Unload DY_Tybbyldy
  628.     End If
  629. End Sub
  630. Private Sub FormatHead()
  631.     If DEBUG_FLAG = False Then On Error Resume Next
  632.     itype = intType
  633.     Select Case intType                         '(窗体变量)
  634.     Case 0 '月
  635.         iBeginMonth = Val(Right(strBegin, 2))
  636.         iEndMonth = Val(Right(strEnd, 2))
  637.         iYear = Xtyear
  638.     Case 1 '季
  639.         iBeginMonth = Val(Right(strBegin, 2))   '此数据减2就是起始月
  640.         iEndMonth = Val(Right(strEnd, 2))       '此数据减2就是起始月
  641.         iYear = Xtyear
  642.     Case 2 '年
  643.         iYear = Val(strBegin)
  644.         iExYear = Val(strEnd)
  645.     End Select
  646.     
  647. End Sub
  648. Private Sub GetBalZiChan()
  649.     If DEBUG_FLAG = False Then On Error Resume Next
  650.     '填充资产类项目
  651.     Dim iRow As Integer
  652.     Set Rs = Cw_DataEnvi.DataConnect.Execute("select * from cwfx_BalanceInitial where LeftOrRight=1")
  653.     
  654.     iWriteRows = Rs.RecordCount - 1             '循环写入行数
  655.     
  656.     With CxbbGrid
  657.         iRow = .FixedRows
  658.         Do Until Rs.EOF
  659.             .AddItem ""
  660.             .TextMatrix(iRow, Sydz("001", GridStr(), Szzls)) = RTrim(Rs!comment)
  661.             .RowHeight(iRow) = Sjhgd
  662.             Rs.MoveNext
  663.             iRow = iRow + 1
  664.         Loop
  665.     End With
  666. End Sub
  667. Private Sub GetBalFuZhai()
  668.     If DEBUG_FLAG = False Then On Error Resume Next
  669.     '填充负债类项目
  670.     Dim iRow As Integer
  671.     '--------------------
  672.     Dim sigWidth As Single
  673.     Dim sigHeight As Single
  674.     '---------------------
  675.     Set Rs = Cw_DataEnvi.DataConnect.Execute("select * from cwfx_BalanceInitial where LeftOrRight=0")
  676.     
  677.     iWriteRows = Rs.RecordCount - 1             '循环写入行数
  678.     
  679.     With CxbbGrid
  680.         sigWidth = .ColWidth(1)
  681.         sigHeight = .RowHeight(1)
  682.         
  683.         .Cols = .Cols + 1
  684.         .ColAlignment(.Cols - 1) = flexAlignLeftCenter
  685.         .FixedAlignment(.Cols - 1) = flexAlignCenterCenter
  686.         .ColWidth(.Cols - 1) = sigWidth
  687.         .RowHeight(.Cols - 1) = sigHeight
  688.         .TextMatrix(0, .Cols - 1) = "负债"
  689.         
  690.         iRow = .FixedRows
  691.         Do Until Rs.EOF
  692.             If .Rows < iRow Then .AddItem ""
  693.             .TextMatrix(iRow, .Cols - 1) = RTrim(Rs!comment)
  694.             .RowHeight(iRow) = Sjhgd
  695.             Rs.MoveNext
  696.             iRow = iRow + 1
  697.         Loop
  698.     End With
  699. End Sub
  700. Private Sub AddGridCol()
  701.     If DEBUG_FLAG = False Then On Error Resume Next
  702.     Dim Item As Integer
  703.     Dim I As Integer
  704.     
  705.     iWriteCols = 0                              '循环写入写数置0
  706.     
  707.     Select Case itype
  708.     Case 0 '月
  709.         If iBeginMonth > iEndMonth Then
  710.             Item = iBeginMonth
  711.             iBeginMonth = iEndMonth
  712.             iEndMonth = Item
  713.         End If
  714.         
  715.         For I = iBeginMonth To iEndMonth
  716.             iWriteCols = iWriteCols + 1
  717.             With CxbbGrid
  718.                 .Cols = .Cols + 1
  719.                 .FixedAlignment(.Cols - 1) = flexAlignCenterCenter
  720.                 .ColAlignment(.Cols - 1) = 6
  721.                 .ColFormat(.Cols - 1) = "#,##0.00"
  722.                 .ColWidth(.Cols - 1) = COL_WIDTH
  723.                 .TextMatrix(.FixedRows - 1, .Cols - 1) = CStr(Xtyear) & DATE_FIX & Format(I, "00") & ""
  724.                 
  725.             End With
  726.         Next
  727.     Case 1 '季
  728.         
  729.         If iBeginMonth > iEndMonth Then
  730.             Item = iBeginMonth
  731.             iBeginMonth = iEndMonth
  732.             iEndMonth = Item
  733.         End If
  734.         
  735.         For I = iBeginMonth To iEndMonth Step 3
  736.             
  737.             iWriteCols = iWriteCols + 1
  738.             
  739.             With CxbbGrid
  740.                 .Cols = .Cols + 1
  741.                 .FixedAlignment(.Cols - 1) = flexAlignCenterCenter
  742.                 .ColWidth(.Cols - 1) = COL_WIDTH
  743.                 .ColAlignment(.Cols - 1) = 6
  744.                 .ColFormat(.Cols - 1) = "#,##0.00"
  745.                 .TextMatrix(.FixedRows - 1, .Cols - 1) = CStr(Xtyear) & DATE_FIX & Format(CStr(I - 2), "00") & "-" & CStr(Xtyear) & DATE_FIX & Format(CStr(I), "00") & ""
  746.             End With
  747.         Next
  748.     Case 2 '年
  749.         If iYear > iExYear Then
  750.             Item = iYear
  751.             iYear = iExYear
  752.             iExYear = Item
  753.         End If
  754.         
  755.         For I = iExYear To iYear
  756.             
  757.             iWriteCols = iWriteCols + 1
  758.             
  759.             With CxbbGrid
  760.                 .Cols = .Cols + 1
  761.                 .FixedAlignment(.Cols - 1) = flexAlignCenterCenter
  762.                 .ColWidth(.Cols - 1) = COL_WIDTH
  763.                 .ColAlignment(.Cols - 1) = 6
  764.                 .ColFormat(.Cols - 1) = "#,##0.00"
  765.                 .TextMatrix(.FixedRows - 1, .Cols - 1) = CStr(I) & "年"
  766.             End With
  767.         Next
  768.     End Select
  769.     
  770. End Sub
  771. '=================写数据到表格===========================================
  772. Private Sub FillGrid()
  773.     If DEBUG_FLAG = False Then On Error Resume Next
  774.     Dim iRow As Integer
  775.     Dim iCol As Integer
  776.     Dim dbl_Return As Double
  777.     Dim dbl_BaseValue As Double                     '本期数据
  778.     Dim dbl_OldValue As Double                      '上期数据
  779.     
  780.     For iCol = GridStarCol To GridStarCol + iWriteCols - 1
  781.         iRow = CxbbGrid.FixedRows
  782.         With Rs
  783.             If Not (.EOF And .BOF) Then
  784.                 .MoveFirst
  785.                 Do Until .EOF
  786.                     ' DoEvents
  787.                     If IsNull(!comment) = False Then
  788.                         If iRow > CxbbGrid.Rows Then CxbbGrid.AddItem ""
  789.                         Select Case strItem
  790.                         Case "cwfx_BalJds"          '绝对数分析
  791.                             Label_Bfb.Visible = False
  792.                             dbl_Return = TimeClass(Trim(!Item), iCol)
  793.                             CxbbGrid.TextMatrix(iRow, iCol) = IIf(dbl_Return = 0, "", dbl_Return)
  794.                         Case "cwfx_BalDj"           '定基分析
  795.                             Label_Bfb.Visible = True
  796.                             dbl_OldValue = TimeClass(Trim(!Item), iCol)
  797.                             If iCol = GridStarCol Then      '如果为起始列,则基数据为本期数据
  798.                                 dbl_BaseValue = dbl_OldValue
  799.                                 CxbbGrid.RowData(iRow) = dbl_OldValue '并保存基数据
  800.                             Else                            '取保存的基数据为比较数据
  801.                                 dbl_BaseValue = CxbbGrid.RowData(iRow)
  802.                             End If
  803.                             If dbl_BaseValue <> 0 Then
  804.                                 dbl_Return = Format((dbl_OldValue / dbl_BaseValue * 100), "#,##0.##")
  805.                                 CxbbGrid.TextMatrix(iRow, iCol) = IIf(dbl_Return = 0, "", CStr(dbl_Return))
  806.                             Else
  807.                                 CxbbGrid.TextMatrix(iRow, iCol) = ""
  808.                             End If
  809.                             dbl_BaseValue = dbl_OldValue
  810.                         Case "cwfx_BalHb"            '环比
  811.                             Label_Bfb.Visible = True
  812.                             dbl_OldValue = TimeClass(Trim(!Item), iCol)
  813.                             If iCol = GridStarCol Then      '如果为起始列,则基数据为本期数据
  814.                                 dbl_BaseValue = dbl_OldValue
  815.                                 CxbbGrid.RowData(iRow) = dbl_OldValue '并保存基数据
  816.                             Else
  817.                                 dbl_BaseValue = CxbbGrid.RowData(iRow)
  818.                             End If
  819.                             If dbl_OldValue <> 0 And dbl_BaseValue = 0 Then
  820.                                 CxbbGrid.TextMatrix(iRow, iCol) = ""
  821.                             ElseIf dbl_OldValue <> 0 And dbl_BaseValue <> 0 Then
  822.                                 dbl_Return = (dbl_OldValue / dbl_BaseValue * 100) ', "#,##0.##")
  823.                                 CxbbGrid.TextMatrix(iRow, iCol) = CStr(IIf(dbl_Return = 0, "", CStr(dbl_Return)))
  824.                             ElseIf dbl_OldValue = 0 And dbl_BaseValue = 0 Then
  825.                                 CxbbGrid.TextMatrix(iRow, iCol) = ""
  826.                             ElseIf dbl_OldValue = 0 And dbl_BaseValue <> 0 Then
  827.                                 CxbbGrid.TextMatrix(iRow, iCol) = ""
  828.                             End If
  829.                             CxbbGrid.RowData(iRow) = dbl_OldValue
  830.                         End Select
  831.                     End If
  832.                     
  833.                     iRow = iRow + 1
  834.                     .MoveNext
  835.                 Loop
  836.             End If
  837.         End With
  838.     Next iCol
  839.     
  840. End Sub
  841. Private Function TimeClass(ByVal ItemClass As String, ByVal iCol As Integer) As Double
  842.     If DEBUG_FLAG = False Then On Error Resume Next
  843.     Dim iTemMonthBegin As Integer
  844.     Dim iTemMonthEnd As Integer
  845.     Dim iTemYear As Integer
  846.     Select Case itype
  847.     Case 0 '月
  848.         iTemYear = Xtyear
  849.         iTemMonthBegin = Val(Right(CxbbGrid.TextMatrix(CxbbGrid.FixedRows - 1, iCol), 2))
  850.         iTemMonthEnd = iTemMonthBegin
  851.         TimeClass = myclsBal.GetPeriodValue(ItemClass, iTemMonthEnd, iTemYear)
  852.     Case 1 '季
  853.         iTemYear = Xtyear
  854.         iTemMonthBegin = Val(Right(CxbbGrid.TextMatrix(CxbbGrid.FixedRows - 1, iCol), 2))
  855.         iTemMonthEnd = iTemMonthBegin
  856.         TimeClass = myclsBal.GetPeriodValue(ItemClass, iTemMonthEnd, iTemYear)
  857.     Case 2 '年
  858.         iTemYear = Val(CxbbGrid.TextMatrix(CxbbGrid.FixedRows - 1, iCol))
  859.         TimeClass = myclsBal.GetPeriodValue(ItemClass, 12, iTemYear)
  860.     End Select
  861. End Function
  862. '========================================================================