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

企业管理

开发平台:

Visual Basic

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