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

企业管理

开发平台:

Visual Basic

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