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

企业管理

开发平台:

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