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

企业管理

开发平台:

Visual Basic

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