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