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

企业管理

开发平台:

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