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

企业管理

开发平台:

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