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

企业管理

开发平台:

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