+
上传用户: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_FrmCuseAcc 
  5.    BackColor       =   &H00C0C0C0&
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "客户科目设置"
  8.    ClientHeight    =   6990
  9.    ClientLeft      =   660
  10.    ClientTop       =   1155
  11.    ClientWidth     =   10860
  12.    Icon            =   "基础设置_客户科目设置.frx":0000
  13.    KeyPreview      =   -1  'True
  14.    LinkTopic       =   "Form4"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   6990
  18.    ScaleWidth      =   10860
  19.    StartUpPosition =   1  '所有者中心
  20.    Begin VB.PictureBox Pic_Title 
  21.       BackColor       =   &H00FFFFFF&
  22.       Height          =   765
  23.       Left            =   60
  24.       Picture         =   "基础设置_客户科目设置.frx":1042
  25.       ScaleHeight     =   705
  26.       ScaleWidth      =   10725
  27.       TabIndex        =   7
  28.       Top             =   570
  29.       Width           =   10785
  30.       Begin VB.Label tsLabel 
  31.          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        =   8
  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        =   3
  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        =   4
  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.       Begin MSComctlLib.ImageList ImageList1 
  184.          Left            =   7890
  185.          Top             =   3330
  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":1E30C
  197.                Key             =   "sz"
  198.             EndProperty
  199.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  200.                Picture         =   "基础设置_客户科目设置.frx":1E6A6
  201.                Key             =   "dy"
  202.             EndProperty
  203.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  204.                Picture         =   "基础设置_客户科目设置.frx":1EA40
  205.                Key             =   "yl"
  206.             EndProperty
  207.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  208.                Picture         =   "基础设置_客户科目设置.frx":1EDDA
  209.                Key             =   "xg"
  210.             EndProperty
  211.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  212.                Picture         =   "基础设置_客户科目设置.frx":1F174
  213.                Key             =   "zh"
  214.             EndProperty
  215.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  216.                Picture         =   "基础设置_客户科目设置.frx":1F50E
  217.                Key             =   "sh"
  218.             EndProperty
  219.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  220.                Picture         =   "基础设置_客户科目设置.frx":1F8A8
  221.                Key             =   "bc"
  222.             EndProperty
  223.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  224.                Picture         =   "基础设置_客户科目设置.frx":1FC42
  225.                Key             =   "fq"
  226.             EndProperty
  227.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  228.                Picture         =   "基础设置_客户科目设置.frx":1FFDC
  229.                Key             =   "bz"
  230.             EndProperty
  231.             BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  232.                Picture         =   "基础设置_客户科目设置.frx":20376
  233.                Key             =   "tc"
  234.             EndProperty
  235.             BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  236.                Picture         =   "基础设置_客户科目设置.frx":20710
  237.                Key             =   "bcgs"
  238.             EndProperty
  239.             BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  240.                Picture         =   "基础设置_客户科目设置.frx":20AAA
  241.                Key             =   "mrlk"
  242.             EndProperty
  243.             BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  244.                Picture         =   "基础设置_客户科目设置.frx":20E44
  245.                Key             =   "xsxm"
  246.             EndProperty
  247.             BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  248.                Picture         =   "基础设置_客户科目设置.frx":211DE
  249.                Key             =   "first"
  250.             EndProperty
  251.             BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  252.                Picture         =   "基础设置_客户科目设置.frx":21578
  253.                Key             =   "prev"
  254.             EndProperty
  255.             BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  256.                Picture         =   "基础设置_客户科目设置.frx":21912
  257.                Key             =   "next"
  258.             EndProperty
  259.             BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  260.                Picture         =   "基础设置_客户科目设置.frx":21CAC
  261.                Key             =   "last"
  262.             EndProperty
  263.             BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  264.                Picture         =   "基础设置_客户科目设置.frx":22046
  265.                Key             =   "xx"
  266.             EndProperty
  267.             BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  268.                Picture         =   "基础设置_客户科目设置.frx":223E0
  269.                Key             =   "define"
  270.             EndProperty
  271.             BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  272.                Picture         =   "基础设置_客户科目设置.frx":2277A
  273.                Key             =   "exec"
  274.             EndProperty
  275.             BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  276.                Picture         =   "基础设置_客户科目设置.frx":22B14
  277.                Key             =   "xz"
  278.             EndProperty
  279.             BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  280.                Picture         =   "基础设置_客户科目设置.frx":22EAE
  281.                Key             =   "sc"
  282.             EndProperty
  283.             BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  284.                Picture         =   "基础设置_客户科目设置.frx":23248
  285.                Key             =   "sx"
  286.             EndProperty
  287.             BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  288.                Picture         =   "基础设置_客户科目设置.frx":235E2
  289.                Key             =   "cx"
  290.             EndProperty
  291.             BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  292.                Picture         =   "基础设置_客户科目设置.frx":2397C
  293.                Key             =   "zd"
  294.             EndProperty
  295.             BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  296.                Picture         =   "基础设置_客户科目设置.frx":23D16
  297.                Key             =   "dz"
  298.             EndProperty
  299.             BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  300.                Picture         =   "基础设置_客户科目设置.frx":240B0
  301.                Key             =   "ph"
  302.             EndProperty
  303.             BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  304.                Picture         =   "基础设置_客户科目设置.frx":2444A
  305.                Key             =   "fz"
  306.             EndProperty
  307.             BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  308.                Picture         =   "基础设置_客户科目设置.frx":247E4
  309.                Key             =   "dw"
  310.             EndProperty
  311.             BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  312.                Picture         =   "基础设置_客户科目设置.frx":24B7E
  313.                Key             =   "pl"
  314.             EndProperty
  315.          EndProperty
  316.       End
  317.    End
  318.    Begin MSComctlLib.Toolbar Tlb_Action 
  319.       Align           =   1  'Align Top
  320.       Height          =   555
  321.       Left            =   0
  322.       TabIndex        =   2
  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        =   6
  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        =   5
  413.       Top             =   1440
  414.       Visible         =   0   'False
  415.       Width           =   345
  416.    End
  417. End
  418. Attribute VB_Name = "JC_FrmCuseAcc"
  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_CuseAcc"
  492.     Load Dyymctbl
  493.     
  494.     '调 入 网 格(Fixed)
  495.     GridCode = "Ar_CuseAcc"      '网格属性编码
  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 CusCode, CusName, ARAccCode, PRAccCode FROM Gy_Customer ORDER BY CusCode"
  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("CusCode") & "")       '客户编码
  558.             WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("CusName") & "")       '客户名称
  559.             WglrGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("ARAccCode") & "")       '应收科目
  560.             WglrGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("PRAccCode") & "")       '预收科目
  561.             '<<]
  562.             
  563.             WglrGrid.RowHeight(jsqte) = Sjhgd
  564.             .MoveNext
  565.             jsqte = jsqte + 1
  566.         Loop
  567.         
  568.     End With
  569.     
  570.     '将网格刷新解禁(Fixed)
  571.     WglrGrid.Redraw = True
  572.     
  573. End Sub
  574. Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
  575.     
  576.     '屏蔽文本框,下拉组合框有效性判断
  577.     
  578.     Valilock = True
  579.     
  580.     '屏蔽网格失去焦点产生的有效性判断
  581.     
  582.     changelock = True
  583.     
  584.     Select Case Button.Key
  585.     Case "ymsz"                                          '页面设置
  586.         Dyymctbl.Show 1
  587.     Case "yl"                                            '预 览
  588.         If Fun_Drfrmyxxpd Then
  589.             Call bbyl(True)
  590.         End If
  591.     Case "dy"                                            '打 印
  592.         If Fun_Drfrmyxxpd Then
  593.             Call bbyl(False)
  594.         End If
  595.     Case "pl"
  596.         '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  597.         If Not Security_Log("Ar_CuseAcc_Edit", Xtczybm, 1, True) Then
  598.             Exit Sub
  599.         End If
  600.         JC_FrmCuseAccPl.Show 1
  601.         
  602.         '重新刷新查询结果
  603.         Call Sub_Query
  604.     Case "bz"                                            '帮 助
  605.         Call F1bz
  606.     Case "fh"                                            '退 出
  607.         Unload Me
  608.         
  609.     End Select
  610.     
  611.     '解 锁
  612.     Valilock = False
  613.     changelock = False
  614.     
  615. End Sub
  616. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)        '支持热键操作
  617.     
  618.     If Shift = 2 Then
  619.         Select Case UCase(Chr(KeyCode))
  620.         Case "P"                   'Ctrl+P 打印
  621.             If Tlb_Action.Buttons("dy").Enabled Then
  622.                 Call bbyl(False)
  623.             End If
  624.         End Select
  625.     End If
  626.     
  627. End Sub
  628. Private Sub Wbkcl()                                                 '文本框录入之前处理(根据实际情况)
  629.     
  630.     Dim xswbrr As String
  631.     
  632.     With WglrGrid
  633.         Zdlrqnr = Trim(.Text)
  634.         xswbrr = Trim(.Text)
  635.         
  636.         If GridBoolean(.Col, 3) Then   '列表框录入
  637.             
  638.             '填充列表框程序
  639.             Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
  640.         Else
  641.             Wbkbhlock = True
  642.             
  643.             '====以下为用户自定义
  644.             Ydtext.Text = xswbrr
  645.             '====以上为用户自定义
  646.             
  647.             Wbkbhlock = False
  648.             Ydtext.SelStart = Len(Ydtext.Text)
  649.         End If
  650.     End With
  651.     
  652. End Sub
  653. Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long)        '录入数据字段有效性判断,同时进行字段录入事后处理
  654.     
  655.     Dim Str_JudgeText As String            '临时有效性判断字段内容
  656.     Dim Coljsq As Long                     '临时列计数器
  657.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  658.     Dim Dbl_Qcye As Double                 '临时期初余额
  659.     
  660.     With WglrGrid
  661.         
  662.         '非录入状态有效性为合法
  663.         If Yxxpdlock Or .Row < .FixedRows Then
  664.             sjzdyxxpd = True
  665.             Exit Function
  666.         End If
  667.         
  668.         Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
  669.         Select Case GridStr(Dqpdwgl, 1)
  670.             
  671.             '以下为自定义部分[
  672.             '1.放置字段有效性判断程序
  673.         Case "003", "004"  '会计科目
  674.             
  675.             If Len(Str_JudgeText) <> 0 Then
  676.                 Sqlstr = "Select Ccode,EndFlag,CusFlag,StopFlag FROM  Cwzz_AccCode  Where Ccode='" & Str_JudgeText & "'"
  677.                 Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  678.                 With RecTemp
  679.                     If .EOF Then
  680.                         Tsxx = "此科目不存在!"
  681.                         GoTo Lrcwcl
  682.                     Else
  683.                         If Not .Fields("CusFlag") Then
  684.                             Tsxx = "此科目非客户往来科目!"
  685.                             GoTo Lrcwcl
  686.                         End If
  687.                         If Not .Fields("EndFlag") Then
  688.                             Tsxx = "此科目非末级科目!"
  689.                             GoTo Lrcwcl
  690.                         End If
  691.                         If .Fields("StopFlag") Then
  692.                             Tsxx = "此科目已停用!"
  693.                             GoTo Lrcwcl
  694.                         End If
  695.                     End If
  696.                 End With
  697.             End If
  698.             
  699.             '2.放置字段事后处理程序
  700.             
  701.             '以上为自定义部分]
  702.             
  703.         End Select
  704.         
  705.         '字段录入正确后为零字段清空
  706.         Call Qkwlzd(Dqpdwgh, Dqpdwgl)
  707.         
  708.         sjzdyxxpd = True
  709.         Yxxpdlock = True
  710.         Exit Function
  711.         
  712.     End With
  713.     
  714. Lrcwcl:    '录入错误处理
  715.     
  716.     With WglrGrid
  717.         Call Xtxxts(Tsxx, 0, 1)
  718.         changelock = True
  719.         .Select Dqpdwgh, Dqpdwgl
  720.         changelock = False
  721.         Call xswbk
  722.         sjzdyxxpd = False
  723.         Exit Function
  724.     End With
  725.     
  726. End Function
  727. Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean                  '录入数据行有效性判断,同时进行行处理
  728.     
  729.     Dim Lrywlz As Long                     '录入错误列值(Fixed)
  730.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  731.     Dim Sqlstr As String                   '临时查询字符串
  732.     Dim Str_Ccode As String                '临时索引编码
  733.     
  734.     With WglrGrid
  735.         
  736.         '行没有发生变化则不进行有效性判断
  737.         If Hyxxpdlock Then
  738.             Sjhzyxxpd = True
  739.             Exit Function
  740.         End If
  741.         
  742.         '以下为自定义部分[
  743.         
  744.         '1.1首先进行单个不能为空或不能为零判断(Fixed)
  745.         For jsqte = Qslz To .Cols - 1
  746.             '字段不能为空
  747.             If GridInt(jsqte, 5) = 1 Then
  748.                 If Len(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
  749.                     Tsxx = GridStr(jsqte, 2)
  750.                     Lrywlz = jsqte
  751.                     GoTo Lrcwcl
  752.                     Exit For
  753.                 End If
  754.             End If
  755.             
  756.             '字段不能为零
  757.             If GridInt(jsqte, 5) = 2 Then
  758.                 If Val(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
  759.                     Tsxx = GridStr(jsqte, 2)
  760.                     Lrywlz = jsqte
  761.                     GoTo Lrcwcl
  762.                     Exit For
  763.                 End If
  764.             End If
  765.         Next jsqte
  766.         
  767.         
  768.         '1.2进行其他有效性判断,编写格式同1.1
  769.         
  770.         '2.放置行处理程序(当数据行通过有效性判断)
  771.         
  772.         Str_Ccode = Trim(.TextMatrix(Yxxpdh, Sydz("001", GridStr(), Szzls)))
  773.         
  774.         On Error GoTo Swcwcl
  775.         
  776.         Cw_DataEnvi.DataConnect.BeginTrans
  777.         
  778.         With RecTemp
  779.             If .State = 1 Then .Close
  780.             .Open "SELECT * FROM Gy_Customer WHERE CusCode='" & Str_Ccode & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  781.             
  782.             If Not RecTemp.EOF Then
  783.                 .Fields("ArAccCode") = WglrGrid.TextMatrix(Yxxpdh, Sydz("003", GridStr(), Szzls))      '应收帐款科目
  784.                 .Fields("PrAccCode") = WglrGrid.TextMatrix(Yxxpdh, Sydz("004", GridStr(), Szzls))      '预收帐款科目
  785.                 .Update
  786.             End If
  787.         End With
  788.         
  789.         Cw_DataEnvi.DataConnect.CommitTrans
  790.         
  791.     End With
  792.     
  793.     '以上为自定义部分]
  794.     
  795.     
  796.     Sjhzyxxpd = True
  797.     Hyxxpdlock = True
  798.     Exit Function
  799.     
  800. Swcwcl:
  801.     
  802.     Cw_DataEnvi.DataConnect.RollbackTrans
  803.     Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
  804.     Call Xtxxts(Tsxx, 0, 1)
  805.     Exit Function
  806.     
  807. Lrcwcl:      '录入错误处理
  808.     
  809.     With WglrGrid
  810.         Call Xtxxts(Tsxx, 0, 1)
  811.         changelock = True
  812.         .Select Yxxpdh, Lrywlz
  813.         changelock = False
  814.         Call xswbk
  815.         Sjhzyxxpd = False
  816.         Exit Function
  817.     End With
  818.     
  819. End Function
  820. '===================以 下 程 序 为 通 用 部 分 ,一 般 不 需 更 改(程序动作部分)======================='
  821. Private Sub Lrzdbz()                                                      '录入字段帮助
  822.     
  823.     If Not Ydcommand.Visible Then
  824.         Exit Sub
  825.     End If
  826.     
  827.     With WglrGrid
  828.         
  829.         Valilock = True
  830.         
  831.         '处理通用部分
  832.         changelock = True        '调入另外窗体必须加锁
  833.         Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
  834.         changelock = False
  835.         
  836.         If Len(Xtfhcs) <> 0 Then
  837.             If GridInt(.Col, 7) = 0 Then
  838.                 Ydtext.Text = Xtfhcs
  839.             Else
  840.                 Ydtext.Text = Xtfhcsfz
  841.             End If
  842.         End If
  843.         
  844.         Valilock = False
  845.         
  846.         If Ydtext.Visible Then
  847.             Ydtext.SetFocus
  848.         End If
  849.     End With
  850.     
  851. End Sub
  852. Private Sub Form_Resize()                                                '窗体大小发生变化时,重新显示文本框
  853.     
  854.     Call Cxxswbk
  855.     
  856. End Sub
  857. Private Function Fun_Drfrmyxxpd() As Boolean                             '调入其它窗体或功能产生的有效性判断(包括数据回写)
  858.     
  859.     Fun_Drfrmyxxpd = True
  860.     
  861.     With WglrGrid
  862.         
  863.         '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
  864.         
  865.         If Ydtext.Visible Or YdCombo.Visible Then
  866.             Call Lrsjhx
  867.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  868.                 Fun_Drfrmyxxpd = False
  869.                 Exit Function
  870.             End If
  871.         End If
  872.         
  873.         '进行行有效性判断
  874.         If Not Sjhzyxxpd(.Row) Then
  875.             Fun_Drfrmyxxpd = False
  876.             Exit Function
  877.         End If
  878.     End With
  879.     
  880. End Function
  881. Private Sub WglrGrid_EnterCell()                                          '显示当前数据行相关信息
  882.     
  883.     With WglrGrid
  884.         If .Row >= .FixedRows Then
  885.             '[>>
  886.             '此处可以填写显示与此网格行相关信息
  887.             '<<]
  888.         End If
  889.     End With
  890.     
  891. End Sub
  892. Private Sub WglrGrid_GotFocus()                                           '网格得到焦点
  893.     
  894.     '网格得到焦点,如果当前选择行为非数据行
  895.     '则调整当前焦点至有效数据行
  896.     
  897.     With WglrGrid
  898.         If .Row < .FixedRows And .Rows > .FixedRows Then
  899.             changelock = True
  900.             .Select .FixedRows, .Col
  901.             changelock = False
  902.         End If
  903.         If .Col < Qslz Then
  904.             changelock = True
  905.             .Select .Row, Qslz
  906.             changelock = False
  907.         End If
  908.     End With
  909.     
  910. End Sub
  911. Private Sub WglrGrid_LostFocus()                                          '录入网格失去焦点
  912.     
  913.     '用以屏蔽调用其它窗体时发生网格失去焦点事件
  914.     If changelock Then
  915.         Exit Sub
  916.     End If
  917.     
  918.     '引发网格RowcolChange事件
  919.     With WglrGrid
  920.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  921.             .Select 0, 0
  922.         End If
  923.     End With
  924.     
  925. End Sub
  926. Private Sub WglrGrid_AfterScroll(ByVal OldTopRow As Long, ByVal OldLeftCol As Long, ByVal NewTopRow As Long, ByVal NewLeftCol As Long)                                             '限制用户在录入过程中滚动鼠标
  927.     
  928.     If Gdtlock Then
  929.         Exit Sub
  930.     End If
  931.     
  932.     With WglrGrid
  933.         If Ydtext.Visible Or YdCombo.Visible Then
  934.             Gdtlock = True
  935.             .TopRow = Dqtoprow
  936.             .LeftCol = Dqleftcol
  937.             Gdtlock = False
  938.             Exit Sub
  939.         End If
  940.     End With
  941.     
  942. End Sub
  943. Private Sub WglrGrid_LeaveCell()                                    '离开单元格
  944.     
  945.     If changelock Then
  946.         Exit Sub
  947.     End If
  948.     
  949.     '记录刚刚离开网格单元的行列值
  950.     Dqlkwgh = WglrGrid.Row
  951.     Dqlkwgl = WglrGrid.Col
  952.     
  953.     '判断是否需要录入数据回写
  954.     If Not (Ydtext.Visible Or YdCombo.Visible) Then
  955.         Exit Sub
  956.     End If
  957.     
  958.     Call Lrsjhx
  959.     
  960. End Sub
  961. Private Sub WglrGrid_RowColChange()                                '网格录入行列发生变化时,进行有效性判断
  962.     
  963.     Valilock = True       '屏蔽文本框失去焦点进行有效性判断
  964.     
  965.     With WglrGrid
  966.         If changelock Then
  967.             Exit Sub
  968.         End If
  969.         If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  970.             Exit Sub
  971.         End If
  972.         If .Row <> Dqlkwgh Then
  973.             If Not Sjhzyxxpd(Dqlkwgh) Then
  974.                 Exit Sub
  975.             End If
  976.         End If
  977.     End With
  978.     
  979.     Call fhyxh
  980.     Call Xldql
  981.     
  982. End Sub
  983. Private Sub WglrGrid_DblClick()                                    '鼠标双击网格显示文本框
  984.         
  985.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  986.     If Not Security_Log("Ar_CuseAcc_Edit", Xtczybm, 1, True) Then
  987.         Exit Sub
  988.     End If
  989.         
  990.     With WglrGrid
  991.         Call xswbk
  992.     End With
  993.     
  994. End Sub
  995. Private Sub Ycwbk()                                                '隐藏文本框,帮助按钮,列表组合框
  996.     
  997.     Valilock = True
  998.     Ydtext.Visible = False
  999.     YdCombo.Visible = False
  1000.     Ydcommand.Visible = False
  1001.     
  1002. End Sub
  1003. Private Sub YdCombo_KeyDown(KeyCode As Integer, Shift As Integer)        '列表框移动
  1004.     
  1005.     With WglrGrid
  1006.         Select Case KeyCode
  1007.         Case vbKeyEscape                'ESC 键放弃录入
  1008.             Valilock = True
  1009.             .SetFocus
  1010.             Call Ycwbk
  1011.             Valilock = False
  1012.             
  1013.         Case vbKeyReturn                '回 车 键 =13
  1014.             KeyCode = 0
  1015.             .SetFocus
  1016.             Call Lrsjhx
  1017.             Rowjsq = .Row
  1018.             Coljsq = .Col + 1
  1019.             If Coljsq > .Cols - 1 Then
  1020.                 If Rowjsq < .Rows - 1 Then
  1021.                     Rowjsq = Rowjsq + 1
  1022.                 End If
  1023.                 Coljsq = Qslz
  1024.             End If
  1025.             Do While Rowjsq <= .Rows - 1
  1026.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1027.                     Coljsq = Coljsq + 1
  1028.                     If Coljsq > .Cols - 1 Then
  1029.                         Rowjsq = Rowjsq + 1
  1030.                         Coljsq = Qslz
  1031.                     End If
  1032.                 Else
  1033.                     Exit Do
  1034.                 End If
  1035.             Loop
  1036.             .Select Rowjsq, Coljsq
  1037.             
  1038.         Case vbKeyLeft                  '左 箭 头 =37
  1039.             If .Col - 1 = Qslz Then
  1040.                 If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1041.                     GoTo jzzx
  1042.                 End If
  1043.             End If
  1044.             If .Col > Qslz Then
  1045.                 KeyCode = 0
  1046.                 .SetFocus
  1047.                 Call Lrsjhx
  1048.                 Coljsq = .Col - 1
  1049.                 Do While Coljsq > Qslz
  1050.                     If Coljsq - 1 = Qslz Then
  1051.                         If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1052.                             GoTo jzzx
  1053.                         End If
  1054.                     End If
  1055.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1056.                         Coljsq = Coljsq - 1
  1057.                     Else
  1058.                         Exit Do
  1059.                     End If
  1060.                 Loop
  1061.                 .Select .Row, Coljsq
  1062.             End If
  1063.             
  1064.         Case vbKeyRight                 '右 箭 头 =39
  1065.             KeyCode = 0
  1066.             .SetFocus
  1067.             Call Lrsjhx
  1068.             Rowjsq = .Row
  1069.             Coljsq = .Col + 1
  1070.             If Coljsq > .Cols - 1 Then
  1071.                 If Rowjsq < .Rows - 1 Then
  1072.                     Rowjsq = Rowjsq + 1
  1073.                 End If
  1074.                 Coljsq = Qslz
  1075.             End If
  1076.             Do While Rowjsq <= .Rows - 1
  1077.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1078.                     Coljsq = Coljsq + 1
  1079.                     If Coljsq > .Cols - 1 Then
  1080.                         Rowjsq = Rowjsq + 1
  1081.                         Coljsq = Qslz
  1082.                     End If
  1083.                 Else
  1084.                     Exit Do
  1085.                 End If
  1086.             Loop
  1087.             .Select Rowjsq, Coljsq
  1088.         Case Else
  1089.         End Select
  1090.         
  1091. jzzx:
  1092.         
  1093.     End With
  1094.     
  1095. End Sub
  1096. Private Sub YdCombo_LostFocus()                    '列表框失去焦点
  1097.     
  1098.     With WglrGrid                                    '因为选中网格会先发生Rowcolchange事件置Valiock
  1099.         If Not Valilock Then                           '为TRUE
  1100.             Call Lrsjhx
  1101.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1102.                 Exit Sub
  1103.             End If
  1104.         End If
  1105.     End With
  1106.     
  1107. End Sub
  1108. Private Sub Ydcommand_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  1109.     
  1110.     Call Lrzdbz
  1111.     
  1112. End Sub
  1113. Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer)
  1114.     
  1115.     Dim Rowjsq As Long, Coljsq As Long
  1116.     
  1117.     With WglrGrid
  1118.         Select Case KeyCode
  1119.         Case vbKeyF2
  1120.             Call Lrzdbz
  1121.         Case vbKeyEscape                'ESC 键放弃录入
  1122.             Valilock = True
  1123.             Call Ycwbk
  1124.             .SetFocus
  1125.         Case vbKeyReturn                '回 车 键 =13
  1126.             KeyCode = 0
  1127.             .SetFocus
  1128.             Call Lrsjhx
  1129.             Rowjsq = .Row
  1130.             Coljsq = .Col + 1
  1131.             If Coljsq > .Cols - 1 Then
  1132.                 If Rowjsq < .Rows - 1 Then
  1133.                     Rowjsq = Rowjsq + 1
  1134.                 End If
  1135.                 Coljsq = Qslz
  1136.             End If
  1137.             Do While Rowjsq <= .Rows - 1
  1138.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1139.                     Coljsq = Coljsq + 1
  1140.                     If Coljsq > .Cols - 1 Then
  1141.                         Rowjsq = Rowjsq + 1
  1142.                         Coljsq = Qslz
  1143.                     End If
  1144.                 Else
  1145.                     Exit Do
  1146.                 End If
  1147.             Loop
  1148.             If Rowjsq <= .Rows - 1 Then
  1149.                 .Select Rowjsq, Coljsq
  1150.             End If
  1151.             
  1152.         Case vbKeyUp                    '上 箭 头 =38
  1153.             KeyCode = 0
  1154.             .SetFocus
  1155.             Call Lrsjhx
  1156.             If .Row > .FixedRows Then
  1157.                 .Row = .Row - 1
  1158.             End If
  1159.             
  1160.         Case vbKeyDown                  '下 箭 头 =40
  1161.             KeyCode = 0
  1162.             .SetFocus
  1163.             Call Lrsjhx
  1164.             If .Row < .Rows - 1 Then
  1165.                 .Row = .Row + 1
  1166.             End If
  1167.         Case vbKeyLeft                  '左 箭 头 =37
  1168.             If .Col - 1 = Qslz Then
  1169.                 If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1170.                     GoTo jzzx
  1171.                 End If
  1172.             End If
  1173.             If Ydtext.SelStart = 0 And .Col > Qslz Then
  1174.                 KeyCode = 0
  1175.                 .SetFocus
  1176.                 Call Lrsjhx
  1177.                 Coljsq = .Col - 1
  1178.                 Do While Coljsq > Qslz
  1179.                     If Coljsq - 1 = Qslz Then
  1180.                         If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1181.                             GoTo jzzx
  1182.                         End If
  1183.                     End If
  1184.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1185.                         Coljsq = Coljsq - 1
  1186.                     Else
  1187.                         Exit Do
  1188.                     End If
  1189.                 Loop
  1190.                 .Select .Row, Coljsq
  1191.             End If
  1192. jzzx:
  1193.             
  1194.             
  1195.         Case vbKeyRight                 '右 箭 头 =39
  1196.             wblong = Len(Ydtext.Text)
  1197.             If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
  1198.                 KeyCode = 0
  1199.                 .SetFocus
  1200.                 Call Lrsjhx
  1201.                 Rowjsq = .Row
  1202.                 Coljsq = .Col + 1
  1203.                 If Coljsq > .Cols - 1 Then
  1204.                     If Rowjsq < .Rows - 1 Then
  1205.                         Rowjsq = Rowjsq + 1
  1206.                     End If
  1207.                     Coljsq = Qslz
  1208.                 End If
  1209.                 Do While Rowjsq <= .Rows - 1
  1210.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1211.                         Coljsq = Coljsq + 1
  1212.                         If Coljsq > .Cols - 1 Then
  1213.                             Rowjsq = Rowjsq + 1
  1214.                             Coljsq = Qslz
  1215.                         End If
  1216.                     Else
  1217.                         Exit Do
  1218.                     End If
  1219.                 Loop
  1220.                 .Select Rowjsq, Coljsq
  1221.             End If
  1222.         Case Else
  1223.         End Select
  1224.     End With
  1225.     
  1226. End Sub
  1227. Private Sub ydtext_KeyPress(KeyAscii As Integer)         '录入字符事中控制
  1228.     
  1229.     Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  1230.     
  1231. End Sub
  1232. Private Sub ydtext_Change()                              '录入事中变化处理
  1233.     
  1234.     '防止程序改变但不进行处理
  1235.     
  1236.     If Wbkbhlock Then
  1237.         Exit Sub
  1238.     End If
  1239.     
  1240.     With WglrGrid
  1241.         
  1242.         '限制字段录入长度
  1243.         Wbkbhlock = True
  1244.         
  1245.         Call TextChangeLimit(Ydtext, GridInt(.Col, 1))  '去掉无效字符
  1246.         
  1247.         Select Case GridInt(.Col, 1)
  1248.         Case 8, 11   '金额型
  1249.             Call Sjgskz(Ydtext, Xtjezws - Xtjexsws - 1, Xtjexsws)
  1250.         Case 9, 12   '数量型
  1251.             Call Sjgskz(Ydtext, Xtslzws - Xtslxsws - 1, Xtslxsws)
  1252.         Case 10      '单价型
  1253.             Call Sjgskz(Ydtext, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  1254.         Case Else    '其他类型
  1255.             If GridInt(.Col, 3) <> 0 Or GridInt(.Col, 4) <> 0 Then
  1256.                 Call Sjgskz(Ydtext, GridInt(.Col, 3), GridInt(.Col, 4))
  1257.             End If
  1258.         End Select
  1259.         
  1260.         Wbkbhlock = False
  1261.     End With
  1262.     
  1263. End Sub
  1264. Private Sub ydtext_LostFocus()            '如果由于选中网格之外的控件而发生有效性判断(选中网格会先发生Rowcolchange事件置Valiock为TRUE)
  1265.     
  1266.     With WglrGrid
  1267.         If Not Valilock Then
  1268.             Call Lrsjhx
  1269.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1270.                 Exit Sub
  1271.             End If
  1272.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1273.                 Exit Sub
  1274.             End If
  1275.         End If
  1276.     End With
  1277.     
  1278. End Sub
  1279. Private Sub xswbk()                       '在当前选中单元显示文本框,列表框,帮助按钮(通用)
  1280.     
  1281.     Dim Wbkpy As Integer, Wbkpy1 As Integer '文本框偏移量
  1282.     
  1283.     '当某种条件成立时禁止文本框激活使单据处于录入状态
  1284.     If Not Fun_AllowInput Then
  1285.         Exit Sub
  1286.     End If
  1287.     
  1288.     '显示文本框前返回有效行列(解决滚动条问题)
  1289.     Call Xldqh
  1290.     Call Xldql
  1291.     
  1292.     '隐藏文本框,帮助按钮,列表组合框
  1293.     Call Ycwbk
  1294.     
  1295.     With WglrGrid
  1296.         Dqlrwgh = .Row
  1297.         Dqlrwgl = .Col
  1298.         If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  1299.             Exit Sub
  1300.         End If
  1301.         
  1302.         Wbkpy = 30
  1303.         Wbkpy1 = 15
  1304.         
  1305.         If GridBoolean(.Col, 3) Then
  1306.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  1307.             YdCombo.Top = .CellTop + .Top + Wbkpy
  1308.             YdCombo.Width = .CellWidth - Wbkpy1
  1309.             Call Wbkcl
  1310.             YdCombo.Visible = True
  1311.             YdCombo.SetFocus
  1312.             Ydcommand.Visible = False
  1313.             Ydtext.Visible = False
  1314.         Else
  1315.             If GridBoolean(.Col, 2) Then
  1316.                 Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
  1317.                 Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
  1318.                 Ydcommand.Visible = True
  1319.             Else
  1320.                 Ydcommand.Visible = False
  1321.             End If
  1322.             
  1323.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1324.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1325.             
  1326.             If Ydcommand.Visible Then
  1327.                 If Sfblbzkd Then
  1328.                     Ydtext.Width = .CellWidth - Ydcommand.Width
  1329.                 Else
  1330.                     Ydtext.Width = .CellWidth - Wbkpy1
  1331.                 End If
  1332.             Else
  1333.                 Ydtext.Width = .CellWidth - Wbkpy1
  1334.             End If
  1335.             
  1336.             Ydtext.Height = .CellHeight - Wbkpy1
  1337.             
  1338.             If GridInt(.Col, 2) <> 0 Then
  1339.                 Ydtext.MaxLength = GridInt(.Col, 2)
  1340.             Else
  1341.                 Ydtext.MaxLength = 3000
  1342.             End If
  1343.             
  1344.             Call Wbkcl
  1345.             
  1346.             Ydtext.Visible = True
  1347.             Ydtext.SetFocus
  1348.         End If
  1349.         
  1350.         Dqtoprow = .TopRow
  1351.         Dqleftcol = .LeftCol
  1352.         
  1353.         '重置锁值
  1354.         Valilock = False
  1355.         Wbkbhlock = False
  1356.     End With
  1357.     
  1358. End Sub
  1359. Private Function Fun_AllowInput() As Boolean                           '当某种条件成立时禁止文本框激活使单据处于录入状态
  1360.     
  1361.     '如果单据操作状态为浏览状态则不能显示录入载体(通用)
  1362.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1363.         Exit Function
  1364.     End If
  1365.     
  1366.     '[>>
  1367.     
  1368.     '此处可以填写禁止文本框激活使单据处于录入状态的理由
  1369.     
  1370.     '<<]
  1371.     
  1372.     Fun_AllowInput = True
  1373.     
  1374. End Function
  1375. Private Sub Cxxswbk()                                                  'Formresize中重新显示文本框,列表框,帮助按钮(通用)
  1376.     
  1377.     Dim Wbkpy As Integer, Wbkpy1 As Integer
  1378.     
  1379.     Wbkpy = 30
  1380.     Wbkpy1 = 15
  1381.     
  1382.     With WglrGrid
  1383.         If YdCombo.Visible Then
  1384.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  1385.             YdCombo.Top = .CellTop + .Top + Wbkpy
  1386.             YdCombo.Width = .CellWidth - Wbkpy1
  1387.         End If
  1388.         If Ydcommand.Visible Then
  1389.             Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
  1390.             Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
  1391.         End If
  1392.         If Ydtext.Visible Then
  1393.             If Ydcommand.Visible Then
  1394.                 If Sfblbzkd Then
  1395.                     Ydtext.Width = .CellWidth - Ydcommand.Width
  1396.                 Else
  1397.                     Ydtext.Width = .CellWidth - Wbkpy1
  1398.                 End If
  1399.             Else
  1400.                 Ydtext.Width = .CellWidth - Wbkpy1
  1401.             End If
  1402.             
  1403.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1404.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1405.             Ydtext.Height = .CellHeight - Wbkpy1
  1406.         End If
  1407.     End With
  1408.     
  1409. End Sub
  1410. Private Sub Lrsjhx()                                                             '文本框录入数据回写
  1411.     
  1412.     With WglrGrid
  1413.         If YdCombo.Visible Then
  1414.             .Text = Trim(YdCombo.Text)
  1415.         End If
  1416.         If Ydtext.Visible Then
  1417.             .Text = Trim(Ydtext.Text)
  1418.         End If
  1419.         
  1420.         '(如果字段录入内容发生变化,则打开有效性判断锁)
  1421.         If Zdlrqnr <> Trim(.Text) Then
  1422.             Yxxpdlock = False
  1423.             Hyxxpdlock = False
  1424.         End If
  1425.         
  1426.         '隐藏文本框,帮助按钮,列表组合框
  1427.         Call Ycwbk
  1428.         
  1429.     End With
  1430.     
  1431. End Sub
  1432. Private Sub WglrGrid_KeyDown(KeyCode As Integer, Shift As Integer)              '网格快捷键
  1433.     
  1434.     '如果单据操作状态为浏览状态则不能显示录入载体
  1435.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1436.         Exit Sub
  1437.     End If
  1438.     
  1439.     Select Case KeyCode
  1440.     Case vbKeyF2                   '按F2键参照
  1441.         Call xswbk
  1442.         Call Lrzdbz
  1443.     End Select
  1444.     
  1445. End Sub
  1446. Private Sub WglrGrid_KeyPress(KeyAscii As Integer)                              '网格接受键盘录入
  1447.         
  1448.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1449.     If Not Security_Log("Ar_CuseAcc_Edit", Xtczybm, 1, True) Then
  1450.         Exit Sub
  1451.     End If
  1452.         
  1453.     '当某种条件成立时禁止文本框激活使单据处于录入状态
  1454.     If Not Fun_AllowInput Then
  1455.         Exit Sub
  1456.     End If
  1457.     
  1458.     With WglrGrid
  1459.         
  1460.         '屏 蔽 回 车 键
  1461.         If KeyAscii = vbKeyReturn Then
  1462.             KeyAscii = 0
  1463.             Rowjsq = .Row
  1464.             Coljsq = .Col + 1
  1465.             If Coljsq > .Cols - 1 Then
  1466.                 If Rowjsq < .Rows - 1 Then
  1467.                     Rowjsq = Rowjsq + 1
  1468.                 End If
  1469.                 Coljsq = Qslz
  1470.             End If
  1471.             Do While Rowjsq <= .Rows - 1
  1472.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1473.                     Coljsq = Coljsq + 1
  1474.                     If Coljsq > .Cols - 1 Then
  1475.                         Rowjsq = Rowjsq + 1
  1476.                         Coljsq = Qslz
  1477.                     End If
  1478.                 Else
  1479.                     Exit Do
  1480.                 End If
  1481.             Loop
  1482.             
  1483.             If Rowjsq <= .Rows - 1 Then
  1484.                 .Select Rowjsq, Coljsq
  1485.             End If
  1486.             
  1487.             Exit Sub
  1488.             
  1489.         End If
  1490.         
  1491.         '接受用户录入
  1492.         Select Case KeyAscii
  1493.         Case 0 To 32             '用户输入KeyAscii为0-32的键 如空格
  1494.             '显示录入载体
  1495.             Call xswbk
  1496.         Case Else
  1497.             
  1498.             '防止非编辑字段SendKeys()出现死循环
  1499.             If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  1500.                 Exit Sub
  1501.             End If
  1502.             
  1503.             '如果此字段为列表框录入则调入相应列表框
  1504.             If GridBoolean(.Col, 3) Then
  1505.                 '列表框录入
  1506.                 Call xswbk
  1507.             Else
  1508.                 Ydtext.Text = ""
  1509.                 
  1510.                 '录入限制
  1511.                 Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  1512.                 If KeyAscii = 0 Then
  1513.                     Exit Sub
  1514.                 End If
  1515.                 Call xswbk
  1516.                 Ydtext.Text = ""
  1517.                 Valilock = True
  1518.                 SendKeys Chr(KeyAscii), True
  1519.                 DoEvents
  1520.                 Valilock = False
  1521.             End If
  1522.         End Select
  1523.     End With
  1524.     
  1525. End Sub
  1526. Private Sub Qkwlzd(sjh As Long, Sjl As Long)                            '清空为零字段
  1527.     
  1528.     If Not GridBoolean(Sjl, 5) Then
  1529.         Exit Sub
  1530.     End If
  1531.     
  1532.     With WglrGrid
  1533.         If Val(Trim(.TextMatrix(sjh, Sjl))) = 0 Then
  1534.             .TextMatrix(sjh, Sjl) = ""
  1535.         End If
  1536.     End With
  1537.     
  1538. End Sub
  1539. Private Sub fhyxh()                                                     '返回录入数据有效行,同时让得到焦点网格可见
  1540.     
  1541.     With WglrGrid
  1542.         If .Row >= .FixedRows Then
  1543.             Call Xldqh
  1544.         End If
  1545.     End With
  1546.     
  1547. End Sub
  1548. Private Sub Xldqh()                                                      '显露当前行
  1549.     
  1550.     Dim Toprowte As Long
  1551.     With WglrGrid
  1552.         Toprowte = 0
  1553.         Do While .CellTop + .RowHeight(.Row) + Fzxwghs * Sjhgd > .Height And .TopRow <> Toprowte
  1554.             Toprowte = .TopRow
  1555.             .TopRow = .TopRow + 1
  1556.         Loop
  1557.         Toprowte = 0
  1558.         Do While .CellTop < .FixedRows * .RowHeight(0) And .TopRow <> Toprowte
  1559.             Toprowte = .TopRow
  1560.             If .TopRow > 1 Then
  1561.                 .TopRow = .TopRow - 1
  1562.             End If
  1563.         Loop
  1564.     End With
  1565.     
  1566. End Sub
  1567. Private Sub Xldql()                                                                  '显露当前列
  1568.     
  1569.     Dim Leftcolte As Long
  1570.     With WglrGrid
  1571.         If .Col >= Qslz And .Col >= .FixedCols Then
  1572.             If .LeftCol > .Col Then
  1573.                 .LeftCol = .Col
  1574.             End If
  1575.             Leftcolte = 0
  1576.             Do While .CellLeft + .CellWidth > .Width And .LeftCol <> Leftcolte
  1577.                 Leftcolte = .LeftCol
  1578.                 .LeftCol = .LeftCol + 1
  1579.             Loop
  1580.         End If
  1581.     End With
  1582.     
  1583. End Sub
  1584. Private Sub WglrGrid_BeforeMoveColumn(ByVal Col As Long, Position As Long)           '网格列发生移动时自动交换网格索引信息
  1585.     Call FnBln_RefreshArray(Col, Position, GridStr(), GridInf())
  1586. End Sub
  1587. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)   '表格格式设置(通用)
  1588.     
  1589.     Select Case Button.Key
  1590.     Case "bcgs"                                       '保存表格格式
  1591.         Call Bcwggs(WglrGrid, GridCode, GridStr())
  1592.     Case "hfmrgs"                                     '恢复默认格式
  1593.         Call Hfmrgs(WglrGrid, GridCode, GridStr())
  1594.     End Select
  1595.     
  1596. End Sub
  1597. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  1598.     
  1599.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  1600.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  1601.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  1602.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  1603.     ReDim Bbxbt(1 To Bbxbtgs)
  1604.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  1605.     If Bbbwhgs <> 0 Then
  1606.         ReDim Bbbwh(1 To Bbbwhgs)
  1607.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  1608.     End If
  1609.     Bbzbt = ReportTitle
  1610.     Call Scyxsjb(WglrGrid)                               '生成报表数据
  1611.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  1612.     If Not bbylte Then
  1613.         Unload DY_Tybbyldy
  1614.     End If
  1615.     
  1616. End Sub