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

企业管理

开发平台:

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