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

企业管理

开发平台:

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