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

企业管理

开发平台:

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