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

企业管理

开发平台:

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 ZB_FrmDlzcxjg 
  5.    Caption         =   "多栏帐查询"
  6.    ClientHeight    =   7755
  7.    ClientLeft      =   315
  8.    ClientTop       =   390
  9.    ClientWidth     =   11190
  10.    HelpContextID   =   5001
  11.    Icon            =   "帐簿_科目多栏帐查询结果.frx":0000
  12.    KeyPreview      =   -1  'True
  13.    LinkTopic       =   "Form1"
  14.    MDIChild        =   -1  'True
  15.    ScaleHeight     =   7755
  16.    ScaleWidth      =   11190
  17.    WindowState     =   2  'Maximized
  18.    Begin VB.Timer Timer1 
  19.       Enabled         =   0   'False
  20.       Interval        =   1
  21.       Left            =   7620
  22.       Top             =   90
  23.    End
  24.    Begin VB.PictureBox Pic_Title 
  25.       Height          =   1065
  26.       Left            =   30
  27.       Picture         =   "帐簿_科目多栏帐查询结果.frx":1042
  28.       ScaleHeight     =   1005
  29.       ScaleWidth      =   11535
  30.       TabIndex        =   0
  31.       Top             =   600
  32.       Width           =   11595
  33.       Begin VB.Label Lab_AccMultiName 
  34.          AutoSize        =   -1  'True
  35.          BackStyle       =   0  'Transparent
  36.          ForeColor       =   &H00000000&
  37.          Height          =   180
  38.          Left            =   1740
  39.          TabIndex        =   14
  40.          Top             =   750
  41.          Width           =   2850
  42.       End
  43.       Begin VB.Label Lab_TitleMess 
  44.          AutoSize        =   -1  'True
  45.          BackStyle       =   0  'Transparent
  46.          Caption         =   "多栏:"
  47.          Height          =   180
  48.          Index           =   1
  49.          Left            =   1170
  50.          TabIndex        =   13
  51.          Top             =   750
  52.          Width           =   450
  53.       End
  54.       Begin VB.Label Label1 
  55.          Appearance      =   0  'Flat
  56.          BackColor       =   &H80000005&
  57.          BackStyle       =   0  'Transparent
  58.          Caption         =   "承前页"
  59.          ForeColor       =   &H80000008&
  60.          Height          =   195
  61.          Index           =   1
  62.          Left            =   9150
  63.          TabIndex        =   12
  64.          Top             =   300
  65.          Width           =   615
  66.       End
  67.       Begin VB.Label Lab_Color 
  68.          Appearance      =   0  'Flat
  69.          BackColor       =   &H00E9F4FA&
  70.          BorderStyle     =   1  'Fixed Single
  71.          ForeColor       =   &H80000008&
  72.          Height          =   195
  73.          Index           =   2
  74.          Left            =   8910
  75.          TabIndex        =   11
  76.          Top             =   270
  77.          Width           =   195
  78.       End
  79.       Begin VB.Label Label1 
  80.          Appearance      =   0  'Flat
  81.          BackColor       =   &H80000005&
  82.          BackStyle       =   0  'Transparent
  83.          Caption         =   "过次页"
  84.          ForeColor       =   &H80000008&
  85.          Height          =   195
  86.          Index           =   0
  87.          Left            =   8220
  88.          TabIndex        =   10
  89.          Top             =   300
  90.          Width           =   615
  91.       End
  92.       Begin VB.Label Lab_Color 
  93.          Appearance      =   0  'Flat
  94.          BackColor       =   &H00DFDFDF&
  95.          BorderStyle     =   1  'Fixed Single
  96.          ForeColor       =   &H80000008&
  97.          Height          =   195
  98.          Index           =   1
  99.          Left            =   7980
  100.          TabIndex        =   9
  101.          Top             =   270
  102.          Width           =   195
  103.       End
  104.       Begin VB.Label Label1 
  105.          Appearance      =   0  'Flat
  106.          BackColor       =   &H80000005&
  107.          BackStyle       =   0  'Transparent
  108.          Caption         =   "未记帐明细会计分录"
  109.          ForeColor       =   &H80000008&
  110.          Height          =   195
  111.          Index           =   2
  112.          Left            =   6240
  113.          TabIndex        =   7
  114.          Top             =   300
  115.          Width           =   1665
  116.       End
  117.       Begin VB.Label Lab_Color 
  118.          Appearance      =   0  'Flat
  119.          BackColor       =   &H00FFFF00&
  120.          BorderStyle     =   1  'Fixed Single
  121.          ForeColor       =   &H80000008&
  122.          Height          =   195
  123.          Index           =   0
  124.          Left            =   6000
  125.          TabIndex        =   6
  126.          Top             =   270
  127.          Width           =   195
  128.       End
  129.       Begin VB.Label Lab_TitleText 
  130.          AutoSize        =   -1  'True
  131.          BackStyle       =   0  'Transparent
  132.          ForeColor       =   &H00000000&
  133.          Height          =   180
  134.          Index           =   0
  135.          Left            =   6960
  136.          TabIndex        =   5
  137.          Top             =   750
  138.          Width           =   2280
  139.       End
  140.       Begin VB.Label TsLabel 
  141.          BackColor       =   &H80000018&
  142.          BackStyle       =   0  'Transparent
  143.          Caption         =   "科目多栏帐"
  144.          BeginProperty Font 
  145.             Name            =   "宋体"
  146.             Size            =   14.25
  147.             Charset         =   134
  148.             Weight          =   700
  149.             Underline       =   0   'False
  150.             Italic          =   0   'False
  151.             Strikethrough   =   0   'False
  152.          EndProperty
  153.          Height          =   330
  154.          Index           =   4
  155.          Left            =   540
  156.          TabIndex        =   2
  157.          Top             =   180
  158.          Width           =   1725
  159.       End
  160.       Begin VB.Label Lab_TitleMess 
  161.          AutoSize        =   -1  'True
  162.          BackStyle       =   0  'Transparent
  163.          Caption         =   "会计期间:"
  164.          Height          =   180
  165.          Index           =   0
  166.          Left            =   6000
  167.          TabIndex        =   1
  168.          Top             =   750
  169.          Width           =   810
  170.       End
  171.    End
  172.    Begin VSFlex8Ctl.VSFlexGrid CxbbGrid 
  173.       Height          =   6885
  174.       Left            =   90
  175.       TabIndex        =   3
  176.       Top             =   1710
  177.       Width           =   11715
  178.       _cx             =   5080
  179.       _cy             =   5080
  180.       Appearance      =   1
  181.       BorderStyle     =   1
  182.       Enabled         =   -1  'True
  183.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  184.          Name            =   "宋体"
  185.          Size            =   9
  186.          Charset         =   134
  187.          Weight          =   400
  188.          Underline       =   0   'False
  189.          Italic          =   0   'False
  190.          Strikethrough   =   0   'False
  191.       EndProperty
  192.       MousePointer    =   0
  193.       BackColor       =   16777215
  194.       ForeColor       =   -2147483640
  195.       BackColorFixed  =   12632256
  196.       ForeColorFixed  =   -2147483630
  197.       BackColorSel    =   -2147483635
  198.       ForeColorSel    =   -2147483634
  199.       BackColorBkg    =   -2147483636
  200.       BackColorAlternate=   16777215
  201.       GridColor       =   -2147483633
  202.       GridColorFixed  =   -2147483632
  203.       TreeColor       =   -2147483632
  204.       FloodColor      =   192
  205.       SheetBorder     =   -2147483642
  206.       FocusRect       =   1
  207.       HighLight       =   1
  208.       AllowSelection  =   -1  'True
  209.       AllowBigSelection=   -1  'True
  210.       AllowUserResizing=   0
  211.       SelectionMode   =   0
  212.       GridLines       =   1
  213.       GridLinesFixed  =   2
  214.       GridLineWidth   =   1
  215.       Rows            =   50
  216.       Cols            =   10
  217.       FixedRows       =   1
  218.       FixedCols       =   1
  219.       RowHeightMin    =   0
  220.       RowHeightMax    =   0
  221.       ColWidthMin     =   0
  222.       ColWidthMax     =   0
  223.       ExtendLastCol   =   0   'False
  224.       FormatString    =   ""
  225.       ScrollTrack     =   0   'False
  226.       ScrollBars      =   3
  227.       ScrollTips      =   0   'False
  228.       MergeCells      =   0
  229.       MergeCompare    =   0
  230.       AutoResize      =   -1  'True
  231.       AutoSizeMode    =   0
  232.       AutoSearch      =   0
  233.       AutoSearchDelay =   2
  234.       MultiTotals     =   -1  'True
  235.       SubtotalPosition=   1
  236.       OutlineBar      =   0
  237.       OutlineCol      =   0
  238.       Ellipsis        =   0
  239.       ExplorerBar     =   0
  240.       PicturesOver    =   0   'False
  241.       FillStyle       =   0
  242.       RightToLeft     =   0   'False
  243.       PictureType     =   0
  244.       TabBehavior     =   0
  245.       OwnerDraw       =   0
  246.       Editable        =   0
  247.       ShowComboButton =   1
  248.       WordWrap        =   0   'False
  249.       TextStyle       =   0
  250.       TextStyleFixed  =   0
  251.       OleDragMode     =   0
  252.       OleDropMode     =   0
  253.       DataMode        =   0
  254.       VirtualData     =   -1  'True
  255.       DataMember      =   ""
  256.       ComboSearch     =   3
  257.       AutoSizeMouse   =   -1  'True
  258.       FrozenRows      =   0
  259.       FrozenCols      =   0
  260.       AllowUserFreezing=   0
  261.       BackColorFrozen =   0
  262.       ForeColorFrozen =   0
  263.       WallPaperAlignment=   9
  264.       AccessibleName  =   ""
  265.       AccessibleDescription=   ""
  266.       AccessibleValue =   ""
  267.       AccessibleRole  =   24
  268.    End
  269.    Begin MSComctlLib.Toolbar SzToolbar 
  270.       Align           =   1  'Align Top
  271.       Height          =   555
  272.       Left            =   0
  273.       TabIndex        =   4
  274.       Top             =   0
  275.       Width           =   11190
  276.       _ExtentX        =   19738
  277.       _ExtentY        =   979
  278.       ButtonWidth     =   820
  279.       ButtonHeight    =   926
  280.       AllowCustomize  =   0   'False
  281.       Appearance      =   1
  282.       Style           =   1
  283.       ImageList       =   "ImageList1"
  284.       _Version        =   393216
  285.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  286.          NumButtons      =   10
  287.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  288.             Caption         =   "设置"
  289.             Key             =   "ymsz"
  290.             ImageKey        =   "sz"
  291.          EndProperty
  292.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  293.             Caption         =   "打印"
  294.             Key             =   "dy"
  295.             ImageKey        =   "dy"
  296.          EndProperty
  297.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  298.             Caption         =   "预览"
  299.             Key             =   "yl"
  300.             ImageKey        =   "yl"
  301.          EndProperty
  302.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  303.             Style           =   3
  304.          EndProperty
  305.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  306.             Caption         =   "查询"
  307.             Key             =   "cx"
  308.             ImageKey        =   "cx"
  309.          EndProperty
  310.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  311.             Style           =   3
  312.          EndProperty
  313.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  314.             Caption         =   "凭证"
  315.             Key             =   "pz"
  316.             ImageKey        =   "pz"
  317.          EndProperty
  318.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  319.             Style           =   3
  320.          EndProperty
  321.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  322.             Caption         =   "帮助"
  323.             Key             =   "bz"
  324.             ImageKey        =   "bz"
  325.          EndProperty
  326.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  327.             Caption         =   "退出"
  328.             Key             =   "fh"
  329.             ImageKey        =   "tc"
  330.          EndProperty
  331.       EndProperty
  332.       BorderStyle     =   1
  333.       Begin MSComctlLib.ImageList ImageList1 
  334.          Left            =   8460
  335.          Top             =   -30
  336.          _ExtentX        =   1005
  337.          _ExtentY        =   1005
  338.          BackColor       =   -2147483643
  339.          ImageWidth      =   16
  340.          ImageHeight     =   16
  341.          MaskColor       =   12632256
  342.          _Version        =   393216
  343.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  344.             NumListImages   =   32
  345.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  346.                Picture         =   "帐簿_科目多栏帐查询结果.frx":35106
  347.                Key             =   "sz"
  348.             EndProperty
  349.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  350.                Picture         =   "帐簿_科目多栏帐查询结果.frx":354A0
  351.                Key             =   "dy"
  352.             EndProperty
  353.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  354.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3583A
  355.                Key             =   "yl"
  356.             EndProperty
  357.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  358.                Picture         =   "帐簿_科目多栏帐查询结果.frx":35BD4
  359.                Key             =   "xg"
  360.             EndProperty
  361.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  362.                Picture         =   "帐簿_科目多栏帐查询结果.frx":35F6E
  363.                Key             =   "zh"
  364.             EndProperty
  365.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  366.                Picture         =   "帐簿_科目多栏帐查询结果.frx":36308
  367.                Key             =   "sh"
  368.             EndProperty
  369.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  370.                Picture         =   "帐簿_科目多栏帐查询结果.frx":366A2
  371.                Key             =   "bc"
  372.             EndProperty
  373.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  374.                Picture         =   "帐簿_科目多栏帐查询结果.frx":36A3C
  375.                Key             =   "fq"
  376.             EndProperty
  377.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  378.                Picture         =   "帐簿_科目多栏帐查询结果.frx":36DD6
  379.                Key             =   "bz"
  380.             EndProperty
  381.             BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  382.                Picture         =   "帐簿_科目多栏帐查询结果.frx":37170
  383.                Key             =   "tc"
  384.             EndProperty
  385.             BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  386.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3750A
  387.                Key             =   "bcgs"
  388.             EndProperty
  389.             BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  390.                Picture         =   "帐簿_科目多栏帐查询结果.frx":378A4
  391.                Key             =   "mrlk"
  392.             EndProperty
  393.             BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  394.                Picture         =   "帐簿_科目多栏帐查询结果.frx":37C3E
  395.                Key             =   "xsxm"
  396.             EndProperty
  397.             BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  398.                Picture         =   "帐簿_科目多栏帐查询结果.frx":37FD8
  399.                Key             =   "first"
  400.             EndProperty
  401.             BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  402.                Picture         =   "帐簿_科目多栏帐查询结果.frx":38372
  403.                Key             =   "prev"
  404.             EndProperty
  405.             BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  406.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3870C
  407.                Key             =   "next"
  408.             EndProperty
  409.             BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  410.                Picture         =   "帐簿_科目多栏帐查询结果.frx":38AA6
  411.                Key             =   "last"
  412.             EndProperty
  413.             BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  414.                Picture         =   "帐簿_科目多栏帐查询结果.frx":38E40
  415.                Key             =   "xx"
  416.             EndProperty
  417.             BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  418.                Picture         =   "帐簿_科目多栏帐查询结果.frx":391DA
  419.                Key             =   "define"
  420.             EndProperty
  421.             BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  422.                Picture         =   "帐簿_科目多栏帐查询结果.frx":39574
  423.                Key             =   "exec"
  424.             EndProperty
  425.             BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  426.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3990E
  427.                Key             =   "xz"
  428.             EndProperty
  429.             BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  430.                Picture         =   "帐簿_科目多栏帐查询结果.frx":39CA8
  431.                Key             =   "sc"
  432.             EndProperty
  433.             BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  434.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3A042
  435.                Key             =   "sx"
  436.             EndProperty
  437.             BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  438.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3A3DC
  439.                Key             =   "cx"
  440.             EndProperty
  441.             BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  442.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3A776
  443.                Key             =   "zd"
  444.             EndProperty
  445.             BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  446.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3AB10
  447.                Key             =   "dz"
  448.             EndProperty
  449.             BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  450.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3AEAA
  451.                Key             =   "ph"
  452.             EndProperty
  453.             BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  454.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3B244
  455.                Key             =   "fz"
  456.             EndProperty
  457.             BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  458.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3B5DE
  459.                Key             =   "dw"
  460.             EndProperty
  461.             BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  462.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3B978
  463.                Key             =   "hf"
  464.             EndProperty
  465.             BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  466.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3BD12
  467.                Key             =   "pz"
  468.             EndProperty
  469.             BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  470.                Picture         =   "帐簿_科目多栏帐查询结果.frx":3C0AC
  471.                Key             =   "check"
  472.             EndProperty
  473.          EndProperty
  474.       End
  475.       Begin MSComctlLib.Toolbar GsToolbar 
  476.          Height          =   525
  477.          Left            =   9510
  478.          TabIndex        =   8
  479.          Top             =   0
  480.          Width           =   1665
  481.          _ExtentX        =   2937
  482.          _ExtentY        =   926
  483.          ButtonWidth     =   1455
  484.          ButtonHeight    =   926
  485.          AllowCustomize  =   0   'False
  486.          Appearance      =   1
  487.          Style           =   1
  488.          ImageList       =   "ImageList1"
  489.          _Version        =   393216
  490.          BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  491.             NumButtons      =   2
  492.             BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  493.                Caption         =   "保存格式"
  494.                Key             =   "bcgs"
  495.                ImageKey        =   "bcgs"
  496.             EndProperty
  497.             BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  498.                Caption         =   "默认列宽"
  499.                Key             =   "hfmrgs"
  500.                ImageKey        =   "mrlk"
  501.             EndProperty
  502.          EndProperty
  503.       End
  504.    End
  505. End
  506. Attribute VB_Name = "ZB_FrmDlzcxjg"
  507. Attribute VB_GlobalNameSpace = False
  508. Attribute VB_Creatable = False
  509. Attribute VB_PredeclaredId = True
  510. Attribute VB_Exposed = False
  511. '****************************************************************************
  512. '*    模 块 名 称 :科目多栏帐
  513. '*    功 能 描 述 :本功能用于查询某多栏帐在某月或某几月的明细帐情况
  514. '*                 并且能够进行立体联查凭证数据。
  515. '*    程序员姓名  :张建忠
  516. '*    最后修改人  :奚俊峰
  517. '*    最后修改时间:2001.12.30
  518. '*    备        注:注意当两个表进行模糊连接操作时,应该对表字段进行去 "空格"
  519. '****************************************************************************
  520. Dim ReportTitle As String                '报表主标题
  521. Dim Str_AnalyCol() As String             '分析方向与网格列值对应表
  522. Dim Str_ItemCol() As String              '科目与网格列值对照表
  523. Dim Str_AccMultiCode As String           '多栏帐编码
  524. '以下为固定使用变量
  525. Dim Dyymctbl As New DY_Dyymsz            '打印页面窗体变量
  526. Dim GridCode As String                   '显示网格网格代码
  527. Dim GridInf() As Variant                 '整个网格设置信息
  528. Dim Tsxx As String                       '系统提示信息
  529. Dim Qslz As Long                         '网格隐藏(非操作显示)列数
  530. Dim Sjhgd As Double                      '网格数据行高度
  531. Dim Sfxshjwg As Boolean                  '是否显示合计网格
  532. Dim GridBoolean() As Boolean             '网格列信息(布尔型)
  533. Dim GridStr()  As String                 '网格列信息(字符型)
  534. Dim GridInt() As Integer                 '网格列信息(整型)
  535. Dim Szzls As Integer                     '数组总列数(网格列数-1)
  536. Private Sub Form_Resize()                '根据窗体大小来调整网格,标题栏大小
  537.     On Error Resume Next
  538.     With CxbbGrid
  539.         .Width = Me.Width - 160
  540.         .Height = Me.Height - .Top - 400
  541.     End With
  542.     With Pic_Title
  543.         .Width = Me.Width - 160
  544.     End With
  545.     GsToolbar.Left = Me.Width - GsToolbar.Width - 140
  546. End Sub
  547. Private Sub Form_Load()                                                   '窗体装入
  548.     
  549.     '调入打印页面设置窗体
  550.     XtReportCode = "Cwzz_dlzcx"
  551.     Load Dyymctbl
  552.     ReportTitle = "多  栏  帐"
  553.     
  554.     '调整标题栏及网格、格式工具条位置
  555.     Pic_Title.Left = 40
  556.     Pic_Title.Top = SzToolbar.Top + SzToolbar.Height - 10
  557.     CxbbGrid.Left = Pic_Title.Left
  558.     CxbbGrid.Top = Pic_Title.Top + Pic_Title.Height + 20
  559.     
  560.     '调 入 网 格
  561.     GridCode = "Cwzz_dlzcx"
  562.     Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  563.     
  564.     Qslz = GridInf(1)
  565.     Sjhgd = GridInf(2)
  566.     Sfxshjwg = GridInf(7)
  567.     Szzls = CxbbGrid.Cols - 1
  568.     
  569.     '调整标题位置
  570.     SetTitlePos tsLabel(4)
  571.     
  572.     
  573. End Sub
  574. Private Sub Form_Unload(Cancel As Integer)                                  '窗体卸载
  575.     '卸载条件窗体
  576.     ZB_FrmDlzcxtj.UnloadCheck.Value = 1
  577.     Unload ZB_FrmDlzcxtj
  578.     '卸载打印页面设置窗体
  579.     Unload Dyymctbl
  580. End Sub
  581. Private Sub Timer1_Timer()                                 '在窗体激活后调入查询程序
  582.     Dim RecTemp As New ADODB.Recordset
  583.     Dim Dbl_ColWidth As Double              '多栏帐多栏部分网格宽度
  584.     Dim Jsqte As Integer
  585.     
  586.     Dbl_ColWidth = 1650                     '支持金额到百亿
  587.     
  588.     '关闭定时器
  589.     Timer1.Enabled = False
  590.     
  591.     '重新设置网格
  592.     If ZB_FrmDlzcxtj.Imgebo_Dlz.ComboItems.count = 0 Then
  593.         Exit Sub
  594.     End If
  595.     
  596.     Str_AccMultiCode = GetComboKey(ZB_FrmDlzcxtj.Imgebo_Dlz, 0)
  597.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select * From Cwzz_AccMultiItem Where AccMultiCode='" & Str_AccMultiCode & "' Order By AnalyseOri Desc")
  598.     CxbbGrid.Cols = Szzls + 1 + RecTemp.RecordCount
  599.     
  600.     ReDim Str_ItemCol(CxbbGrid.Cols - 1)
  601.     ReDim Str_AnalyCol(CxbbGrid.Cols - 1)
  602.     
  603.     Jsqte = Szzls + 1
  604.     Do While Not RecTemp.EOF
  605.         Str_ItemCol(Jsqte) = Trim(RecTemp.Fields("Ccode") & "")       '核算科目
  606.         Str_AnalyCol(Jsqte) = Trim(RecTemp.Fields("AnalyseOri") & "") '分析方向
  607.         
  608.         CxbbGrid.TextMatrix(0, Jsqte) = Trim(RecTemp.Fields("AnalyseOri") & "") + Space(2) + "方"
  609.         CxbbGrid.TextMatrix(1, Jsqte) = Trim(RecTemp.Fields("ItemName") & "")
  610.         CxbbGrid.FixedAlignment(Jsqte) = 4
  611.         CxbbGrid.ColAlignment(Jsqte) = 6
  612.         CxbbGrid.ColFormat(Jsqte) = "#,##0." + String(Xtjexsws, "0")
  613.         CxbbGrid.ColWidth(Jsqte) = Dbl_ColWidth
  614.         Jsqte = Jsqte + 1
  615.         RecTemp.MoveNext
  616.     Loop
  617.     
  618.     Xt_Wait.Show
  619.     Xt_Wait.Refresh
  620.     
  621.     '加快显示速度
  622.     CxbbGrid.Redraw = False
  623.     
  624.     '生成查询结果
  625.     Call Sub_Query
  626.     
  627.     CxbbGrid.Redraw = True
  628.     
  629.     Xt_Wait.Hide
  630.     
  631. End Sub
  632. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)       '网格格式调整
  633.     Select Case Button.Key
  634.     Case "bcgs"                                          '保存表格格式
  635.         Call Bcwggs(CxbbGrid, GridCode, GridStr)
  636.     Case "hfmrgs"                                        '恢复默认格式
  637.         Call Hfmrgs(CxbbGrid, GridCode, GridStr)
  638.     Case "szxsxm"                                        '设置显示项目
  639.         Call Szxsxm(CxbbGrid, GridCode)
  640.     End Select
  641. End Sub
  642. Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
  643.     Select Case Button.Key
  644.     Case "ymsz"                                          '页面设置
  645.         Dyymctbl.Show 1
  646.     Case "yl"                                            '预 览
  647.         Call bbyl(True)
  648.     Case "dy"                                            '打 印
  649.         Call bbyl(False)
  650.     Case "cx"                                            '查 询
  651.         ZB_FrmDlzcxtj.Show 1
  652.     Case "pz"                                            '凭 证
  653.         Call CxbbGrid_DblClick
  654.     Case "bz"                                            '帮 助
  655.         Call F1bz
  656.     Case "fh"                                            '退 出
  657.         Unload Me
  658.     End Select
  659. End Sub
  660. Private Sub Sub_Query()                                    '生成查询结果
  661.     Dim Rec_AccMultiItem As New ADODB.Recordset     '临时使用多栏帐栏目动态集
  662.     Dim RecTemp As New ADODB.Recordset              '临时使用动态集
  663.     Dim Sqlstr As String                            '查询字符串
  664.     Dim Coljsq As Long                              '网格列计数器
  665.     Dim Jsqte As Long                               '临时动态计数器
  666.     Dim Str_Ccode As String                         '查询会计科目
  667.     Dim Int_BPeriod As Integer                      '查询起始会计期间
  668.     Dim Int_EPeriod As Integer                      '查询终止会计期间
  669.     Dim Int_Year As Integer                         '查询会计年度
  670.     Dim Bln_IncluNotBook As Boolean                 '是否包含未记帐凭证
  671.     Dim Bln_CqGcShow As Boolean                     '是否显示承前过次
  672.     Dim Int_Zdzyhs As Integer                       '正式帐页指定报表行数
  673.     Dim Int_DqPeriod As Integer                     '查询进行当前会计期间
  674.     Dim Lng_MonthCount As Long                      '本月明细帐记录条数
  675.     Dim Lng_YearCount As Long                       '本年明细帐记录条数
  676.     
  677.     Dim Dbl_Qcyete#                                 '期初金额
  678.     Dim Dbl_Jejfhj#, Dbl_Jedfhj#                    '本期合计(金额)
  679.     Dim Dbl_Jejflj#, Dbl_Jedflj#                    '截止累计(金额)
  680.     Dim Dbl_Qmyete#                                 '期末金额
  681.     
  682.     Dim Dbl_JejfhjDlz() As Double, Dbl_JedfhjDlz() As Double          '本期合计(金额)多栏部分
  683.     Dim Dbl_JejfljDlz() As Double, Dbl_JedfljDlz() As Double          '截止累计(金额)多栏部分
  684.     
  685.     
  686.     '以下为用户自定义部分[
  687.     
  688.     '清除原查询数据
  689.     CxbbGrid.Rows = CxbbGrid.FixedRows
  690.     
  691.     '得到查询起始和截止会计期间,并判断是否包含未记帐凭证
  692.     
  693.     If ZB_FrmDlzcxtj.Imgebo_Dlz.ComboItems.count = 0 Then
  694.         Exit Sub
  695.     End If
  696.     
  697.     
  698.     With ZB_FrmDlzcxtj
  699.         
  700.         Lab_AccMultiName.Caption = GetComboKey(ZB_FrmDlzcxtj.Imgebo_Dlz, 1)                                      '多栏名称
  701.         Lab_TitleText(0).Caption = ZB_FrmDlzcxtj.Combo_Kjqj(0).Text & "--" & ZB_FrmDlzcxtj.Combo_Kjqj(1).Text    '会计期间
  702.         
  703.         Int_Year = Int(Mid(.Combo_Kjqj(0).Text, 1, 4))
  704.         Int_BPeriod = Int(Mid(.Combo_Kjqj(0).Text, 6, 2))
  705.         Int_EPeriod = Int(Mid(.Combo_Kjqj(1).Text, 6, 2))
  706.         
  707.         '是否包含未记帐凭证
  708.         If .Chk_NotBook.Value = 1 Then
  709.             Bln_IncluNotBook = True
  710.         Else
  711.             Bln_IncluNotBook = False
  712.         End If
  713.         
  714.         '是否显示承前过次,如显示则将页面设置指定行数控制为>1且必须指定报表行数打印输出
  715.         If .Chk_CqGcShow = 1 Then
  716.             Bln_CqGcShow = True
  717.             Dyymctbl.ZdhsCheck.Enabled = False
  718.             Dyymctbl.ZdhsCheck.Value = 1
  719.             Dyymctbl.BbhsText.Enabled = False
  720.             Dyymctbl.BbhsVScroll.Enabled = False
  721.             Dyymctbl.BbhsText.Text = .LrText(0).Text
  722.         Else
  723.             Bln_CqGcShow = False
  724.             Dyymctbl.ZdhsCheck.Enabled = True
  725.             Dyymctbl.BbhsText.Enabled = True
  726.             Dyymctbl.BbhsVScroll.Enabled = True
  727.         End If
  728.         Int_Zdzyhs = Val(.LrText(0).Text)
  729.         
  730.     End With
  731.     
  732.     '初始化各种值
  733.     Dbl_Qcyete = 0
  734.     
  735.     Dbl_Jejfhj = 0
  736.     Dbl_Jedfhj = 0
  737.     
  738.     Dbl_Jejflj = 0
  739.     Dbl_Jedflj = 0
  740.     
  741.     ReDim Dbl_JejfhjDlz(CxbbGrid.Cols - 1)
  742.     ReDim Dbl_JedfhjDlz(CxbbGrid.Cols - 1)
  743.     ReDim Dbl_JejfljDlz(CxbbGrid.Cols - 1)
  744.     ReDim Dbl_JedfljDlz(CxbbGrid.Cols - 1)
  745.     
  746.     Lng_MonthCount = 0
  747.     Lng_YearCount = 0
  748.     
  749.     Jsqte = CxbbGrid.FixedRows - 1
  750.     
  751.     '1.计算期初余额(金额),并计算截止查询起始会计期间累计数据
  752.     Sqlstr = " SELECT Cwzz_AccMultiItem.Ccode,Qcyehj=IsNull(SUM(Cwzz_AccSum.Qcye),0),Mjjehj=IsNull(SUM(Cwzz_AccSum.Mjje),0),Mdjehj=IsNull(SUM(Cwzz_AccSum.Mdje),0), " & _
  753.     " Byjfljjehj=IsNull(SUM(Cwzz_AccSum.Byjfljje),0),Bydfljjehj=IsNull(SUM(Cwzz_AccSum.Bydfljje),0) FROM Cwzz_AccMultiItem LEFT OUTER JOIN " & _
  754.     " Cwzz_AccSum ON Cwzz_AccMultiItem.Ccode = Cwzz_AccSum.Ccode And Cwzz_AccSum.Year=" & Int_Year & _
  755.     " And Cwzz_AccSum.Period=" & Int_BPeriod & " WHERE Cwzz_AccMultiItem.AccMultiCode = '" & Str_AccMultiCode & "' Group By Cwzz_AccMultiItem.Ccode"
  756.     
  757.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  758.     Do While Not RecTemp.EOF
  759.         Dbl_Qcyete = Dbl_Qcyete + RecTemp.Fields("Qcyehj")
  760.         
  761.         '截止累计数据需要减掉本会计期间相应记帐数据
  762.         Dbl_Jejflj = Dbl_Jejflj + RecTemp.Fields("Byjfljjehj") - RecTemp.Fields("Mjjehj")
  763.         Dbl_Jedflj = Dbl_Jedflj + RecTemp.Fields("Bydfljjehj") - RecTemp.Fields("Mdjehj")
  764.         Dbl_JejfljDlz(Fun_CcodeCol(RecTemp.Fields("Ccode"))) = Dbl_JejfljDlz(Fun_CcodeCol(RecTemp.Fields("Ccode"))) + RecTemp.Fields("Byjfljjehj") - RecTemp.Fields("Mjjehj")
  765.         Dbl_JedfljDlz(Fun_CcodeCol(RecTemp.Fields("Ccode"))) = Dbl_JedfljDlz(Fun_CcodeCol(RecTemp.Fields("Ccode"))) + RecTemp.Fields("Bydfljjehj") - RecTemp.Fields("Mdjehj")
  766.         
  767.         RecTemp.MoveNext
  768.     Loop
  769.     
  770.     '如果包含未记帐凭证则计算小于查询起始会计期间包含科目借贷方合计
  771.     If Bln_IncluNotBook Then
  772.         Set Rec_AccMultiItem = Cw_DataEnvi.DataConnect.Execute("Select Ccode From Cwzz_AccMultiItem Where AccMultiCode='" & Str_AccMultiCode & "' Order By AnalyseOri Desc")
  773.         Do While Not Rec_AccMultiItem.EOF
  774.             Sqlstr = "SELECT Jfjehj=isnull(Sum(Jfje),0) ,Dfjehj=isnull(Sum(Dfje),0) From Cwzz_V_AccVouch Where BookFlag=0 And Ccode like '" & Trim(Rec_AccMultiItem.Fields("Ccode")) & "%' And Year=" & Int_Year & _
  775.             " And Period<" & Int_BPeriod
  776.             Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  777.             If Not RecTemp.EOF Then
  778.                 Dbl_Qcyete = Dbl_Qcyete + RecTemp.Fields("Jfjehj") - RecTemp.Fields("Dfjehj")
  779.                 
  780.                 '计算相应截止查询起始会计期间累计数据
  781.                 Dbl_Jejflj = Dbl_Jejflj + RecTemp.Fields("Jfjehj")
  782.                 Dbl_Jedflj = Dbl_Jedflj + RecTemp.Fields("Dfjehj")
  783.                 Dbl_JejfljDlz(Fun_CcodeCol(Trim(Rec_AccMultiItem.Fields("Ccode")))) = Dbl_JejfljDlz(Fun_CcodeCol(Trim(Rec_AccMultiItem.Fields("Ccode")))) + RecTemp.Fields("Jfjehj")
  784.                 Dbl_JedfljDlz(Fun_CcodeCol(Trim(Rec_AccMultiItem.Fields("Ccode")))) = Dbl_JedfljDlz(Fun_CcodeCol(Trim(Rec_AccMultiItem.Fields("Ccode")))) + RecTemp.Fields("Dfjehj")
  785.             End If
  786.             
  787.             Rec_AccMultiItem.MoveNext
  788.         Loop
  789.         
  790.     End If
  791.     
  792.     CxbbGrid.AddItem ""
  793.     Jsqte = Jsqte + 1
  794.     
  795.     '将期初数据写入网格(第1会计期间为上年结转,其余会计期间为期初余额)
  796.     If Int_BPeriod = 1 Then
  797.         CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = "上年结转"
  798.     Else
  799.         CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = "期初余额"
  800.     End If
  801.     
  802.     '输出余额
  803.     Call Sub_OutBalance(Jsqte, Dbl_Qcyete)
  804.     
  805.     
  806.     '2.读取查询会计期间范围内所有符合条件明细帐数据(以年度+会计期间),并写入网格
  807.     
  808.     '记录当前会计期间
  809.     Int_DqPeriod = Int_BPeriod
  810.     
  811.     '筛选所有符合条件数据
  812.     Sqlstr = "SELECT DISTINCT b.* FROM dbo.Cwzz_AccMultiItem a, dbo.Cwzz_V_AccVouchAss b" & _
  813.     " WHERE a.AccMultiCode = '" & Str_AccMultiCode & "' AND RTRIM(b.Ccode) LIKE RTRIM(a.Ccode) + '%'" & _
  814.     " And b.Year=" & Int_Year & " And b.Period>=" & Int_BPeriod & " And b.Period<=" & Int_EPeriod
  815.     
  816.     If Not Bln_IncluNotBook Then
  817.         Sqlstr = Sqlstr & " And b.BookFlag=1"
  818.     End If
  819.     Sqlstr = Sqlstr & " Order By b.Year,b.Period,b.Ddate,b.VouchID,b.SerialID"
  820.     
  821.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  822.     
  823.     With RecTemp
  824.         
  825.         Do While Not .EOF
  826.             
  827.             Str_Ccode = Trim(.Fields("Ccode"))          '此条明细帐记录
  828.             
  829.             If .Fields("Jfje") <> 0 Then
  830.                 If Fun_CcodeCol(Str_Ccode, "借") = 0 Then
  831.                     GoTo Wxjl
  832.                 End If
  833.             Else
  834.                 If Fun_CcodeCol(Str_Ccode, "贷") = 0 Then
  835.                     GoTo Wxjl
  836.                 End If
  837.             End If
  838.             
  839.             '当前进行会计期间发生变化则添加本月合计及本年累计
  840.             If .Fields("Period") <> Int_DqPeriod Then
  841.                 '显示本月合计
  842.                 If Lng_MonthCount <> 0 Then
  843.                     CxbbGrid.AddItem ""
  844.                     Jsqte = Jsqte + 1
  845.                     
  846.                     '输出本月合计
  847.                     Call Sub_OutPeriodSum(Jsqte, Int_DqPeriod, Dbl_Jejfhj, Dbl_Jedfhj, Dbl_JejfhjDlz(), Dbl_JedfhjDlz())
  848.                     
  849.                     '输出余额
  850.                     Call Sub_OutBalance(Jsqte, Dbl_Qcyete)
  851.                 End If
  852.                 
  853.                 '重新初始化本月合计数据
  854.                 Dbl_Jejfhj = 0
  855.                 Dbl_Jedfhj = 0
  856.                 
  857.                 Lng_MonthCount = 0
  858.                 
  859.                 For szjsq = 0 To CxbbGrid.Cols - 1
  860.                     Dbl_JejfhjDlz(szjsq) = 0
  861.                     Dbl_JedfhjDlz(szjsq) = 0
  862.                 Next szjsq
  863.                 
  864.                 '显示本年累计
  865.                 If Lng_YearCount <> 0 Then
  866.                     CxbbGrid.AddItem ""
  867.                     Jsqte = Jsqte + 1
  868.                     
  869.                     '输出本年累计
  870.                     Call Sub_OutYearSum(Jsqte, Int_DqPeriod, Dbl_Jejflj, Dbl_Jedflj, Dbl_JejfljDlz(), Dbl_JedfljDlz())
  871.                     
  872.                     '输出余额
  873.                     Call Sub_OutBalance(Jsqte, Dbl_Qcyete)
  874.                 End If
  875.                 
  876.                 '修改当前会计期间
  877.                 Int_DqPeriod = .Fields("Period")
  878.                 
  879.             End If        '显示本月合计,本年累计完毕
  880.             
  881.             
  882.             '显示明细数据
  883.             CxbbGrid.AddItem ""
  884.             Jsqte = Jsqte + 1
  885.             
  886.             '本月、本年记录计数器+1
  887.             Lng_MonthCount = Lng_MonthCount + 1
  888.             Lng_YearCount = Lng_YearCount + 1
  889.             
  890.             '未记帐明细分录变色显示
  891.             If .Fields("BookFlag") = 0 Then
  892.                 CxbbGrid.Cell(flexcpBackColor, Jsqte, 0, , CxbbGrid.Cols - 1) = Lab_Color(0).BackColor
  893.             End If
  894.             
  895.             CxbbGrid.TextMatrix(Jsqte, 0) = .Fields("VouchId")              '凭证ID
  896.             
  897.             
  898.             If IsDate(.Fields("Ddate")) Then
  899.                 CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = .Fields("Ddate")                    '日期
  900.             End If
  901.             CxbbGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("VouchClassCode") & "") + "-" + Mid(Trim(Str(10000 + .Fields("VouchNo"))), 2, 4) '凭证字号
  902.             CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("Digest") & "")           '摘要
  903.             
  904.             '部门
  905.             If Trim(.Fields("DeptName") & "") <> "" Then
  906.                 CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) + " " + Trim(.Fields("DeptName") & "")
  907.             End If
  908.             '个人
  909.             If Trim(.Fields("PersonName") & "") <> "" Then
  910.                 CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) + " " + Trim(.Fields("PersonName") & "")
  911.             End If
  912.             '客户
  913.             If Trim(.Fields("CusName") & "") <> "" Then
  914.                 CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) + " " + Trim(.Fields("CusName") & "")
  915.             End If
  916.             '项目
  917.             If Trim(.Fields("ItemName") & "") <> "" Then
  918.                 CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) + " " + Trim(.Fields("ItemName") & "")
  919.             End If
  920.             
  921.             If .Fields("Jfje") <> 0 Then                                                                       '借方金额
  922.                 CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = .Fields("Jfje")
  923.                 If Fun_CcodeCol(Str_Ccode, "借") <> 0 Then
  924.                     CxbbGrid.TextMatrix(Jsqte, Fun_CcodeCol(Str_Ccode, "借")) = .Fields("Jfje")
  925.                 End If
  926.             End If
  927.             If .Fields("Dfje") <> 0 Then                                                                       '贷方金额
  928.                 CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = .Fields("Dfje")
  929.                 If Fun_CcodeCol(Str_Ccode, "贷") <> 0 Then
  930.                     CxbbGrid.TextMatrix(Jsqte, Fun_CcodeCol(Str_Ccode, "贷")) = .Fields("Dfje")
  931.                 End If
  932.             End If
  933.             
  934.             '累加本月合计,本年累计数据
  935.             Dbl_Jejfhj = Dbl_Jejfhj + .Fields("Jfje")
  936.             Dbl_Jedfhj = Dbl_Jedfhj + .Fields("Dfje")
  937.             If Fun_CcodeCol(Str_Ccode, "借") <> 0 Then
  938.                 Dbl_JejfhjDlz(Fun_CcodeCol(Str_Ccode, "借")) = Dbl_JejfhjDlz(Fun_CcodeCol(Str_Ccode, "借")) + .Fields("Jfje")
  939.             End If
  940.             If Fun_CcodeCol(Str_Ccode, "贷") <> 0 Then
  941.                 Dbl_JedfhjDlz(Fun_CcodeCol(Str_Ccode, "贷")) = Dbl_JedfhjDlz(Fun_CcodeCol(Str_Ccode, "贷")) + .Fields("Dfje")
  942.             End If
  943.             
  944.             Dbl_Jejflj = Dbl_Jejflj + .Fields("Jfje")
  945.             Dbl_Jedflj = Dbl_Jedflj + .Fields("Dfje")
  946.             If Fun_CcodeCol(Str_Ccode, "借") <> 0 Then
  947.                 Dbl_JejfljDlz(Fun_CcodeCol(Str_Ccode, "借")) = Dbl_JejfljDlz(Fun_CcodeCol(Str_Ccode, "借")) + .Fields("Jfje")
  948.             End If
  949.             If Fun_CcodeCol(Str_Ccode, "贷") <> 0 Then
  950.                 Dbl_JedfljDlz(Fun_CcodeCol(Str_Ccode, "贷")) = Dbl_JedfljDlz(Fun_CcodeCol(Str_Ccode, "贷")) + .Fields("Dfje")
  951.             End If
  952.             
  953.             '3.计算余额
  954.             Dbl_Qcyete = Dbl_Qcyete + .Fields("Jfje") - .Fields("Dfje")
  955.             
  956.             '输出余额
  957.             Call Sub_OutBalance(Jsqte, Dbl_Qcyete)
  958.             
  959.             
  960.             '跳过无效记录
  961. Wxjl:
  962.             
  963.             .MoveNext
  964.             
  965.             '计算是否输出承前/过次行(如果用户选择输出承前/过次)
  966.             If Bln_CqGcShow Then
  967.                 If Not .EOF Then
  968.                     If .Fields("Period") = Int_DqPeriod Then
  969.                         Call Sub_OutQcGc(Jsqte, Int_Zdzyhs, Int_DqPeriod, Dbl_Jejfhj, Dbl_Jedfhj, Dbl_Qcyete, Dbl_JejfhjDlz(), Dbl_JedfhjDlz())
  970.                     End If
  971.                 End If
  972.             End If
  973.             
  974.         Loop
  975.         
  976.         '添加本月合计及本年累计
  977.         
  978.         If Lng_MonthCount <> 0 Then
  979.             CxbbGrid.AddItem ""
  980.             Jsqte = Jsqte + 1
  981.             
  982.             '输出本月合计
  983.             Call Sub_OutPeriodSum(Jsqte, Int_DqPeriod, Dbl_Jejfhj, Dbl_Jedfhj, Dbl_JejfhjDlz(), Dbl_JedfhjDlz())
  984.             
  985.             '输出余额
  986.             Call Sub_OutBalance(Jsqte, Dbl_Qcyete)
  987.         End If
  988.         
  989.         '显示本年累计
  990.         If Lng_YearCount <> 0 Then
  991.             CxbbGrid.AddItem ""
  992.             Jsqte = Jsqte + 1
  993.             
  994.             '输出本年累计
  995.             Call Sub_OutYearSum(Jsqte, Int_DqPeriod, Dbl_Jejflj, Dbl_Jedflj, Dbl_JejfljDlz(), Dbl_JedfljDlz())
  996.             
  997.             '输出余额
  998.             Call Sub_OutBalance(Jsqte, Dbl_Qcyete)
  999.         End If
  1000.         
  1001.     End With
  1002.     
  1003.     '重置网格行高
  1004.     For Jsqte = CxbbGrid.FixedRows To CxbbGrid.Rows - 1
  1005.         CxbbGrid.RowHeight(Jsqte) = Sjhgd
  1006.     Next Jsqte
  1007.     
  1008. End Sub
  1009. Private Function Fun_CcodeCol(Str_Ccode As String, Optional Yefx As String) As Long          '科目与网格列对应值
  1010.     Dim Int_Maxlen As Integer
  1011.     Dim Coljsq As Long
  1012.     Fun_CcodeCol = 0
  1013.     Int_Maxlen = Len(Trim(Str_Ccode))
  1014.     For Jsqte = Int_Maxlen To 1 Step -1
  1015.         For Coljsq = Szzls + 1 To CxbbGrid.Cols - 1
  1016.             If Trim(Yefx) = "" Then
  1017.                 If Str_ItemCol(Coljsq) = Mid(Trim(Str_Ccode), 1, Jsqte) Then
  1018.                     Fun_CcodeCol = Coljsq
  1019.                     Exit Function
  1020.                 End If
  1021.             Else
  1022.                 If Str_ItemCol(Coljsq) = Mid(Trim(Str_Ccode), 1, Jsqte) And Str_AnalyCol(Coljsq) = Trim(Yefx) Then
  1023.                     Fun_CcodeCol = Coljsq
  1024.                     Exit Function
  1025.                 End If
  1026.             End If
  1027.         Next Coljsq
  1028.     Next Jsqte
  1029. End Function
  1030. Private Sub Sub_OutBalance(Jsqte As Long, Dbl_Qcyete#)         '输出余额
  1031.     If Dbl_Qcyete = 0 Then
  1032.         CxbbGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = "平"          '期初方向
  1033.     Else
  1034.         If Dbl_Qcyete > 0 Then
  1035.             CxbbGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = "借"
  1036.             CxbbGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = Dbl_Qcyete
  1037.         Else
  1038.             CxbbGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = "贷"
  1039.             CxbbGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = -Dbl_Qcyete
  1040.         End If
  1041.     End If
  1042. End Sub
  1043. Private Sub Sub_OutPeriodSum(Jsqte As Long, Int_DqPeriod%, Dbl_Jejfhj#, Dbl_Jedfhj#, Dbl_JejfhjDlz() As Double, Dbl_JedfhjDlz() As Double)    '输出本月合计
  1044.     Dim Lng_ColJsq As Long     '网格列值
  1045.     
  1046.     CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Mid(Trim(Str(100 + Int_DqPeriod)), 2, 2)
  1047.     CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = "本月合计"
  1048.     If Dbl_Jejfhj <> 0 Then                                                        '本月借方金额合计
  1049.         CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Dbl_Jejfhj
  1050.     End If
  1051.     If Dbl_Jedfhj <> 0 Then                                                        '本月贷方金额合计
  1052.         CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Dbl_Jedfhj
  1053.     End If
  1054.     
  1055.     '多栏帐部分本月合计填充
  1056.     For Lng_ColJsq = Szzls + 1 To CxbbGrid.Cols - 1
  1057.         If Dbl_JejfhjDlz(Lng_ColJsq) <> 0 And Str_AnalyCol(Lng_ColJsq) = "借" Then
  1058.             CxbbGrid.TextMatrix(Jsqte, Lng_ColJsq) = Dbl_JejfhjDlz(Lng_ColJsq)
  1059.         End If
  1060.         If Dbl_JedfhjDlz(Lng_ColJsq) <> 0 And Str_AnalyCol(Lng_ColJsq) = "贷" Then
  1061.             CxbbGrid.TextMatrix(Jsqte, Lng_ColJsq) = Dbl_JedfhjDlz(Lng_ColJsq)
  1062.         End If
  1063.     Next Lng_ColJsq
  1064. End Sub
  1065. Private Sub Sub_OutYearSum(Jsqte As Long, Int_DqPeriod%, Dbl_Jejflj#, Dbl_Jedflj#, Dbl_JejfljDlz() As Double, Dbl_JedfljDlz() As Double) '输出本年累计
  1066.     CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Mid(Trim(Str(100 + Int_DqPeriod)), 2, 2)
  1067.     CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = "本年累计"
  1068.     If Dbl_Jejflj <> 0 Then                                                        '本年借方金额累计
  1069.         CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Dbl_Jejflj
  1070.     End If
  1071.     If Dbl_Jedflj <> 0 Then                                                        '本年贷方金额累计
  1072.         CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Dbl_Jedflj
  1073.     End If
  1074.     
  1075.     '多栏帐部分本年累计填充
  1076.     For Lng_ColJsq = Szzls + 1 To CxbbGrid.Cols - 1
  1077.         If Dbl_JejfljDlz(Lng_ColJsq) <> 0 And Str_AnalyCol(Lng_ColJsq) = "借" Then
  1078.             CxbbGrid.TextMatrix(Jsqte, Lng_ColJsq) = Dbl_JejfljDlz(Lng_ColJsq)
  1079.         End If
  1080.         If Dbl_JedfljDlz(Lng_ColJsq) <> 0 And Str_AnalyCol(Lng_ColJsq) = "贷" Then
  1081.             CxbbGrid.TextMatrix(Jsqte, Lng_ColJsq) = Dbl_JedfljDlz(Lng_ColJsq)
  1082.         End If
  1083.     Next Lng_ColJsq
  1084. End Sub
  1085. Private Sub Sub_OutQcGc(Jsqte As Long, Int_Zdzyhs%, Int_DqPeriod%, Dbl_Jejfhj#, Dbl_Jedfhj#, Dbl_Qcyete#, Dbl_JejfhjDlz() As Double, Dbl_JedfhjDlz() As Double)          '输出承前/过次行
  1086.     If (Jsqte - CxbbGrid.FixedRows + 2) Mod Int_Zdzyhs = 0 Then
  1087.         CxbbGrid.AddItem ""
  1088.         Jsqte = Jsqte + 1
  1089.         CxbbGrid.Cell(flexcpBackColor, Jsqte, 0, , CxbbGrid.Cols - 1) = Lab_Color(1).BackColor
  1090.         CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Mid(Trim(Str(100 + Int_DqPeriod)), 2, 2)
  1091.         CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = "过次页"
  1092.         If Dbl_Jejfhj <> 0 Then                                                        '本月借方金额合计
  1093.             CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Dbl_Jejfhj
  1094.         End If
  1095.         If Dbl_Jedfhj <> 0 Then                                                        '本月贷方金额合计
  1096.             CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Dbl_Jedfhj
  1097.         End If
  1098.         
  1099.         '输出余额
  1100.         Call Sub_OutBalance(Jsqte, Dbl_Qcyete)
  1101.         
  1102.         '多栏帐部分承前过次填充
  1103.         For Lng_ColJsq = Szzls + 1 To CxbbGrid.Cols - 1
  1104.             If Dbl_JejfhjDlz(Lng_ColJsq) <> 0 And Str_AnalyCol(Lng_ColJsq) = "借" Then
  1105.                 CxbbGrid.TextMatrix(Jsqte, Lng_ColJsq) = Dbl_JejfhjDlz(Lng_ColJsq)
  1106.             End If
  1107.             If Dbl_JedfhjDlz(Lng_ColJsq) <> 0 And Str_AnalyCol(Lng_ColJsq) = "贷" Then
  1108.                 CxbbGrid.TextMatrix(Jsqte, Lng_ColJsq) = Dbl_JedfhjDlz(Lng_ColJsq)
  1109.             End If
  1110.         Next Lng_ColJsq
  1111.         
  1112.         CxbbGrid.AddItem ""
  1113.         Jsqte = Jsqte + 1
  1114.         CxbbGrid.Cell(flexcpBackColor, Jsqte, 0, , CxbbGrid.Cols - 1) = Lab_Color(2).BackColor
  1115.         CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Mid(Trim(Str(100 + Int_DqPeriod)), 2, 2)
  1116.         CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = "承前页"
  1117.         If Dbl_Jejfhj <> 0 Then                                                        '本月借方金额合计
  1118.             CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Dbl_Jejfhj
  1119.         End If
  1120.         If Dbl_Jedfhj <> 0 Then                                                        '本月贷方金额合计
  1121.             CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Dbl_Jedfhj
  1122.         End If
  1123.         
  1124.         '输出余额
  1125.         Call Sub_OutBalance(Jsqte, Dbl_Qcyete)
  1126.         
  1127.         '多栏帐部分承前过次填充
  1128.         For Lng_ColJsq = Szzls + 1 To CxbbGrid.Cols - 1
  1129.             If Dbl_JejfhjDlz(Lng_ColJsq) <> 0 And Str_AnalyCol(Lng_ColJsq) = "借" Then
  1130.                 CxbbGrid.TextMatrix(Jsqte, Lng_ColJsq) = Dbl_JejfhjDlz(Lng_ColJsq)
  1131.             End If
  1132.             If Dbl_JedfhjDlz(Lng_ColJsq) <> 0 And Str_AnalyCol(Lng_ColJsq) = "贷" Then
  1133.                 CxbbGrid.TextMatrix(Jsqte, Lng_ColJsq) = Dbl_JedfhjDlz(Lng_ColJsq)
  1134.             End If
  1135.         Next Lng_ColJsq
  1136.         
  1137.     End If
  1138. End Sub
  1139. Private Sub CxbbGrid_DblClick()          '用户双击网格调入相应凭证
  1140.     Dim RecTemp As New ADODB.Recordset
  1141.     
  1142.     With CxbbGrid
  1143.         '非数据行退出
  1144.         If CxbbGrid.Row < CxbbGrid.FixedRows Then
  1145.             Exit Sub
  1146.         End If
  1147.         If Trim(.TextMatrix(.Row, 0)) = "" Then
  1148.             Exit Sub
  1149.         End If
  1150.     End With
  1151.     Sqlstr = "SELECT VouchID From Cwzz_AccVouchMain" & _
  1152.     " Where VouchID=" & Val(CxbbGrid.TextMatrix(CxbbGrid.Row, 0))
  1153.     
  1154.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  1155.     
  1156.     With RecTemp
  1157.         
  1158.         If .EOF Then
  1159.             Tsxx = "此凭证已被其他用户删除!"
  1160.             Call Xtxxts(Tsxx, 0, 4)
  1161.             Exit Sub
  1162.         Else
  1163.             
  1164.             With PZ_JzpzclFrm
  1165.                 '填充查询凭证标识
  1166.                 .Lab_VouchId = Trim(CxbbGrid.TextMatrix(CxbbGrid.Row, 0))
  1167.                 
  1168.                 '设置凭证处理为列表查询状态
  1169.                 .Lab_Pzclzt.Caption = "4"
  1170.                 
  1171.                 .Show 1
  1172.                 
  1173.             End With
  1174.             
  1175.         End If
  1176.         
  1177.     End With
  1178.     
  1179. End Sub
  1180. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  1181.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  1182.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  1183.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  1184.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  1185.     ReDim Bbxbt(1 To Bbxbtgs)
  1186.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  1187.     If Bbbwhgs <> 0 Then
  1188.         ReDim Bbbwh(1 To Bbbwhgs)
  1189.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  1190.     End If
  1191.     Bbzbt = ReportTitle
  1192.     Bbxbt(1) = Space(2) + "多栏帐名称:" + Me.Lab_AccMultiName.Caption
  1193.     bbxbtzzxs(1) = 1                                     '报表行组织形式(0-居左 1-居中 2-居右)
  1194.     Call Scyxsjb(CxbbGrid)                               '生成报表数据
  1195.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  1196.     If Not bbylte Then
  1197.         Unload DY_Tybbyldy
  1198.     End If
  1199. End Sub