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

企业管理

开发平台:

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 XJ_FrmXjllbbxm 
  5.    BackColor       =   &H00C0C0C0&
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "现金流量表项目设置"
  8.    ClientHeight    =   7380
  9.    ClientLeft      =   675
  10.    ClientTop       =   720
  11.    ClientWidth     =   10575
  12.    Icon            =   "现金流量_报表项目设置.frx":0000
  13.    KeyPreview      =   -1  'True
  14.    LinkTopic       =   "Form4"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   7380
  18.    ScaleWidth      =   10575
  19.    StartUpPosition =   1  '所有者中心
  20.    Begin MSComctlLib.Toolbar GsToolbar 
  21.       Height          =   525
  22.       Left            =   8955
  23.       TabIndex        =   13
  24.       Top             =   0
  25.       Width           =   1665
  26.       _ExtentX        =   2937
  27.       _ExtentY        =   926
  28.       ButtonWidth     =   1455
  29.       ButtonHeight    =   926
  30.       AllowCustomize  =   0   'False
  31.       Appearance      =   1
  32.       Style           =   1
  33.       ImageList       =   "ImageList1"
  34.       _Version        =   393216
  35.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  36.          NumButtons      =   2
  37.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  38.             Caption         =   "保存格式"
  39.             Key             =   "bcgs"
  40.             ImageKey        =   "bcgs"
  41.          EndProperty
  42.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  43.             Caption         =   "默认列宽"
  44.             Key             =   "hfmrgs"
  45.             ImageKey        =   "mrlk"
  46.          EndProperty
  47.       EndProperty
  48.    End
  49.    Begin VB.TextBox Ydtext 
  50.       BackColor       =   &H00C0FFFF&
  51.       BorderStyle     =   0  'None
  52.       Height          =   330
  53.       Left            =   6090
  54.       MultiLine       =   -1  'True
  55.       TabIndex        =   1
  56.       Top             =   1050
  57.       Visible         =   0   'False
  58.       Width           =   1185
  59.    End
  60.    Begin VB.ComboBox YdCombo 
  61.       Height          =   300
  62.       Left            =   6090
  63.       Style           =   2  'Dropdown List
  64.       TabIndex        =   12
  65.       Top             =   720
  66.       Visible         =   0   'False
  67.       Width           =   1155
  68.    End
  69.    Begin VB.PictureBox Pic_Title 
  70.       Height          =   825
  71.       Left            =   30
  72.       Picture         =   "现金流量_报表项目设置.frx":1042
  73.       ScaleHeight     =   765
  74.       ScaleWidth      =   10845
  75.       TabIndex        =   5
  76.       Top             =   600
  77.       Width           =   10905
  78.       Begin VB.Label Lab_Row 
  79.          Alignment       =   2  'Center
  80.          Appearance      =   0  'Flat
  81.          BackColor       =   &H80000005&
  82.          BackStyle       =   0  'Transparent
  83.          ForeColor       =   &H00000000&
  84.          Height          =   225
  85.          Left            =   9330
  86.          TabIndex        =   11
  87.          Top             =   270
  88.          Width           =   315
  89.       End
  90.       Begin VB.Label TsLabel 
  91.          BackStyle       =   0  'Transparent
  92.          Caption         =   "(第"
  93.          Height          =   255
  94.          Index           =   11
  95.          Left            =   9030
  96.          TabIndex        =   10
  97.          Top             =   270
  98.          Width           =   315
  99.       End
  100.       Begin VB.Label TsLabel 
  101.          BackStyle       =   0  'Transparent
  102.          Caption         =   "行)"
  103.          Height          =   255
  104.          Index           =   12
  105.          Left            =   9660
  106.          TabIndex        =   9
  107.          Top             =   270
  108.          Width           =   405
  109.       End
  110.       Begin VB.Label TsLabel 
  111.          BackStyle       =   0  'Transparent
  112.          Caption         =   "当前记录"
  113.          Height          =   255
  114.          Index           =   13
  115.          Left            =   8190
  116.          TabIndex        =   8
  117.          Top             =   270
  118.          Width           =   825
  119.       End
  120.       Begin VB.Label Lab_TitleText 
  121.          BackStyle       =   0  'Transparent
  122.          ForeColor       =   &H00FF0000&
  123.          Height          =   225
  124.          Index           =   0
  125.          Left            =   6960
  126.          TabIndex        =   7
  127.          Top             =   480
  128.          Width           =   1395
  129.       End
  130.       Begin VB.Label TsLabel 
  131.          AutoSize        =   -1  'True
  132.          BackColor       =   &H80000018&
  133.          BackStyle       =   0  'Transparent
  134.          Caption         =   "现金流量表设置"
  135.          BeginProperty Font 
  136.             Name            =   "宋体"
  137.             Size            =   14.25
  138.             Charset         =   134
  139.             Weight          =   700
  140.             Underline       =   0   'False
  141.             Italic          =   0   'False
  142.             Strikethrough   =   0   'False
  143.          EndProperty
  144.          ForeColor       =   &H00000000&
  145.          Height          =   285
  146.          Index           =   4
  147.          Left            =   510
  148.          TabIndex        =   6
  149.          Top             =   180
  150.          Width           =   2100
  151.       End
  152.    End
  153.    Begin MSComctlLib.Toolbar Tlb_Action 
  154.       Align           =   1  'Align Top
  155.       Height          =   555
  156.       Left            =   0
  157.       TabIndex        =   3
  158.       Top             =   0
  159.       Width           =   10575
  160.       _ExtentX        =   18653
  161.       _ExtentY        =   979
  162.       ButtonWidth     =   820
  163.       ButtonHeight    =   926
  164.       AllowCustomize  =   0   'False
  165.       Wrappable       =   0   'False
  166.       Appearance      =   1
  167.       Style           =   1
  168.       ImageList       =   "ImageList1"
  169.       _Version        =   393216
  170.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  171.          NumButtons      =   9
  172.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  173.             Caption         =   "设置"
  174.             Key             =   "ymsz"
  175.             Object.ToolTipText     =   "打印页面设置"
  176.             ImageKey        =   "sz"
  177.          EndProperty
  178.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  179.             Caption         =   "打印"
  180.             Key             =   "dy"
  181.             Object.ToolTipText     =   "打印当前单据或Ctrl+P"
  182.             ImageKey        =   "dy"
  183.          EndProperty
  184.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  185.             Caption         =   "预览"
  186.             Key             =   "yl"
  187.             ImageKey        =   "yl"
  188.          EndProperty
  189.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  190.             Style           =   3
  191.          EndProperty
  192.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  193.             Caption         =   "增行"
  194.             Key             =   "zh"
  195.             Object.ToolTipText     =   "插入一行或Insert"
  196.             ImageKey        =   "zh"
  197.          EndProperty
  198.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  199.             Caption         =   "删行"
  200.             Key             =   "sh"
  201.             Object.ToolTipText     =   "删除当前记录行或Delete"
  202.             ImageKey        =   "sh"
  203.          EndProperty
  204.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  205.             Style           =   3
  206.          EndProperty
  207.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  208.             Caption         =   "帮助"
  209.             Key             =   "bz"
  210.             ImageKey        =   "bz"
  211.          EndProperty
  212.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  213.             Caption         =   "退出"
  214.             Key             =   "fh"
  215.             ImageKey        =   "tc"
  216.          EndProperty
  217.       EndProperty
  218.       BorderStyle     =   1
  219.       Begin MSComctlLib.ImageList ImageList1 
  220.          Left            =   4860
  221.          Top             =   0
  222.          _ExtentX        =   1005
  223.          _ExtentY        =   1005
  224.          BackColor       =   -2147483643
  225.          ImageWidth      =   16
  226.          ImageHeight     =   16
  227.          MaskColor       =   12632256
  228.          _Version        =   393216
  229.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  230.             NumListImages   =   32
  231.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  232.                Picture         =   "现金流量_报表项目设置.frx":35106
  233.                Key             =   "sz"
  234.             EndProperty
  235.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  236.                Picture         =   "现金流量_报表项目设置.frx":354A0
  237.                Key             =   "dy"
  238.             EndProperty
  239.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  240.                Picture         =   "现金流量_报表项目设置.frx":3583A
  241.                Key             =   "yl"
  242.             EndProperty
  243.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  244.                Picture         =   "现金流量_报表项目设置.frx":35BD4
  245.                Key             =   "xg"
  246.             EndProperty
  247.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  248.                Picture         =   "现金流量_报表项目设置.frx":35F6E
  249.                Key             =   "zh"
  250.             EndProperty
  251.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  252.                Picture         =   "现金流量_报表项目设置.frx":36308
  253.                Key             =   "sh"
  254.             EndProperty
  255.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  256.                Picture         =   "现金流量_报表项目设置.frx":366A2
  257.                Key             =   "bc"
  258.             EndProperty
  259.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  260.                Picture         =   "现金流量_报表项目设置.frx":36A3C
  261.                Key             =   "fq"
  262.             EndProperty
  263.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  264.                Picture         =   "现金流量_报表项目设置.frx":36DD6
  265.                Key             =   "bz"
  266.             EndProperty
  267.             BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  268.                Picture         =   "现金流量_报表项目设置.frx":37170
  269.                Key             =   "tc"
  270.             EndProperty
  271.             BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  272.                Picture         =   "现金流量_报表项目设置.frx":3750A
  273.                Key             =   "bcgs"
  274.             EndProperty
  275.             BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  276.                Picture         =   "现金流量_报表项目设置.frx":378A4
  277.                Key             =   "mrlk"
  278.             EndProperty
  279.             BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  280.                Picture         =   "现金流量_报表项目设置.frx":37C3E
  281.                Key             =   "xsxm"
  282.             EndProperty
  283.             BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  284.                Picture         =   "现金流量_报表项目设置.frx":37FD8
  285.                Key             =   "first"
  286.             EndProperty
  287.             BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  288.                Picture         =   "现金流量_报表项目设置.frx":38372
  289.                Key             =   "prev"
  290.             EndProperty
  291.             BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  292.                Picture         =   "现金流量_报表项目设置.frx":3870C
  293.                Key             =   "next"
  294.             EndProperty
  295.             BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  296.                Picture         =   "现金流量_报表项目设置.frx":38AA6
  297.                Key             =   "last"
  298.             EndProperty
  299.             BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  300.                Picture         =   "现金流量_报表项目设置.frx":38E40
  301.                Key             =   "xx"
  302.             EndProperty
  303.             BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  304.                Picture         =   "现金流量_报表项目设置.frx":391DA
  305.                Key             =   "define"
  306.             EndProperty
  307.             BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  308.                Picture         =   "现金流量_报表项目设置.frx":39574
  309.                Key             =   "exec"
  310.             EndProperty
  311.             BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  312.                Picture         =   "现金流量_报表项目设置.frx":3990E
  313.                Key             =   "xz"
  314.             EndProperty
  315.             BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  316.                Picture         =   "现金流量_报表项目设置.frx":39CA8
  317.                Key             =   "sc"
  318.             EndProperty
  319.             BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  320.                Picture         =   "现金流量_报表项目设置.frx":3A042
  321.                Key             =   "sx"
  322.             EndProperty
  323.             BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  324.                Picture         =   "现金流量_报表项目设置.frx":3A3DC
  325.                Key             =   "cx"
  326.             EndProperty
  327.             BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  328.                Picture         =   "现金流量_报表项目设置.frx":3A776
  329.                Key             =   "zd"
  330.             EndProperty
  331.             BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  332.                Picture         =   "现金流量_报表项目设置.frx":3AB10
  333.                Key             =   "dz"
  334.             EndProperty
  335.             BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  336.                Picture         =   "现金流量_报表项目设置.frx":3AEAA
  337.                Key             =   "ph"
  338.             EndProperty
  339.             BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  340.                Picture         =   "现金流量_报表项目设置.frx":3B244
  341.                Key             =   "fz"
  342.             EndProperty
  343.             BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  344.                Picture         =   "现金流量_报表项目设置.frx":3B5DE
  345.                Key             =   "dw"
  346.             EndProperty
  347.             BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  348.                Picture         =   "现金流量_报表项目设置.frx":3B978
  349.                Key             =   "hf"
  350.             EndProperty
  351.             BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  352.                Picture         =   "现金流量_报表项目设置.frx":3BD12
  353.                Key             =   "pz"
  354.             EndProperty
  355.             BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  356.                Picture         =   "现金流量_报表项目设置.frx":3C0AC
  357.                Key             =   "check"
  358.             EndProperty
  359.          EndProperty
  360.       End
  361.    End
  362.    Begin VB.CommandButton Ydcommand 
  363.       Height          =   289
  364.       Left            =   8400
  365.       Picture         =   "现金流量_报表项目设置.frx":3C446
  366.       Style           =   1  'Graphical
  367.       TabIndex        =   2
  368.       Top             =   150
  369.       Visible         =   0   'False
  370.       Width           =   285
  371.    End
  372.    Begin VB.CommandButton Ydcommand1 
  373.       Height          =   289
  374.       Left            =   8760
  375.       Picture         =   "现金流量_报表项目设置.frx":3C7E8
  376.       Style           =   1  'Graphical
  377.       TabIndex        =   4
  378.       Top             =   150
  379.       Visible         =   0   'False
  380.       Width           =   285
  381.    End
  382.    Begin VSFlex8Ctl.VSFlexGrid WglrGrid 
  383.       Height          =   4125
  384.       Left            =   30
  385.       TabIndex        =   0
  386.       Top             =   1500
  387.       Width           =   10905
  388.       _cx             =   5080
  389.       _cy             =   5080
  390.       Appearance      =   1
  391.       BorderStyle     =   1
  392.       Enabled         =   -1  'True
  393.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  394.          Name            =   "宋体"
  395.          Size            =   9
  396.          Charset         =   134
  397.          Weight          =   400
  398.          Underline       =   0   'False
  399.          Italic          =   0   'False
  400.          Strikethrough   =   0   'False
  401.       EndProperty
  402.       MousePointer    =   0
  403.       BackColor       =   16777215
  404.       ForeColor       =   -2147483640
  405.       BackColorFixed  =   12632256
  406.       ForeColorFixed  =   -2147483630
  407.       BackColorSel    =   -2147483635
  408.       ForeColorSel    =   -2147483634
  409.       BackColorBkg    =   -2147483636
  410.       BackColorAlternate=   16777215
  411.       GridColor       =   -2147483633
  412.       GridColorFixed  =   -2147483632
  413.       TreeColor       =   -2147483632
  414.       FloodColor      =   192
  415.       SheetBorder     =   -2147483642
  416.       FocusRect       =   1
  417.       HighLight       =   1
  418.       AllowSelection  =   -1  'True
  419.       AllowBigSelection=   -1  'True
  420.       AllowUserResizing=   0
  421.       SelectionMode   =   0
  422.       GridLines       =   1
  423.       GridLinesFixed  =   2
  424.       GridLineWidth   =   1
  425.       Rows            =   50
  426.       Cols            =   10
  427.       FixedRows       =   1
  428.       FixedCols       =   1
  429.       RowHeightMin    =   0
  430.       RowHeightMax    =   0
  431.       ColWidthMin     =   0
  432.       ColWidthMax     =   0
  433.       ExtendLastCol   =   0   'False
  434.       FormatString    =   ""
  435.       ScrollTrack     =   0   'False
  436.       ScrollBars      =   3
  437.       ScrollTips      =   0   'False
  438.       MergeCells      =   0
  439.       MergeCompare    =   0
  440.       AutoResize      =   -1  'True
  441.       AutoSizeMode    =   0
  442.       AutoSearch      =   0
  443.       AutoSearchDelay =   2
  444.       MultiTotals     =   -1  'True
  445.       SubtotalPosition=   1
  446.       OutlineBar      =   0
  447.       OutlineCol      =   0
  448.       Ellipsis        =   0
  449.       ExplorerBar     =   0
  450.       PicturesOver    =   0   'False
  451.       FillStyle       =   0
  452.       RightToLeft     =   0   'False
  453.       PictureType     =   0
  454.       TabBehavior     =   0
  455.       OwnerDraw       =   0
  456.       Editable        =   0
  457.       ShowComboButton =   1
  458.       WordWrap        =   0   'False
  459.       TextStyle       =   0
  460.       TextStyleFixed  =   0
  461.       OleDragMode     =   0
  462.       OleDropMode     =   0
  463.       DataMode        =   0
  464.       VirtualData     =   -1  'True
  465.       DataMember      =   ""
  466.       ComboSearch     =   3
  467.       AutoSizeMouse   =   -1  'True
  468.       FrozenRows      =   0
  469.       FrozenCols      =   0
  470.       AllowUserFreezing=   0
  471.       BackColorFrozen =   0
  472.       ForeColorFrozen =   0
  473.       WallPaperAlignment=   9
  474.       AccessibleName  =   ""
  475.       AccessibleDescription=   ""
  476.       AccessibleValue =   ""
  477.       AccessibleRole  =   24
  478.    End
  479.    Begin VB.Label Lab_OperStatus 
  480.       BackColor       =   &H000080FF&
  481.       Caption         =   "1"
  482.       Height          =   345
  483.       Left            =   10170
  484.       TabIndex        =   14
  485.       Top             =   600
  486.       Visible         =   0   'False
  487.       Width           =   345
  488.    End
  489. End
  490. Attribute VB_Name = "XJ_FrmXjllbbxm"
  491. Attribute VB_GlobalNameSpace = False
  492. Attribute VB_Creatable = False
  493. Attribute VB_PredeclaredId = True
  494. Attribute VB_Exposed = False
  495. '**************************************************************************************
  496. '*    模 块 名 称 :现金流量表项目设置
  497. '*    功 能 描 述 :此功能模块主要完成现金流量表报表格式及各项目属性设置
  498. '*    程序员姓名  :张建忠
  499. '*    最后修改人  :张建忠
  500. '*    最后修改时间:2001/12/03
  501. '*    备        注:程序中所有依实际情况自定义部分均用[>> <<]括起
  502. '*
  503. '*    1.每次调入外部功能窗体,均要加锁ChangeLock=True,窗体关闭后解锁ChangeLock=false
  504. '*
  505. '*    3.Lab_OperStatus 用此标签来标识单据录入状态(默认值为1) 1-浏览 2-修改
  506. '**************************************************************************************
  507.  '以下为自定义变量
  508.     Dim Rec_CashFlowItem As New ADODB.Recordset     '现金流量表报表项目动态集
  509.  
  510.  '以下为固定使用变量(网格)
  511.     Dim Cxnrrec As New ADODB.Recordset              '显示查询内容动态集
  512.     Dim Dyymctbl As New DY_Dyymsz                   '打印页面窗体变量
  513.     Dim GridCode As String                          '显示网格网格代码
  514.     Dim GridInf() As Variant                        '整个网格设置信息
  515.     Dim ReportTitle As String                       '报表主标题
  516.     Dim Tsxx As String                              '系统提示信息
  517.     Dim Pmbcsjhs As Long                            '屏幕网格保持数据行数(大于等于1)
  518.     Dim Fzxwghs As Integer                          '辅助项网格行数(包括合计行)
  519.     Dim Sfxshjwg As Boolean                         '是否显示合计网格
  520.     Dim Qslz As Long                                '网格隐藏(非操作显示)列数
  521.     Dim Sjhgd As Double                             '网格数据行高度
  522.     Dim GridBoolean() As Boolean                    '网格列信息(布尔型)
  523.     Dim GridStr()  As String                        '网格列信息(字符型)
  524.     Dim GridInt() As Integer                        '网格列信息(整型)
  525.     Dim Sfblbzkd As Boolean                         '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
  526.     Dim Dqlrwgh As Long                             '当前录入数据网格行
  527.     Dim Dqlrwgl As Long                             '当前录入数据网格列
  528.     Dim Dqlkwgh As Long                             '刚刚离开网格行(不一定为录入行)
  529.     Dim Dqlkwgl As Long                             '刚刚离开网格列
  530.     Dim Dqtoprow As Long                            '当前录入状态时最上端可视行
  531.     Dim Dqleftcol As Long                           '当前录入状态时最左端可视列
  532.     Dim Zdlrqnr As String                           '字段录入修改前内容(用来判断内容是否修改)
  533.     Dim Wbkbhlock As Boolean                        '文本框改变值锁
  534.     Dim changelock As Boolean                       '网格行列改变控制锁(用来区别用户改变.程序改变)
  535.     Dim Gdtlock As Boolean                          '滚动条滚动控制(用来区别用户改变.程序改变)
  536.     Dim Yxxpdlock As Boolean                        '字段有效性判断锁(内容不修改不需进行字段有效性判断)
  537.     Dim Hyxxpdlock As Boolean                       '行有效性判断锁(字段内容不修改不需进行行有效性判断)
  538.     Dim Valilock As Boolean                         '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
  539.     Dim Shsfts As Boolean                           '删除记录行是否提示
  540.     Dim Szzls As Integer                            '网格信息数组最大下标值(网格列数-1)
  541.     
  542. Private Sub Form_KeyPress(KeyAscii As Integer)      '控制焦点转移和限制录入字符"'"
  543.     Select Case KeyAscii
  544.     Case 39           '屏蔽字符"'"
  545.         KeyAscii = 0
  546.     End Select
  547. End Sub
  548. Private Sub Form_Load()                              '窗 体 装 入
  549.     
  550.     '初始化各种锁值
  551.     changelock = False             '网格行列改变控制锁
  552.     Gdtlock = False                '滚动条滚动控制
  553.     Yxxpdlock = True               '字段有效性判断锁
  554.     Hyxxpdlock = True              '行有效性判断锁
  555.     Wbkbhlock = False              '文本框内容改变锁
  556.     
  557.     '报表主标题及报表编码
  558.     ReportTitle = "现金流量表设置"
  559.     XtReportCode = "Cwzz_xjllbbxm"
  560.     Load Dyymctbl
  561.     
  562.     '调 入 网 格
  563.     GridCode = "Cwzz_xjllbbxm"        '网格属性编码
  564.     Call BzWgcsh(WglrGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  565.     
  566.     Qslz = GridInf(1)
  567.     Sjhgd = GridInf(2)
  568.     Pmbcsjhs = GridInf(3)
  569.     Fzxwghs = GridInf(4)
  570.     Sfblbzkd = GridInf(5)
  571.     Shsfts = GridInf(6)
  572.     Sfxshjwg = GridInf(7)
  573.     Szzls = WglrGrid.Cols - 1
  574.     
  575.     For Jsqte = WglrGrid.FixedRows To WglrGrid.Rows - 1
  576.         WglrGrid.RowHeight(Jsqte) = Sjhgd
  577.     Next Jsqte
  578.     
  579.     '生成查询结果
  580.     Call Sub_Query
  581.     
  582.     '设置状态为修改状态
  583.     Lab_OperStatus = "2"
  584.     
  585.     '调整标题位置
  586.     SetTitlePos TsLabel(4)
  587.     
  588.     
  589. End Sub
  590. Private Sub Form_Unload(Cancel As Integer)           '窗体卸载
  591.     
  592.     '卸载打印页面窗体
  593.     Unload Dyymctbl
  594.     
  595. End Sub
  596. Private Sub Sub_Query()                              '生成查询结果
  597.     Dim Sqlstr As String                   '查询字符串
  598.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  599.     Dim Jsqte  As Long                     '临时计数器
  600.     
  601.     Sqlstr = "SELECT * From Cwzz_CashFlowItem ORDER BY LogicId "
  602.     
  603.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  604.     
  605.     With RecTemp
  606.         
  607.         WglrGrid.Clear 1
  608.         
  609.         WglrGrid.Rows = .RecordCount + WglrGrid.FixedRows
  610.         
  611.         Jsqte = WglrGrid.FixedRows
  612.         Do While Not .EOF
  613.             If Jsqte >= WglrGrid.Rows Then
  614.                 WglrGrid.AddItem ""
  615.             End If
  616.             
  617.             '[>>显示查询内容
  618.             WglrGrid.TextMatrix(Jsqte, 0) = "*"                                                              '行标识
  619.             WglrGrid.TextMatrix(Jsqte, 1) = Trim(.Fields("CashFlowId"))                                      '项目ID
  620.             WglrGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("CashFlowCode") & "")   '项目编码
  621.             WglrGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = RTrim(.Fields("CashFlowName") & "")  '项目名称
  622.             WglrGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("RowNo") & "")          '行次
  623.             WglrGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("DataSource") & "")     '数据来源
  624.             If .Fields("DistributeFlag") Then                                                                '是否参与分配
  625.                 WglrGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = "是"
  626.             End If
  627.             
  628.             '<<]
  629.             
  630.             WglrGrid.RowHeight(Jsqte) = Sjhgd
  631.             .MoveNext
  632.             Jsqte = Jsqte + 1
  633.         Loop
  634.     End With
  635.     
  636.     '调整网格
  637.     Call Sub_AdjustGrid
  638.     
  639. End Sub
  640. Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
  641.     
  642.     '屏蔽文本框,下拉组合框有效性判断
  643.     
  644.     Valilock = True
  645.     
  646.     '屏蔽网格失去焦点产生的有效性判断
  647.     
  648.     changelock = True
  649.     
  650.     Select Case Button.Key
  651.     Case "ymsz"                                          '页面设置
  652.         Dyymctbl.Show 1
  653.     Case "yl"                                            '预 览
  654.         If Fun_Drfrmyxxpd Then
  655.             Call bbyl(True)
  656.         End If
  657.     Case "dy"                                            '打 印
  658.         If Fun_Drfrmyxxpd Then
  659.             Call bbyl(False)
  660.         End If
  661.     Case "zh"                                            '增 行
  662.         Call zjlrfl
  663.     Case "sh"                                            '删 行
  664.         Call Scdqfl
  665.     Case "bz"                                            '帮 助
  666.         Call F1bz
  667.     Case "fh"                                            '退 出
  668.         If Fun_Drfrmyxxpd Then
  669.             Unload Me
  670.         End If
  671.     End Select
  672.     
  673.     '解 锁
  674.     Valilock = False
  675.     changelock = False
  676.     
  677. End Sub
  678. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)        '支持热键操作
  679.     If Shift = 2 Then
  680.         Select Case UCase(Chr(KeyCode))
  681.         Case "P"                   'Ctrl+P 打印
  682.             If Tlb_Action.Buttons("dy").Enabled Then
  683.                 Call bbyl(False)
  684.             End If
  685.         End Select
  686.     End If
  687. End Sub
  688. Private Sub Wbkcl()                                                 '文本框录入之前处理(根据实际情况)
  689.     Dim xswbrr As String
  690.     With WglrGrid
  691.         Zdlrqnr = Trim(.Text)
  692.         xswbrr = RTrim(.Text)          '原Trim()
  693.         
  694.         If GridBoolean(.Col, 3) Then   '列表框录入
  695.             
  696.             '填充列表框程序
  697.             Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
  698.         Else
  699.             Wbkbhlock = True
  700.             
  701.             '====以下为用户自定义
  702.             Ydtext.Text = xswbrr
  703.             '====以上为用户自定义
  704.             
  705.             Wbkbhlock = False
  706.             Ydtext.SelStart = Len(Ydtext.Text)
  707.         End If
  708.     End With
  709. End Sub
  710. Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long)        '录入数据字段有效性判断,同时进行字段录入事后处理
  711.     Dim Str_JudgeText As String  '临时有效性判断字段内容
  712.     Dim Coljsq As Long           '临时列计数器
  713.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  714.     
  715.     With WglrGrid
  716.         
  717.         '非录入状态有效性为合法
  718.         If Yxxpdlock Or .Row < .FixedRows Then
  719.             sjzdyxxpd = True
  720.             Exit Function
  721.         End If
  722.         
  723.         Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
  724.         Select Case GridStr(Dqpdwgl, 1)
  725.             
  726.             '以下为自定义部分[
  727.             '1.放置字段有效性判断程序
  728.             
  729.             '2.放置字段事后处理程序
  730.             
  731.             '以上为自定义部分]
  732.             
  733.         End Select
  734.         
  735.         '字段录入正确后为零字段清空
  736.         Call Qkwlzd(Dqpdwgh, Dqpdwgl)
  737.         
  738.         sjzdyxxpd = True
  739.         Yxxpdlock = True
  740.         Exit Function
  741.     End With
  742.     
  743. Lrcwcl:    '录入错误处理
  744.     With WglrGrid
  745.         Call Xtxxts(Tsxx, 0, 1)
  746.         changelock = True
  747.         .Select Dqpdwgh, Dqpdwgl
  748.         changelock = False
  749.         Call xswbk
  750.         sjzdyxxpd = False
  751.         Exit Function
  752.     End With
  753. End Function
  754. Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean                  '录入数据行有效性判断,同时进行行处理
  755.     Dim Lrywlz As Long
  756.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  757.     With WglrGrid
  758.         If .Rows <= .FixedRows Then Exit Function   ' 如果没有记录,则退出
  759.         '判断行为空和无效数据行则清除当前行
  760.         If .TextMatrix(Yxxpdh, 0) <> "*" Then
  761.             Sjhzyxxpd = True
  762.             Exit Function
  763.         Else
  764.             If pdhwk(Yxxpdh) And Yxxpdh + 1 <= .Rows - 1 Then
  765.                 If .TextMatrix(Yxxpdh + 1, 0) <> "*" Then
  766.                     changelock = True
  767.                     .RemoveItem Yxxpdh
  768.                     If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  769.                         .AddItem ""
  770.                         .RowHeight(.Rows - 1) = Sjhgd
  771.                     End If
  772.                     changelock = False
  773.                     Sjhzyxxpd = True
  774.                     Exit Function
  775.                 End If
  776.             End If
  777.         End If
  778.         
  779.         '行没有发生变化则不进行有效性判断
  780.         If Hyxxpdlock Then
  781.             Sjhzyxxpd = True
  782.             Exit Function
  783.         End If
  784.         
  785.         '以下为自定义部分[
  786.         
  787.         '1.放置行有效性判断程序
  788.         
  789.         '首先进行为空判断(固定不变)
  790.         For Jsqte = Qslz To .Cols - 1
  791.             
  792.             '字段不能为空
  793.             If GridInt(Jsqte, 5) = 1 Then
  794.                 If Len(Trim(.TextMatrix(Yxxpdh, Jsqte))) = 0 Then
  795.                     Tsxx = GridStr(Jsqte, 2)
  796.                     Lrywlz = Jsqte
  797.                     GoTo Lrcwcl
  798.                     Exit For
  799.                 End If
  800.             End If
  801.             
  802.             '字段不能为零
  803.             If GridInt(Jsqte, 5) = 2 Then
  804.                 If Val(Trim(.TextMatrix(Yxxpdh, Jsqte))) = 0 Then
  805.                     Tsxx = GridStr(Jsqte, 2)
  806.                     Lrywlz = Jsqte
  807.                     GoTo Lrcwcl
  808.                     Exit For
  809.                 End If
  810.             End If
  811.             
  812.         Next Jsqte
  813.         
  814.         '项目为空不能参与凭证数据分配
  815.         If Trim(.TextMatrix(Yxxpdh, Sydz("005", GridStr(), Szzls))) = "是" And Trim(.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls))) = "" Then
  816.             Tsxx = "项目为空不能参与凭证数据分配!"
  817.             Lrywlz = Sydz("002", GridStr(), Szzls)
  818.             GoTo Lrcwcl
  819.         End If
  820.         
  821.         '参与凭证数据分配项目项目编码不能为空
  822.         If Trim(.TextMatrix(Yxxpdh, Sydz("005", GridStr(), Szzls))) = "是" And Trim(.TextMatrix(Yxxpdh, Sydz("001", GridStr(), Szzls))) = "" Then
  823.             Tsxx = "参与凭证数据分配项目项目编码不能为空!"
  824.             Lrywlz = Sydz("001", GridStr(), Szzls)
  825.             GoTo Lrcwcl
  826.         End If
  827.         
  828.         '2.放置行处理程序
  829.         
  830.         '[>>
  831.         On Error GoTo Swcwcl
  832.         
  833.         
  834.         Cw_DataEnvi.DataConnect.BeginTrans
  835.         With Rec_CashFlowItem
  836.             If Trim(WglrGrid.TextMatrix(Yxxpdh, 1)) <> "" Then
  837.                 '修改原内容
  838.                 If .State = 1 Then .Close
  839.                 
  840.                 Rec_CashFlowItem.Open "SELECT * From Cwzz_CashFlowItem Where CashFlowID='" & Trim(WglrGrid.TextMatrix(Yxxpdh, 1)) & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  841.                 
  842.                 If Not .EOF Then
  843.                     .Fields("CashFlowCode") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("001", GridStr(), Szzls)))   '项目编码
  844.                     .Fields("CashFlowName") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls)))  '项目名称
  845.                     .Fields("RowNo") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("003", GridStr(), Szzls)))          '行次
  846.                     .Fields("DataSource") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("004", GridStr(), Szzls)))     '数据来源
  847.                     If Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("005", GridStr(), Szzls))) = "是" Then
  848.                         .Fields("DistributeFlag") = 1
  849.                     Else
  850.                         .Fields("DistributeFlag") = 0
  851.                     End If
  852.                     
  853.                     .Update
  854.                 End If
  855.             Else
  856.                 '增加一条记录
  857.                 Cw_DataEnvi.DataConnect.Execute ("Update Cwzz_CashFlowItem Set LogicId=LogicId+1 Where LogicId>=" & Val(Yxxpdh))
  858.                 If .State = 1 Then .Close
  859.                 Rec_CashFlowItem.Open "SELECT * From Cwzz_CashFlowItem Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  860.                 .AddNew
  861.                 .Fields("LogicId") = Val(Yxxpdh)                                                                '逻辑行值
  862.                 .Fields("CashFlowCode") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("001", GridStr(), Szzls)))      '项目编码
  863.                 .Fields("CashFlowName") = RTrim(WglrGrid.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls)))     '项目名称
  864.                 .Fields("RowNo") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("003", GridStr(), Szzls)))             '行次
  865.                 .Fields("DataSource") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("004", GridStr(), Szzls)))        '数据来源
  866.                 If Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("005", GridStr(), Szzls))) = "是" Then
  867.                     .Fields("DistributeFlag") = 1
  868.                 Else
  869.                     .Fields("DistributeFlag") = 0
  870.                 End If
  871.                 .Update
  872.                 WglrGrid.TextMatrix(Yxxpdh, 1) = .Fields("CashFlowID")
  873.             End If
  874.         End With
  875.         
  876.         Cw_DataEnvi.DataConnect.CommitTrans
  877.         
  878.         '<<]
  879.         
  880.         '以上为自定义部分]
  881.         
  882.     End With
  883.     
  884.     Sjhzyxxpd = True
  885.     Hyxxpdlock = True
  886.     Exit Function
  887.     
  888. Swcwcl:
  889.     Cw_DataEnvi.DataConnect.RollbackTrans
  890.     Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
  891.     Call Xtxxts(Tsxx, 0, 1)
  892.     Exit Function
  893.     
  894. Lrcwcl:      '录入错误处理
  895.     With WglrGrid
  896.         Call Xtxxts(Tsxx, 0, 1)
  897.         changelock = True
  898.         .Select Yxxpdh, Lrywlz
  899.         changelock = False
  900.         Call xswbk
  901.         
  902.         Sjhzyxxpd = False
  903.         Exit Function
  904.     End With
  905. End Function
  906. '===================以 下 程 序 为 通 用 部 分 ,一 般 不 需 更 改======================='
  907. Private Sub Sub_AdjustGrid()
  908.     '调 整 网 格
  909.     With WglrGrid
  910.         '加 1 保持一行录入行
  911.         If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  912.             .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  913.             For Jsqte = .FixedRows To .Rows - 1
  914.                 .RowHeight(Jsqte) = Sjhgd
  915.             Next Jsqte
  916.         Else
  917.             '判断是否有辅助行和录入行,如没有则加行
  918.             Do While .TextMatrix(.Rows - 1 - Fzxwghs, 0) = "*"
  919.                 .AddItem ""
  920.                 .RowHeight(.Rows - 1) = Sjhgd
  921.             Loop
  922.         End If
  923.     End With
  924. End Sub
  925. Private Sub Lrzdbz()                                                      '录入字段帮助
  926.     If Not Ydcommand.Visible Then
  927.         Exit Sub
  928.     End If
  929.     Valilock = True
  930.     With WglrGrid
  931.         
  932.         changelock = True        '调入另外窗体必须加锁
  933.         Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
  934.         changelock = False
  935.         If Len(Xtfhcs) <> 0 Then
  936.             If GridInt(.Col, 7) = 0 Then
  937.                 Ydtext.Text = Xtfhcs
  938.             Else
  939.                 Ydtext.Text = Xtfhcsfz
  940.             End If
  941.         End If
  942.         
  943.         Valilock = False
  944.         If Ydtext.Visible Then
  945.             Ydtext.SetFocus
  946.         End If
  947.     End With
  948. End Sub
  949. Private Sub Form_Resize()                                                '窗体大小发生变化时,重新显示文本框
  950.     Call Cxxswbk
  951.     On Error Resume Next
  952.     With WglrGrid
  953.         .Width = Me.Width - 160
  954.         .Height = Me.Height - .Top - 400
  955.     End With
  956.     With Pic_Title
  957.         .Width = Me.Width - 160
  958.     End With
  959.     
  960.     GsToolbar.Left = Me.Width - GsToolbar.Width - 100
  961. End Sub
  962. Private Function Fun_Drfrmyxxpd() As Boolean                             '调入其它窗体或功能产生的有效性判断(包括数据回写)
  963.     Fun_Drfrmyxxpd = True
  964.     With WglrGrid
  965.         
  966.         '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
  967.         
  968.         If Ydtext.Visible Or YdCombo.Visible Then
  969.             Call Lrsjhx
  970.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  971.                 Fun_Drfrmyxxpd = False
  972.                 Exit Function
  973.             End If
  974.         End If
  975.         
  976.         '进行行有效性判断
  977.         If Not Sjhzyxxpd(.Row) Then
  978.             Fun_Drfrmyxxpd = False
  979.             Exit Function
  980.         End If
  981.         
  982.     End With
  983. End Function
  984. Private Sub WglrGrid_EnterCell()                                    '显示当前数据行相关信息
  985.     With WglrGrid
  986.         If .Row >= .FixedRows Then
  987.             Lab_Row = Trim(Str(.Row - .FixedRows + 1))
  988.         End If
  989.     End With
  990. End Sub
  991. Private Sub WglrGrid_GotFocus()                                     '网格得到焦点
  992.     
  993.     '网格得到焦点,如果当前选择行为非数据行
  994.     '则调整当前焦点至有效数据行
  995.     
  996.     With WglrGrid
  997.         If .Row < .FixedRows And .Rows > .FixedRows Then
  998.             changelock = True
  999.             .Select .FixedRows, .Col
  1000.             changelock = False
  1001.         End If
  1002.         If .Col < Qslz Then
  1003.             changelock = True
  1004.             .Select .Row, Qslz
  1005.             changelock = False
  1006.         End If
  1007.     End With
  1008.     
  1009. End Sub
  1010. Private Sub WglrGrid_LostFocus()                                    '录入网格失去焦点
  1011.     
  1012.     '用以屏蔽调用其它窗体时发生网格失去焦点事件
  1013.     If changelock Then
  1014.         Exit Sub
  1015.     End If
  1016.     
  1017.     '引发网格RowcolChange事件
  1018.     With WglrGrid
  1019.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1020.             .Select 0, 0
  1021.         End If
  1022.     End With
  1023.     
  1024. End Sub
  1025. Private Sub WglrGrid_AfterScroll(ByVal OldTopRow As Long, ByVal OldLeftCol As Long, ByVal NewTopRow As Long, ByVal NewLeftCol As Long)                                       '限制用户在录入过程中滚动鼠标
  1026.     
  1027.     If Gdtlock Then
  1028.         Exit Sub
  1029.     End If
  1030.     
  1031.     With WglrGrid
  1032.         If Ydtext.Visible Or YdCombo.Visible Then
  1033.             Gdtlock = True
  1034.             .TopRow = Dqtoprow
  1035.             .LeftCol = Dqleftcol
  1036.             Gdtlock = False
  1037.             Exit Sub
  1038.         End If
  1039.         
  1040.     End With
  1041. End Sub
  1042. Private Sub WglrGrid_LeaveCell()                                    '离开单元格
  1043.     If changelock Then
  1044.         Exit Sub
  1045.     End If
  1046.     
  1047.     '记录刚刚离开网格单元的行列值
  1048.     Dqlkwgh = WglrGrid.Row
  1049.     Dqlkwgl = WglrGrid.Col
  1050.     
  1051.     '判断是否需要录入数据回写
  1052.     If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1053.         Exit Sub
  1054.     End If
  1055.     Call Lrsjhx
  1056. End Sub
  1057. Private Sub WglrGrid_RowColChange()                                '网格录入行列发生变化时,进行有效性判断
  1058.     Valilock = True       '屏蔽文本框失去焦点进行有效性判断
  1059.     With WglrGrid
  1060.         If changelock Then
  1061.             Exit Sub
  1062.         End If
  1063.         If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1064.             Exit Sub
  1065.         End If
  1066.         If .Row <> Dqlkwgh Then
  1067.             If Not Sjhzyxxpd(Dqlkwgh) Then
  1068.                 Exit Sub
  1069.             End If
  1070.         End If
  1071.     End With
  1072.     Call fhyxh
  1073.     Call Xldql
  1074.     
  1075. End Sub
  1076. Private Sub WglrGrid_DblClick()          '鼠标双击网格显示文本框
  1077.     With WglrGrid
  1078.         Call xswbk
  1079.     End With
  1080. End Sub
  1081. Private Sub Ycwbk()                      '隐藏文本框,帮助按钮,列表组合框
  1082.     Valilock = True
  1083.     Ydtext.Visible = False
  1084.     YdCombo.Visible = False
  1085.     Ydcommand.Visible = False
  1086. End Sub
  1087. Private Sub YdCombo_KeyDown(KeyCode As Integer, Shift As Integer)        '列表框移动
  1088.     With WglrGrid
  1089.         Select Case KeyCode
  1090.         Case vbKeyEscape                'ESC 键放弃录入
  1091.             Valilock = True
  1092.             .SetFocus
  1093.             Call Ycwbk
  1094.             Valilock = False
  1095.         Case vbKeyReturn                '回 车 键 =13
  1096.             KeyCode = 0
  1097.             .SetFocus
  1098.             Call Lrsjhx
  1099.             Rowjsq = .Row
  1100.             Coljsq = .Col + 1
  1101.             If Coljsq > .Cols - 1 Then
  1102.                 If Rowjsq < .Rows - 1 Then
  1103.                     Rowjsq = Rowjsq + 1
  1104.                 End If
  1105.                 Coljsq = Qslz
  1106.             End If
  1107.             Do While Rowjsq <= .Rows - 1
  1108.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1109.                     Coljsq = Coljsq + 1
  1110.                     If Coljsq > .Cols - 1 Then
  1111.                         Rowjsq = Rowjsq + 1
  1112.                         Coljsq = Qslz
  1113.                     End If
  1114.                 Else
  1115.                     Exit Do
  1116.                 End If
  1117.             Loop
  1118.             .Select Rowjsq, Coljsq
  1119.         Case vbKeyLeft                  '左 箭 头 =37
  1120.             If .Col - 1 = Qslz Then
  1121.                 If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1122.                     GoTo jzzx
  1123.                 End If
  1124.             End If
  1125.             If .Col > Qslz Then
  1126.                 KeyCode = 0
  1127.                 .SetFocus
  1128.                 Call Lrsjhx
  1129.                 Coljsq = .Col - 1
  1130.                 Do While Coljsq > Qslz
  1131.                     If Coljsq - 1 = Qslz Then
  1132.                         If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1133.                             GoTo jzzx
  1134.                         End If
  1135.                     End If
  1136.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1137.                         Coljsq = Coljsq - 1
  1138.                     Else
  1139.                         Exit Do
  1140.                     End If
  1141.                 Loop
  1142.                 .Select .Row, Coljsq
  1143.             End If
  1144.             
  1145.         Case vbKeyRight                 '右 箭 头 =39
  1146.             KeyCode = 0
  1147.             .SetFocus
  1148.             Call Lrsjhx
  1149.             Rowjsq = .Row
  1150.             Coljsq = .Col + 1
  1151.             If Coljsq > .Cols - 1 Then
  1152.                 If Rowjsq < .Rows - 1 Then
  1153.                     Rowjsq = Rowjsq + 1
  1154.                 End If
  1155.                 Coljsq = Qslz
  1156.             End If
  1157.             Do While Rowjsq <= .Rows - 1
  1158.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1159.                     Coljsq = Coljsq + 1
  1160.                     If Coljsq > .Cols - 1 Then
  1161.                         Rowjsq = Rowjsq + 1
  1162.                         Coljsq = Qslz
  1163.                     End If
  1164.                 Else
  1165.                     Exit Do
  1166.                 End If
  1167.             Loop
  1168.             .Select Rowjsq, Coljsq
  1169.         Case Else
  1170.         End Select
  1171.         
  1172. jzzx:
  1173.         
  1174.     End With
  1175. End Sub
  1176. Private Sub YdCombo_LostFocus()
  1177.     With WglrGrid                                    '因为选中网格会先发生Rowcolchange事件置Valiock
  1178.         If Not Valilock Then                           '为TRUE
  1179.             Call Lrsjhx
  1180.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1181.                 Exit Sub
  1182.             End If
  1183.         End If
  1184.     End With
  1185. End Sub
  1186. Private Sub Ydcommand_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  1187.     Call Lrzdbz
  1188. End Sub
  1189. Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer)
  1190.     Dim Rowjsq As Long, Coljsq As Long
  1191.     With WglrGrid
  1192.         Select Case KeyCode
  1193.         Case vbKeyF2
  1194.             Call Lrzdbz
  1195.         Case vbKeyEscape                'ESC 键放弃录入
  1196.             Valilock = True
  1197.             Call Ycwbk
  1198.             .SetFocus
  1199.         Case vbKeyReturn                '回 车 键 =13
  1200.             KeyCode = 0
  1201.             .SetFocus
  1202.             Call Lrsjhx
  1203.             Rowjsq = .Row
  1204.             Coljsq = .Col + 1
  1205.             If Coljsq > .Cols - 1 Then
  1206.                 If Rowjsq < .Rows - 1 Then
  1207.                     Rowjsq = Rowjsq + 1
  1208.                 End If
  1209.                 Coljsq = Qslz
  1210.             End If
  1211.             Do While Rowjsq <= .Rows - 1
  1212.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1213.                     Coljsq = Coljsq + 1
  1214.                     If Coljsq > .Cols - 1 Then
  1215.                         Rowjsq = Rowjsq + 1
  1216.                         Coljsq = Qslz
  1217.                     End If
  1218.                 Else
  1219.                     Exit Do
  1220.                 End If
  1221.             Loop
  1222.             .Select Rowjsq, Coljsq
  1223.         Case vbKeyUp                    '上 箭 头 =38
  1224.             KeyCode = 0
  1225.             .SetFocus
  1226.             Call Lrsjhx
  1227.             If .Row > .FixedRows Then
  1228.                 .Row = .Row - 1
  1229.             End If
  1230.         Case vbKeyDown                  '下 箭 头 =40
  1231.             KeyCode = 0
  1232.             .SetFocus
  1233.             Call Lrsjhx
  1234.             If .Row < .Rows - 1 Then
  1235.                 .Row = .Row + 1
  1236.             End If
  1237.         Case vbKeyLeft                  '左 箭 头 =37
  1238.             If .Col - 1 = Qslz Then
  1239.                 If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1240.                     GoTo jzzx
  1241.                 End If
  1242.             End If
  1243.             If Ydtext.SelStart = 0 And .Col > Qslz Then
  1244.                 KeyCode = 0
  1245.                 .SetFocus
  1246.                 Call Lrsjhx
  1247.                 Coljsq = .Col - 1
  1248.                 Do While Coljsq > Qslz
  1249.                     If Coljsq - 1 = Qslz Then
  1250.                         If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1251.                             GoTo jzzx
  1252.                         End If
  1253.                     End If
  1254.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1255.                         Coljsq = Coljsq - 1
  1256.                     Else
  1257.                         Exit Do
  1258.                     End If
  1259.                 Loop
  1260.                 .Select .Row, Coljsq
  1261.             End If
  1262. jzzx:
  1263.             
  1264.             
  1265.         Case vbKeyRight                 '右 箭 头 =39
  1266.             wblong = Len(Ydtext.Text)
  1267.             If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
  1268.                 KeyCode = 0
  1269.                 .SetFocus
  1270.                 Call Lrsjhx
  1271.                 Rowjsq = .Row
  1272.                 Coljsq = .Col + 1
  1273.                 If Coljsq > .Cols - 1 Then
  1274.                     If Rowjsq < .Rows - 1 Then
  1275.                         Rowjsq = Rowjsq + 1
  1276.                     End If
  1277.                     Coljsq = Qslz
  1278.                 End If
  1279.                 Do While Rowjsq <= .Rows - 1
  1280.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1281.                         Coljsq = Coljsq + 1
  1282.                         If Coljsq > .Cols - 1 Then
  1283.                             Rowjsq = Rowjsq + 1
  1284.                             Coljsq = Qslz
  1285.                         End If
  1286.                     Else
  1287.                         Exit Do
  1288.                     End If
  1289.                 Loop
  1290.                 .Select Rowjsq, Coljsq
  1291.             End If
  1292.         Case Else
  1293.         End Select
  1294.     End With
  1295. End Sub
  1296. Private Sub ydtext_KeyPress(KeyAscii As Integer)         '录入字符事中控制
  1297.     Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  1298.     If KeyAscii <> 0 Then
  1299.         Call Xyxhbz(Dqlrwgh)
  1300.     End If
  1301. End Sub
  1302. Private Sub ydtext_Change()                              '录入事中变化处理
  1303.     
  1304.     '防止程序改变但不进行处理
  1305.     
  1306.     If Wbkbhlock Then
  1307.         Exit Sub
  1308.     End If
  1309.     
  1310.     With WglrGrid
  1311.         
  1312.         '限制字段录入长度
  1313.         Wbkbhlock = True
  1314.         Select Case GridInt(.Col, 1)
  1315.         Case 8
  1316.             Call Sjgskz(Ydtext, Xtjezws - Xtjexsws - 1, Xtjexsws)
  1317.         Case 9
  1318.             Call Sjgskz(Ydtext, Xtslzws - Xtslxsws - 1, Xtslxsws)
  1319.         Case 10
  1320.             Call Sjgskz(Ydtext, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  1321.         Case Else
  1322.             If GridInt(.Col, 3) <> 0 Or GridInt(.Col, 4) <> 0 Then
  1323.                 Call Sjgskz(Ydtext, GridInt(.Col, 3), GridInt(.Col, 4))
  1324.             End If
  1325.         End Select
  1326.         Wbkbhlock = False
  1327.     End With
  1328. End Sub
  1329. Private Sub ydtext_LostFocus()            '如果由于选中网格之外的控件而发生有效性判断(选中网格会先发生Rowcolchange事件置Valiock为TRUE)
  1330.     With WglrGrid
  1331.         If Not Valilock Then
  1332.             Call Lrsjhx
  1333.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1334.                 Exit Sub
  1335.             End If
  1336.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1337.                 Exit Sub
  1338.             End If
  1339.         End If
  1340.     End With
  1341. End Sub
  1342. Private Sub xswbk()                       '在当前选中单元显示文本框,列表框,帮助按钮(通用)
  1343.     Dim Wbkpy As Integer, Wbkpy1 As Integer '文本框偏移量
  1344.     
  1345.     '如果单据操作状态为浏览状态则不能显示录入载体
  1346.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1347.         Exit Sub
  1348.     End If
  1349.     
  1350.     '显示文本框前返回有效行列(解决滚动条问题)
  1351.     Call Xldqh
  1352.     Call Xldql
  1353.     
  1354.     '隐藏文本框,帮助按钮,列表组合框
  1355.     Call Ycwbk
  1356.     
  1357.     With WglrGrid
  1358.         Dqlrwgh = .Row
  1359.         Dqlrwgl = .Col
  1360.         If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  1361.             Exit Sub
  1362.         End If
  1363.         
  1364.         Wbkpy = 30
  1365.         Wbkpy1 = 15
  1366.         
  1367.         If GridBoolean(.Col, 3) Then
  1368.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  1369.             YdCombo.Top = .CellTop + .Top + Wbkpy
  1370.             YdCombo.Width = .CellWidth - Wbkpy1
  1371.             Call Wbkcl
  1372.             YdCombo.Visible = True
  1373.             YdCombo.SetFocus
  1374.             Ydcommand.Visible = False
  1375.             Ydtext.Visible = False
  1376.         Else
  1377.             If GridBoolean(.Col, 2) Then
  1378.                 Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
  1379.                 Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
  1380.                 Ydcommand.Visible = True
  1381.             Else
  1382.                 Ydcommand.Visible = False
  1383.             End If
  1384.             
  1385.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1386.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1387.             If Ydcommand.Visible Then
  1388.                 If Sfblbzkd Then
  1389.                     Ydtext.Width = .CellWidth - Ydcommand.Width
  1390.                 Else
  1391.                     Ydtext.Width = .CellWidth - Wbkpy1
  1392.                 End If
  1393.             Else
  1394.                 Ydtext.Width = .CellWidth - Wbkpy1
  1395.             End If
  1396.             Ydtext.Height = .CellHeight - Wbkpy1
  1397.             
  1398.             If GridInt(.Col, 2) <> 0 Then
  1399.                 Ydtext.MaxLength = GridInt(.Col, 2)
  1400.             Else
  1401.                 Ydtext.MaxLength = 3000
  1402.             End If
  1403.             
  1404.             Call Wbkcl
  1405.             
  1406.             Ydtext.Visible = True
  1407.             Ydtext.SetFocus
  1408.         End If
  1409.         Dqtoprow = .TopRow
  1410.         Dqleftcol = .LeftCol
  1411.         
  1412.         '重置锁值
  1413.         Valilock = False
  1414.         Wbkbhlock = False
  1415.     End With
  1416. End Sub
  1417. Private Sub Cxxswbk()                                                  'Formresize中重新显示文本框,列表框,帮助按钮(通用)
  1418.     
  1419.     Dim Wbkpy As Integer, Wbkpy1 As Integer
  1420.     Wbkpy = 30
  1421.     Wbkpy1 = 15
  1422.     With WglrGrid
  1423.         If YdCombo.Visible Then
  1424.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  1425.             YdCombo.Top = .CellTop + .Top + Wbkpy
  1426.             YdCombo.Width = .CellWidth - Wbkpy1
  1427.         End If
  1428.         If Ydcommand.Visible Then
  1429.             Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
  1430.             Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
  1431.         End If
  1432.         If Ydtext.Visible Then
  1433.             If Ydcommand.Visible Then
  1434.                 If Sfblbzkd Then
  1435.                     Ydtext.Width = .CellWidth - Ydcommand.Width
  1436.                 Else
  1437.                     Ydtext.Width = .CellWidth - Wbkpy1
  1438.                 End If
  1439.             Else
  1440.                 Ydtext.Width = .CellWidth - Wbkpy1
  1441.             End If
  1442.             
  1443.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1444.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1445.             Ydtext.Height = .CellHeight - Wbkpy1
  1446.         End If
  1447.     End With
  1448.     
  1449. End Sub
  1450. Private Sub Lrsjhx()                                                   '文本框录入数据回写
  1451.     With WglrGrid
  1452.         If YdCombo.Visible Then
  1453.             .Text = Trim(YdCombo.Text)
  1454.         End If
  1455.         If Ydtext.Visible Then
  1456.             .Text = RTrim(Ydtext.Text)       '原Trim()
  1457.         End If
  1458.         
  1459.         '(如果字段录入内容发生变化,则打开有效性判断锁)
  1460.         If .Col = Sydz("002", GridStr(), Szzls) Then
  1461.             If Zdlrqnr <> RTrim(.Text) Then
  1462.                 Yxxpdlock = False
  1463.                 Hyxxpdlock = False
  1464.             End If
  1465.         Else
  1466.             If Zdlrqnr <> Trim(.Text) Then
  1467.                 Yxxpdlock = False
  1468.                 Hyxxpdlock = False
  1469.             End If
  1470.         End If
  1471.         
  1472.         '如果字段录入内容不为空则写数据行有效性标志
  1473.         
  1474.         If Len(Trim(.Text)) <> 0 Then
  1475.             Call Xyxhbz(.Row)
  1476.         End If
  1477.         
  1478.         '隐藏文本框,帮助按钮,列表组合框
  1479.         Call Ycwbk
  1480.         
  1481.     End With
  1482. End Sub
  1483. Private Sub WglrGrid_KeyDown(KeyCode As Integer, Shift As Integer)    '网格录入增行,删行快捷键
  1484.     
  1485.     '如果单据操作状态为浏览状态则不能显示录入载体
  1486.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1487.         Exit Sub
  1488.     End If
  1489.     
  1490.     Select Case KeyCode
  1491.     Case vbKeyF2                   '按F2键参照
  1492.         Call xswbk
  1493.         Call Lrzdbz
  1494.     Case vbKeyDelete               '删行
  1495.         Call Scdqfl
  1496.     Case vbKeyInsert               '增行
  1497.         Call zjlrfl
  1498.     End Select
  1499.     
  1500. End Sub
  1501. Private Sub WglrGrid_KeyPress(KeyAscii As Integer)                     '网格接受键盘录入
  1502.     Dim Str_ChangeTe As String    '临时交换内容
  1503.     Dim Coljsq As Long            '临时列计数器
  1504.     Dim Int_SaveKey As Integer    '保存KeyAscii值
  1505.     
  1506.     '如果单据操作状态为浏览状态则不能显示录入载体
  1507.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1508.         Exit Sub
  1509.     End If
  1510.     
  1511.     Int_SaveKey = KeyAscii
  1512.     
  1513.     With WglrGrid
  1514.         '屏 蔽 回 车 键
  1515.         If KeyAscii = vbKeyReturn Then
  1516.             KeyAscii = 0
  1517.             Rowjsq = .Row
  1518.             Coljsq = .Col + 1
  1519.             If Coljsq > .Cols - 1 Then
  1520.                 If Rowjsq < .Rows - 1 Then
  1521.                     Rowjsq = Rowjsq + 1
  1522.                 End If
  1523.                 Coljsq = Qslz
  1524.             End If
  1525.             Do While Rowjsq <= .Rows - 1
  1526.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1527.                     Coljsq = Coljsq + 1
  1528.                     If Coljsq > .Cols - 1 Then
  1529.                         Rowjsq = Rowjsq + 1
  1530.                         Coljsq = Qslz
  1531.                     End If
  1532.                 Else
  1533.                     Exit Do
  1534.                 End If
  1535.             Loop
  1536.             .Select Rowjsq, Coljsq
  1537.             Exit Sub
  1538.         End If
  1539.         '接受用户录入
  1540.         Select Case KeyAscii
  1541.         Case 0 To 32
  1542.             
  1543.             '显示录入载体
  1544.             Call xswbk
  1545.             
  1546.         Case Else
  1547.             
  1548.             '防止非编辑字段SendKeys()出现死循环
  1549.             If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  1550.                 Exit Sub
  1551.             End If
  1552.             
  1553.             If GridBoolean(.Col, 3) Then
  1554.                 
  1555.                 '列表框录入
  1556.                 Call xswbk
  1557.                 
  1558.             Else
  1559.                 
  1560.                 
  1561.                 Ydtext.Text = ""
  1562.                 Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  1563.                 If KeyAscii = 0 Then
  1564.                     Exit Sub
  1565.                 End If
  1566.                 
  1567.                 '写有效行数据标志
  1568.                 Call Xyxhbz(.Row)
  1569.                 Call xswbk
  1570.                 Ydtext.Text = ""
  1571.                 Valilock = True
  1572.                 SendKeys Chr(KeyAscii), wait
  1573.                 DoEvents
  1574.                 Valilock = False
  1575.                 
  1576.             End If
  1577.         End Select
  1578.     End With
  1579. End Sub
  1580. Private Sub zjlrfl()                                                    '增加录入分录
  1581.     With WglrGrid
  1582.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1583.             If Not Fun_Drfrmyxxpd Then
  1584.                 Exit Sub
  1585.             End If
  1586.         Else
  1587.             Exit Sub
  1588.         End If
  1589.         If .Row < .FixedRows Then
  1590.             Exit Sub
  1591.         End If
  1592.         .AddItem "", .Row
  1593.         .RowHeight(.Row) = Sjhgd
  1594.         If .Row <> .Rows - 1 Then
  1595.             If .TextMatrix(.Row + 1, 0) = "*" Then
  1596.                 .TextMatrix(.Row, 0) = "*"
  1597.             Else
  1598.                 .RemoveItem .Rows - 1
  1599.             End If
  1600.         End If
  1601.         Call Xldqh
  1602.         Call Xldql
  1603.         Hyxxpdlock = False
  1604.     End With
  1605. End Sub
  1606. Private Sub Scdqfl()                                                    '删除当前分录
  1607.     Dim Answer As Integer, Scqwghz As Long, Scqwglz As Long, Hjlzte As Long, Sflrzt As Boolean
  1608.     With WglrGrid
  1609.         Scqwghz = .Row
  1610.         Scqwglz = .Col
  1611.         If .TextMatrix(.Row, 0) = "*" Then
  1612.             
  1613.             '判断是否为录入状态
  1614.             If Ydtext.Visible Or YdCombo.Visible Then
  1615.                 Sflrzt = True
  1616.                 Validate = True
  1617.                 Call Lrsjhx
  1618.                 Validate = False
  1619.             End If
  1620.             
  1621.             Call Xldqh
  1622.             changelock = True
  1623.             .Select .Row, 0
  1624.             changelock = False
  1625.             If Shsfts Then
  1626.                 .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = QBColor(12)
  1627.                 Tsxx = "请确认是否删除当前记录?"
  1628.                 Yhanswer = Xtxxts(Tsxx, 2, 2)
  1629.                 If Yhanswer = 2 Then
  1630.                     .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = &H80000005
  1631.                     changelock = True
  1632.                     .Select Scqwghz, Scqwglz
  1633.                     changelock = False
  1634.                     
  1635.                     '如为录入状态,则恢复录入
  1636.                     If Sflrzt Then
  1637.                         Call xswbk
  1638.                     End If
  1639.                     
  1640.                     Exit Sub
  1641.                 End If
  1642.             End If
  1643.             
  1644.             '[>>删除当前记录同时将此记录后面逻辑标号相应-1
  1645.             On Error GoTo Swcwcl
  1646.             Cw_DataEnvi.DataConnect.BeginTrans
  1647.             
  1648.             Cw_DataEnvi.DataConnect.Execute ("Delete Cwzz_CashFlowItem Where CashFlowID=" & Val(Trim(WglrGrid.TextMatrix(.Row, 1))))
  1649.             Cw_DataEnvi.DataConnect.Execute ("Update Cwzz_CashFlowItem Set LogicId=LogicId-1 Where LogicId>" & .Row)
  1650.             
  1651.             Cw_DataEnvi.DataConnect.CommitTrans
  1652.             
  1653.             '<<]
  1654.             .RemoveItem .Row
  1655.             
  1656.             If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  1657.                 .AddItem ""
  1658.                 .RowHeight(.Rows - 1) = Sjhgd
  1659.             End If
  1660.             changelock = True
  1661.             .Select .Row, Scqwglz
  1662.             changelock = False
  1663.             
  1664.         End If
  1665.     End With
  1666.     
  1667.     Exit Sub
  1668.     
  1669.     '[>>事务错误处理
  1670. Swcwcl:
  1671.     If Err.Number = -2147217873 Then              '(-2147217873 为SQL Server 2000通过建立外键产生的错误号)
  1672.         Tsxx = "该编码已经被使用,不能删除!"
  1673.         Call Xtxxts(Tsxx, 0, 1)
  1674.         Exit Sub
  1675.     Else
  1676.         Tsxx = "出现未知情况,该编码不能被删除!"
  1677.         Call Xtxxts(Tsxx, 0, 1)
  1678.         Exit Sub
  1679.     End If
  1680.     '<<]
  1681. End Sub
  1682. Private Sub Qkwlzd(sjh As Long, Sjl As Long)                            '清空为零字段
  1683.     If Not GridBoolean(Sjl, 5) Then
  1684.         Exit Sub
  1685.     End If
  1686.     With WglrGrid
  1687.         If Val(Trim(.TextMatrix(sjh, Sjl))) = 0 Then
  1688.             .TextMatrix(sjh, Sjl) = ""
  1689.         End If
  1690.     End With
  1691. End Sub
  1692. Private Sub fhyxh()                                                     '返回录入数据有效行,同时让得到焦点网格可见
  1693.     With WglrGrid
  1694.         If .Row >= .FixedRows Then
  1695.             If .TextMatrix(.Row, 0) <> "*" Then
  1696.                 For Rowjsq = .FixedRows To .Rows - 1
  1697.                     If .TextMatrix(Rowjsq, 0) <> "*" Then
  1698.                         Exit For
  1699.                     End If
  1700.                 Next Rowjsq
  1701.                 If Rowjsq <= .Rows - 1 Then
  1702.                     changelock = True
  1703.                     .Select Rowjsq, .Col
  1704.                     changelock = False
  1705.                 Else
  1706.                     changelock = True
  1707.                     .Select .Rows - 1, .Col
  1708.                     changelock = False
  1709.                 End If
  1710.             End If
  1711.             Call Xldqh
  1712.         End If
  1713.     End With
  1714. End Sub
  1715. Private Sub Xldqh()                                                      '显露当前行
  1716.     Dim Toprowte As Long
  1717.     With WglrGrid
  1718.         Toprowte = 0
  1719.         Do While .CellTop + .RowHeight(.Row) + Fzxwghs * Sjhgd > .Height And .TopRow <> Toprowte
  1720.             Toprowte = .TopRow
  1721.             .TopRow = .TopRow + 1
  1722.         Loop
  1723.         Toprowte = 0
  1724.         Do While .CellTop < .FixedRows * .RowHeight(0) And .TopRow <> Toprowte
  1725.             Toprowte = .TopRow
  1726.             .TopRow = .TopRow - 1
  1727.         Loop
  1728.     End With
  1729. End Sub
  1730. Private Sub Xldql()                                                     '显露当前列
  1731.     
  1732.     Dim Leftcolte As Long
  1733.     
  1734.     With WglrGrid
  1735.         If .Col >= Qslz And .Col >= .FixedCols Then
  1736.             If .LeftCol > .Col Then
  1737.                 .LeftCol = .Col
  1738.             End If
  1739.             Leftcolte = 0
  1740.             Do While .CellLeft + .CellWidth > .Width And .LeftCol <> Leftcolte
  1741.                 Leftcolte = .LeftCol
  1742.                 .LeftCol = .LeftCol + 1
  1743.             Loop
  1744.         End If
  1745.     End With
  1746.     
  1747. End Sub
  1748. Private Function pdhwk(sjh As Long)                                     '判断网格行是否为空行(所有录入字段均为空*非录入字段除外)
  1749.     With WglrGrid
  1750.         For Coljsq = Qslz To .Cols - 1
  1751.             If Len(Trim(.TextMatrix(sjh, Coljsq))) <> 0 And GridBoolean(Coljsq, 1) Then
  1752.                 pdhwk = False
  1753.                 Exit Function
  1754.             End If
  1755.         Next Coljsq
  1756.         pdhwk = True
  1757.     End With
  1758. End Function
  1759. Private Sub Xyxhbz(sjh As Long)                                         '写行有效性标志,并判断是否增行
  1760.     With WglrGrid
  1761.         If .TextMatrix(sjh, 0) = "*" Then
  1762.             Exit Sub
  1763.         End If
  1764.         .TextMatrix(sjh, 0) = "*"
  1765.         If sjh >= .Rows - Fzxwghs - 1 Then
  1766.             .AddItem ""
  1767.             .RowHeight(.Rows - 1) = Sjhgd
  1768.         End If
  1769.     End With
  1770. End Sub
  1771. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)   '表格格式设置(通用)
  1772.     
  1773.     Select Case Button.Key
  1774.     Case "bcgs"                                       '保存表格格式
  1775.         Call Bcwggs(WglrGrid, GridCode, GridStr())
  1776.     Case "hfmrgs"                                     '恢复默认格式
  1777.         Call Hfmrgs(WglrGrid, GridCode, GridStr())
  1778.     Case "szxsxm"                                     '设置显示项目
  1779.         Call Szxsxm(WglrGrid, GridCode)
  1780.     End Select
  1781.     
  1782. End Sub
  1783. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  1784.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  1785.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  1786.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  1787.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  1788.     ReDim Bbxbt(1 To Bbxbtgs)
  1789.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  1790.     If Bbbwhgs <> 0 Then
  1791.         ReDim Bbbwh(1 To Bbbwhgs)
  1792.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  1793.     End If
  1794.     Bbzbt = ReportTitle
  1795.     Call Scyxsjb(WglrGrid)                               '生成报表数据
  1796.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  1797.     If Not bbylte Then
  1798.         Unload DY_Tybbyldy
  1799.     End If
  1800. End Sub