上传用户: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 AutoTran_DefiMy 
  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            =   14.25
  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          =   285
  152.          Index           =   6
  153.          Left            =   360
  154.          TabIndex        =   10
  155.          Top             =   240
  156.          Width           =   2100
  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 = "AutoTran_DefiMy"
  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.         Else
  1568.             '判断是否有辅助行和录入行,如没有则加行
  1569.             Do While .TextMatrix(.Rows - 1 - Fzxwghs, 0) = "*"
  1570.                 .AddItem ""
  1571.                 .RowHeight(.Rows - 1) = Sjhgd
  1572.             Loop
  1573.         End If
  1574.     End With
  1575. End Sub
  1576. Private Sub Lrzdbz()                                                      '录入字段帮助
  1577.     If Not Ydcommand.Visible Then
  1578.         Exit Sub
  1579.     End If
  1580.     Valilock = True         '为防止按ydText中帮助按纽时,引起ydText的LostFocus事件。
  1581.     With WglrGrid
  1582.         '[>>会计科目编码帮助单独处理
  1583.         Select Case .Col
  1584.         Case Sydz("002", GridStr(), Szzls), Sydz("006", GridStr(), Szzls)
  1585.             Xtcdcs = Trim(Ydtext.Text)
  1586.             PZ_FrmKjkmcz.Show 1
  1587.             If Len(Xtfhcs) <> 0 Then
  1588.                 Ydtext.Text = Xtfhcs
  1589.             End If
  1590.         Case Sydz("010", GridStr(), Szzls)
  1591.             AutoTran_AssMy.Show 1
  1592.         Case Else
  1593.             '处理通用部分
  1594.             changelock = True        '调入另外窗体必须加锁,为不必执行网格的离开焦点造成的RowColChange事件
  1595.             '?没有必要,因为,文本框和命令按纽之间转换焦点,不会执行RowColChange
  1596.             Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
  1597.             changelock = False
  1598.             If Len(Xtfhcs) <> 0 Then
  1599.                 If GridInt(.Col, 7) = 0 Then
  1600.                     Ydtext.Text = Xtfhcs
  1601.                 Else
  1602.                     Ydtext.Text = Xtfhcsfz
  1603.                 End If
  1604.             End If
  1605.         End Select
  1606.         '[>>处理完毕
  1607.         Valilock = False
  1608.         If Ydtext.Visible Then
  1609.             If Ydtext.Enabled Then Ydtext.SetFocus
  1610.         End If
  1611.     End With
  1612. End Sub
  1613. Private Sub Form_Resize()                                                '窗体大小发生变化时,重新显示文本框
  1614.     Call Cxxswbk
  1615. End Sub
  1616. Private Function Fun_Drfrmyxxpd() As Boolean                             '调入其它窗体或功能产生的有效性判断(包括数据回写)
  1617.     '因为点工具栏的按纽时文本框或网格均没有失去焦点事件发生,为保证该操作之前进行录入数据的有效性判断而设。
  1618.     Fun_Drfrmyxxpd = True
  1619.     With WglrGrid
  1620.         '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
  1621.         If Yd_Help.Visible = True Then
  1622.             Yd_Help.Visible = False
  1623.         End If
  1624.         If Ydtext.Visible Or YdCombo.Visible Then
  1625.             Call Lrsjhx
  1626.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1627.                 Fun_Drfrmyxxpd = False
  1628.                 Exit Function
  1629.             End If
  1630.         End If
  1631.         '进行行有效性判断
  1632.         If Not Sjhzyxxpd(.Row) Then
  1633.             Fun_Drfrmyxxpd = False
  1634.             Exit Function
  1635.         End If
  1636.     End With
  1637. End Function
  1638. Private Sub WglrGrid_EnterCell()                                    '显示当前数据行相关信息
  1639.     With WglrGrid
  1640.         If .Row >= .FixedRows Then
  1641.             Lab_Row = Trim(Str(.Row - .FixedRows + 1))
  1642.         End If
  1643.     End With
  1644. End Sub
  1645. Private Sub WglrGrid_GotFocus()                                     '网格得到焦点
  1646.     '网格得到焦点,如果当前选择行为非数据行
  1647.     '则调整当前焦点至有效数据行
  1648.     With WglrGrid
  1649.         If .Row < .FixedRows And .Rows > .FixedRows Then
  1650.             changelock = True
  1651.             .Select .FixedRows, .Col
  1652.             changelock = False
  1653.         End If
  1654.         If .Col < Qslz Then     '
  1655.             changelock = True
  1656.             .Select .Row, Qslz
  1657.             changelock = False
  1658.         End If
  1659.         If .Row >= .FixedRows And Help_Bz_Col(.Col) = True And Lab_OperStatus.Caption = 3 Then
  1660.             Call Yd_Help_Show
  1661.         End If
  1662.     End With
  1663. End Sub
  1664. Private Sub WglrGrid_KeyUp(KeyCode As Integer, Shift As Integer)
  1665.     '如果单据操作状态为浏览状态则不能显示录入载体
  1666.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1667.         Exit Sub
  1668.     End If
  1669.     If Help_Bz_Col(WglrGrid.Col) = True And Lab_OperStatus.Caption = 3 Then
  1670.         Call Yd_Help_Show
  1671.     Else
  1672.         Yd_Help.Visible = False
  1673.     End If
  1674.     
  1675. End Sub
  1676. Private Sub WglrGrid_LostFocus()                                    '录入网格失去焦点
  1677.     '网格内部原因:网格单元内需要录入信息过程中,(程序控制)本单元内的文本框或下拉列表框显露并获得焦点时引发该事件发生;
  1678.     '网格外部原因:网格之外的控件获得焦点造成网格失去焦点,比如网格外的文本框。
  1679.     
  1680.     '用以屏蔽调用其它窗体时发生网格失去焦点事件
  1681.     If changelock Then
  1682.         Exit Sub
  1683.     End If
  1684.     '在每个单元输入均合法,但整行输入有可能不合法,在文本框不可编辑状态,这时网格外的某控件获得焦点时,网格失去焦点,必须人为引发RowColChange事件
  1685.     '故意引发网格RowcolChange事件
  1686.     With WglrGrid
  1687.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1688.             .Select 0, 0
  1689.         End If
  1690.     End With
  1691. End Sub
  1692. Private Sub WglrGrid_Scroll()                                       '限制用户在录入过程中滚动鼠标
  1693.     If Gdtlock Then
  1694.         Exit Sub
  1695.     End If
  1696.     With WglrGrid
  1697.         If Ydtext.Visible Or YdCombo.Visible Or Yd_Help.Visible = True Then
  1698.             Gdtlock = True
  1699.             .TopRow = Dqtoprow
  1700.             .LeftCol = Dqleftcol
  1701.             Gdtlock = False
  1702.             Exit Sub
  1703.         End If
  1704.     End With
  1705. End Sub
  1706. Private Sub WglrGrid_LeaveCell()                                    '离开单元格
  1707.     If changelock Then
  1708.         Exit Sub
  1709.     End If
  1710.     '记录刚刚离开网格单元的行列值
  1711.     Dqlkwgh = WglrGrid.Row
  1712.     Dqlkwgl = WglrGrid.Col
  1713.     '判断是否需要录入数据回写
  1714.     If Help_Bz_Col(WglrGrid.Col) = True Then
  1715.         Yd_Help.Visible = False
  1716.     End If
  1717.     If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1718.         Exit Sub
  1719.     End If
  1720.     Call Lrsjhx
  1721. End Sub
  1722. Private Sub WglrGrid_RowColChange()                                '网格录入行列发生变化时,进行有效性判断
  1723.     
  1724.     Valilock = True       '屏蔽文本框失去焦点进行有效性判断
  1725.     With WglrGrid
  1726.         If changelock Then
  1727.             Exit Sub
  1728.         End If
  1729.         If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1730.             Exit Sub
  1731.         End If
  1732.         If .Row <> Dqlkwgh Then     '若刚刚进入行《》刚刚离开行,进行行有效性判断
  1733.             If Not Sjhzyxxpd(Dqlkwgh) Then
  1734.                 Exit Sub
  1735.             End If
  1736.         End If
  1737.     End With
  1738.     Call fhyxh      '返回有效行
  1739.     Call Xldql
  1740.     
  1741. End Sub
  1742. Private Sub WglrGrid_DblClick()          '鼠标双击网格显示文本框
  1743.     Dim CurrentRow As Integer
  1744.     Dim CurrentCol As Integer
  1745.     
  1746.     If Lab_OperStatus.Caption = "3" Then
  1747.         With WglrGrid
  1748.             
  1749.             If .Col = Sydz("006", GridStr(), Szzls) Then
  1750.                 
  1751.                 CurrentRow = .Row
  1752.                 CurrentCol = .Col
  1753.                 Glo_FormulaString = WglrGrid.TextMatrix(.Row, .Col)
  1754.                 AutoTran_FormulaGen.Show 1
  1755.                 
  1756.                 .Row = CurrentRow
  1757.                 .Col = CurrentCol
  1758.                 .TextMatrix(.Row, .Col) = Glo_FormulaString
  1759.                 
  1760.             End If
  1761.             
  1762.         End With
  1763.         
  1764.     End If
  1765.     
  1766.     With WglrGrid
  1767.         If GridBoolean(.Col, 1) = True Then
  1768.             Call xswbk
  1769.         Else
  1770.             If Help_Bz_Col(.Col) = True And Lab_OperStatus.Caption = 3 Then
  1771.                 Call Yd_Help_Show
  1772.             End If
  1773.         End If
  1774.     End With
  1775. End Sub
  1776. Private Sub Ycwbk()                      '隐藏文本框,帮助按钮,列表组合框
  1777.     Valilock = True
  1778.     Ydtext.Visible = False
  1779.     YdCombo.Visible = False
  1780.     Ydcommand.Visible = False
  1781. End Sub
  1782. Private Sub YdCombo_KeyDown(KeyCode As Integer, Shift As Integer)        '列表框的光标移动
  1783.     With WglrGrid
  1784.         Select Case KeyCode
  1785.         Case vbKeyEscape                'ESC 键放弃录入
  1786.             Valilock = True
  1787.             .SetFocus
  1788.             Call Ycwbk
  1789.             Valilock = False
  1790.         Case vbKeyReturn                '回 车 键 =13
  1791.             KeyCode = 0
  1792.             .SetFocus
  1793.             Call Lrsjhx
  1794.             Rowjsq = .Row
  1795.             Coljsq = .Col + 1
  1796.             If Coljsq > .Cols - 1 Then
  1797.                 If Rowjsq < .Rows - 1 Then
  1798.                     Rowjsq = Rowjsq + 1
  1799.                 End If
  1800.                 Coljsq = Qslz
  1801.             End If
  1802.             Do While Rowjsq <= .Rows - 1
  1803.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1) And Help_Bz_Col(Coljsq) = False) Then
  1804.                     Coljsq = Coljsq + 1
  1805.                     If Coljsq > .Cols - 1 Then
  1806.                         Rowjsq = Rowjsq + 1
  1807.                         Coljsq = Qslz
  1808.                     End If
  1809.                 Else
  1810.                     Exit Do
  1811.                 End If
  1812.             Loop
  1813.             .Select Rowjsq, Coljsq
  1814.         Case vbKeyLeft                  '左 箭 头 =37
  1815.             If .Col - 1 = Qslz Then
  1816.                 If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1817.                     GoTo jzzx
  1818.                 End If
  1819.             End If
  1820.             If .Col > Qslz Then
  1821.                 KeyCode = 0
  1822.                 .SetFocus
  1823.                 Call Lrsjhx
  1824.                 Coljsq = .Col - 1
  1825.                 Do While Coljsq > Qslz
  1826.                     If Coljsq - 1 = Qslz Then
  1827.                         If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1828.                             GoTo jzzx
  1829.                         End If
  1830.                     End If
  1831.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1) And Help_Bz_Col(Coljsq) = False) Then
  1832.                         Coljsq = Coljsq - 1
  1833.                     Else
  1834.                         Exit Do
  1835.                     End If
  1836.                 Loop
  1837.                 .Select .Row, Coljsq
  1838.             End If
  1839.         Case vbKeyRight                 '右 箭 头 =39
  1840.             KeyCode = 0
  1841.             .SetFocus
  1842.             Call Lrsjhx
  1843.             Rowjsq = .Row
  1844.             Coljsq = .Col + 1
  1845.             If Coljsq > .Cols - 1 Then
  1846.                 If Rowjsq < .Rows - 1 Then
  1847.                     Rowjsq = Rowjsq + 1
  1848.                 End If
  1849.                 Coljsq = Qslz
  1850.             End If
  1851.             Do While Rowjsq <= .Rows - 1
  1852.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1) And Help_Bz_Col(Coljsq) = False) Then
  1853.                     Coljsq = Coljsq + 1
  1854.                     If Coljsq > .Cols - 1 Then
  1855.                         Rowjsq = Rowjsq + 1
  1856.                         Coljsq = Qslz
  1857.                     End If
  1858.                 Else
  1859.                     Exit Do
  1860.                 End If
  1861.             Loop
  1862.             .Select Rowjsq, Coljsq
  1863.         Case Else
  1864.         End Select
  1865.     End With
  1866. jzzx:
  1867. End Sub
  1868. Private Sub YdCombo_LostFocus()                     '下拉列表框失去焦点
  1869.     With WglrGrid                                    '因为选中网格会先发生Rowcolchange事件置Valiock
  1870.         If Not Valilock Then                           '为TRUE
  1871.             Call Lrsjhx
  1872.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1873.                 Exit Sub
  1874.             End If
  1875.         End If
  1876.     End With
  1877. End Sub
  1878. Private Sub Ydcommand_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  1879.     Call Lrzdbz
  1880. End Sub
  1881. Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer)    '录入文本框的焦点发生移动或特殊击键动作,回车、帮助、ESC键、上下左右箭头
  1882.     Dim Rowjsq As Long, Coljsq As Long
  1883.     With WglrGrid
  1884.         Select Case KeyCode
  1885.         Case vbKeyF2
  1886.             Call Lrzdbz
  1887.         Case vbKeyEscape                'ESC 键放弃录入
  1888.             Valilock = True
  1889.             Call Ycwbk
  1890.             .SetFocus
  1891.         Case vbKeyReturn                '回 车 键 =13
  1892.             KeyCode = 0
  1893.             .SetFocus
  1894.             Call Lrsjhx
  1895.             Rowjsq = .Row
  1896.             Coljsq = .Col + 1
  1897.             If Coljsq > .Cols - 1 Then
  1898.                 If Rowjsq < .Rows - 1 Then
  1899.                     Rowjsq = Rowjsq + 1
  1900.                 End If
  1901.                 Coljsq = Qslz
  1902.             End If
  1903.             Do While Rowjsq <= .Rows - 1
  1904.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1) And Help_Bz_Col(Coljsq) = False) Then
  1905.                     Coljsq = Coljsq + 1
  1906.                     If Coljsq > .Cols - 1 Then
  1907.                         Rowjsq = Rowjsq + 1
  1908.                         Coljsq = Qslz
  1909.                     End If
  1910.                 Else
  1911.                     Exit Do
  1912.                 End If
  1913.             Loop
  1914.             .Select Rowjsq, Coljsq
  1915.         Case vbKeyUp                    '上 箭 头 =38
  1916.             KeyCode = 0
  1917.             .SetFocus
  1918.             Call Lrsjhx
  1919.             If .Row > .FixedRows Then
  1920.                 .Row = .Row - 1
  1921.             End If
  1922.         Case vbKeyDown                  '下 箭 头 =40
  1923.             KeyCode = 0
  1924.             .SetFocus
  1925.             Call Lrsjhx
  1926.             If .Row < .Rows - 1 Then
  1927.                 .Row = .Row + 1
  1928.             End If
  1929.         Case vbKeyLeft                  '左 箭 头 =37
  1930.             If .Col - 1 = Qslz Then
  1931.                 If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1932.                     GoTo jzzx
  1933.                 End If
  1934.             End If
  1935.             If Ydtext.SelStart = 0 And .Col > Qslz Then
  1936.                 KeyCode = 0
  1937.                 .SetFocus
  1938.                 Call Lrsjhx
  1939.                 Coljsq = .Col - 1
  1940.                 Do While Coljsq > Qslz
  1941.                     If Coljsq - 1 = Qslz Then
  1942.                         If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1943.                             GoTo jzzx
  1944.                         End If
  1945.                     End If
  1946.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1) And Help_Bz_Col(Coljsq) = False) Then
  1947.                         Coljsq = Coljsq - 1
  1948.                     Else
  1949.                         Exit Do
  1950.                     End If
  1951.                 Loop
  1952.                 .Select .Row, Coljsq
  1953.             End If
  1954. jzzx:
  1955.         Case vbKeyRight                 '右 箭 头 =39
  1956.             wblong = Len(Ydtext.Text)
  1957.             If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
  1958.                 KeyCode = 0
  1959.                 .SetFocus
  1960.                 Call Lrsjhx
  1961.                 Rowjsq = .Row
  1962.                 Coljsq = .Col + 1
  1963.                 If Coljsq > .Cols - 1 Then
  1964.                     If Rowjsq < .Rows - 1 Then
  1965.                         Rowjsq = Rowjsq + 1
  1966.                     End If
  1967.                     Coljsq = Qslz
  1968.                 End If
  1969.                 Do While Rowjsq <= .Rows - 1
  1970.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1) And Help_Bz_Col(Coljsq) = False) Then
  1971.                         Coljsq = Coljsq + 1
  1972.                         If Coljsq > .Cols - 1 Then
  1973.                             Rowjsq = Rowjsq + 1
  1974.                             Coljsq = Qslz
  1975.                         End If
  1976.                     Else
  1977.                         Exit Do
  1978.                     End If
  1979.                 Loop
  1980.                 .Select Rowjsq, Coljsq
  1981.             End If
  1982.         Case Else
  1983.         End Select
  1984.     End With
  1985. End Sub
  1986. Private Sub ydtext_KeyPress(KeyAscii As Integer)         '录入字符事中控制
  1987.     Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)    '参数:文本框控件,字段数据类型,输入字符
  1988.     If KeyAscii <> 0 Then
  1989.         Call Xyxhbz(Dqlrwgh)
  1990.     End If
  1991. End Sub
  1992. Private Sub ydtext_Change() '录入事中变化处理
  1993.     '防止程序改变但不进行处理
  1994.     If Wbkbhlock Then
  1995.         Exit Sub
  1996.     End If
  1997.     With WglrGrid
  1998.         '限制字段录入长度
  1999.         Wbkbhlock = True
  2000.         Select Case GridInt(.Col, 1)
  2001.         Case 8
  2002.             Call Sjgskz(Ydtext, Xtjezws - Xtjexsws - 1, Xtjexsws)
  2003.         Case 9
  2004.             Call Sjgskz(Ydtext, Xtslzws - Xtslxsws - 1, Xtslxsws)
  2005.         Case 10
  2006.             Call Sjgskz(Ydtext, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  2007.         Case Else
  2008.             If GridInt(.Col, 3) <> 0 Or GridInt(.Col, 4) <> 0 Then
  2009.                 Call Sjgskz(Ydtext, GridInt(.Col, 3), GridInt(.Col, 4))
  2010.             End If
  2011.         End Select
  2012.         Wbkbhlock = False
  2013.     End With
  2014. End Sub
  2015. Private Sub ydtext_LostFocus()            '如果由于选中网格之外的控件而发生有效性判断(选中网格会先发生Rowcolchange事件置Valiock为TRUE)
  2016.     With WglrGrid
  2017.         If Valilock = False Then
  2018.             Call Lrsjhx
  2019.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then Exit Sub
  2020.             If Not Sjhzyxxpd(Dqlrwgh) Then
  2021.                 Exit Sub
  2022.             End If
  2023.         End If
  2024.     End With
  2025. End Sub
  2026. Private Sub WglrGrid_KeyDown(KeyCode As Integer, Shift As Integer)    '网格录入在录入状态下的增行,删行快捷键
  2027.     '如果单据操作状态为浏览状态则不能显示录入载体
  2028.     If Trim(Lab_OperStatus.Caption) = "1" Then
  2029.         Exit Sub
  2030.     End If
  2031.     Select Case KeyCode
  2032.     Case vbKeyDelete               '删行
  2033.         Call Scdqfl
  2034.     Case vbKeyInsert               '增行
  2035.         Call zjlrfl
  2036.     Case vbKeyF2
  2037.         If Help_Bz_Col(WglrGrid.Col) = True Then
  2038.             If GridStr(WglrGrid.Col, 1) = "010" Then
  2039.                 Call Yd_Help_content
  2040.             End If
  2041.         End If
  2042.     End Select
  2043. End Sub
  2044. Private Sub WglrGrid_KeyPress(KeyAscii As Integer)                     '网格接受键盘录入
  2045.     Dim Str_ChangeTe As String    '临时交换内容
  2046.     Dim Coljsq As Long            '临时列计数器
  2047.     Dim Int_SaveKey As Integer    '保存KeyAscii值
  2048.     
  2049.     '如果单据操作状态为浏览状态则不能显示录入载体
  2050.     If Trim(Lab_OperStatus.Caption) = "1" Then Exit Sub
  2051.     Int_SaveKey = KeyAscii
  2052.     With WglrGrid
  2053.         '屏 蔽 回 车 键,因为光标在网格单元内回两次车才能转移到下一单元,因此需要屏蔽一次回车键
  2054.         If KeyAscii = vbKeyReturn Then
  2055.             KeyAscii = 0
  2056.             Rowjsq = .Row
  2057.             Coljsq = .Col + 1
  2058.             If Coljsq > .Cols - 1 Then
  2059.                 If Rowjsq < .Rows - 1 Then
  2060.                     Rowjsq = Rowjsq + 1
  2061.                 End If
  2062.                 Coljsq = Qslz
  2063.             End If
  2064.             Do While Rowjsq <= .Rows - 1
  2065.                 
  2066.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1) And Help_Bz_Col(Coljsq) = False) Then
  2067.                     Coljsq = Coljsq + 1
  2068.                     If Coljsq > .Cols - 1 Then
  2069.                         Rowjsq = Rowjsq + 1
  2070.                         Coljsq = Qslz
  2071.                     End If
  2072.                 Else
  2073.                     Exit Do
  2074.                 End If
  2075.             Loop
  2076.             .Select Rowjsq, Coljsq
  2077.             If Help_Bz_Col(.Col) = True And Lab_OperStatus.Caption = 3 Then
  2078.                 Call Yd_Help_Show
  2079.             Else
  2080.                 Yd_Help.Visible = False
  2081.             End If
  2082.             Exit Sub
  2083.         End If
  2084.         '接受用户录入
  2085.         Select Case KeyAscii
  2086.         Case 0 To 32          '显示录入载体
  2087.             If GridBoolean(.Col, 1) = True Then
  2088.                 Call xswbk
  2089.             Else
  2090.                 If Help_Bz_Col(.Col) = True Then
  2091.                     Call Sub_Drfzhsx(.Row, Trim(.TextMatrix(.Row, Sydz("002", GridStr(), Szzls))))
  2092.                 End If
  2093.             End If
  2094.         Case Else
  2095.             '防止非编辑字段SendKeys()出现死循环
  2096.             If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then Exit Sub  '该网格列不允许编辑时,退出.
  2097.             If GridBoolean(.Col, 3) Then '列表框录入
  2098.                 Call xswbk
  2099.             Else
  2100.                 Wbkbhlock = True
  2101.                 Ydtext.Text = ""
  2102.                 Wbkbhlock = False
  2103.                 Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)  '?何用
  2104.                 If KeyAscii = 0 Then Exit Sub
  2105.                 '写有效行数据标志
  2106.                 Call Xyxhbz(.Row)
  2107.                 Call xswbk
  2108.                 Wbkbhlock = True
  2109.                 Ydtext.Text = ""
  2110.                 Wbkbhlock = False
  2111.                 Valilock = True
  2112.                 SendKeys Chr(KeyAscii), wait
  2113.                 DoEvents
  2114.                 Valilock = False
  2115.             End If
  2116.         End Select
  2117.     End With
  2118. End Sub
  2119. Private Sub zjlrfl()                                                    '增加录入分录
  2120.     With WglrGrid
  2121.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  2122.             If Not Fun_Drfrmyxxpd Then Exit Sub
  2123.         Else
  2124.             Exit Sub
  2125.         End If
  2126.         If .Row < .FixedRows Then Exit Sub
  2127.         .AddItem "", .Row
  2128.         .RowHeight(.Row) = Sjhgd
  2129.         If .Row <> .Rows - 1 Then
  2130.             If .TextMatrix(.Row + 1, 0) = "*" Then
  2131.                 .TextMatrix(.Row, 0) = "*"
  2132.             Else
  2133.                 .RemoveItem .Rows - 1
  2134.             End If
  2135.         End If
  2136.         Call Xldqh
  2137.         Call Xldql
  2138.         Hyxxpdlock = False
  2139.     End With
  2140. End Sub
  2141. Private Sub Scdqfl()                                                    '删除当前分录
  2142.     Dim Answer As Integer, Scqwghz As Long, Scqwglz As Long, Hjlzte As Long, Sflrzt As Boolean
  2143.     With WglrGrid
  2144.         Scqwghz = .Row
  2145.         Scqwglz = .Col
  2146.         If .TextMatrix(.Row, 0) = "*" Then
  2147.             '判断是否为录入状态
  2148.             If Ydtext.Visible Or YdCombo.Visible Then
  2149.                 Sflrzt = True
  2150.                 Validate = True
  2151.                 Call Lrsjhx
  2152.                 Validate = False
  2153.             End If
  2154.             If Yd_Help.Visible = True Then
  2155.                 Yd_Help.Visible = False
  2156.             End If
  2157.             Call Xldqh
  2158.             changelock = True
  2159.             .Select .Row, 0
  2160.             changelock = False
  2161.             If Shsfts Then
  2162.                 .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = QBColor(12)
  2163.                 Tsxx = "请确认是否删除当前记录?"
  2164.                 yhAnswer = Xtxxts(Tsxx, 2, 2)
  2165.                 If yhAnswer = 2 Then
  2166.                     .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = &H80000005
  2167.                     changelock = True
  2168.                     .Select Scqwghz, Scqwglz
  2169.                     changelock = False
  2170.                     '如为录入状态,则恢复录入
  2171.                     If Sflrzt Then
  2172.                         If GridBoolean(.Col, 1) = True Then
  2173.                             Call xswbk
  2174.                         Else
  2175.                             If Help_Bz_Col(.Col) = True And Lab_OperStatus.Caption = 3 Then
  2176.                                 Call Yd_Help_Show
  2177.                             End If
  2178.                         End If
  2179.                     End If
  2180.                     Exit Sub
  2181.                 End If
  2182.             End If
  2183.             .RemoveItem .Row
  2184.             If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  2185.                 .AddItem ""
  2186.                 .RowHeight(.Rows - 1) = Sjhgd
  2187.             End If
  2188.             changelock = True
  2189.             .Select .Row, Scqwglz
  2190.             changelock = False
  2191.         End If
  2192.     End With
  2193. End Sub
  2194. Private Sub Qkwlzd(sjh As Long, Sjl As Long)                            '清空为零字段
  2195.     If Not GridBoolean(Sjl, 5) Then Exit Sub
  2196.     With WglrGrid
  2197.         If Val(Trim(.TextMatrix(sjh, Sjl))) = 0 Then .TextMatrix(sjh, Sjl) = ""
  2198.     End With
  2199. End Sub
  2200. Private Sub fhyxh()                                                     '返回录入数据有效行,同时让得到焦点网格可见
  2201.     With WglrGrid
  2202.         If .Row >= .FixedRows Then
  2203.             If .TextMatrix(.Row, 0) <> "*" Then     '点击网格空区域时执行此语句
  2204.                 For Rowjsq = .FixedRows To .Rows - 1        '为找到最后一数据行的下一行
  2205.                     If .TextMatrix(Rowjsq, 0) <> "*" Then
  2206.                         Exit For
  2207.                     End If
  2208.                 Next Rowjsq
  2209.                 If Rowjsq <= .Rows - 1 Then
  2210.                     changelock = True
  2211.                     .Select Rowjsq, .Col
  2212.                     changelock = False
  2213.                 Else
  2214.                     changelock = True
  2215.                     .Select .Rows - 1, .Col
  2216.                     changelock = False
  2217.                 End If
  2218.             End If
  2219.             Call Xldqh
  2220.         End If
  2221.     End With
  2222. End Sub
  2223. Private Sub Xldqh()                                                      '显露当前行
  2224.     Dim Toprowte As Long
  2225.     With WglrGrid
  2226.         Toprowte = 0
  2227.         Do While .CellTop + .RowHeight(.Row) + Fzxwghs * Sjhgd > .Height And .TopRow <> Toprowte
  2228.             Toprowte = .TopRow
  2229.             .TopRow = .TopRow + 1
  2230.         Loop
  2231.         Toprowte = 0
  2232.         Do While .CellTop < .FixedRows * .RowHeight(0) And .TopRow <> Toprowte
  2233.             Toprowte = .TopRow
  2234.             .TopRow = .TopRow - 1
  2235.         Loop
  2236.     End With
  2237. End Sub
  2238. Private Sub Xldql()                                                     '显露当前列
  2239.     Dim Leftcolte As Long
  2240.     With WglrGrid
  2241.         If .Col >= Qslz Then
  2242.             If .LeftCol > .Col Then
  2243.                 .LeftCol = .Col
  2244.             End If
  2245.             Leftcolte = 0
  2246.             Do While .CellLeft + .CellWidth > .Width And .LeftCol <> Leftcolte
  2247.                 Leftcolte = .LeftCol
  2248.                 .LeftCol = .LeftCol + 1
  2249.             Loop
  2250.         End If
  2251.     End With
  2252.     
  2253. End Sub
  2254. Private Function pdhwk(sjh As Long)                                     '判断网格行是否为空行(所有录入字段均为空*非录入字段除外)
  2255.     With WglrGrid
  2256.         For Coljsq = Qslz To .Cols - 1
  2257.             If Len(Trim(.TextMatrix(sjh, Coljsq))) <> 0 And GridBoolean(Coljsq, 1) Then
  2258.                 pdhwk = False
  2259.                 Exit Function
  2260.             End If
  2261.         Next Coljsq
  2262.         pdhwk = True
  2263.     End With
  2264. End Function
  2265. Private Sub Xyxhbz(sjh As Long)                                         '写行有效性标志,并判断是否增行
  2266.     With WglrGrid
  2267.         If .TextMatrix(sjh, 0) = "*" Then
  2268.             Exit Sub
  2269.         End If
  2270.         .TextMatrix(sjh, 0) = "*"
  2271.         If sjh >= .Rows - Fzxwghs - 1 Then
  2272.             .AddItem ""
  2273.             .RowHeight(.Rows - 1) = Sjhgd
  2274.         End If
  2275.     End With
  2276. End Sub
  2277. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)   '表格格式设置(通用)
  2278.     Yd_Help.Visible = False
  2279.     Select Case Button.Key
  2280.     Case "bcgs"                              '保存表格格式
  2281.         Call Bcwggs(WglrGrid, GridCode, GridStr)
  2282.     Case "hfmrgs"                            '恢复默认格式
  2283.         Call Hfmrgs(WglrGrid, GridCode, GridStr)
  2284.     End Select
  2285. End Sub
  2286. Private Sub bbyl(bbylte As Boolean)                                     '打印预览(通用)
  2287.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  2288.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  2289.     Bbxbtgs = 1                                  '报 表 小 标 题 行 数
  2290.     Bbbwhgs = 1                                  '报 表 表 尾 行 数
  2291.     ReDim Bbxbt(1 To Bbxbtgs)
  2292.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  2293.     If Bbbwhgs <> 0 Then
  2294.         ReDim Bbbwh(1 To Bbbwhgs)
  2295.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  2296.     End If
  2297.     Bbzbt = ReportTitle
  2298.     bbxbtzzxs(1) = 0                             '报表行组织形式(0-居左 1-居中 2-居右)
  2299.     Bbxbt(1) = "转帐名称:  " + Lbl_AutoAccName.Caption              '报表行组织形式(0-居左 1-居中 2-居右)
  2300.     Call Scyxsjb(WglrGrid)                               '生成报表数据
  2301.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  2302.     If Not bbylte Then
  2303.         Unload DY_Tybbyldy
  2304.     End If
  2305. End Sub
  2306. Private Function Sub_SaveBill() As Boolean                   '保 存 单 据
  2307.     Dim Recfind As New adodb.Recordset     '有效性判断动态集
  2308.     Dim Rowjsq As Long           '网格行计数器
  2309.     Dim Coljsq As Long           '网格列计数器
  2310.     Dim Int_RowCount As Integer  '有效数据行计数器
  2311.     Dim Bln_AssVali As Boolean   '辅助核算错误标识
  2312.     Dim Lrywlz As Long           '录入有误列值
  2313.     Dim Bj As Boolean           '辅助项有效标志
  2314.     Dim Rs As New adodb.Recordset
  2315.     
  2316.     '下面将对所有有效数据行进行有效性判断
  2317.     Int_RowCount = 0
  2318.     With WglrGrid
  2319.         For Rowjsq = .FixedRows To .Rows
  2320.             
  2321.             '带*号者为有效数据行
  2322.             If .TextMatrix(Rowjsq, 0) <> "*" Then
  2323.                 Exit For
  2324.             Else
  2325.                 Int_RowCount = Int_RowCount + 1
  2326.             End If
  2327.             
  2328.             '2.[自定义判断(补丁)
  2329.             '首先进行为空判断(固定不变)
  2330.             For jsqte = Qslz To .Cols - 1
  2331.                 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
  2332.                     Tsxx = GridStr(jsqte, 2)
  2333.                     Lrywlz = jsqte
  2334.                     GoTo Lrcwcl
  2335.                     Exit For
  2336.                 End If
  2337.             Next jsqte
  2338.             If WglrGrid.TextMatrix(Rowjsq, Sydz("006", GridStr(), Szzls)) <> "" Then
  2339.                 If WglrGrid.TextMatrix(Rowjsq, Sydz("008", GridStr(), Szzls)) = "对方汇总数" Then
  2340.                     Tsxx = "来源数据项目是“对方汇总数”,则来源科目应清空!"
  2341.                     GoTo Lrcwcl
  2342.                 End If
  2343.             Else
  2344.                 If WglrGrid.TextMatrix(Rowjsq, Sydz("008", GridStr(), Szzls)) <> "对方汇总数" Then '在网格定义中,来源数据项可以为空,但来源项目<>“对方汇总"时不能为空
  2345.                     Tsxx = "来源科目不能为空!"
  2346.                     GoTo Lrcwcl
  2347.                 End If
  2348.             End If
  2349.             
  2350.             '判断辅助项目有效性
  2351.             If Trim(WglrGrid.TextMatrix(Rowjsq, Sydz("002", GridStr(), Szzls))) <> "" Then
  2352.                 Sqlstr = "Select * FROM Cwzz_AccCode Where Ccode='" & Trim(.TextMatrix(Rowjsq, Sydz("002", GridStr(), Szzls))) & "' "
  2353.                 Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  2354.                 Lrywlz = Sydz("002", GridStr(), Szzls)
  2355.                 If AssVali(Rowjsq, RecTemp) = False Then
  2356.                     Exit Function
  2357.                 End If
  2358.             End If
  2359.         Next Rowjsq
  2360.         If Int_RowCount = 0 Then
  2361.             Tsxx = "有效行数为零,不能存盘!"
  2362.             Call Xtxxts(Tsxx, 0, 1)
  2363.             Exit Function
  2364.         End If
  2365.     End With  '网格
  2366.     
  2367.     '如果以上有效性检查均顺利通过,则执行存盘动作
  2368.     
  2369.     On Error GoTo Swcwcl
  2370.     
  2371.     
  2372.     Cw_DataEnvi.DataConnect.BeginTrans
  2373.     
  2374.     '修改单据
  2375.     '1.删除原单据所有内容
  2376.     
  2377.     Cw_DataEnvi.DataConnect.Execute ("Delete Cwzz_AutoTranItem Where TranCode='" & Trim(Lbl_AutoAccCode.Caption) & "' and TranClass='" & TranClassCode & "'")
  2378.     If Rec_AutoTranItem.State = 1 Then Rec_AutoTranItem.Close
  2379.     Rec_AutoTranItem.Open "Select * From Cwzz_AutoTranItem Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockPessimistic
  2380.     
  2381.     
  2382.     For Rowjsq = WglrGrid.FixedRows To WglrGrid.Rows
  2383.         If WglrGrid.TextMatrix(Rowjsq, 0) <> "*" Then
  2384.             Exit For
  2385.         End If
  2386.         With Rec_AutoTranItem
  2387.             .AddNew
  2388.             .Fields("TranClass") = TranClassCode
  2389.             .Fields("TranCode") = Trim(Lbl_AutoAccCode.Caption)                                         '转帐编号
  2390.             .Fields("Digest") = Trim(WglrGrid.TextMatrix(Rowjsq, Sydz("001", GridStr(), Szzls)))        '摘要
  2391.             .Fields("Ccode") = Trim(WglrGrid.TextMatrix(Rowjsq, Sydz("002", GridStr(), Szzls)))         '转帐科目
  2392.             .Fields("TranOri") = WglrGrid.TextMatrix(Rowjsq, Sydz("004", GridStr(), Szzls))             '转帐方向
  2393.             .Fields("TranProp") = WglrGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), Szzls))            '转帐性质
  2394.             .Fields("FormulaString") = WglrGrid.TextMatrix(Rowjsq, Sydz("006", GridStr(), Szzls))            '来源科目
  2395.             '            If Val(WglrGrid.TextMatrix(Rowjsq, Sydz("009", GridStr(), Szzls))) <> 0 Then                '分配比例
  2396.             '              .Fields("DistriProp") = Val(WglrGrid.TextMatrix(Rowjsq, Sydz("009", GridStr(), Szzls)))
  2397.             '            Else
  2398.             '              .Fields("DistriProp") = 100                                                               '若网格内该项没有填写,默认100%
  2399.             '            End If
  2400.             '            .Fields("FormulaCode") = WglrGrid.TextMatrix(Rowjsq, 13)                                    '来源数据项目
  2401.             .Fields("PersonCode") = Trim(WglrGrid.TextMatrix(Rowjsq, 1))                                '职员编码
  2402.             .Fields("DeptCode") = Trim(WglrGrid.TextMatrix(Rowjsq, 3))                                  '部门编码
  2403.             .Fields("CusCode") = Trim(WglrGrid.TextMatrix(Rowjsq, 5))                                   '客户单位编码
  2404.             .Fields("Suppliercode") = Trim(WglrGrid.TextMatrix(Rowjsq, 7))                             '供应商编码
  2405.             .Fields("ItemClassCode") = Trim(WglrGrid.TextMatrix(Rowjsq, 9))                             '项目大类编码
  2406.             .Fields("ItemCode") = Trim(WglrGrid.TextMatrix(Rowjsq, 11))                                 '项目编码
  2407.             .Update
  2408.         End With
  2409.     Next Rowjsq
  2410.     Cw_DataEnvi.DataConnect.CommitTrans
  2411.     Sub_SaveBill = True
  2412.     Tsxx = "保存完毕! "
  2413.     Call Xtxxts(Tsxx, 0, 4)
  2414.     
  2415.     '标识单据发生改动
  2416.     Bln_BillChange = True
  2417.     
  2418.     '设置操作状态为浏览
  2419.     Lab_OperStatus = "1"
  2420.     Call Sub_OperStatus("11")
  2421.     Exit Function
  2422.     
  2423. Swcwcl:
  2424.     Cw_DataEnvi.DataConnect.RollbackTrans
  2425.     
  2426.     'Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
  2427.     Tsxx = Err.Description
  2428.     
  2429.     Call Xtxxts(Tsxx, 0, 1)
  2430.     Exit Function
  2431.     
  2432. Lrcwcl:        '录入错误处理
  2433.     With WglrGrid
  2434.         Call Xtxxts("(第 " + Trim(Str(Int_RowCount)) + " 条记录)-" + Tsxx, 0, 1)
  2435.         changelock = True
  2436.         .Select Rowjsq, Lrywlz
  2437.         WglrGrid.SetFocus
  2438.         changelock = False
  2439.         Exit Function
  2440.     End With
  2441.     
  2442. End Function
  2443. '************以下为文本框录入处理程序(固定不变部分)*************'
  2444. Private Sub Wbklrwbcl(Index As Integer)    '文本框录入事后处理程序
  2445.     
  2446.     '以下为依据实际情况自定义部分[
  2447.     
  2448.     '在此填写文本框录入事后处理程序
  2449.     
  2450.     ']以上为依据实际情况自定义部分
  2451. End Sub
  2452. Private Sub Cxxswbk()                                                  'Formresize中重新显示文本框,列表框,帮助按钮(通用)
  2453.     Dim Wbkpy As Integer, Wbkpy1 As Integer
  2454.     Wbkpy = 30
  2455.     Wbkpy1 = 15
  2456.     With WglrGrid
  2457.         If YdCombo.Visible Then
  2458.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  2459.             YdCombo.Top = .CellTop + .Top + Wbkpy
  2460.             YdCombo.Width = .CellWidth - Wbkpy1
  2461.         End If
  2462.         If Ydcommand.Visible Then
  2463.             Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
  2464.             Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
  2465.         End If
  2466.         If Ydtext.Visible Then
  2467.             If Ydcommand.Visible Then
  2468.                 If Sfblbzkd Then
  2469.                     Ydtext.Width = .CellWidth - Ydcommand.Width
  2470.                 Else
  2471.                     Ydtext.Width = .CellWidth - Wbkpy1
  2472.                 End If
  2473.             Else
  2474.                 Ydtext.Width = .CellWidth - Wbkpy1
  2475.             End If
  2476.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  2477.             Ydtext.Top = .CellTop + .Top + Wbkpy
  2478.             Ydtext.Height = .CellHeight - Wbkpy1
  2479.         End If
  2480.     End With
  2481. End Sub
  2482. Private Sub Yd_Help_Show()
  2483.     Dim RecTemp As New adodb.Recordset
  2484.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute("select * from cwzz_AccCode where Ccode='" & Trim(WglrGrid.TextMatrix(WglrGrid.Row, Sydz("002", GridStr(), Szzls))) & "'")
  2485.     If RecTemp.EOF = False Then
  2486.         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
  2487.             With WglrGrid
  2488.                 Yd_Help.Visible = True
  2489.                 Yd_Help.Left = .Left + .CellLeft + .CellWidth - Yd_Help.Width
  2490.                 Yd_Help.Top = .Top + .CellTop + .CellHeight - Yd_Help.Height
  2491.             End With
  2492.         End If
  2493.     End If
  2494.     With WglrGrid               '记录下当前的顶行和列,以备在YD_HELP按纽可用时,滚动滚动条时保持屏幕网格不发生滚动
  2495.         Dqtoprow = .TopRow
  2496.         Dqleftcol = .LeftCol
  2497.     End With
  2498. End Sub
  2499. Private Function AssVali(Row As Long, Rs As adodb.Recordset) As Boolean
  2500.     Dim RsTemp As adodb.Recordset     '临时数据表
  2501.     '部门核算则部门不能为空且有效
  2502.     AssVali = False
  2503.     With Rs
  2504.         If .Fields("EndFlag") Then                 '末级标志时
  2505.             If Rs.Fields("DeptFlag") Then
  2506.                 If Len(Trim(WglrGrid.TextMatrix(Row, 3))) = 0 Then
  2507.                     Tsxx = "需要部门核算,部门项不能为空!"
  2508.                     GoTo Lrcwcl
  2509.                 Else
  2510.                     Set RsTemp = Cw_DataEnvi.DataConnect.Execute("Select DeptCode FROM Gy_Department Where DeptCode='" & Trim(WglrGrid.TextMatrix(Row, 3)) & "'")
  2511.                     If RsTemp.EOF Then
  2512.                         Tsxx = "部门不存在!"
  2513.                         GoTo Lrcwcl
  2514.                     End If
  2515.                 End If
  2516.             Else
  2517.                 WglrGrid.TextMatrix(Row, 3) = ""
  2518.                 WglrGrid.TextMatrix(Row, 4) = ""
  2519.             End If
  2520.         Else
  2521.             WglrGrid.TextMatrix(Row, 3) = ""
  2522.             WglrGrid.TextMatrix(Row, 4) = ""
  2523.         End If
  2524.         
  2525.         
  2526.         '客户单位核算则往来单位不能为空
  2527.         If .Fields("EndFlag") Then                '末级标志时
  2528.             If RecTemp.Fields("CusFlag") Then
  2529.                 If Len(Trim(WglrGrid.TextMatrix(Row, 5))) = 0 Then
  2530.                     Tsxx = "需要客户单位核算,客户单位项不能为空!"
  2531.                     GoTo Lrcwcl
  2532.                 Else
  2533.                     Set RsTemp = Cw_DataEnvi.DataConnect.Execute("Select CusCode FROM Gy_Customer Where CusCode='" & Trim(WglrGrid.TextMatrix(Row, 5)) & "'")
  2534.                     If RsTemp.EOF Then
  2535.                         Tsxx = "客户单位不存在!"
  2536.                         GoTo Lrcwcl
  2537.                     End If
  2538.                 End If
  2539.             Else
  2540.                 WglrGrid.TextMatrix(Row, 5) = ""
  2541.                 WglrGrid.TextMatrix(Row, 6) = ""
  2542.             End If
  2543.         Else
  2544.             WglrGrid.TextMatrix(Row, 5) = ""
  2545.             WglrGrid.TextMatrix(Row, 6) = ""
  2546.         End If
  2547.         
  2548.         '供应商单位核算则供应商单位不能为空
  2549.         If .Fields("EndFlag") Then                '末级标志时
  2550.             If RecTemp.Fields("SupplierFlag") Then
  2551.                 If Len(Trim(WglrGrid.TextMatrix(Row, 7))) = 0 Then
  2552.                     Tsxx = "需要供应商核算,供应商单位项不能为空"
  2553.                     GoTo Lrcwcl
  2554.                 Else
  2555.                     Set RsTemp = Cw_DataEnvi.DataConnect.Execute("Select Suppliercode FROM Gy_Supplier Where Suppliercode='" & Trim(WglrGrid.TextMatrix(Row, 7)) & "'")
  2556.                     If RsTemp.EOF Then
  2557.                         Tsxx = "供应商单位不存在!"
  2558.                         GoTo Lrcwcl
  2559.                     End If
  2560.                 End If
  2561.             Else
  2562.                 WglrGrid.TextMatrix(Row, 7) = ""
  2563.                 WglrGrid.TextMatrix(Row, 8) = ""
  2564.             End If
  2565.         Else
  2566.             WglrGrid.TextMatrix(Row, 7) = ""
  2567.             WglrGrid.TextMatrix(Row, 8) = ""
  2568.         End If
  2569.         
  2570.         '个人往来核算则个人项不能为空
  2571.         If .Fields("EndFlag") Then                '末级标志时
  2572.             If RecTemp.Fields("PersonFlag") Then
  2573.                 If Len(Trim(WglrGrid.TextMatrix(Row, 1))) = 0 Then
  2574.                     Tsxx = "需要个人往来核算,个人项不能为空"
  2575.                     GoTo Lrcwcl
  2576.                 Else
  2577.                     Set RsTemp = Cw_DataEnvi.DataConnect.Execute("Select PersonCode FROM Gy_Person Where PersonCode='" & Trim(WglrGrid.TextMatrix(Row, 1)) & "'")
  2578.                     If RsTemp.EOF Then
  2579.                         Tsxx = "个人不存在!"
  2580.                         GoTo Lrcwcl
  2581.                     End If
  2582.                 End If
  2583.             Else
  2584.                 WglrGrid.TextMatrix(Row, 1) = ""
  2585.                 WglrGrid.TextMatrix(Row, 2) = ""
  2586.             End If
  2587.         Else
  2588.             WglrGrid.TextMatrix(Row, 1) = ""
  2589.             WglrGrid.TextMatrix(Row, 2) = ""
  2590.         End If
  2591.         
  2592.         '项目核算则项目不能为空
  2593.         If .Fields("EndFlag") Then                 '末级标志时
  2594.             If RecTemp.Fields("ItemFlag") Then
  2595.                 If Len(Trim(WglrGrid.TextMatrix(Row, 11))) = 0 Then
  2596.                     Tsxx = "需要项目核算,核算项目不能为空"
  2597.                     GoTo Lrcwcl
  2598.                 Else
  2599.                     Set RsTemp = Cw_DataEnvi.DataConnect.Execute("Select ItemCode FROM Cwzz_Item Where ItemClassCode='" & Trim(WglrGrid.TextMatrix(Row, 9)) & "' " & _
  2600.                     "And ItemCode='" & Trim(WglrGrid.TextMatrix(Row, 11)) & "'")
  2601.                     
  2602.                     If RsTemp.EOF Then
  2603.                         Tsxx = "核算项目不存在!"
  2604.                         GoTo Lrcwcl
  2605.                     End If
  2606.                 End If
  2607.             Else
  2608.                 WglrGrid.TextMatrix(Row, 11) = ""
  2609.                 WglrGrid.TextMatrix(Row, 12) = ""
  2610.             End If
  2611.         Else
  2612.             WglrGrid.TextMatrix(Row, 11) = ""
  2613.             WglrGrid.TextMatrix(Row, 12) = ""
  2614.         End If
  2615.     End With
  2616.     Rs.Close
  2617.     AssVali = True
  2618.     Exit Function
  2619. Lrcwcl:        '录入错误处理
  2620.     With WglrGrid
  2621.         Call Xtxxts("(第 " + Trim(Str(Row)) + " 条记录)-" + Tsxx, 0, 1)
  2622.         changelock = True
  2623.         .Select Row, Sydz("010", GridStr(), Szzls)
  2624.         WglrGrid.SetFocus
  2625.         changelock = False
  2626.         Exit Function
  2627.     End With
  2628. End Function