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

企业管理

开发平台:

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