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

企业管理

开发平台:

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