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

企业管理

开发平台:

Visual Basic

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