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

企业管理

开发平台:

Visual Basic

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