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

企业管理

开发平台:

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