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