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