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

企业管理

开发平台:

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