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

企业管理

开发平台:

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