+
上传用户: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.       BackColor       =   &H00FFFFFF&
  32.       Height          =   855
  33.       Left            =   0
  34.       Picture         =   "基础设置_帐龄区间设置.frx":13CC
  35.       ScaleHeight     =   795
  36.       ScaleWidth      =   11715
  37.       TabIndex        =   7
  38.       Top             =   570
  39.       Width           =   11775
  40.       Begin MSComctlLib.ImageList ImageList1 
  41.          Left            =   4260
  42.          Top             =   60
  43.          _ExtentX        =   1005
  44.          _ExtentY        =   1005
  45.          BackColor       =   -2147483643
  46.          ImageWidth      =   16
  47.          ImageHeight     =   16
  48.          MaskColor       =   12632256
  49.          _Version        =   393216
  50.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  51.             NumListImages   =   25
  52.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  53.                Picture         =   "基础设置_帐龄区间设置.frx":1E30C
  54.                Key             =   "sz"
  55.             EndProperty
  56.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  57.                Picture         =   "基础设置_帐龄区间设置.frx":1E6A6
  58.                Key             =   "dy"
  59.             EndProperty
  60.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  61.                Picture         =   "基础设置_帐龄区间设置.frx":1EA40
  62.                Key             =   "yl"
  63.             EndProperty
  64.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  65.                Picture         =   "基础设置_帐龄区间设置.frx":1EDDA
  66.                Key             =   "xg"
  67.             EndProperty
  68.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  69.                Picture         =   "基础设置_帐龄区间设置.frx":1F174
  70.                Key             =   "zh"
  71.             EndProperty
  72.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  73.                Picture         =   "基础设置_帐龄区间设置.frx":1F50E
  74.                Key             =   "sh"
  75.             EndProperty
  76.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  77.                Picture         =   "基础设置_帐龄区间设置.frx":1F8A8
  78.                Key             =   "bc"
  79.             EndProperty
  80.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  81.                Picture         =   "基础设置_帐龄区间设置.frx":1FC42
  82.                Key             =   "fq"
  83.             EndProperty
  84.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  85.                Picture         =   "基础设置_帐龄区间设置.frx":1FFDC
  86.                Key             =   "bz"
  87.             EndProperty
  88.             BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  89.                Picture         =   "基础设置_帐龄区间设置.frx":20376
  90.                Key             =   "tc"
  91.             EndProperty
  92.             BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  93.                Picture         =   "基础设置_帐龄区间设置.frx":20710
  94.                Key             =   "bcgs"
  95.             EndProperty
  96.             BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  97.                Picture         =   "基础设置_帐龄区间设置.frx":20AAA
  98.                Key             =   "mrlk"
  99.             EndProperty
  100.             BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  101.                Picture         =   "基础设置_帐龄区间设置.frx":20E44
  102.                Key             =   "xsxm"
  103.             EndProperty
  104.             BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  105.                Picture         =   "基础设置_帐龄区间设置.frx":211DE
  106.                Key             =   "first"
  107.             EndProperty
  108.             BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  109.                Picture         =   "基础设置_帐龄区间设置.frx":21578
  110.                Key             =   "prev"
  111.             EndProperty
  112.             BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  113.                Picture         =   "基础设置_帐龄区间设置.frx":21912
  114.                Key             =   "next"
  115.             EndProperty
  116.             BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  117.                Picture         =   "基础设置_帐龄区间设置.frx":21CAC
  118.                Key             =   "last"
  119.             EndProperty
  120.             BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  121.                Picture         =   "基础设置_帐龄区间设置.frx":22046
  122.                Key             =   "xx"
  123.             EndProperty
  124.             BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  125.                Picture         =   "基础设置_帐龄区间设置.frx":223E0
  126.                Key             =   "define"
  127.             EndProperty
  128.             BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  129.                Picture         =   "基础设置_帐龄区间设置.frx":2277A
  130.                Key             =   "exec"
  131.             EndProperty
  132.             BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  133.                Picture         =   "基础设置_帐龄区间设置.frx":22B14
  134.                Key             =   "xz"
  135.             EndProperty
  136.             BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  137.                Picture         =   "基础设置_帐龄区间设置.frx":22EAE
  138.                Key             =   "sc"
  139.             EndProperty
  140.             BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  141.                Picture         =   "基础设置_帐龄区间设置.frx":23248
  142.                Key             =   "sx"
  143.             EndProperty
  144.             BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  145.                Picture         =   "基础设置_帐龄区间设置.frx":235E2
  146.                Key             =   "cx"
  147.             EndProperty
  148.             BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  149.                Picture         =   "基础设置_帐龄区间设置.frx":2397C
  150.                Key             =   "zd"
  151.             EndProperty
  152.          EndProperty
  153.       End
  154.       Begin VB.Label Lab_TitleText 
  155.          BackStyle       =   0  'Transparent
  156.          ForeColor       =   &H00FF0000&
  157.          Height          =   225
  158.          Left            =   750
  159.          TabIndex        =   9
  160.          Top             =   690
  161.          Width           =   1455
  162.       End
  163.       Begin VB.Label tsLabel 
  164.          BackColor       =   &H80000018&
  165.          BackStyle       =   0  'Transparent
  166.          Caption         =   "帐龄区间设置"
  167.          BeginProperty Font 
  168.             Name            =   "宋体"
  169.             Size            =   14.25
  170.             Charset         =   134
  171.             Weight          =   700
  172.             Underline       =   0   'False
  173.             Italic          =   0   'False
  174.             Strikethrough   =   0   'False
  175.          EndProperty
  176.          ForeColor       =   &H00000000&
  177.          Height          =   375
  178.          Index           =   4
  179.          Left            =   510
  180.          TabIndex        =   8
  181.          Top             =   180
  182.          Width           =   1935
  183.       End
  184.    End
  185.    Begin VB.TextBox Ydtext 
  186.       BackColor       =   &H00C0FFFF&
  187.       BorderStyle     =   0  'None
  188.       Height          =   330
  189.       Left            =   9300
  190.       MultiLine       =   -1  'True
  191.       TabIndex        =   0
  192.       Top             =   1620
  193.       Visible         =   0   'False
  194.       Width           =   1185
  195.    End
  196.    Begin VB.ComboBox YdCombo 
  197.       Height          =   300
  198.       Left            =   9300
  199.       Style           =   2  'Dropdown List
  200.       TabIndex        =   3
  201.       Top             =   2010
  202.       Visible         =   0   'False
  203.       Width           =   1665
  204.    End
  205.    Begin VB.Timer Timer1 
  206.       Interval        =   1
  207.       Left            =   10530
  208.       Top             =   1560
  209.    End
  210.    Begin VSFlex8Ctl.VSFlexGrid WglrGrid 
  211.       Height          =   5835
  212.       Left            =   60
  213.       TabIndex        =   4
  214.       Top             =   1500
  215.       Width           =   8205
  216.       _cx             =   5080
  217.       _cy             =   5080
  218.       Appearance      =   1
  219.       BorderStyle     =   1
  220.       Enabled         =   -1  'True
  221.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  222.          Name            =   "宋体"
  223.          Size            =   9
  224.          Charset         =   134
  225.          Weight          =   400
  226.          Underline       =   0   'False
  227.          Italic          =   0   'False
  228.          Strikethrough   =   0   'False
  229.       EndProperty
  230.       MousePointer    =   0
  231.       BackColor       =   16777215
  232.       ForeColor       =   -2147483640
  233.       BackColorFixed  =   12632256
  234.       ForeColorFixed  =   -2147483630
  235.       BackColorSel    =   -2147483635
  236.       ForeColorSel    =   -2147483634
  237.       BackColorBkg    =   -2147483636
  238.       BackColorAlternate=   16777215
  239.       GridColor       =   -2147483633
  240.       GridColorFixed  =   -2147483632
  241.       TreeColor       =   -2147483632
  242.       FloodColor      =   192
  243.       SheetBorder     =   -2147483642
  244.       FocusRect       =   1
  245.       HighLight       =   1
  246.       AllowSelection  =   -1  'True
  247.       AllowBigSelection=   -1  'True
  248.       AllowUserResizing=   0
  249.       SelectionMode   =   0
  250.       GridLines       =   1
  251.       GridLinesFixed  =   2
  252.       GridLineWidth   =   1
  253.       Rows            =   50
  254.       Cols            =   10
  255.       FixedRows       =   1
  256.       FixedCols       =   1
  257.       RowHeightMin    =   0
  258.       RowHeightMax    =   0
  259.       ColWidthMin     =   0
  260.       ColWidthMax     =   0
  261.       ExtendLastCol   =   0   'False
  262.       FormatString    =   ""
  263.       ScrollTrack     =   0   'False
  264.       ScrollBars      =   3
  265.       ScrollTips      =   0   'False
  266.       MergeCells      =   0
  267.       MergeCompare    =   0
  268.       AutoResize      =   -1  'True
  269.       AutoSizeMode    =   0
  270.       AutoSearch      =   0
  271.       AutoSearchDelay =   2
  272.       MultiTotals     =   -1  'True
  273.       SubtotalPosition=   1
  274.       OutlineBar      =   0
  275.       OutlineCol      =   0
  276.       Ellipsis        =   0
  277.       ExplorerBar     =   0
  278.       PicturesOver    =   0   'False
  279.       FillStyle       =   0
  280.       RightToLeft     =   0   'False
  281.       PictureType     =   0
  282.       TabBehavior     =   0
  283.       OwnerDraw       =   0
  284.       Editable        =   0
  285.       ShowComboButton =   1
  286.       WordWrap        =   0   'False
  287.       TextStyle       =   0
  288.       TextStyleFixed  =   0
  289.       OleDragMode     =   0
  290.       OleDropMode     =   0
  291.       DataMode        =   0
  292.       VirtualData     =   -1  'True
  293.       DataMember      =   ""
  294.       ComboSearch     =   3
  295.       AutoSizeMouse   =   -1  'True
  296.       FrozenRows      =   0
  297.       FrozenCols      =   0
  298.       AllowUserFreezing=   0
  299.       BackColorFrozen =   0
  300.       ForeColorFrozen =   0
  301.       WallPaperAlignment=   9
  302.       AccessibleName  =   ""
  303.       AccessibleDescription=   ""
  304.       AccessibleValue =   ""
  305.       AccessibleRole  =   24
  306.    End
  307.    Begin MSComctlLib.Toolbar Tlb_Action 
  308.       Align           =   1  'Align Top
  309.       Height          =   555
  310.       Left            =   0
  311.       TabIndex        =   2
  312.       Top             =   0
  313.       Width           =   8325
  314.       _ExtentX        =   14684
  315.       _ExtentY        =   979
  316.       ButtonWidth     =   820
  317.       ButtonHeight    =   926
  318.       AllowCustomize  =   0   'False
  319.       Wrappable       =   0   'False
  320.       Appearance      =   1
  321.       Style           =   1
  322.       ImageList       =   "ImageList1"
  323.       _Version        =   393216
  324.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  325.          NumButtons      =   9
  326.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  327.             Caption         =   "设置"
  328.             Key             =   "ymsz"
  329.             Object.ToolTipText     =   "打印页面设置"
  330.             ImageKey        =   "sz"
  331.          EndProperty
  332.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  333.             Caption         =   "打印"
  334.             Key             =   "dy"
  335.             Object.ToolTipText     =   "打印当前单据或Ctrl+P"
  336.             ImageKey        =   "dy"
  337.          EndProperty
  338.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  339.             Caption         =   "预览"
  340.             Key             =   "yl"
  341.             ImageKey        =   "yl"
  342.          EndProperty
  343.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  344.             Style           =   3
  345.          EndProperty
  346.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  347.             Caption         =   "增行"
  348.             Key             =   "zh"
  349.             Object.ToolTipText     =   "插入一行或按Insert键"
  350.             ImageKey        =   "zh"
  351.          EndProperty
  352.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  353.             Caption         =   "删行"
  354.             Key             =   "sh"
  355.             Object.ToolTipText     =   "删除当前记录行或Delete"
  356.             ImageKey        =   "sh"
  357.          EndProperty
  358.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  359.             Style           =   3
  360.          EndProperty
  361.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  362.             Caption         =   "帮助"
  363.             Key             =   "bz"
  364.             ImageKey        =   "bz"
  365.          EndProperty
  366.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  367.             Caption         =   "退出"
  368.             Key             =   "fh"
  369.             ImageKey        =   "tc"
  370.          EndProperty
  371.       EndProperty
  372.       BorderStyle     =   1
  373.       Begin MSComctlLib.Toolbar GsToolbar 
  374.          Height          =   525
  375.          Left            =   6600
  376.          TabIndex        =   6
  377.          Top             =   0
  378.          Width           =   1695
  379.          _ExtentX        =   2990
  380.          _ExtentY        =   926
  381.          ButtonWidth     =   1455
  382.          ButtonHeight    =   926
  383.          AllowCustomize  =   0   'False
  384.          Appearance      =   1
  385.          Style           =   1
  386.          ImageList       =   "ImageList1"
  387.          _Version        =   393216
  388.          BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  389.             NumButtons      =   2
  390.             BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  391.                Caption         =   "保存格式"
  392.                Key             =   "bcgs"
  393.                ImageKey        =   "bcgs"
  394.             EndProperty
  395.             BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  396.                Caption         =   "默认列宽"
  397.                Key             =   "hfmrgs"
  398.                ImageKey        =   "mrlk"
  399.             EndProperty
  400.          EndProperty
  401.       End
  402.    End
  403.    Begin VB.Label Lab_OperStatus 
  404.       BackColor       =   &H000080FF&
  405.       Caption         =   "1"
  406.       Height          =   345
  407.       Left            =   10980
  408.       TabIndex        =   5
  409.       Top             =   1590
  410.       Visible         =   0   'False
  411.       Width           =   345
  412.    End
  413. End
  414. Attribute VB_Name = "JC_FrmBillAge"
  415. Attribute VB_GlobalNameSpace = False
  416. Attribute VB_Creatable = False
  417. Attribute VB_PredeclaredId = True
  418. Attribute VB_Exposed = False
  419. '**************************************************************************************************
  420. '*    模 块 名 称 :帐龄区间设置
  421. '*    功 能 描 述 :
  422. '*    程序员姓名  :张建忠
  423. '*    最后修改人  :张建忠
  424. '*    最后修改时间:2001/12/04
  425. '*    备        注:程序中所有依实际情况自定义部分均用[>> <<]括起,注意此种录入需要修改"Sub Scdqfl"
  426. '*
  427. '*    1.每次调入外部功能窗体,均要加锁ChangeLock=True,窗体关闭后解锁ChangeLock=false
  428. '*
  429. '*    3.Lab_OperStatus 用此标签来标识单据录入状态(默认值为1) 1-浏览 2-修改
  430. '**************************************************************************************************
  431.  
  432.  '以下为自定义变量
  433.  
  434.  
  435. '其它固定使用变量
  436. Dim Tsxx As String                              '系统信息提示(Fixed)
  437. Dim ReportTitle As String                       '报表主标题(Fixed)
  438.     
  439. '以下为固定使用变量(网格)
  440. Dim Cxnrrec As New ADODB.Recordset              '显示查询内容动态集
  441. Dim Dyymctbl As New DY_Dyymsz                   '打印页面窗体变量
  442. Dim GridCode As String                          '显示网格网格代码
  443. Dim GridInf() As Variant                        '整个网格设置信息
  444. Dim Pmbcsjhs As Long                            '屏幕网格保持数据行数(大于等于1)
  445. Dim Fzxwghs As Integer                          '辅助项网格行数(包括合计行)
  446. Dim Sfxshjwg As Boolean                         '是否显示合计网格
  447. Dim Qslz As Long                                '网格隐藏(非操作显示)列数
  448. Dim Sjhgd As Double                             '网格数据行高度
  449. Dim GridBoolean() As Boolean                    '网格列信息(布尔型)
  450. Dim GridStr()  As String                        '网格列信息(字符型)
  451. Dim GridInt() As Integer                        '网格列信息(整型)
  452. Dim Sfblbzkd As Boolean                         '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
  453. Dim Dqlrwgh As Long                             '当前录入数据网格行
  454. Dim Dqlrwgl As Long                             '当前录入数据网格列
  455. Dim Dqlkwgh As Long                             '刚刚离开网格行(不一定为录入行)
  456. Dim Dqlkwgl As Long                             '刚刚离开网格列
  457. Dim Dqtoprow As Long                            '当前录入状态时最上端可视行
  458. Dim Dqleftcol As Long                           '当前录入状态时最左端可视列
  459. Dim Zdlrqnr As String                           '字段录入修改前内容(用来判断内容是否修改)
  460. Dim Wbkbhlock As Boolean                        '文本框改变值锁
  461. Dim changelock As Boolean                       '网格行列改变控制锁(用来区别用户改变.程序改变)
  462. Dim Gdtlock As Boolean                          '滚动条滚动控制(用来区别用户改变.程序改变)
  463. Dim Yxxpdlock As Boolean                        '字段有效性判断锁(内容不修改不需进行字段有效性判断)
  464. Dim Hyxxpdlock As Boolean                       '行有效性判断锁(字段内容不修改不需进行行有效性判断)
  465. Dim Valilock As Boolean                         '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
  466. Dim Shsfts As Boolean                           '删除记录行是否提示
  467. Dim Szzls As Integer                            '网格信息数组最大下标值(网格列数-1)
  468.     
  469. Private Sub Form_KeyPress(KeyAscii As Integer)      '控制焦点转移和限制录入字符"'"
  470.     
  471.     Select Case KeyAscii
  472.     Case 39           '屏蔽字符"'"
  473.         KeyAscii = 0
  474.     End Select
  475.     
  476. End Sub
  477. Private Sub Form_Load()                              '窗 体 装 入
  478.     
  479.     '初始化各种锁值(Fixed)
  480.     changelock = False             '网格行列改变控制锁
  481.     Gdtlock = False                '滚动条滚动控制
  482.     Yxxpdlock = True               '字段有效性判断锁
  483.     Hyxxpdlock = True              '行有效性判断锁
  484.     Wbkbhlock = False              '文本框内容改变锁
  485.     
  486.     '报表主标题及报表编码(Fixed)
  487.     ReportTitle = "帐龄区间表"
  488.     XtReportCode = "Ar_BillAge"
  489.     Load Dyymctbl
  490.     
  491.     '调 入 网 格(Fixed)
  492.     GridCode = "Ar_BillAge"       '网格属性编码
  493.     Call BzWgcsh(WglrGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  494.     
  495.     Qslz = GridInf(1)
  496.     Sjhgd = GridInf(2)
  497.     Pmbcsjhs = GridInf(3)
  498.     Fzxwghs = GridInf(4)
  499.     Sfblbzkd = GridInf(5)
  500.     Shsfts = GridInf(6)
  501.     Sfxshjwg = GridInf(7)
  502.     Szzls = WglrGrid.Cols - 1
  503.     
  504.     '设置标题栏宽度、网格宽度高度(Fixed)
  505.     Pic_Title.Move 50, Pic_Title.Top, Me.Width - 150, Pic_Title.Height
  506.     WglrGrid.Move 50, Pic_Title.Top + Pic_Title.Height, Me.Width - 150
  507.     WglrGrid.Height = Me.Height - WglrGrid.Top - 380
  508.     
  509.     '生成查询结果
  510.     Call Sub_Query
  511.     
  512.     '设置状态为修改状态
  513.     Lab_OperStatus = "2"
  514.     
  515. End Sub
  516. Private Sub Form_Unload(Cancel As Integer)           '窗体卸载
  517.     
  518.     '调入其它窗体或功能产生的有效性判断(包括数据回写)
  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 * From RP_BillAge Where RpFlag='AR' ORDER BY BillAgeID"
  539.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  540.     
  541.     With RecTemp
  542.         WglrGrid.Rows = WglrGrid.FixedRows
  543.         jsqte = WglrGrid.FixedRows
  544.         
  545.         Do While Not .EOF
  546.             
  547.             WglrGrid.AddItem ""
  548.             '[>>显示查询内容
  549.             WglrGrid.TextMatrix(jsqte, 0) = "*"                                                              '行标识
  550.             WglrGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("BEDays") & "")         '起止天数
  551.             WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = .Fields("MinBillAge")                '总天数
  552.             
  553.             '<<]
  554.             WglrGrid.RowHeight(jsqte) = Sjhgd
  555.             .MoveNext
  556.             jsqte = jsqte + 1
  557.         Loop
  558.     End With
  559.     
  560.     '将网格刷新解禁(Fixed)
  561.     WglrGrid.Redraw = True
  562.     
  563.     '调整网格(Fixed)
  564.     Call Sub_AdjustGrid
  565.     
  566. End Sub
  567. Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
  568.     
  569.     '屏蔽文本框,下拉组合框有效性判断
  570.     
  571.     Valilock = True
  572.     
  573.     '屏蔽网格失去焦点产生的有效性判断
  574.     
  575.     changelock = True
  576.     
  577.     Select Case Button.Key
  578.     Case "ymsz"                                          '页面设置
  579.         Dyymctbl.Show 1
  580.     Case "yl"                                            '预 览
  581.         If Fun_Drfrmyxxpd Then
  582.             Call bbyl(True)
  583.         End If
  584.     Case "dy"                                            '打 印
  585.         If Fun_Drfrmyxxpd Then
  586.             Call bbyl(False)
  587.         End If
  588.     Case "zh"                                            '增 行
  589.         Call zjlrfl
  590.     Case "sh"                                            '删 行
  591.         Call Scdqfl
  592.     Case "bz"                                            '帮 助
  593.         Call F1bz
  594.     Case "fh"                                            '退 出
  595.         Unload Me
  596.     End Select
  597.     
  598.     '解 锁
  599.     Valilock = False
  600.     changelock = False
  601.     
  602. End Sub
  603. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)        '支持热键操作
  604.     
  605.     If Shift = 2 Then
  606.         Select Case UCase(Chr(KeyCode))
  607.         Case "P"                   'Ctrl+P 打印
  608.             If Tlb_Action.Buttons("dy").Enabled Then
  609.                 Call bbyl(False)
  610.             End If
  611.         End Select
  612.     End If
  613.     
  614. End Sub
  615. Private Sub Wbkcl()                                                 '文本框录入之前处理(根据实际情况)
  616.     
  617.     Dim xswbrr As String
  618.     
  619.     With WglrGrid
  620.         Zdlrqnr = Trim(.Text)
  621.         xswbrr = Trim(.Text)
  622.         
  623.         If GridBoolean(.Col, 3) Then   '列表框录入
  624.             
  625.             '填充列表框程序
  626.             Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
  627.         Else
  628.             Wbkbhlock = True
  629.             
  630.             '====以下为用户自定义
  631.             Ydtext.Text = xswbrr
  632.             '====以上为用户自定义
  633.             
  634.             Wbkbhlock = False
  635.             Ydtext.SelStart = Len(Ydtext.Text)
  636.         End If
  637.     End With
  638.     
  639. End Sub
  640. Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long) As Boolean       '录入数据字段有效性判断,同时进行字段录入事后处理
  641.     '函数参数:Dqpdwgh, Dqpdwgl 当前要判断网格单元所处行列值
  642.     
  643.     Dim Str_JudgeText As String                 '临时有效性判断字段内容(Fixed)
  644.     Dim Coljsq As Long                          '临时列计数器(Fixed)
  645.     Dim RecTemp As New ADODB.Recordset          '临时使用动态集(Fixed)
  646.     Dim Sqlstr As String                        '临时使用查询字符串(Fixed)
  647.     
  648.     With WglrGrid
  649.         
  650.         '非录入状态或非数据行则其有效性为合法(Fixed)
  651.         If Yxxpdlock Or .Row < .FixedRows Then
  652.             sjzdyxxpd = True
  653.             Exit Function
  654.         End If
  655.         
  656.         '取得当前要判断字段内容(Fixed)
  657.         Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
  658.         
  659.         '根据不同字段进行相应的处理(依据其逻辑编号)
  660.         Select Case GridStr(Dqpdwgl, 1)
  661.             
  662.             '[>>以下为自定义部分
  663.             
  664.             '<<以上为自定义部分]
  665.         End Select
  666.         
  667.         '字段录入正确后为零字段清空(Fixed)
  668.         Call Qkwlzd(Dqpdwgh, Dqpdwgl)
  669.         
  670.         '字段有效性判断通过,将字段有效性判断加锁直至再次改变(Fixed)
  671.         sjzdyxxpd = True
  672.         Yxxpdlock = True
  673.         Exit Function
  674.     End With
  675.     
  676. Lrcwcl:    '录入错误处理(Fixed)
  677.     
  678.     With WglrGrid
  679.         '给出错误提示信息
  680.         Call Xtxxts(Tsxx, 0, 1)
  681.         
  682.         '返回网格错误位置(ChangeLock避免再次引发RowColChange有效性判断),装入录入载体
  683.         changelock = True
  684.         .Select Dqpdwgh, Dqpdwgl
  685.         changelock = False
  686.         Call xswbk
  687.         
  688.         '函数返回False
  689.         sjzdyxxpd = False
  690.         Exit Function
  691.     End With
  692.     
  693. End Function
  694. Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean                  '录入数据行有效性判断,同时进行行处理
  695.     
  696.     Dim Lrywlz As Long                     '录入错误列值(Fixed)
  697.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  698.     Dim Sqlstr As String                   '临时查询字符串
  699.     
  700.     With WglrGrid
  701.         
  702.         '判断行为空和无效数据行则清除当前行
  703.         If Yxxpdh > (.Rows - .FixedRows) Then Exit Function
  704.         If .TextMatrix(Yxxpdh, 0) <> "*" Then
  705.             Sjhzyxxpd = True
  706.             Exit Function
  707.         Else
  708.             If pdhwk(Yxxpdh) And Yxxpdh + 1 <= .Rows - 1 Then
  709.                 If .TextMatrix(Yxxpdh + 1, 0) <> "*" Then
  710.                     changelock = True
  711.                     .RemoveItem Yxxpdh
  712.                     
  713.                     If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  714.                         .AddItem ""
  715.                         .RowHeight(.Rows - 1) = Sjhgd
  716.                     End If
  717.                     
  718.                     changelock = False
  719.                     Sjhzyxxpd = True
  720.                     Exit Function
  721.                 End If
  722.             End If
  723.         End If
  724.         
  725.         '行没有发生变化则不进行有效性判断
  726.         If Hyxxpdlock Then
  727.             Sjhzyxxpd = True
  728.             Exit Function
  729.         End If
  730.         
  731.         '以下为自定义部分[
  732.         
  733.         '1.1首先进行单个不能为空或不能为零判断(Fixed)
  734.         For jsqte = Qslz To .Cols - 1
  735.             
  736.             '字段不能为空
  737.             If GridInt(jsqte, 5) = 1 Then
  738.                 If Len(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
  739.                     Tsxx = GridStr(jsqte, 2)
  740.                     Lrywlz = jsqte
  741.                     GoTo Lrcwcl
  742.                     Exit For
  743.                 End If
  744.             End If
  745.             
  746.             '字段不能为零
  747.             If GridInt(jsqte, 5) = 2 Then
  748.                 If Val(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
  749.                     Tsxx = GridStr(jsqte, 2)
  750.                     Lrywlz = jsqte
  751.                     GoTo Lrcwcl
  752.                     Exit For
  753.                 End If
  754.             End If
  755.             
  756.         Next jsqte
  757.         
  758.         
  759.         '帐龄分析总天数应逐渐递增
  760.         If Yxxpdh > .FixedRows Then
  761.             If Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls))) <= Val(WglrGrid.TextMatrix(Yxxpdh - 1, Sydz("002", GridStr(), Szzls))) Then
  762.                 Tsxx = "帐龄分析总天数应逐渐递增!"
  763.                 Lrywlz = Sydz("002", GridStr(), Szzls)
  764.                 GoTo Lrcwcl
  765.             End If
  766.         End If
  767.         
  768.         If Yxxpdh < .Rows - 1 And Yxxpdh + 1 <> .Rows - 1 Then
  769.             If Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls))) >= Val(WglrGrid.TextMatrix(Yxxpdh + 1, Sydz("002", GridStr(), Szzls))) Then
  770.                 Tsxx = "帐龄分析总天数应逐渐递增!"
  771.                 Lrywlz = Sydz("002", GridStr(), Szzls)
  772.                 GoTo Lrcwcl
  773.             End If
  774.         End If
  775.         
  776.         '2.放置行处理程序
  777.         
  778.         '[>>
  779.         On Error GoTo Swcwcl
  780.         
  781.         Cw_DataEnvi.DataConnect.BeginTrans
  782.         
  783.         Cw_DataEnvi.DataConnect.Execute ("Delete RP_BillAge Where RPFlag='AR'")
  784.         
  785.         For jsqte = WglrGrid.FixedRows To WglrGrid.Rows - 1
  786.             If WglrGrid.TextMatrix(jsqte, 0) = "*" Then
  787.                 If WglrGrid.TextMatrix(jsqte + 1, 0) = "*" Then
  788.                     Str_BGDays = "过期" & WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) & "-" & Trim(Str(Val(WglrGrid.TextMatrix(jsqte + 1, Sydz("002", GridStr(), Szzls))) - 1)) & "天"
  789.                     Int_MaxBillAge = Val(WglrGrid.TextMatrix(jsqte + 1, Sydz("002", GridStr(), Szzls))) - 1
  790.                 Else
  791.                     Str_BGDays = "过期" & WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) & "天以上"
  792.                     Int_MaxBillAge = 9999999
  793.                 End If
  794.                 
  795.                 Sqlstr = "Insert Into RP_BillAge (MinBillAge,MaxBillAge,BEDays,RPFlag) values (" & Val(WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls))) & "," & Int_MaxBillAge & ",'" & Str_BGDays & "','AR')"
  796.                 Cw_DataEnvi.DataConnect.Execute (Sqlstr)
  797.             End If
  798.         Next jsqte
  799.         
  800.     End With
  801.     
  802.     Cw_DataEnvi.DataConnect.CommitTrans
  803.     
  804.     '刷新查询结果
  805.     Lng_GridRow = WglrGrid.Row
  806.     
  807.     Call Sub_Query
  808.     
  809.     changelock = True
  810.     WglrGrid.Row = Lng_GridRow
  811.     changelock = False
  812.     
  813.     '<<]
  814.     
  815.     '以上为自定义部分]
  816.     
  817.     Sjhzyxxpd = True
  818.     Hyxxpdlock = True
  819.     Exit Function
  820.     
  821. Swcwcl:
  822.     
  823.     Cw_DataEnvi.DataConnect.RollbackTrans
  824.     Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
  825.     Call Xtxxts(Tsxx, 0, 1)
  826.     Exit Function
  827.     
  828. Lrcwcl:      '录入错误处理
  829.     
  830.     With WglrGrid
  831.         Call Xtxxts(Tsxx, 0, 1)
  832.         changelock = True
  833.         .Select Yxxpdh, Lrywlz
  834.         changelock = False
  835.         Call xswbk
  836.         
  837.         Sjhzyxxpd = False
  838.         Exit Function
  839.     End With
  840.     
  841. End Function
  842. '===================以 下 程 序 为 通 用 部 分 ,一 般 不 需 更 改(程序动作部分)======================='
  843. Private Sub Sub_AdjustGrid()
  844.     
  845.     '调 整 网 格
  846.     With WglrGrid
  847.         '加 1 保持一行录入行
  848.         If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  849.             .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  850.             For jsqte = .FixedRows To .Rows - 1
  851.                 .RowHeight(jsqte) = Sjhgd
  852.             Next jsqte
  853.         Else
  854.             '判断是否有辅助行和录入行,如没有则加行
  855.             Do While .TextMatrix(.Rows - 1 - Fzxwghs, 0) = "*"
  856.                 .AddItem ""
  857.                 .RowHeight(.Rows - 1) = Sjhgd
  858.             Loop
  859.         End If
  860.     End With
  861.     
  862. End Sub
  863. Private Sub Lrzdbz()                                                      '录入字段帮助
  864.     
  865.     If Not Ydcommand.Visible Then
  866.         Exit Sub
  867.     End If
  868.     
  869.     With WglrGrid
  870.         
  871.         Valilock = True
  872.         
  873.         '处理通用部分
  874.         changelock = True        '调入另外窗体必须加锁
  875.         Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
  876.         changelock = False
  877.         
  878.         If Len(Xtfhcs) <> 0 Then
  879.             If GridInt(.Col, 7) = 0 Then
  880.                 Ydtext.Text = Xtfhcs
  881.             Else
  882.                 Ydtext.Text = Xtfhcsfz
  883.             End If
  884.         End If
  885.         
  886.         Valilock = False
  887.         
  888.         If Ydtext.Visible Then
  889.             Ydtext.SetFocus
  890.         End If
  891.         
  892.     End With
  893.     
  894. End Sub
  895. Private Sub Form_Resize()                                                '窗体大小发生变化时,重新显示文本框
  896.     
  897.     Call Cxxswbk
  898.     
  899. End Sub
  900. Private Function Fun_Drfrmyxxpd() As Boolean                             '调入其它窗体或功能产生的有效性判断(包括数据回写)
  901.     
  902.     Fun_Drfrmyxxpd = True
  903.     
  904.     With WglrGrid
  905.         '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
  906.         
  907.         If Ydtext.Visible Or YdCombo.Visible Then
  908.             Call Lrsjhx
  909.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  910.                 Fun_Drfrmyxxpd = False
  911.                 Exit Function
  912.             End If
  913.         End If
  914.         
  915.         '进行行有效性判断
  916.         If Not Sjhzyxxpd(.Row) Then
  917.             Fun_Drfrmyxxpd = False
  918.             Exit Function
  919.         End If
  920.     End With
  921.     
  922. End Function
  923. Private Sub WglrGrid_EnterCell()                                                 '显示当前数据行相关信息
  924.     
  925.     With WglrGrid
  926.         If .Row >= .FixedRows Then
  927.             '[>>
  928.             '此处可以填写显示与此网格行相关信息
  929.             '<<]
  930.         End If
  931.     End With
  932.     
  933. End Sub
  934. Private Sub WglrGrid_GotFocus()                                     '网格得到焦点
  935.     
  936.     '网格得到焦点,如果当前选择行为非数据行
  937.     '则调整当前焦点至有效数据行
  938.     
  939.     With WglrGrid
  940.         If .Row < .FixedRows And .Rows > .FixedRows Then
  941.             changelock = True
  942.             .Select .FixedRows, .Col
  943.             changelock = False
  944.         End If
  945.         If .Col < Qslz Then
  946.             changelock = True
  947.             .Select .Row, Qslz
  948.             changelock = False
  949.         End If
  950.     End With
  951.     
  952. End Sub
  953. Private Sub WglrGrid_LostFocus()                                    '录入网格失去焦点
  954.     
  955.     '用以屏蔽调用其它窗体时发生网格失去焦点事件
  956.     If changelock Then
  957.         Exit Sub
  958.     End If
  959.     
  960.     '引发网格RowcolChange事件
  961.     With WglrGrid
  962.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  963.             .Select 0, 0
  964.         End If
  965.     End With
  966.     
  967. End Sub
  968. Private Sub WglrGrid_AfterScroll(ByVal OldTopRow As Long, ByVal OldLeftCol As Long, ByVal NewTopRow As Long, ByVal NewLeftCol As Long)                                       '限制用户在录入过程中滚动鼠标
  969.     
  970.     If Gdtlock Then
  971.         Exit Sub
  972.     End If
  973.     
  974.     With WglrGrid
  975.         If Ydtext.Visible Or YdCombo.Visible Then
  976.             Gdtlock = True
  977.             .TopRow = Dqtoprow
  978.             .LeftCol = Dqleftcol
  979.             Gdtlock = False
  980.             Exit Sub
  981.         End If
  982.     End With
  983.     
  984. End Sub
  985. Private Sub WglrGrid_LeaveCell()                                    '离开单元格
  986.     
  987.     If changelock Then
  988.         Exit Sub
  989.     End If
  990.     
  991.     '记录刚刚离开网格单元的行列值
  992.     Dqlkwgh = WglrGrid.Row
  993.     Dqlkwgl = WglrGrid.Col
  994.     
  995.     '判断是否需要录入数据回写
  996.     If Not (Ydtext.Visible Or YdCombo.Visible) Then
  997.         Exit Sub
  998.     End If
  999.     
  1000.     Call Lrsjhx
  1001.     
  1002. End Sub
  1003. Private Sub WglrGrid_RowColChange()                                '网格录入行列发生变化时,进行有效性判断
  1004.     
  1005.     Valilock = True       '屏蔽文本框失去焦点进行有效性判断
  1006.     
  1007.     With WglrGrid
  1008.         If changelock Then
  1009.             Exit Sub
  1010.         End If
  1011.         If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1012.             Exit Sub
  1013.         End If
  1014.         If .Row <> Dqlkwgh Then
  1015.             If Not Sjhzyxxpd(Dqlkwgh) Then
  1016.                 Exit Sub
  1017.             End If
  1018.         End If
  1019.     End With
  1020.     
  1021.     Call fhyxh
  1022.     Call Xldql
  1023.     
  1024. End Sub
  1025. Private Sub WglrGrid_DblClick()          '鼠标双击网格显示文本框
  1026.     
  1027.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1028.     If Not Security_Log("Ar_BillAge_Edit", Xtczybm, 1, True) Then
  1029.         Exit Sub
  1030.     End If
  1031.     
  1032.     With WglrGrid
  1033.         Call xswbk
  1034.     End With
  1035.     
  1036. End Sub
  1037. Private Sub Ycwbk()                      '隐藏文本框,帮助按钮,列表组合框
  1038.     
  1039.     Valilock = True
  1040.     Ydtext.Visible = False
  1041.     YdCombo.Visible = False
  1042.     Ydcommand.Visible = False
  1043.     
  1044. End Sub
  1045. Private Sub YdCombo_KeyDown(KeyCode As Integer, Shift As Integer)        '列表框移动
  1046.     With WglrGrid
  1047.         Select Case KeyCode
  1048.         Case vbKeyEscape                'ESC 键放弃录入
  1049.             Valilock = True
  1050.             .SetFocus
  1051.             Call Ycwbk
  1052.             Valilock = False
  1053.         Case vbKeyReturn                '回 车 键 =13
  1054.             KeyCode = 0
  1055.             .SetFocus
  1056.             Call Lrsjhx
  1057.             Rowjsq = .Row
  1058.             Coljsq = .Col + 1
  1059.             If Coljsq > .Cols - 1 Then
  1060.                 If Rowjsq < .Rows - 1 Then
  1061.                     Rowjsq = Rowjsq + 1
  1062.                 End If
  1063.                 Coljsq = Qslz
  1064.             End If
  1065.             Do While Rowjsq <= .Rows - 1
  1066.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1067.                     Coljsq = Coljsq + 1
  1068.                     If Coljsq > .Cols - 1 Then
  1069.                         Rowjsq = Rowjsq + 1
  1070.                         Coljsq = Qslz
  1071.                     End If
  1072.                 Else
  1073.                     Exit Do
  1074.                 End If
  1075.             Loop
  1076.             .Select Rowjsq, Coljsq
  1077.             
  1078.         Case vbKeyLeft                  '左 箭 头 =37
  1079.             If .Col - 1 = Qslz Then
  1080.                 If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1081.                     GoTo jzzx
  1082.                 End If
  1083.             End If
  1084.             If .Col > Qslz Then
  1085.                 KeyCode = 0
  1086.                 .SetFocus
  1087.                 Call Lrsjhx
  1088.                 Coljsq = .Col - 1
  1089.                 Do While Coljsq > Qslz
  1090.                     If Coljsq - 1 = Qslz Then
  1091.                         If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1092.                             GoTo jzzx
  1093.                         End If
  1094.                     End If
  1095.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1096.                         Coljsq = Coljsq - 1
  1097.                     Else
  1098.                         Exit Do
  1099.                     End If
  1100.                 Loop
  1101.                 .Select .Row, Coljsq
  1102.             End If
  1103.             
  1104.         Case vbKeyRight                 '右 箭 头 =39
  1105.             KeyCode = 0
  1106.             .SetFocus
  1107.             Call Lrsjhx
  1108.             Rowjsq = .Row
  1109.             Coljsq = .Col + 1
  1110.             If Coljsq > .Cols - 1 Then
  1111.                 If Rowjsq < .Rows - 1 Then
  1112.                     Rowjsq = Rowjsq + 1
  1113.                 End If
  1114.                 Coljsq = Qslz
  1115.             End If
  1116.             Do While Rowjsq <= .Rows - 1
  1117.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1118.                     Coljsq = Coljsq + 1
  1119.                     If Coljsq > .Cols - 1 Then
  1120.                         Rowjsq = Rowjsq + 1
  1121.                         Coljsq = Qslz
  1122.                     End If
  1123.                 Else
  1124.                     Exit Do
  1125.                 End If
  1126.             Loop
  1127.             .Select Rowjsq, Coljsq
  1128.         Case Else
  1129.             
  1130.         End Select
  1131.         
  1132. jzzx:
  1133.         
  1134.     End With
  1135.     
  1136. End Sub
  1137. Private Sub YdCombo_LostFocus()
  1138.     
  1139.     With WglrGrid                                    '因为选中网格会先发生Rowcolchange事件置Valiock
  1140.         If Not Valilock Then                           '为TRUE
  1141.             Call Lrsjhx
  1142.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1143.                 Exit Sub
  1144.             End If
  1145.         End If
  1146.     End With
  1147. End Sub
  1148. Private Sub Ydcommand_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  1149.     
  1150.     Call Lrzdbz
  1151.     
  1152. End Sub
  1153. Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer)
  1154.     
  1155.     Dim Rowjsq As Long, Coljsq As Long
  1156.     
  1157.     With WglrGrid
  1158.         Select Case KeyCode
  1159.         Case vbKeyF2
  1160.             Call Lrzdbz
  1161.         Case vbKeyEscape                'ESC 键放弃录入
  1162.             Valilock = True
  1163.             Call Ycwbk
  1164.             .SetFocus
  1165.         Case vbKeyReturn                '回 车 键 =13
  1166.             KeyCode = 0
  1167.             .SetFocus
  1168.             Call Lrsjhx
  1169.             Rowjsq = .Row
  1170.             Coljsq = .Col + 1
  1171.             If Coljsq > .Cols - 1 Then
  1172.                 If Rowjsq < .Rows - 1 Then
  1173.                     Rowjsq = Rowjsq + 1
  1174.                 End If
  1175.                 Coljsq = Qslz
  1176.             End If
  1177.             Do While Rowjsq <= .Rows - 1
  1178.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1179.                     Coljsq = Coljsq + 1
  1180.                     If Coljsq > .Cols - 1 Then
  1181.                         Rowjsq = Rowjsq + 1
  1182.                         Coljsq = Qslz
  1183.                     End If
  1184.                 Else
  1185.                     Exit Do
  1186.                 End If
  1187.             Loop
  1188.             If Rowjsq <= .Rows - 1 Then
  1189.                 .Select Rowjsq, Coljsq
  1190.             End If
  1191.             
  1192.         Case vbKeyUp                    '上 箭 头 =38
  1193.             KeyCode = 0
  1194.             .SetFocus
  1195.             Call Lrsjhx
  1196.             If .Row > .FixedRows Then
  1197.                 .Row = .Row - 1
  1198.             End If
  1199.             
  1200.         Case vbKeyDown                  '下 箭 头 =40
  1201.             KeyCode = 0
  1202.             .SetFocus
  1203.             Call Lrsjhx
  1204.             If .Row < .Rows - 1 Then
  1205.                 .Row = .Row + 1
  1206.             End If
  1207.             
  1208.         Case vbKeyLeft                  '左 箭 头 =37
  1209.             If .Col - 1 = Qslz Then
  1210.                 If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1211.                     GoTo jzzx
  1212.                 End If
  1213.             End If
  1214.             If Ydtext.SelStart = 0 And .Col > Qslz Then
  1215.                 KeyCode = 0
  1216.                 .SetFocus
  1217.                 Call Lrsjhx
  1218.                 Coljsq = .Col - 1
  1219.                 Do While Coljsq > Qslz
  1220.                     If Coljsq - 1 = Qslz Then
  1221.                         If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1222.                             GoTo jzzx
  1223.                         End If
  1224.                     End If
  1225.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1226.                         Coljsq = Coljsq - 1
  1227.                     Else
  1228.                         Exit Do
  1229.                     End If
  1230.                 Loop
  1231.                 .Select .Row, Coljsq
  1232.             End If
  1233. jzzx:
  1234.             
  1235.         Case vbKeyRight                 '右 箭 头 =39
  1236.             wblong = Len(Ydtext.Text)
  1237.             If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
  1238.                 KeyCode = 0
  1239.                 .SetFocus
  1240.                 Call Lrsjhx
  1241.                 Rowjsq = .Row
  1242.                 Coljsq = .Col + 1
  1243.                 If Coljsq > .Cols - 1 Then
  1244.                     If Rowjsq < .Rows - 1 Then
  1245.                         Rowjsq = Rowjsq + 1
  1246.                     End If
  1247.                     Coljsq = Qslz
  1248.                 End If
  1249.                 Do While Rowjsq <= .Rows - 1
  1250.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1251.                         Coljsq = Coljsq + 1
  1252.                         If Coljsq > .Cols - 1 Then
  1253.                             Rowjsq = Rowjsq + 1
  1254.                             Coljsq = Qslz
  1255.                         End If
  1256.                     Else
  1257.                         Exit Do
  1258.                     End If
  1259.                 Loop
  1260.                 .Select Rowjsq, Coljsq
  1261.             End If
  1262.         Case Else
  1263.             
  1264.         End Select
  1265.     End With
  1266.     
  1267. End Sub
  1268. Private Sub ydtext_KeyPress(KeyAscii As Integer)         '录入字符事中控制
  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("Ar_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("Ar_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("Ar_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='AR'")
  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 & "','AR')"
  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