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

企业管理

开发平台:

Visual Basic

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