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

企业管理

开发平台:

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