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

企业管理

开发平台:

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 DJ_AdjustOutBill 
  5.    BackColor       =   &H00E9F4FA&
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "出库单调整"
  8.    ClientHeight    =   6210
  9.    ClientLeft      =   45
  10.    ClientTop       =   330
  11.    ClientWidth     =   11325
  12.    HelpContextID   =   13030502
  13.    Icon            =   "单据调整_出库单调整.frx":0000
  14.    KeyPreview      =   -1  'True
  15.    LinkTopic       =   "Form1"
  16.    MaxButton       =   0   'False
  17.    MinButton       =   0   'False
  18.    ScaleHeight     =   6210
  19.    ScaleWidth      =   11325
  20.    StartUpPosition =   2  '屏幕中心
  21.    Begin VB.TextBox LrText 
  22.       ForeColor       =   &H00000000&
  23.       Height          =   300
  24.       Index           =   0
  25.       Left            =   1020
  26.       TabIndex        =   4
  27.       Text            =   "0"
  28.       Top             =   1500
  29.       Width           =   1650
  30.    End
  31.    Begin VB.CommandButton Ydcommand 
  32.       Height          =   300
  33.       Left            =   10050
  34.       Picture         =   "单据调整_出库单调整.frx":1042
  35.       Style           =   1  'Graphical
  36.       TabIndex        =   3
  37.       Top             =   1740
  38.       Visible         =   0   'False
  39.       Width           =   300
  40.    End
  41.    Begin VB.TextBox Ydtext 
  42.       BackColor       =   &H80000018&
  43.       BorderStyle     =   0  'None
  44.       Height          =   330
  45.       Left            =   7080
  46.       MultiLine       =   -1  'True
  47.       TabIndex        =   2
  48.       Top             =   1710
  49.       Visible         =   0   'False
  50.       Width           =   1185
  51.    End
  52.    Begin VB.Timer Timer1 
  53.       Interval        =   1
  54.       Left            =   9690
  55.       Top             =   150
  56.    End
  57.    Begin VB.CommandButton Ydcommand1 
  58.       Height          =   300
  59.       Left            =   10050
  60.       Picture         =   "单据调整_出库单调整.frx":13CC
  61.       Style           =   1  'Graphical
  62.       TabIndex        =   1
  63.       Top             =   1350
  64.       Visible         =   0   'False
  65.       Width           =   300
  66.    End
  67.    Begin VB.ComboBox YdCombo 
  68.       Height          =   315
  69.       Left            =   8370
  70.       Style           =   2  'Dropdown List
  71.       TabIndex        =   0
  72.       Top             =   1710
  73.       Visible         =   0   'False
  74.       Width           =   1155
  75.    End
  76.    Begin MSComctlLib.ImageList ImageList1 
  77.       Left            =   10410
  78.       Top             =   1410
  79.       _ExtentX        =   1005
  80.       _ExtentY        =   1005
  81.       BackColor       =   -2147483643
  82.       ImageWidth      =   16
  83.       ImageHeight     =   16
  84.       MaskColor       =   12632256
  85.       _Version        =   393216
  86.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  87.          NumListImages   =   37
  88.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  89.             Picture         =   "单据调整_出库单调整.frx":1756
  90.             Key             =   "sz"
  91.          EndProperty
  92.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  93.             Picture         =   "单据调整_出库单调整.frx":1AF0
  94.             Key             =   "dy"
  95.          EndProperty
  96.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  97.             Picture         =   "单据调整_出库单调整.frx":1E8A
  98.             Key             =   "yl"
  99.          EndProperty
  100.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  101.             Picture         =   "单据调整_出库单调整.frx":2224
  102.             Key             =   "xg"
  103.          EndProperty
  104.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  105.             Picture         =   "单据调整_出库单调整.frx":25BE
  106.             Key             =   "zh"
  107.          EndProperty
  108.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  109.             Picture         =   "单据调整_出库单调整.frx":2958
  110.             Key             =   "sh"
  111.          EndProperty
  112.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  113.             Picture         =   "单据调整_出库单调整.frx":2CF2
  114.             Key             =   "bc"
  115.          EndProperty
  116.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  117.             Picture         =   "单据调整_出库单调整.frx":308C
  118.             Key             =   "fq"
  119.          EndProperty
  120.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  121.             Picture         =   "单据调整_出库单调整.frx":3426
  122.             Key             =   "bz"
  123.          EndProperty
  124.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  125.             Picture         =   "单据调整_出库单调整.frx":37C0
  126.             Key             =   "tc"
  127.          EndProperty
  128.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  129.             Picture         =   "单据调整_出库单调整.frx":3B5A
  130.             Key             =   "bcgs"
  131.          EndProperty
  132.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  133.             Picture         =   "单据调整_出库单调整.frx":3EF4
  134.             Key             =   "mrlk"
  135.          EndProperty
  136.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  137.             Picture         =   "单据调整_出库单调整.frx":428E
  138.             Key             =   "xsxm"
  139.          EndProperty
  140.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  141.             Picture         =   "单据调整_出库单调整.frx":4628
  142.             Key             =   "first"
  143.          EndProperty
  144.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  145.             Picture         =   "单据调整_出库单调整.frx":49C2
  146.             Key             =   "prev"
  147.          EndProperty
  148.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  149.             Picture         =   "单据调整_出库单调整.frx":4D5C
  150.             Key             =   "next"
  151.          EndProperty
  152.          BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  153.             Picture         =   "单据调整_出库单调整.frx":50F6
  154.             Key             =   "last"
  155.          EndProperty
  156.          BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  157.             Picture         =   "单据调整_出库单调整.frx":5490
  158.             Key             =   "xx"
  159.          EndProperty
  160.          BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  161.             Picture         =   "单据调整_出库单调整.frx":582A
  162.             Key             =   "define"
  163.          EndProperty
  164.          BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  165.             Picture         =   "单据调整_出库单调整.frx":5BC4
  166.             Key             =   "exec"
  167.          EndProperty
  168.          BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  169.             Picture         =   "单据调整_出库单调整.frx":5F5E
  170.             Key             =   "xz"
  171.          EndProperty
  172.          BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  173.             Picture         =   "单据调整_出库单调整.frx":62F8
  174.             Key             =   "sc"
  175.          EndProperty
  176.          BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  177.             Picture         =   "单据调整_出库单调整.frx":6692
  178.             Key             =   "sx"
  179.          EndProperty
  180.          BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  181.             Picture         =   "单据调整_出库单调整.frx":6A2C
  182.             Key             =   "cx"
  183.          EndProperty
  184.          BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  185.             Picture         =   "单据调整_出库单调整.frx":6DC6
  186.             Key             =   "zd"
  187.          EndProperty
  188.          BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  189.             Picture         =   "单据调整_出库单调整.frx":7160
  190.             Key             =   "dz"
  191.          EndProperty
  192.          BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  193.             Picture         =   "单据调整_出库单调整.frx":74FA
  194.             Key             =   "ph"
  195.          EndProperty
  196.          BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  197.             Picture         =   "单据调整_出库单调整.frx":7894
  198.             Key             =   "fz"
  199.          EndProperty
  200.          BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  201.             Picture         =   "单据调整_出库单调整.frx":7C2E
  202.             Key             =   "dw"
  203.          EndProperty
  204.          BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  205.             Picture         =   "单据调整_出库单调整.frx":7FC8
  206.             Key             =   "hf"
  207.          EndProperty
  208.          BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  209.             Picture         =   "单据调整_出库单调整.frx":8362
  210.             Key             =   "pz"
  211.          EndProperty
  212.          BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  213.             Picture         =   "单据调整_出库单调整.frx":86FC
  214.             Key             =   "check"
  215.          EndProperty
  216.          BeginProperty ListImage33 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  217.             Picture         =   "单据调整_出库单调整.frx":8A96
  218.             Key             =   "qs"
  219.          EndProperty
  220.          BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  221.             Picture         =   "单据调整_出库单调整.frx":8E30
  222.             Key             =   "fullcheck"
  223.          EndProperty
  224.          BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  225.             Picture         =   "单据调整_出库单调整.frx":91CA
  226.             Key             =   "qq"
  227.          EndProperty
  228.          BeginProperty ListImage36 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  229.             Picture         =   "单据调整_出库单调整.frx":9564
  230.             Key             =   "bcw"
  231.          EndProperty
  232.          BeginProperty ListImage37 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  233.             Picture         =   "单据调整_出库单调整.frx":98FE
  234.             Key             =   "ye"
  235.          EndProperty
  236.       EndProperty
  237.    End
  238.    Begin MSComctlLib.Toolbar Tlb_Action 
  239.       Align           =   1  'Align Top
  240.       Height          =   555
  241.       Left            =   0
  242.       TabIndex        =   5
  243.       Top             =   0
  244.       Width           =   11325
  245.       _ExtentX        =   19976
  246.       _ExtentY        =   979
  247.       ButtonWidth     =   820
  248.       ButtonHeight    =   926
  249.       AllowCustomize  =   0   'False
  250.       Wrappable       =   0   'False
  251.       Appearance      =   1
  252.       Style           =   1
  253.       ImageList       =   "ImageList1"
  254.       _Version        =   393216
  255.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  256.          NumButtons      =   18
  257.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  258.             Caption         =   "打印"
  259.             Key             =   "dy"
  260.             Object.ToolTipText     =   "打印当前单据或Ctrl+P"
  261.             ImageKey        =   "dy"
  262.          EndProperty
  263.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  264.             Caption         =   "预览"
  265.             Key             =   "yl"
  266.             ImageKey        =   "yl"
  267.          EndProperty
  268.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  269.             Key             =   "fgh0"
  270.             Style           =   3
  271.          EndProperty
  272.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  273.             Caption         =   "新增"
  274.             Key             =   "xz"
  275.             Object.ToolTipText     =   "新增加一张单据或F5"
  276.             ImageKey        =   "xz"
  277.          EndProperty
  278.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  279.             Key             =   "fgh1"
  280.             Style           =   3
  281.          EndProperty
  282.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  283.             Caption         =   "增行"
  284.             Key             =   "zh"
  285.             Object.ToolTipText     =   "插入一行或Insert"
  286.             ImageKey        =   "zh"
  287.          EndProperty
  288.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  289.             Caption         =   "删行"
  290.             Key             =   "sh"
  291.             Object.ToolTipText     =   "删除当前记录行或Delete"
  292.             ImageKey        =   "sh"
  293.          EndProperty
  294.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  295.             Key             =   "fgh2"
  296.             Style           =   3
  297.          EndProperty
  298.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  299.             Caption         =   "保存"
  300.             Key             =   "bc"
  301.             Object.ToolTipText     =   "保存单据或F6"
  302.             ImageKey        =   "bc"
  303.          EndProperty
  304.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  305.             Caption         =   "放弃"
  306.             Key             =   "fq"
  307.             Object.ToolTipText     =   "放弃此次操作"
  308.             ImageKey        =   "fq"
  309.          EndProperty
  310.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  311.             Key             =   "fgh3"
  312.             Style           =   3
  313.          EndProperty
  314.          BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  315.             Caption         =   "首张"
  316.             Key             =   "first"
  317.             ImageKey        =   "first"
  318.          EndProperty
  319.          BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  320.             Caption         =   "上张"
  321.             Key             =   "prev"
  322.             ImageKey        =   "prev"
  323.          EndProperty
  324.          BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  325.             Caption         =   "下张"
  326.             Key             =   "next"
  327.             ImageKey        =   "next"
  328.          EndProperty
  329.          BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  330.             Caption         =   "末张"
  331.             Key             =   "last"
  332.             ImageKey        =   "last"
  333.          EndProperty
  334.          BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  335.             Key             =   "fgh5"
  336.             Style           =   3
  337.          EndProperty
  338.          BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  339.             Caption         =   "帮助"
  340.             Key             =   "bz"
  341.             ImageKey        =   "bz"
  342.          EndProperty
  343.          BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  344.             Caption         =   "退出"
  345.             Key             =   "fh"
  346.             ImageKey        =   "tc"
  347.          EndProperty
  348.       EndProperty
  349.       BorderStyle     =   1
  350.    End
  351.    Begin VSFlex8Ctl.VSFlexGrid WglrGrid 
  352.       Height          =   3345
  353.       Left            =   120
  354.       TabIndex        =   6
  355.       Top             =   2160
  356.       Width           =   10770
  357.       _cx             =   5080
  358.       _cy             =   5080
  359.       Appearance      =   1
  360.       BorderStyle     =   1
  361.       Enabled         =   -1  'True
  362.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  363.          Name            =   "宋体"
  364.          Size            =   9
  365.          Charset         =   134
  366.          Weight          =   400
  367.          Underline       =   0   'False
  368.          Italic          =   0   'False
  369.          Strikethrough   =   0   'False
  370.       EndProperty
  371.       MousePointer    =   0
  372.       BackColor       =   16777215
  373.       ForeColor       =   -2147483640
  374.       BackColorFixed  =   12640511
  375.       ForeColorFixed  =   -2147483630
  376.       BackColorSel    =   -2147483643
  377.       ForeColorSel    =   -2147483640
  378.       BackColorBkg    =   16777215
  379.       BackColorAlternate=   16777215
  380.       GridColor       =   -2147483633
  381.       GridColorFixed  =   -2147483632
  382.       TreeColor       =   -2147483632
  383.       FloodColor      =   192
  384.       SheetBorder     =   -2147483642
  385.       FocusRect       =   1
  386.       HighLight       =   1
  387.       AllowSelection  =   0   'False
  388.       AllowBigSelection=   0   'False
  389.       AllowUserResizing=   0
  390.       SelectionMode   =   0
  391.       GridLines       =   1
  392.       GridLinesFixed  =   2
  393.       GridLineWidth   =   1
  394.       Rows            =   5000
  395.       Cols            =   10
  396.       FixedRows       =   1
  397.       FixedCols       =   0
  398.       RowHeightMin    =   0
  399.       RowHeightMax    =   0
  400.       ColWidthMin     =   0
  401.       ColWidthMax     =   0
  402.       ExtendLastCol   =   0   'False
  403.       FormatString    =   ""
  404.       ScrollTrack     =   0   'False
  405.       ScrollBars      =   3
  406.       ScrollTips      =   0   'False
  407.       MergeCells      =   0
  408.       MergeCompare    =   0
  409.       AutoResize      =   -1  'True
  410.       AutoSizeMode    =   0
  411.       AutoSearch      =   0
  412.       AutoSearchDelay =   2
  413.       MultiTotals     =   -1  'True
  414.       SubtotalPosition=   1
  415.       OutlineBar      =   0
  416.       OutlineCol      =   0
  417.       Ellipsis        =   0
  418.       ExplorerBar     =   0
  419.       PicturesOver    =   0   'False
  420.       FillStyle       =   0
  421.       RightToLeft     =   0   'False
  422.       PictureType     =   0
  423.       TabBehavior     =   0
  424.       OwnerDraw       =   0
  425.       Editable        =   0
  426.       ShowComboButton =   1
  427.       WordWrap        =   -1  'True
  428.       TextStyle       =   0
  429.       TextStyleFixed  =   0
  430.       OleDragMode     =   0
  431.       OleDropMode     =   0
  432.       DataMode        =   0
  433.       VirtualData     =   -1  'True
  434.       DataMember      =   ""
  435.       ComboSearch     =   3
  436.       AutoSizeMouse   =   -1  'True
  437.       FrozenRows      =   0
  438.       FrozenCols      =   0
  439.       AllowUserFreezing=   0
  440.       BackColorFrozen =   0
  441.       ForeColorFrozen =   0
  442.       WallPaperAlignment=   9
  443.       AccessibleName  =   ""
  444.       AccessibleDescription=   ""
  445.       AccessibleValue =   ""
  446.       AccessibleRole  =   24
  447.       Begin VSFlex8Ctl.VSFlexGrid HjGrid 
  448.          Height          =   885
  449.          Left            =   0
  450.          TabIndex        =   7
  451.          Top             =   2400
  452.          Width           =   7545
  453.          _cx             =   5080
  454.          _cy             =   5080
  455.          Appearance      =   1
  456.          BorderStyle     =   0
  457.          Enabled         =   -1  'True
  458.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  459.             Name            =   "宋体"
  460.             Size            =   9
  461.             Charset         =   134
  462.             Weight          =   400
  463.             Underline       =   0   'False
  464.             Italic          =   0   'False
  465.             Strikethrough   =   0   'False
  466.          EndProperty
  467.          MousePointer    =   0
  468.          BackColor       =   14671839
  469.          ForeColor       =   -2147483640
  470.          BackColorFixed  =   -2147483633
  471.          ForeColorFixed  =   -2147483630
  472.          BackColorSel    =   -2147483643
  473.          ForeColorSel    =   -2147483640
  474.          BackColorBkg    =   16777215
  475.          BackColorAlternate=   14671839
  476.          GridColor       =   -2147483633
  477.          GridColorFixed  =   -2147483632
  478.          TreeColor       =   -2147483632
  479.          FloodColor      =   192
  480.          SheetBorder     =   -2147483642
  481.          FocusRect       =   1
  482.          HighLight       =   1
  483.          AllowSelection  =   0   'False
  484.          AllowBigSelection=   0   'False
  485.          AllowUserResizing=   0
  486.          SelectionMode   =   0
  487.          GridLines       =   1
  488.          GridLinesFixed  =   2
  489.          GridLineWidth   =   1
  490.          Rows            =   5000
  491.          Cols            =   10
  492.          FixedRows       =   1
  493.          FixedCols       =   0
  494.          RowHeightMin    =   0
  495.          RowHeightMax    =   0
  496.          ColWidthMin     =   0
  497.          ColWidthMax     =   0
  498.          ExtendLastCol   =   0   'False
  499.          FormatString    =   ""
  500.          ScrollTrack     =   0   'False
  501.          ScrollBars      =   3
  502.          ScrollTips      =   0   'False
  503.          MergeCells      =   0
  504.          MergeCompare    =   0
  505.          AutoResize      =   -1  'True
  506.          AutoSizeMode    =   0
  507.          AutoSearch      =   0
  508.          AutoSearchDelay =   2
  509.          MultiTotals     =   -1  'True
  510.          SubtotalPosition=   1
  511.          OutlineBar      =   0
  512.          OutlineCol      =   0
  513.          Ellipsis        =   0
  514.          ExplorerBar     =   0
  515.          PicturesOver    =   0   'False
  516.          FillStyle       =   0
  517.          RightToLeft     =   0   'False
  518.          PictureType     =   0
  519.          TabBehavior     =   0
  520.          OwnerDraw       =   0
  521.          Editable        =   0
  522.          ShowComboButton =   1
  523.          WordWrap        =   -1  'True
  524.          TextStyle       =   0
  525.          TextStyleFixed  =   0
  526.          OleDragMode     =   0
  527.          OleDropMode     =   0
  528.          DataMode        =   0
  529.          VirtualData     =   -1  'True
  530.          DataMember      =   ""
  531.          ComboSearch     =   3
  532.          AutoSizeMouse   =   -1  'True
  533.          FrozenRows      =   0
  534.          FrozenCols      =   0
  535.          AllowUserFreezing=   0
  536.          BackColorFrozen =   0
  537.          ForeColorFrozen =   0
  538.          WallPaperAlignment=   9
  539.          AccessibleName  =   ""
  540.          AccessibleDescription=   ""
  541.          AccessibleValue =   ""
  542.          AccessibleRole  =   24
  543.       End
  544.    End
  545.    Begin VB.Label Lab_Title 
  546.       AutoSize        =   -1  'True
  547.       BackColor       =   &H80000018&
  548.       BackStyle       =   0  'Transparent
  549.       Caption         =   "单据标题自动调整"
  550.       BeginProperty Font 
  551.          Name            =   "宋体"
  552.          Size            =   15
  553.          Charset         =   134
  554.          Weight          =   700
  555.          Underline       =   0   'False
  556.          Italic          =   0   'False
  557.          Strikethrough   =   0   'False
  558.       EndProperty
  559.       ForeColor       =   &H00000000&
  560.       Height          =   300
  561.       Left            =   4440
  562.       TabIndex        =   14
  563.       Top             =   840
  564.       Width           =   2520
  565.    End
  566.    Begin VB.Label Lab_BillId 
  567.       AutoSize        =   -1  'True
  568.       BackColor       =   &H0080C0FF&
  569.       Height          =   270
  570.       Left            =   7050
  571.       TabIndex        =   13
  572.       Top             =   1350
  573.       Visible         =   0   'False
  574.       Width           =   2490
  575.    End
  576.    Begin VB.Label Lab_Djclzt 
  577.       BackColor       =   &H0000FFFF&
  578.       Caption         =   "1"
  579.       ForeColor       =   &H00808080&
  580.       Height          =   255
  581.       Left            =   9690
  582.       TabIndex        =   12
  583.       Top             =   1350
  584.       Visible         =   0   'False
  585.       Width           =   285
  586.    End
  587.    Begin VB.Label Lab_OperStatus 
  588.       BackColor       =   &H000080FF&
  589.       Caption         =   "1"
  590.       Height          =   345
  591.       Left            =   9660
  592.       TabIndex        =   11
  593.       Top             =   1710
  594.       Visible         =   0   'False
  595.       Width           =   345
  596.    End
  597.    Begin VB.Label Lab_Bill 
  598.       Appearance      =   0  'Flat
  599.       BackColor       =   &H80000005&
  600.       BackStyle       =   0  'Transparent
  601.       ForeColor       =   &H00000000&
  602.       Height          =   225
  603.       Left            =   9030
  604.       TabIndex        =   10
  605.       Top             =   6330
  606.       Width           =   735
  607.    End
  608.    Begin VB.Label Lab_Checker 
  609.       Appearance      =   0  'Flat
  610.       BackColor       =   &H80000005&
  611.       BackStyle       =   0  'Transparent
  612.       ForeColor       =   &H00000000&
  613.       Height          =   225
  614.       Left            =   7170
  615.       TabIndex        =   9
  616.       Top             =   6360
  617.       Width           =   735
  618.    End
  619.    Begin VB.Label TsLabel 
  620.       Alignment       =   1  'Right Justify
  621.       AutoSize        =   -1  'True
  622.       BackStyle       =   0  'Transparent
  623.       Caption         =   "单据号:"
  624.       Height          =   180
  625.       Index           =   0
  626.       Left            =   240
  627.       TabIndex        =   8
  628.       Top             =   1560
  629.       Width           =   765
  630.    End
  631. End
  632. Attribute VB_Name = "DJ_AdjustOutBill"
  633. Attribute VB_GlobalNameSpace = False
  634. Attribute VB_Creatable = False
  635. Attribute VB_PredeclaredId = True
  636. Attribute VB_Exposed = False
  637. '***********************************************************************************************************
  638. '*    模 块 名 称 :出库单调整
  639. '*    功 能 描 述 :此功能模块主要完成单据录入、预览打印等。
  640. '*    程序员姓名  :白凤英
  641. '*    最后修改人  :白凤英
  642. '*    最后修改时间:2001/12/10
  643. '*    备        注:程序中所有依实际情况自定义部分均用[>>  <<]括起
  644. '*
  645. '*    1.每次调入外部功能窗体,均要加锁ChangeLock=True,窗体关闭后解锁ChangeLock=false
  646. '*                                    TextValiLock=True             TextValiLock=false
  647. '*
  648. '*    2.Lab_OperStatus 用此标签来标识单据录入状态(默认值为1) "1"-浏览 "2"-新增 "
  649. '*
  650. '*    3.Lab_Djclzt 用此标签来标识单据处理状态(默认值为1) "1"-填制单据  "2"-查询单据列表  "3"-明细帐联查单据
  651. '*
  652. '*    4.原则:只要单据能够存盘(无论修改或新增)则其必须接受完整性及有效性规则检查
  653. '***********************************************************************************************************
  654.  
  655. '[以下为根据实际情况设置变量
  656. Dim Bln_BillChange As Boolean                   '标识单据是否发生改动
  657. Dim Rec_Query As New ADODB.Recordset            '单据组查询结果动态集(保存当前单据组ID)
  658. Public Str_QueryCondi As String                 '单据组查询条件(接收单据列表传递查询条件)
  659. Dim Str_RightEdit As String                     '单据编辑(新增、修改、删除)权限索引
  660. Dim PriceMode As String                         '仓库计价方式
  661. ']
  662. '以下为固定使用变量(单据)
  663. Dim BillCode As String                          '单据设计编码(索引号)
  664. Dim Var_Bill() As Variant                       '用来返回单据设计信息
  665. Dim ReportTitle As String                       '报表主标题
  666. Dim Tsxx As String                              '系统提示信息
  667. '以下为固定使用变量(网格)
  668. Dim Cxnrrec As New ADODB.Recordset              '显示查询内容动态集
  669. Dim Dyymctbl As New DY_Dyymsz                   '打印页面窗体变量
  670. Dim GridCode As String                          '显示网格网格代码
  671. Dim GridInf() As Variant                        '整个网格设置信息
  672. Dim Pmbcsjhs As Long                            '屏幕网格保持数据行数(大于等于1)
  673. Dim Fzxwghs As Integer                          '辅助项网格行数(包括合计行)
  674. Dim Sfxshjwg As Boolean                         '是否显示合计网格
  675. Dim Qslz As Long                                '网格隐藏(非操作显示)列数
  676. Dim Sjhgd As Double                             '网格数据行高度
  677. Dim GridBoolean() As Boolean                    '网格列信息(布尔型)
  678. Dim GridStr()  As String                        '网格列信息(字符型)
  679. Dim GridInt() As Integer                        '网格列信息(整型)
  680. Dim Sfblbzkd As Boolean                         '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
  681. Dim Dqlrwgh As Long                             '当前录入数据网格行
  682. Dim Dqlrwgl As Long                             '当前录入数据网格列
  683. Dim Dqlkwgh As Long                             '刚刚离开网格行(不一定为录入行)
  684. Dim Dqlkwgl As Long                             '刚刚离开网格列
  685. Dim Dqtoprow As Long                            '当前录入状态时最上端可视行
  686. Dim Dqleftcol As Long                           '当前录入状态时最左端可视列
  687. Dim Zdlrqnr As String                           '字段录入修改前内容(用来判断内容是否修改)
  688. Dim Wbkbhlock As Boolean                        '文本框改变值锁
  689. Dim Changelock As Boolean                       '网格行列改变控制锁(用来区别用户改变.程序改变)
  690. Dim Gdtlock As Boolean                          '滚动条滚动控制(用来区别用户改变.程序改变)
  691. Dim Yxxpdlock As Boolean                        '字段有效性判断锁(内容不修改不需进行字段有效性判断)
  692. Dim Hyxxpdlock As Boolean                       '行有效性判断锁(字段内容不修改不需进行行有效性判断)
  693. Dim Valilock As Boolean                         '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
  694. Dim Shsfts As Boolean                           '删除记录行是否提示
  695. Dim Szzls As Integer                            '网格信息数组最大下标值(网格列数-1)
  696. '以下为固定使用变量(文本框)
  697. Dim Textvar() As Variant                        '存储变体型文本框信息
  698. Dim Textboolean() As Boolean                    '存储布尔型文本框信息
  699. Dim Textint() As Integer                        '存储整型文本框信息
  700. Dim Textstr() As String                         '存储字符型文本框信息
  701. Dim Max_Text_Index As Integer                   '最大录入文本框索引值
  702. Dim TextGroupCode As String                     '文本框录入分组编码
  703. Dim TextValiLock As Boolean                     '文本框失去焦点是否进行有效性控制判断
  704. Dim TextValiJudgeLock() As Boolean              '文本框录入有效性判断控制锁
  705. Dim TextChangeLock As Boolean                   '文本框内容变换控制锁
  706. '自定义变量
  707. Dim FGISPriceMode As String                     '记价方式
  708.     
  709. Private Sub Form_KeyPress(KeyAscii As Integer)      '控 制 焦 点 转 移
  710.     
  711.     Dim jdzygs As Integer
  712.     jdzygs = 12                                     '在单据录入中,此焦点转移控制值一定小于等于文本框个数,否则网格回车键将不支持.
  713.     Select Case KeyAscii
  714.         Case vbKeyReturn
  715.             If Kjjdzy(jdzygs) Then
  716.                 KeyAscii = 0
  717.             End If
  718.         Case 39           '屏蔽字符"'"
  719.             KeyAscii = 0
  720.     End Select
  721. End Sub
  722. Private Sub Form_Load()                                                        '窗 体 装 入
  723.     '初始化各种锁值(Fixed)
  724.     Changelock = False             '网格行列改变控制锁
  725.     Gdtlock = False                '滚动条滚动控制
  726.     Yxxpdlock = True               '字段有效性判断锁
  727.     Hyxxpdlock = True              '行有效性判断锁
  728.     Wbkbhlock = False              '文本框内容改变锁
  729.     
  730.     '单据权限索引设置
  731.     Str_RightEdit = "Chhs_AdjustOutEidt"
  732.     '调入单据信息(需要修改BillCode)
  733.     BillCode = "1302"
  734.     Call Sub_ReadBillInfo(BillCode, Me, Var_Bill())
  735.     Lab_Title = Var_Bill(2)
  736.     Lab_Title.Move (Me.Width - Lab_Title.Width) / 2, 800
  737.     '报表编码
  738.     XtReportCode = Var_Bill(5)
  739.     Load Dyymctbl
  740.   
  741.     '以下为文本框处理程序(Fixed)
  742.     TextGroupCode = Var_Bill(3)
  743.  
  744.     Call Drwbkxx(TextGroupCode, Textvar(), Textboolean(), Textint(), Textstr())  '读入文本框录入信息
  745.     Call Wbkcsh
  746.   
  747.     '调入网格并记录一些网格信息(Fixed)
  748.     GridCode = Var_Bill(4)         '网格属性编码
  749.     Call BzWgcsh(WglrGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  750.       
  751.     Qslz = GridInf(1)
  752.     Sjhgd = GridInf(2)
  753.     Fzxwghs = GridInf(4)
  754.     Sfblbzkd = GridInf(5)
  755.     Shsfts = GridInf(6)
  756.     Sfxshjwg = GridInf(7)
  757.     Szzls = WglrGrid.Cols - 1
  758.     Pmbcsjhs = Int((WglrGrid.Height - WglrGrid.FixedRows * WglrGrid.RowHeight(0)) / Sjhgd) - Fzxwghs - 1
  759.       
  760.     For Jsqte = WglrGrid.FixedRows To WglrGrid.Rows - 1
  761.         WglrGrid.RowHeight(Jsqte) = Sjhgd
  762.     Next Jsqte
  763.     
  764.     '初始化合计网格(Fixed)
  765.     Call Cshhjwg
  766.     
  767.     '单据变动置为False(Fixed)
  768.     Bln_BillChange = False
  769.     
  770.     '调入数据初始化模块(Fixed)
  771.     Lab_Djclzt.Caption = Xtcdcs
  772.     Call Sjcsh(Trim(Lab_Djclzt.Caption))
  773.     
  774. End Sub
  775. Private Sub Form_Unload(Cancel As Integer)           '窗体卸载
  776.     '是否保存已修改单据
  777.     Dim YAnswer As Integer
  778.     If Lab_OperStatus.Caption = "2" Or Lab_OperStatus.Caption = "3" Then
  779.         Tsxx = "单据尚未保存,是否退出?"
  780.         YAnswer = Xtxxts(Tsxx, 2, 2)
  781.         If YAnswer <> 1 Then
  782.             Cancel = 1
  783.             Exit Sub
  784.         End If
  785.     End If
  786.     
  787.     '卸载打印页面窗体
  788.     Unload Dyymctbl
  789.     
  790.     '判断单据是否发生变化,并返回相应标识
  791.     If Bln_BillChange Then
  792.         Xtfhcs = "1"
  793.     Else
  794.         Xtfhcs = "0"
  795.     End If
  796.     
  797.     '用户退出时写上机日志
  798.     Security_Log "Chhs_AdjustOutBill", Xtczybm, 2, False
  799.     
  800. End Sub
  801. Private Sub Sjcsh(Str_Pzclzt As String)              '数据初始化模块(根据实际情况)
  802.     
  803.     Dim SqlStr As String       '查询单据列表条件
  804.     '[>>根据实际情况初始化
  805.     Select Case Str_Pzclzt
  806.         Case "1"   '填制单据
  807.             '调入用户查询结果动态集
  808.             SqlStr = "SELECT DISTINCT Chhs_V_AdjustInOut.InOutAdjustMainId From Chhs_V_AdjustInOut LEFT OUTER JOIN Gy_Whlimit ON Chhs_V_AdjustInOut.WhCode = Gy_Whlimit.WhCode where Gy_Whlimit.Czybm='" & Xtczybm & "' and BillDate='" & Xtrq & "' and BillCode='1302' ORDER BY Chhs_V_AdjustInOut.InOutAdjustMainId"
  809.             Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  810.       
  811.             '新增单据
  812.             Call Sub_AddBill
  813.             
  814.         Case "2"   '查询单据(单据列表)
  815.             
  816.             '填充查询单据标识
  817.             Lab_BillId.Caption = XT_BillID
  818.             Str_QueryCondi = Xtcdcsfz
  819.             
  820.             Call Sub_ShowBill
  821.             Call Sub_OperStatus("10")
  822.             
  823.             '调入用户查询结果动态集
  824.             SqlStr = "SELECT DISTINCT InOutAdjustMainId From Chhs_V_AdjustInOut a LEFT OUTER JOIN Gy_Whlimit ON a.WhCode = Gy_Whlimit.WhCode " & Str_QueryCondi & " and Gy_Whlimit.Czybm='" & Xtczybm & "' and BillCode='1302' ORDER BY a.InOutAdjustMainId"
  825.             Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  826.             Rec_Query.Find "InOutAdjustMainId=" & Val(Lab_BillId.Caption)
  827.         
  828.         Case "3"   '明细帐联查单据
  829.             '设置工具条显示
  830.             With Tlb_Action
  831.                 .Buttons("xz").Enabled = False             '新增
  832.                 .Buttons("fgh0").Enabled = False           '分隔行
  833.                 .Buttons("zh").Enabled = False             '增行
  834.                 .Buttons("sh").Enabled = False             '删行
  835.                 .Buttons("fgh1").Enabled = False           '分隔行
  836.                 .Buttons("bc").Enabled = False             '保存
  837.                 .Buttons("fq").Enabled = False             '放弃
  838.                 .Buttons("fgh2").Enabled = False           '分隔行
  839.                 .Buttons("first").Enabled = False          '首张
  840.                 .Buttons("prev").Enabled = False           '上张
  841.                 .Buttons("next").Enabled = False           '下张
  842.                 .Buttons("last").Enabled = False           '末张
  843.                 .Buttons("fgh5").Enabled = False           '分割行
  844.             End With
  845.       
  846.             Lab_BillId.Caption = XT_BillID
  847.             Str_QueryCondi = Xtcdcsfz
  848.             Call Sub_ShowBill
  849.       
  850.             '设置操作状态为浏览
  851.             Lab_OperStatus.Caption = "1"
  852.       
  853.             '录入文本框
  854.             For Jsqte = Max_Text_Index To 0 Step -1
  855.             LrText(Jsqte).Enabled = False
  856.         Next Jsqte
  857.     End Select
  858.   
  859.     '<<]
  860.   
  861. End Sub
  862. Private Sub Sub_ShowBill()                                          '根据当前单据ID显示整张单据内容
  863.    
  864.     '过程默认参数为当前窗体中单据ID:Lab_BillID
  865.     Dim SqlStr As String                           '临时使用字符串
  866.     Dim Rectemp As New ADODB.Recordset             '临时使用动态集
  867.     Dim Jsqte As Long                              '临时计数器
  868.     
  869.     '禁止网格刷新动作,为加快网格显示速度(Fixed)
  870.     WglrGrid.Redraw = False
  871.     '本张单据查询字符串
  872.     SqlStr = "SELECT * FROM Chhs_V_AdjustInOut where InOutAdjustMainId='" & Val(Lab_BillId.Caption) & "' Order By InOutAdjustMainId"
  873.     Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  874.       
  875.     With Rectemp
  876.     
  877.         WglrGrid.Rows = WglrGrid.FixedRows
  878.         
  879.         If .EOF Then
  880.             WglrGrid.Redraw = True
  881.             Exit Sub
  882.         Else
  883.             '[>>显示单据头
  884.             TextChangeLock = True     '文本框加锁
  885.             LrText(0).Text = Trim(.Fields("BillNum"))                                                '单据号
  886.             If IsDate(.Fields("BillDate")) Then
  887.                 LrText(1).Text = Format(.Fields("BillDate"), "yyyy-mm-dd")                           '日期
  888.             End If
  889.             LrText(2).Text = Trim(.Fields("DeptName") & "")                                          '部门
  890.             LrText(2).Tag = Trim(.Fields("DeptCode") & "")
  891.             LrText(3).Text = Trim(.Fields("WhName") & "")                                            '仓库
  892.             LrText(3).Tag = Trim(.Fields("Whcode") & "")
  893.             PriceMode = Trim(.Fields("pricemode"))
  894.             LrText(4).Text = Trim(.Fields("InoutClassName") & "")                                    '出库类别
  895.             LrText(4).Tag = Trim(.Fields("InoutClassCode") & "")
  896.             LrText(5).Text = Trim(.Fields("CusName") & "")                                           '客户
  897.             LrText(5).Tag = Trim(.Fields("CusCode") & "")
  898.             LrText(6).Text = Trim(.Fields("PersonName") & "")                                        '业务员
  899.             LrText(6).Tag = Trim(.Fields("PersonCode") & "")
  900.             LrText(7).Text = Trim(.Fields("remark") & "")                                            '备注
  901.             LrText(8).Text = Trim(.Fields("chalkitupman") & "")                                      '记帐人
  902.             LrText(9).Text = Trim(.Fields("Maker") & "")                                             '制单人
  903.             
  904.             TextChangeLock = False    '文本框解锁
  905.             '<<]
  906.         End If
  907.         
  908.         Jsqte = WglrGrid.FixedRows
  909.         
  910.         Do While Not .EOF
  911.         
  912.             WglrGrid.AddItem ""
  913.             
  914.             '[>>显示单据分录
  915.             WglrGrid.TextMatrix(Jsqte, 0) = "*"                                                                        '数据有效行标识(必填)
  916.             WglrGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("MNumber") & "")                  '存货编码
  917.             WglrGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("MName") & "")                    '存货名称
  918.             WglrGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("Model") & "")                    '存货规格
  919.             WglrGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("PrimaryUnitName") & "")          '计量单位
  920.             
  921.             If .Fields("EMoney") <> 0 Then
  922.                 WglrGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = .Fields("EMoney")                          '金额
  923.             Else
  924.                 WglrGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = ""
  925.             End If
  926.             '<<]
  927.                    
  928.             WglrGrid.RowHeight(Jsqte) = Sjhgd
  929.             .MoveNext
  930.             Jsqte = Jsqte + 1
  931.         Loop
  932.     End With
  933.        
  934.             
  935.     '调整网格(Fixed)
  936.     Call Sub_AdjustGrid
  937.       
  938.     '计算合计数据(Fixed)
  939.     For Jsqte = Qslz To WglrGrid.Cols - 1
  940.         Call Sjhj(Jsqte)
  941.     Next Jsqte
  942.     
  943.     '将网格刷新解禁(Fixed)
  944.     WglrGrid.Redraw = True
  945.     
  946. End Sub
  947. Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
  948.      
  949.     '屏蔽文本框,下拉组合框有效性判断
  950.     Valilock = True
  951.      
  952.     '屏蔽网格失去焦点产生的有效性判断
  953.     Changelock = True
  954.          
  955.     Select Case Button.Key
  956.         Case "yl"                                            '预 览
  957.             If Fun_Drfrmyxxpd Then
  958.                 BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, False
  959.             End If
  960.         Case "dy"                                            '打 印
  961.             If Fun_Drfrmyxxpd Then
  962.                 Dim yhAnswer As Integer      '打印提示
  963.                 
  964.                 '用户确认是否打印单据
  965.                 Tsxx = "请确认是否打印当前单据?"
  966.                 yhAnswer = Xtxxts(Tsxx, 2, 2)
  967.                 If yhAnswer = 2 Then
  968.                     Exit Sub
  969.                 End If
  970.                 BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, True
  971.             End If
  972.         Case "xz"                                            '新 增
  973.             Call Sub_AddBill
  974.         Case "zh"                                            '增 行
  975.             Call zjlrfl
  976.         Case "sh"                                            '删 行
  977.             Call Scdqfl
  978.         Case "bc"                                            '保 存
  979.             If Fun_Drfrmyxxpd Then
  980.                 Call Sub_SaveBill
  981.             End If
  982.         Case "fq"                                            '放 弃
  983.             Call Sub_AbandonBill
  984.         Case "first"                                         '首 张
  985.             Call Sub_First
  986.         Case "prev"                                          '上 张
  987.             Call Sub_Prev
  988.         Case "next"                                          '下 张
  989.             Call Sub_next
  990.         Case "last"                                          '末 张
  991.             Call Sub_Last
  992.         Case "bz"                                            '帮 助
  993.             Call F1bz
  994.         Case "fh"                                            '退 出
  995.             Unload Me
  996.     End Select
  997.        
  998.     '解 锁
  999.     Valilock = False
  1000.     Changelock = False
  1001.     TextChangeLock = False
  1002.         
  1003. End Sub
  1004. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)     '支持热键操作
  1005.     
  1006.     Select Case KeyCode
  1007.         Case vbKeyF5          '增加单据
  1008.             If Tlb_Action.Buttons("xz").Enabled And Tlb_Action.Buttons("xz").Visible Then
  1009.                 Call Sub_AddBill
  1010.             End If
  1011.     End Select
  1012. End Sub
  1013. Private Sub Sub_OperStatus(Str_Status As String)                 '工具条依据不同状态所进行的变化
  1014.     
  1015.     With Tlb_Action
  1016.         Select Case Str_Status
  1017.             Case "10"   '浏览((列表)调入单据处理时的进入状态、(列表)新增状态时放弃录入)
  1018.                 '工具条
  1019.                 .Buttons("dy").Enabled = True       '打印
  1020.                 .Buttons("yl").Enabled = True       '预览
  1021.                 .Buttons("xz").Enabled = True       '新增
  1022.                 .Buttons("zh").Enabled = False      '增行
  1023.                 .Buttons("sh").Enabled = False      '删行
  1024.                 .Buttons("bc").Enabled = False      '保存
  1025.                 .Buttons("fq").Enabled = False      '放弃
  1026.                 .Buttons("first").Enabled = True    '首张
  1027.                 .Buttons("prev").Enabled = True     '上张
  1028.                 .Buttons("next").Enabled = True     '下张
  1029.                 .Buttons("last").Enabled = True     '末张
  1030.                 .Buttons("bz").Enabled = True       '帮助
  1031.                 .Buttons("fh").Enabled = True       '退出
  1032.         
  1033.                 '设置文本框录入状态
  1034.                 Call Sub_LrtextStatus(False)
  1035.             Case "20"   '新增单据((录入)新增一张单据 、(列表)新增一张单据)
  1036.                 '工具条
  1037.                 .Buttons("dy").Enabled = False      '打印
  1038.                 .Buttons("yl").Enabled = False      '预览
  1039.                 .Buttons("xz").Enabled = False      '新增
  1040.                 .Buttons("zh").Enabled = True       '增行
  1041.                 .Buttons("sh").Enabled = True       '删行
  1042.                 .Buttons("bc").Enabled = True       '保存
  1043.                 .Buttons("fq").Enabled = True       '放弃
  1044.                 .Buttons("first").Enabled = False   '首张
  1045.                 .Buttons("prev").Enabled = False    '上张
  1046.                 .Buttons("next").Enabled = False    '下张
  1047.                 .Buttons("last").Enabled = False    '末张
  1048.                 .Buttons("bz").Enabled = True       '帮助
  1049.                 .Buttons("fh").Enabled = True       '退出
  1050.                 
  1051.                 '设置文本框录入状态
  1052.                 Call Sub_LrtextStatus(True)
  1053.             Case "30"   '修改((录入)调入修改功能、(列表)调入修改功能)
  1054.                 '工具条
  1055.                 .Buttons("dy").Enabled = False      '打印
  1056.                 .Buttons("yl").Enabled = False      '预览
  1057.                 .Buttons("xz").Enabled = False      '新增
  1058.                 .Buttons("zh").Enabled = True       '增行
  1059.                 .Buttons("sh").Enabled = True       '删行
  1060.                 .Buttons("bc").Enabled = True       '保存
  1061.                 .Buttons("fq").Enabled = True       '放弃
  1062.                 .Buttons("first").Enabled = False   '首张
  1063.                 .Buttons("prev").Enabled = False    '上张
  1064.                 .Buttons("next").Enabled = False    '下张
  1065.                 .Buttons("last").Enabled = False    '末张
  1066.                 .Buttons("bz").Enabled = True       '帮助
  1067.                 .Buttons("fh").Enabled = True       '退出
  1068.                 
  1069.                 '设置文本框录入状态
  1070.                 Call Sub_LrtextStatus(True)
  1071.                             
  1072.         End Select
  1073.     End With
  1074. End Sub
  1075. Private Sub Sub_LrtextStatus(TextEnabled As Boolean)                            '设置录入文本框状态
  1076.     '录入文本框状态设置
  1077.     If TextEnabled Then
  1078.         For Jsqte = Max_Text_Index To 0 Step -1
  1079.             '判断文本框是否可编辑
  1080.             If Textboolean(Jsqte, 5) Then
  1081.                 LrText(Jsqte).Enabled = True
  1082.             Else
  1083.                 LrText(Jsqte).Enabled = False
  1084.             End If
  1085.         Next Jsqte
  1086.     Else
  1087.         For Jsqte = Max_Text_Index To 0 Step -1
  1088.             LrText(Jsqte).Enabled = False
  1089.         Next Jsqte
  1090.     End If
  1091.     
  1092.     '制单人、记帐人设置为false
  1093.     LrText(8).Enabled = False
  1094.     LrText(9).Enabled = False
  1095. End Sub
  1096. Private Sub Wbkcl()                                                 '文本框录入之前处理(根据实际情况)
  1097.     
  1098.     Dim xswbrr As String
  1099.     With WglrGrid
  1100.         Zdlrqnr = Trim(.Text)
  1101.         xswbrr = Trim(.Text)
  1102.         If GridBoolean(.Col, 3) Then   '列表框录入
  1103.             '填充列表框程序
  1104.             Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
  1105.         Else
  1106.             Wbkbhlock = True
  1107.        
  1108.             '====以下为用户自定义
  1109.             Ydtext.Text = xswbrr
  1110.             '====以上为用户自定义
  1111.          
  1112.             Wbkbhlock = False
  1113.             Ydtext.SelStart = Len(Ydtext.Text)
  1114.         End If
  1115.     End With
  1116. End Sub
  1117. Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long) As Boolean       '录入数据字段有效性判断,同时进行字段录入事后处理
  1118.  
  1119.     '函数参数:Dqpdwgh, Dqpdwgl 当前要判断网格单元所处行列值
  1120.     Dim Str_JudgeText As String                 '临时有效性判断字段内容
  1121.     Dim Coljsq As Long                          '临时列计数器
  1122.     Dim Rectemp As New ADODB.Recordset          '临时使用动态集
  1123.     Dim SqlStr As String                        '临时使用查询字符串
  1124.     With WglrGrid
  1125.         '非录入状态或非数据行则其有效性为合法
  1126.         If Yxxpdlock Or .Row < .FixedRows Then
  1127.             sjzdyxxpd = True
  1128.             Exit Function
  1129.         End If
  1130.         
  1131.         '取得当前要判断字段内容
  1132.         Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
  1133.       
  1134.         '根据不同字段进行相应的处理(依据其逻辑编号)
  1135.         Select Case GridStr(Dqpdwgl, 1)
  1136.             '[>>以下为自定义部分
  1137.             Case "001"                   '存货编码
  1138.             
  1139.                 If Not Trim(Str_JudgeText) = "" Then
  1140.                     '1.放置字段有效性判断
  1141.                     SqlStr = "SELECT MNumber,MName,Model,PrimaryUnitName,PlanPrice,InvSortCode From Gy_Material Where MNumber='" & Str_JudgeText & "' Or MName='" & Str_JudgeText & "'"
  1142.                     Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  1143.                     If Rectemp.EOF Then
  1144.                         Tsxx = "此存货编码不存在!"
  1145.                         GoTo Lrcwcl
  1146.                     End If
  1147.                     '2.放置字段事后处理程序
  1148.                     .TextMatrix(Dqpdwgh, 4) = Trim(Rectemp.Fields("Invsortcode") & "")                              '显示存货分类
  1149.                     .TextMatrix(Dqpdwgh, Sydz("002", GridStr(), Szzls)) = Trim(Rectemp.Fields("MName") & "")        '显示存货名称
  1150.                     .TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = Trim(Rectemp.Fields("Model") & "")        '显示存货规格型号
  1151.                     .TextMatrix(Dqpdwgh, Sydz("004", GridStr(), Szzls)) = Trim(Rectemp.Fields("PrimaryUnitName"))   '主计量单位
  1152.                   
  1153.                 Else
  1154.                     '3.清空相关字段
  1155.                     .TextMatrix(Dqpdwgh, 4) = ""                                                                     '存货分类
  1156.                     .TextMatrix(Dqpdwgh, Sydz("002", GridStr(), Szzls)) = ""                                         '存货名称
  1157.                     .TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = ""                                         '存货规格型号
  1158.                     .TextMatrix(Dqpdwgh, Sydz("004", GridStr(), Szzls)) = ""                                         '主计量单位
  1159.                 End If
  1160.         End Select
  1161.         
  1162.         '字段录入正确后为零字段清空(Fixed)
  1163.         Call Qkwlzd(Dqpdwgh, Dqpdwgl)
  1164.      
  1165.         '字段录入正确后进行数据合计(Fixed)
  1166.         For Coljsq = Qslz To .Cols - 1
  1167.             Call Sjhj(Coljsq)
  1168.         Next Coljsq
  1169.      
  1170.         '字段有效性判断通过,将字段有效性判断加锁直至再次改变(Fixed)
  1171.         sjzdyxxpd = True
  1172.         Yxxpdlock = True
  1173.         Exit Function
  1174.     End With
  1175.   
  1176. Lrcwcl:    '录入错误处理
  1177.     With WglrGrid
  1178.   
  1179.         '给出错误提示信息
  1180.         Call Xtxxts(Tsxx, 0, 1)
  1181.           
  1182.         '返回网格错误位置(ChangeLock避免再次引发RowColChange有效性判断),装入录入载体
  1183.         Changelock = True
  1184.         .Select Dqpdwgh, Dqpdwgl
  1185.         Changelock = False
  1186.         Call xswbk
  1187.           
  1188.         '函数返回False
  1189.         sjzdyxxpd = False
  1190.         Exit Function
  1191.     End With
  1192. End Function
  1193. Private Sub Sub_JoinCount(Lng_CountRow As Long, Lng_CountCol As Long)       '当网格列值发生改变时,处理网格列之间的关联计算(可选)
  1194.   
  1195.   '过程参数:Lng_CountRow,Lng_CountCol 网格改变内容所处行列值
  1196.    
  1197.     With WglrGrid
  1198.         Select Case GridStr(Lng_CountCol, 1)         '判断网格列对应逻辑编号
  1199.                
  1200.             '[>>以下为自定义部分
  1201.             Case Else
  1202.             '<<以上为自定义部分]
  1203.         End Select
  1204.     End With
  1205. End Sub
  1206. Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean                     '录入数据行有效性判断,同时进行行处理
  1207.  
  1208.     '函数参数:Yxxpdh 要进行有效性判断的网格数据行的行值
  1209.     Dim Lrywlz As Long                            '录入有误网格列值
  1210.     Dim Rectemp As New ADODB.Recordset            '临时使用动态集
  1211.     Dim SqlStr As String
  1212.     
  1213.     With WglrGrid
  1214.         If Yxxpdh > (.Rows - .FixedRows) Then Exit Function
  1215.         '判断行为空(行中所有可编辑列数据均为空或为零)和无效数据行则清除当前行
  1216.         If .TextMatrix(Yxxpdh, 0) <> "*" Then
  1217.             Sjhzyxxpd = True
  1218.             Exit Function
  1219.         Else
  1220.             If pdhwk(Yxxpdh) And Yxxpdh + 1 <= .Rows - 1 Then
  1221.                 '当要判断行处于网格末行时才允许删行,否则要进行有效性判断
  1222.                 If .TextMatrix(Yxxpdh + 1, 0) <> "*" Then
  1223.                     Changelock = True
  1224.                     .RemoveItem Yxxpdh
  1225.                     If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  1226.                         .AddItem ""
  1227.                         .RowHeight(.Rows - 1) = Sjhgd
  1228.                     End If
  1229.                     Changelock = False
  1230.                     Sjhzyxxpd = True
  1231.                     Exit Function
  1232.                 End If
  1233.             End If
  1234.         End If
  1235.   
  1236.         '行没有发生变化则不进行有效性判断
  1237.         If Hyxxpdlock Then
  1238.             Sjhzyxxpd = True
  1239.             Exit Function
  1240.         End If
  1241.   
  1242.         '[>>以下为自定义部分
  1243.     
  1244.         '1.放置行有效性判断程序
  1245.            
  1246.         '1.1首先进行单个不能为空或不能为零判断(Fixed)
  1247.         For Jsqte = Qslz To .Cols - 1
  1248.             
  1249.             '字段不能为空
  1250.             If GridInt(Jsqte, 5) = 1 Then
  1251.                 If Len(Trim(.TextMatrix(Yxxpdh, Jsqte))) = 0 Then
  1252.                     Tsxx = GridStr(Jsqte, 2)
  1253.                     Lrywlz = Jsqte
  1254.                     GoTo Lrcwcl
  1255.                     Exit For
  1256.                 End If
  1257.             End If
  1258.             
  1259.             '字段不能为零
  1260.             If GridInt(Jsqte, 5) = 2 Then
  1261.                 If Val(Trim(.TextMatrix(Yxxpdh, Jsqte))) = 0 Then
  1262.                     Tsxx = GridStr(Jsqte, 2)
  1263.                     Lrywlz = Jsqte
  1264.                     GoTo Lrcwcl
  1265.                     Exit For
  1266.                 End If
  1267.             End If
  1268.         Next Jsqte
  1269.         
  1270.         '1.2进行其他有效性判断,编写格式同1.1
  1271.             
  1272.         '2.放置行处理程序(当数据行通过有效性判断)
  1273.         '以上为自定义部分<<]
  1274.     End With
  1275.     '如果此行通过行有效性判断则加锁,直至此行数据再次发生变化
  1276.     Sjhzyxxpd = True
  1277.     Hyxxpdlock = True
  1278.     Exit Function
  1279. Lrcwcl:      '录入错误处理
  1280.     With WglrGrid
  1281.   
  1282.         '给出错误提示信息
  1283.         Call Xtxxts(Tsxx, 0, 1)
  1284.       
  1285.         '返回网格错误位置 (ChangeLock避免再次引发RowColChange有效性判断), 装入录入载体
  1286.         Changelock = True
  1287.         .Select Yxxpdh, Lrywlz
  1288.         Changelock = False
  1289.         Call xswbk
  1290.     
  1291.         '函数返回False
  1292.         Sjhzyxxpd = False
  1293.         Exit Function
  1294.     End With
  1295. End Function
  1296. Private Sub Sub_AddBill()                                                '新增一张单据
  1297.     
  1298.     Dim Rectemp As New ADODB.Recordset            '临时使用动态集
  1299.     Dim Jsqte As Long                             '临时计数器
  1300.    
  1301.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1302.     If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  1303.        Exit Sub
  1304.     End If
  1305.     
  1306.     '系统操作日期不在当前会计年度
  1307.     If Not Xtyear = PGKjYear Then
  1308.         Tsxx = "操作日期不在当前会计年度(" + Trim(Str(PGKjYear)) + ")之内,请重新登录!"
  1309.         Call Xtxxts(Tsxx, 0, 1)
  1310.         Exit Sub
  1311.     End If
  1312.     
  1313.     '系统操作日期是否在当前会计期间
  1314.     If Not Xtmm = PGNowmon Then
  1315.         Tsxx = "操作日期不在当前会计期间(" + Trim(Str(PGKjYear)) + "." + Trim(Str(PGNowmon)) + ")之内,请重新登录!"
  1316.         Call Xtxxts(Tsxx, 0, 1)
  1317.         Exit Sub
  1318.     End If
  1319.     
  1320.     '设置操作状态为浏览,选择仓库后状态为新增(Fixed)
  1321.     Lab_OperStatus.Caption = "2"
  1322.        
  1323.     '设置工具条状态(Fixed)
  1324.     Call Sub_OperStatus("20")
  1325.    
  1326.     '清空VouchID(Fixed)
  1327.     Lab_BillId.Caption = ""
  1328.       
  1329.     '录入文本框清除内容
  1330.     For Jsqte = Max_Text_Index To 0 Step -1
  1331.         LrText(Jsqte).Tag = ""
  1332.         LrText(Jsqte).Text = ""
  1333.     Next Jsqte
  1334.    
  1335.     '[>>显示制单人,此处还可以设置录入默认值如自动生成单据号、默认单据录入日期注意加锁
  1336.     LrText(8).Text = ""
  1337.     LrText(9).Text = Xtczy
  1338.             
  1339.     LrText(0).Enabled = False
  1340.     
  1341.     '设置单据日期默认为系统业务日期
  1342.     TextChangeLock = True
  1343.     LrText(1).Text = Format(Xtrq, "yyyy-mm-dd")
  1344.     TextChangeLock = False
  1345.    
  1346.     '<<]
  1347.    
  1348.     '重置网格(Fixed)
  1349.     With WglrGrid
  1350.         .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1351.         For Jsqte = .FixedRows To .Rows - 1
  1352.             .RowHeight(Jsqte) = Sjhgd
  1353.         Next Jsqte
  1354.         WglrGrid.Clear 1
  1355.         Changelock = True
  1356.         .Select .FixedRows, Qslz
  1357.         Changelock = False
  1358.     End With
  1359.    
  1360.     '计算合计数据(清零)(Fixed)
  1361.     For Jsqte = Qslz To WglrGrid.Cols - 1
  1362.         Call Sjhj(Jsqte)
  1363.     Next Jsqte
  1364.     
  1365.     '让第一个录入项得到焦点(Fixed)
  1366.     On Error Resume Next
  1367.     LrText(1).SetFocus
  1368.     
  1369. End Sub
  1370. Private Sub Sub_AbandonBill()                                              '放弃对当前单据的操作
  1371.  
  1372.     Dim Jsqte As Long                    '临时使用计数器
  1373.   
  1374.     '先关闭录入载体(Fixed)
  1375.     Changelock = True
  1376.     Valilock = True
  1377.     Call Ycwbk
  1378.     Changelock = False
  1379.     Valilock = False
  1380.     '如果单据有效则重新显示当前单据,置单据为空状态
  1381.     If Not Rec_Query.EOF Then
  1382.         Lab_BillId.Caption = Rec_Query.Fields("InOutAdjustMainId")
  1383.         Call Sub_ShowBill
  1384.     Else
  1385.         '单据ID置为0
  1386.         Lab_BillId.Caption = 0
  1387.      
  1388.         '清除录入文本框
  1389.         For Jsqte = Max_Text_Index To 0 Step -1
  1390.             LrText(Jsqte).Tag = ""
  1391.             LrText(Jsqte).Text = ""
  1392.         Next Jsqte
  1393.         '重置网格(Fixed)
  1394.         With WglrGrid
  1395.             .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1396.             For Jsqte = .FixedRows To .Rows - 1
  1397.                 .RowHeight(Jsqte) = Sjhgd
  1398.             Next Jsqte
  1399.             WglrGrid.Clear 1
  1400.             Changelock = True
  1401.             .Select .FixedRows, Qslz
  1402.             Changelock = False
  1403.         End With
  1404.         '计算合计数据(清零)(Fixed)
  1405.         For Jsqte = Qslz To WglrGrid.Cols - 1
  1406.             Call Sjhj(Jsqte)
  1407.         Next Jsqte
  1408.     End If
  1409.     
  1410.     '设置操作状态为浏览
  1411.     Lab_OperStatus = "1"
  1412.     Call Sub_OperStatus("10")
  1413.     
  1414. End Sub
  1415. Private Function Sub_SaveBill() As Boolean                                   '保 存 单 据
  1416.   
  1417.     Dim Rectemp As New ADODB.Recordset                    '临时使用动态集
  1418.     Dim RecTempFz As New ADODB.Recordset                  '临时使用动态集
  1419.     Dim RectempMx As New ADODB.Recordset                  '临时使用动态集
  1420.     Dim RecTempZz As New ADODB.Recordset                  '临时使用动态集
  1421.     Dim Rec_VouchMain As New ADODB.Recordset              '单据主表动态集
  1422.     Dim Rec_VouchSub As New ADODB.Recordset               '单据子表动态集
  1423.     Dim Rowjsq As Long                                    '网格行计数器
  1424.     Dim Coljsq As Long                                    '网格列计数器
  1425.     Dim Jsqte As Integer                                  '临时计数器
  1426.     Dim Lng_RowCount As Long                              '有效数据行计数器
  1427.     Dim Lrywlz As Long                                    '录入有误列值
  1428.     Dim SqlStr As String                                  'SQL语句
  1429.     Dim DiffE As Double                                   '差异额
  1430.     Dim mPeriod As Integer                                '当前会计期间
  1431.   
  1432.     Sub_SaveBill = False
  1433.   
  1434.     '一.============先对单据内容进行有效性判断==============='
  1435.   
  1436.     '先进行字段不能为空或不能为零有效性判断(Fixed)
  1437.     For Jsqte = 0 To Max_Text_Index
  1438.         If Textint(Jsqte, 8) = 1 Then     '字段不能为空
  1439.             If Len(Trim(LrText(Jsqte).Text)) = 0 Then
  1440.                 Tsxx = Textstr(Jsqte, 7) & "不能为空!"
  1441.                 Call Xtxxts(Tsxx, 0, 1)
  1442.                 LrText(Jsqte).SetFocus
  1443.                 Exit Function
  1444.             End If
  1445.         Else
  1446.             If Textint(Jsqte, 8) = 2 Then   '字段不能为零
  1447.                 If Val(Trim(LrText(Jsqte).Text)) = 0 Then
  1448.                     Tsxx = Textstr(Jsqte, 7) & "不能为零!"
  1449.                     Call Xtxxts(Tsxx, 0, 1)
  1450.                     LrText(Jsqte).SetFocus
  1451.                     Exit Function
  1452.                 End If
  1453.             End If
  1454.         End If
  1455.     Next Jsqte
  1456.     
  1457.     '对需要进行事后判断的文本框录入内容进行有效性判断 (Fixed)
  1458.     For Jsqte = 0 To Max_Text_Index
  1459.         If Textint(Jsqte, 9) = 0 Or Textint(Jsqte, 9) = 2 Then
  1460.             If Not TextYxxpd(Jsqte) Then
  1461.                 Call TextShow(Jsqte)
  1462.                 Exit Function
  1463.             End If
  1464.         End If
  1465.     Next Jsqte
  1466.   
  1467.     '[>>
  1468.   
  1469.     '可在此区域写入其他对单据表头内容的有效性判断.
  1470.     
  1471.     '单据录入日期是否在当前年度
  1472.     If Not Year(CDate(LrText(1))) = PGKjYear Then
  1473.         Tsxx = "操作日期不在当前会计年度(" + Trim(Str(PGKjYear)) + ")之内!"
  1474.         Call Xtxxts(Tsxx, 0, 1)
  1475.         Exit Function
  1476.     End If
  1477.     
  1478.     mPeriod = PGNowmon
  1479.     
  1480.     '单据日期必须在当前会计期间
  1481.     If Month(LrText(1).Text) <> mPeriod Then
  1482.         Tsxx = "操作日期不在当前会计期间(" + Trim(Str(PGKjYear)) + "." + Trim(Str(mPeriod)) + ")之内!"
  1483.         Call Xtxxts(Tsxx, 0, 1)
  1484.         Exit Function
  1485.     End If
  1486.     '<<]
  1487.   
  1488.     '[>>下面将对所有有效数据行进行有效性判断
  1489.   
  1490.     Lng_RowCount = 0
  1491.   
  1492.     With WglrGrid
  1493.         For Rowjsq = .FixedRows To .Rows - 1
  1494.             '带*号者为有效数据行(Fixed)
  1495.             If .TextMatrix(Rowjsq, 0) <> "*" Then
  1496.                 Exit For
  1497.             Else
  1498.                 Lng_RowCount = Lng_RowCount + 1
  1499.             End If
  1500.             '1.首先进行为空或为零判断(Fixed)
  1501.             For Jsqte = Qslz To .Cols - 1
  1502.             
  1503.                 '字段不能为空
  1504.                 If GridInt(Jsqte, 5) = 1 Then
  1505.                     If Len(Trim(.TextMatrix(Rowjsq, Jsqte))) = 0 Then
  1506.                         Tsxx = GridStr(Jsqte, 2)
  1507.                         Lrywlz = Jsqte
  1508.                         GoTo Lrcwcl
  1509.                         Exit For
  1510.                     End If
  1511.                 End If
  1512.                 
  1513.                 '字段不能为零
  1514.                 If GridInt(Jsqte, 5) = 2 Then
  1515.                     If Val(Trim(.TextMatrix(Rowjsq, Jsqte))) = 0 Then
  1516.                         Tsxx = GridStr(Jsqte, 2)
  1517.                         Lrywlz = Jsqte
  1518.                         GoTo Lrcwcl
  1519.                         Exit For
  1520.                     End If
  1521.                 End If
  1522.             Next Jsqte
  1523.            
  1524.             '2.判断存货编码是否存在(Define)
  1525.             SqlStr = "SELECT MNumber From Gy_Material Where MNumber='" & Trim(.TextMatrix(Rowjsq, Sydz("001", GridStr(), Szzls))) & "'"
  1526.             Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  1527.             If Rectemp.EOF Then
  1528.                 Tsxx = "此存货编码不存在!"
  1529.                 Lrywlz = Sydz("001", GridStr(), Szzls)
  1530.                 GoTo Lrcwcl
  1531.             End If
  1532.         Next Rowjsq
  1533.      
  1534.         '单据分录行数不能为零(Fixed)
  1535.         If Lng_RowCount = 0 Then
  1536.             Tsxx = "单据分录行数不能为零!"
  1537.             Call Xtxxts(Tsxx, 0, 1)
  1538.             Exit Function
  1539.         End If
  1540.         
  1541.         '[>>
  1542.         '此处可以定义整张单据不能通过有效性检查的理由
  1543.         '<<]
  1544.     End With  '网格
  1545.    
  1546.    
  1547.     '二.=============如果以上有效性检查均顺利通过,则执行存盘动作============'
  1548.    
  1549.     '对存盘进行事务处理(Fixed)
  1550.     On Error GoTo Swcwcl
  1551.     Cw_DataEnvi.DataConnect.BeginTrans
  1552.     
  1553.     '判断单据状态以进行不同处理
  1554.     
  1555.     '1.先对单据主表进行处理
  1556.     
  1557.         '新增单据
  1558.         
  1559.         '1.对于某些单据号自动生成的单据则可在此处自动生成
  1560.          LrText(0).Text = CreatBillCode(BillCode, True, , , Trim(LrText(3).Tag))
  1561.     
  1562.         '2.开始存盘
  1563.          
  1564.         '打开单据主表动态集
  1565.         If Rec_VouchMain.State = 1 Then Rec_VouchMain.Close
  1566.         Rec_VouchMain.Open "Select * From chhs_inoutadjustmain Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  1567.              
  1568.         With Rec_VouchMain
  1569.             .AddNew
  1570.             .Fields("InOutAdjustMainId") = CreatBillID(BillCode)                            '单据ID
  1571.             .Fields("BillCode") = BillCode                                                  '单据类型
  1572.             .Fields("BillNum") = Trim(LrText(0).Text)                                       '单据号
  1573.             .Fields("BillDate") = CDate(LrText(1).Text)                                     '日期
  1574.             .Fields("WhCode") = Trim(LrText(3).Tag)                                         '仓库
  1575.             .Fields("InoutClassCode") = Trim(LrText(4).Tag)                                 '入库类别
  1576.             .Fields("DeptCode") = Trim(LrText(2).Tag)                                       '部门
  1577.             .Fields("CusCode") = Trim(LrText(5).Tag)                                        '供应商
  1578.             .Fields("PersonCode") = Trim(LrText(6).Tag)                                     '业务员
  1579.             .Fields("Remark") = Trim(LrText(7).Text)                                        '备注
  1580.             .Fields("Maker") = Xtczy                                                        '制单人
  1581.             .Fields("ChalkitupMan") = Xtczy                                                 '记帐人
  1582.             .Fields("KjYear") = Xtyear                                                      '会计年
  1583.             .Fields("Period") = mPeriod                                                      '会计月
  1584.             .Fields("InOutFlag") = 0                                                       '收发标志
  1585.             .Update
  1586.             
  1587.             '系统读出单据ID写入Lab_BillID
  1588.             Lab_BillId.Caption = .Fields("InOutAdjustMainId")
  1589.         End With
  1590.          
  1591.     '2.对单据子表进行处理
  1592.          
  1593.     '打开单据子表动态集
  1594.     If Rec_VouchSub.State = 1 Then Rec_VouchSub.Close
  1595.     Rec_VouchSub.Open "Select * From Chhs_InOutAdjustSub Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  1596.      
  1597.     '将网格中有效数据行写入单据子表
  1598.     For Rowjsq = WglrGrid.FixedRows To WglrGrid.Rows - 1
  1599.         If WglrGrid.TextMatrix(Rowjsq, 0) <> "*" Then
  1600.             Exit For
  1601.         End If
  1602.         
  1603.         With Rec_VouchSub
  1604.             .AddNew
  1605.             .Fields("InOutAdjustSubId") = Rowjsq - WglrGrid.FixedRows + 1                                            '单据记录顺序号
  1606.             .Fields("InOutAdjustMainId") = Val(Lab_BillId.Caption)                                                   '单据ID
  1607.             .Fields("MNumber") = Trim(WglrGrid.TextMatrix(Rowjsq, Sydz("001", GridStr(), Szzls)))                    '存货编码
  1608.             .Fields("EMoney") = Val(WglrGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), Szzls)))                      '金额
  1609.             .UpdateBatch
  1610.                 
  1611.             '调整单入明细帐
  1612.             If RecTempFz.State = 1 Then RecTempFz.Close
  1613.             RecTempFz.Open "select * from chhs_list where 1=2 ", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockBatchOptimistic
  1614.             RecTempFz.AddNew
  1615.             RecTempFz.Fields("inoutflag") = 0
  1616.             RecTempFz.Fields("billnum") = Trim(LrText(0).Text)
  1617.             RecTempFz.Fields("billdate") = CDate(LrText(1).Text)
  1618.             RecTempFz.Fields("deptcode") = Trim(LrText(2).Tag)
  1619.             RecTempFz.Fields("whcode") = Trim(LrText(3).Tag)
  1620.             RecTempFz.Fields("inoutclasscode") = Trim(LrText(4).Tag)
  1621.             RecTempFz.Fields("personcode") = Trim(LrText(5).Tag)
  1622.             RecTempFz.Fields("cuscode") = Trim(LrText(6).Tag)
  1623.             RecTempFz.Fields("remark") = Trim(LrText(7).Text)
  1624.             RecTempFz.Fields("mnumber") = Trim(WglrGrid.TextMatrix(Rowjsq, Sydz("001", GridStr(), Szzls)))
  1625.             RecTempFz.Fields("inoutadjustmainid") = .Fields("inoutadjustmainid")
  1626.             RecTempFz.Fields("inoutadjustsubid") = .Fields("inoutadjustsubid")
  1627.             '期末处理差异
  1628.             If Qmclcy And Trim(PriceMode) = "计划价法" Then
  1629.                 RecTempFz.Fields("dfdiff") = Val(WglrGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), Szzls)))
  1630.             Else
  1631.                 RecTempFz.Fields("outmoney") = Val(WglrGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), Szzls)))
  1632.             End If
  1633.             RecTempFz.Fields("billcode") = BillCode
  1634.             RecTempFz.Fields("kjyear") = Xtyear
  1635.             RecTempFz.Fields("period") = mPeriod
  1636.             RecTempFz.Fields("chalkdate") = CDate(LrText(1).Text)
  1637.             RecTempFz.Fields("chalkitupman") = Xtczy
  1638.             RecTempFz.Fields("maker") = Xtczy
  1639.             
  1640.             '存货科目
  1641.             Xtfhcs = ""
  1642.             Xtfhcsfz = ""
  1643.             Call MaccCode(Trim(RecTempFz.Fields("whcode")), Trim(RecTempFz.Fields("mnumber")), Trim(WglrGrid.TextMatrix(Rowjsq, 4)))
  1644.             RecTempFz.Fields("mateacct") = Xtfhcs
  1645.             If Qmclcy And RecTempFz.Fields("dfdiff") <> 0 Then
  1646.                 RecTempFz.Fields("diffacct") = Xtfhcsfz
  1647.             End If
  1648.             
  1649.             '对方科目
  1650.             Xtfhcs = ""
  1651.             Call DfaccCode(Trim(RecTempFz.Fields("inoutclasscode") & ""), Trim(RecTempFz.Fields("deptcode") & ""), Trim(WglrGrid.TextMatrix(Rowjsq, 4)), Trim(RecTempFz.Fields("mnumber")))
  1652.             RecTempFz.Fields("dfacct") = Xtfhcs
  1653.             
  1654.             RecTempFz.UpdateBatch
  1655.                 
  1656.             '调整总帐
  1657.             If RecTempZz.State = 1 Then RecTempZz.Close
  1658.             SqlStr = "select * from chhs_mate where kjyear=" & Xtyear & " and period=" & PGNowmon & _
  1659.                 " and whcode='" & Trim(LrText(3).Tag) & "'" & _
  1660.                 " and mnumber='" & Trim(WglrGrid.TextMatrix(Rowjsq, Sydz("001", GridStr(), Szzls))) & "'"
  1661.             RecTempZz.Open SqlStr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockBatchOptimistic
  1662.             If Not RecTempZz.EOF Then
  1663.                 DiffE = Val(WglrGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), Szzls)))
  1664.                 If Qmclcy And Trim(PriceMode) = "计划价法" Then
  1665.                     RecTempZz.Fields("dfdiff") = RecTempZz.Fields("dfdiff") + DiffE
  1666.                 Else
  1667.                    RecTempZz.Fields("outmoney") = RecTempZz.Fields("outmoney") + DiffE
  1668.                 End If
  1669.                 RecTempZz.UpdateBatch
  1670.             End If
  1671.             
  1672.             If PriceMode = "移动平均法" Then
  1673.                  SqlStr = "select * from chhs_v_list where whcode='" & Trim(RecTempFz.Fields("whcode")) & "'" & _
  1674.                          " and mnumber='" & Trim(RecTempFz.Fields("mnumber")) & "' " & _
  1675.                          " and billdate>='" & Trim(LrText(1).Text) & "'and InoutFlag=0 and InOutMainId<>0 " & _
  1676.                          " and kjyear=" & Xtyear & " and period=" & mPeriod & " order by billdate,listid"
  1677.                  Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  1678.                  Do While Not Rectemp.EOF
  1679.                  
  1680.                     If Not Rectemp.Fields("sfjeztflag") Then
  1681.                         '入库金额汇总
  1682.                         SumQuan = 0
  1683.                         SumMoney = 0
  1684.                         MovePrice = 0
  1685.                         
  1686.                         SqlStr = "SELECT SUM(InQuan)-SUM(OutQuan) AS SumQuan,SUM(InMoney)-SUM(OutMoney)AS SumMoney  " & _
  1687.                                 " FROM Chhs_List a where kjyear=" & Xtyear & _
  1688.                                 " and period<=" & mPeriod & " and Inoutmainid<> " & Rectemp.Fields("inoutmainid") & _
  1689.                                 " and a.whcode='" & Trim(Rectemp.Fields("whcode")) & "'" & _
  1690.                                 " and a.mnumber='" & Trim(Rectemp.Fields("mnumber")) & "'" & _
  1691.                                 " and a.billdate<='" & Rectemp.Fields("billdate") & "'"
  1692.                         Set RecTempFz = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  1693.                         If Not RecTempFz.EOF Then
  1694.                             If Not IsNull(RecTempFz.Fields("SumQuan")) Then
  1695.                                 SumQuan = RecTempFz.Fields("SumQuan")
  1696.                             End If
  1697.                             If Not IsNull(RecTempFz.Fields("SumMoney")) Then
  1698.                                 SumMoney = RecTempFz.Fields("SumMoney")
  1699.                             End If
  1700.                         End If
  1701.                         
  1702.                         If SumQuan <> 0 Then
  1703.                             MovePrice = Format(SumMoney / SumQuan, "###0." + String(Xtdjxsws, "0"))
  1704.                         End If
  1705.                         
  1706.                         '移动平均单价<=0时,手工输入单价
  1707.                         If MovePrice <= 0 Then
  1708.                             Tsxx = "移动平均单价<=0,不允许记帐!"
  1709.                             GoTo Mocwcl
  1710.                         End If
  1711.                         
  1712.                         '调整移动平均单价
  1713.                         If RectempMx.State = 1 Then RectempMx.Close
  1714.                         RectempMx.Open "select * from chhs_list where inoutmainid=" & Rectemp.Fields("inoutmainid") & " and inoutsubid=" & Rectemp.Fields("inoutsubid") & " ", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockBatchOptimistic
  1715.                         If Not Rectemp.EOF Then
  1716.                             RectempMx.Fields("outprice") = MovePrice
  1717.                             RectempMx.Fields("outmoney") = Format(RectempMx.Fields("outquan") * MovePrice, "####0." + String(Xtjexsws, "0"))
  1718.                             RectempMx.UpdateBatch
  1719.                             
  1720.                             Cw_DataEnvi.DataConnect.Execute ("update gy_inoutsub set price=" & MovePrice & ",issuemoney=" & Rectemp.Fields("outmoney") & " where inoutmainid=" & Rectemp.Fields("inoutmainid") & " and inoutsubid=" & Rectemp.Fields("inoutsubid"))
  1721.                         Else
  1722.                             GoTo Swcwcl
  1723.                         End If
  1724.                      End If
  1725.                      Rectemp.MoveNext
  1726.                  Loop
  1727.                  
  1728.                  '调整总帐
  1729.                  SqlStr = "SELECT SUM(InQuan) AS SumInQuan,SUM(InMoney) AS SumInMoney,  " & _
  1730.                              "SUM(OutQuan) AS SumOutQuan,SUM(OutMoney) AS SumOutMoney" & _
  1731.                              " FROM Chhs_List a where kjyear=" & Xtyear & _
  1732.                              " and period=" & mPeriod & " and a.StartFlag=0 " & _
  1733.                              " and whcode='" & Trim(LrText(3).Tag) & "'" & _
  1734.                              " and mnumber='" & Trim(WglrGrid.TextMatrix(Rowjsq, Sydz("001", GridStr(), Szzls))) & "'"
  1735.                  Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  1736.                  If Not Rectemp.EOF Then
  1737.                     If RecTempZz.State = 1 Then RecTempZz.Close
  1738.                     RecTempZz.Open "select * from chhs_mate where kjyear=" & Xtyear & _
  1739.                                 " and period=" & mPeriod & "  " & _
  1740.                                 " and whcode='" & Trim(LrText(3).Tag) & "'" & _
  1741.                                 " and mnumber='" & Trim(WglrGrid.TextMatrix(Rowjsq, Sydz("001", GridStr(), Szzls))) & "'"
  1742.                     If Not RecTempZz.EOF Then
  1743.                         If Not IsNull(Rectemp.Fields("suminquan")) Then
  1744.                              RecTempZz.Fields("inquan") = Rectemp.Fields("suminquan")
  1745.                         Else
  1746.                             RecTempZz.Fields("inquan") = 0
  1747.                         End If
  1748.                         If Not IsNull(Rectemp.Fields("suminmoney")) Then
  1749.                             RecTempZz.Fields("inmoney") = Rectemp.Fields("suminmoney")
  1750.                         Else
  1751.                             RecTempZz.Fields("inmoney") = 0
  1752.                         End If
  1753.                         If RecTempZz.Fields("inquan") <> 0 And RecTempZz.Fields("inmoney") <> 0 Then
  1754.                             RecTempZz("inprice") = RecTempZz.Fields("inmoney") / RecTempZz("inquan")
  1755.                         End If
  1756.                         If Not IsNull(Rectemp.Fields("sumoutquan")) Then
  1757.                             RecTempZz.Fields("outquan") = Rectemp.Fields("sumoutquan")
  1758.                         Else
  1759.                             RecTempZz.Fields("outquan") = 0
  1760.                         End If
  1761.                         If Not IsNull(Rectemp.Fields("sumoutquan")) Then
  1762.                             RecTempZz.Fields("outmoney") = Rectemp.Fields("sumoutquan")
  1763.                         Else
  1764.                             RecTempZz.Fields("outmoney") = 0
  1765.                         End If
  1766.                         If RecTempZz.Fields("outquan") <> 0 And RecTempZz.Fields("outmoney") <> 0 Then
  1767.                             RecTempZz("outprice") = RecTempZz.Fields("outmoney") / RecTempZz("outquan")
  1768.                         End If
  1769.                     End If
  1770.                     RecTempZz.UpdateBatch
  1771.                 End If
  1772.             End If
  1773.         End With
  1774.     Next Rowjsq
  1775.     
  1776.     Cw_DataEnvi.DataConnect.CommitTrans
  1777.     
  1778.     Sub_SaveBill = True
  1779.     Tsxx = "单据存盘完毕! 单据号:" & Trim(LrText(0).Text)
  1780.     Call Xtxxts(Tsxx, 0, 4)
  1781.     
  1782.     '标识单据发生改动
  1783.     Bln_BillChange = True
  1784.     
  1785.     '设置单据改变后的状态
  1786.     Lab_OperStatus = "1"
  1787.     Call Sub_OperStatus("10")
  1788.     Rec_Query.Requery
  1789.     Rec_Query.Find "InOutAdjustMainId=" & Val(Lab_BillId.Caption)
  1790.     
  1791.     Exit Function
  1792. Swcwcl:       '数据存盘时出现错误
  1793.     Cw_DataEnvi.DataConnect.RollbackTrans
  1794.     With WglrGrid
  1795.         If Err.Number = -2147217887 Then
  1796.             Tsxx = "单据中第  " & Trim(Str(Rowjsq - .FixedRows + 1)) & " 条分录录入数据超出允许范围!"
  1797.             Call Xtxxts(Tsxx, 0, 1)
  1798.             Changelock = True
  1799.             .Select Rowjsq, Qslz
  1800.             WglrGrid.SetFocus
  1801.             Changelock = False
  1802.             Exit Function
  1803.         Else
  1804.             Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
  1805.             Call Xtxxts(Tsxx, 0, 1)
  1806.             Exit Function
  1807.         End If
  1808.     End With
  1809. Lrcwcl:        '录入错误处理(存盘前逐行有效性判断)
  1810.     With WglrGrid
  1811.         Call Xtxxts("(第 " & Trim(Str(Rowjsq - .FixedRows + 1)) & " 条单据分录)-" & Tsxx, 0, 1)
  1812.         Changelock = True
  1813.         .Select Rowjsq, Lrywlz
  1814.         WglrGrid.SetFocus
  1815.         Changelock = False
  1816.         Exit Function
  1817.     End With
  1818. Mocwcl:
  1819.     Cw_DataEnvi.DataConnect.RollbackTrans
  1820.     With WglrGrid
  1821.         Call Xtxxts(Tsxx, 0, 1)
  1822.         Changelock = True
  1823.         .Select Rowjsq, Lrywlz
  1824.         WglrGrid.SetFocus
  1825.         Changelock = False
  1826.         Exit Function
  1827.     End With
  1828.     
  1829. End Function
  1830. '选择首张,上张,下张,末张(此4个过程只需用您的单据ID字段名替换"OrderBillMainId"即可)
  1831. Private Sub Sub_First()             '首 张
  1832.     
  1833.     With Rec_Query
  1834.         If .RecordCount = 0 Then
  1835.             Exit Sub
  1836.         End If
  1837.         .MoveFirst
  1838.         Lab_BillId.Caption = .Fields("InOutAdjustMainId")
  1839.         Call Sub_ShowBill
  1840.     End With
  1841. End Sub
  1842. Private Sub Sub_Prev()             '上 张
  1843.     
  1844.     With Rec_Query
  1845.         If .RecordCount = 0 Then
  1846.             Exit Sub
  1847.         End If
  1848.         If Not .BOF Then
  1849.             .MovePrevious
  1850.         End If
  1851.         If Not .BOF Then
  1852.             Lab_BillId.Caption = .Fields("InOutAdjustMainId")
  1853.         Else
  1854.             .MoveNext
  1855.         End If
  1856.         Call Sub_ShowBill
  1857.     End With
  1858. End Sub
  1859. Private Sub Sub_next()             '下 张
  1860.     With Rec_Query
  1861.         If .RecordCount = 0 Then
  1862.             Exit Sub
  1863.         End If
  1864.         If Not .EOF Then
  1865.             .MoveNext
  1866.         End If
  1867.         If Not .EOF Then
  1868.             Lab_BillId.Caption = .Fields("InOutAdjustMainId")
  1869.         Else
  1870.             .MovePrevious
  1871.         End If
  1872.         Call Sub_ShowBill
  1873.     End With
  1874. End Sub
  1875. Private Sub Sub_Last()              '末 张
  1876.     
  1877.     With Rec_Query
  1878.         If .RecordCount = 0 Then
  1879.             Exit Sub
  1880.         End If
  1881.         .MoveLast
  1882.         Lab_BillId.Caption = .Fields("InOutAdjustMainId")
  1883.         Call Sub_ShowBill
  1884.     End With
  1885. End Sub
  1886.     
  1887. '[>>===================以下为根据实际业务需要自定义过程区域=============================<<]
  1888. '[>>===================以上为根据实际业务需要自定义过程区域=============================<<]
  1889. '===================以 下 程 序 为 通 用 部 分 ,一 般 不 需 更 改(程序动作部分)======================='
  1890. Private Sub Sub_AdjustGrid()
  1891.   
  1892.     '调 整 网 格
  1893.     With WglrGrid
  1894.         '加 1 保持一行录入行
  1895.         If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  1896.             .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1897.             For Jsqte = .FixedRows To .Rows - 1
  1898.                 .RowHeight(Jsqte) = Sjhgd
  1899.             Next Jsqte
  1900.         End If
  1901.         
  1902.         '判断是否有辅助行和录入行,如没有则加行
  1903.         Do While .TextMatrix(.Rows - 1 - Fzxwghs, 0) = "*"
  1904.             .AddItem ""
  1905.             .RowHeight(.Rows - 1) = Sjhgd
  1906.         Loop
  1907.     
  1908.     End With
  1909. End Sub
  1910. Private Sub Lrzdbz()                                                      '录入字段帮助
  1911.     
  1912.     If Not Ydcommand.Visible Then
  1913.         Exit Sub
  1914.     End If
  1915.    
  1916.     With WglrGrid
  1917.         Valilock = True
  1918.     
  1919.         '处理通用部分
  1920.         Changelock = True        '调入另外窗体必须加锁
  1921.         Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
  1922.         Changelock = False
  1923.         
  1924.         If Len(Xtfhcs) <> 0 Then
  1925.             If GridInt(.Col, 7) = 0 Then
  1926.                 Ydtext.Text = Xtfhcs
  1927.             Else
  1928.                 Ydtext.Text = Xtfhcsfz
  1929.             End If
  1930.         End If
  1931.         
  1932.         Valilock = False
  1933.         If Ydtext.Visible Then
  1934.             Ydtext.SetFocus
  1935.         End If
  1936.     End With
  1937. End Sub
  1938. Private Sub Cshhjwg()                                                     '初始化合计网格(*对合计网格来说,录入网格为容器)
  1939.     
  1940.     With HjGrid
  1941.     
  1942.        '是否显示合计网格
  1943.        If Not Sfxshjwg Then
  1944.            .Visible = False
  1945.            Exit Sub
  1946.        Else
  1947.            .Visible = True
  1948.        End If
  1949.       
  1950.        '设置网格相关属性
  1951.        .Enabled = False
  1952.        .Appearance = flexFlat
  1953.        .BorderStyle = flexBorderNone
  1954.        .ScrollBars = flexScrollBarNone
  1955.        .Width = WglrGrid.Width
  1956.        .FixedRows = 0
  1957.        .Rows = 1
  1958.        .Cols = WglrGrid.Cols
  1959.        .LeftCol = WglrGrid.LeftCol
  1960.        .TextMatrix(0, Qslz) = "合  计"
  1961.        For Jsqte = 0 To WglrGrid.Cols - 1
  1962.            .ColHidden(Jsqte) = WglrGrid.ColHidden(Jsqte)
  1963.            .ColWidth(Jsqte) = WglrGrid.ColWidth(Jsqte)
  1964.            .ColAlignment(Jsqte) = WglrGrid.ColAlignment(Jsqte)
  1965.            .ColFormat(Jsqte) = WglrGrid.ColFormat(Jsqte)
  1966.        Next Jsqte
  1967.        .ColAlignment(Qslz) = flexAlignCenterTop
  1968.        For Jsqte = .FixedRows To .Rows - 1
  1969.            .RowHeight(Jsqte) = .Height / .Rows
  1970.        Next Jsqte
  1971.        
  1972.       '程序自动调整网格高度(自动设置为网格剩余高度+辅助项网格行数(默认为1)*数据行高度)、并设置其位置信息
  1973.        .Height = Fzxwghs * Sjhgd + ((WglrGrid.Height - WglrGrid.FixedRows * WglrGrid.RowHeight(0)) Mod Sjhgd)
  1974.        .RowHeight(0) = .Height
  1975.        .Move 0, WglrGrid.Height - .Height, WglrGrid.Width, .Height
  1976.     End With
  1977. End Sub
  1978. Private Sub Form_Resize()                                                '窗体大小发生变化时,重新显示文本框
  1979.    Call Cxxswbk
  1980. End Sub
  1981. Private Function Fun_Drfrmyxxpd() As Boolean                             '调入其它窗体或功能产生的有效性判断(包括数据回写)
  1982.     Fun_Drfrmyxxpd = True
  1983.     With WglrGrid
  1984.    
  1985.         '如果文本框处于编辑状态,则先进性文本框的有效性判断
  1986.         If Ydcommand1.Visible Then
  1987.            If Not TextYxxpd(Ydcommand1.Tag) Then
  1988.               Fun_Drfrmyxxpd = False
  1989.               Exit Function
  1990.            End If
  1991.         End If
  1992.         
  1993.         '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
  1994.         If Ydtext.Visible Or YdCombo.Visible Then
  1995.             Call Lrsjhx
  1996.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1997.                 Fun_Drfrmyxxpd = False
  1998.                 Exit Function
  1999.             End If
  2000.         End If
  2001.    
  2002.         '进行行有效性判断
  2003.         If Not Sjhzyxxpd(.Row) Then
  2004.             Fun_Drfrmyxxpd = False
  2005.             Exit Function
  2006.         End If
  2007.     End With
  2008. End Function
  2009. Private Sub WglrGrid_AfterUserResize(ByVal Row As Long, ByVal Col As Long)       '调整列宽
  2010.     
  2011.     If HjGrid.Visible Then
  2012.         With HjGrid
  2013.             .ColWidth(Col) = WglrGrid.ColWidth(Col)
  2014.         End With
  2015.     End If
  2016. End Sub
  2017. Private Sub WglrGrid_EnterCell()                                                 '显示当前数据行相关信息
  2018.     
  2019.     With WglrGrid
  2020.         If .Row >= .FixedRows Then
  2021.             '[>>
  2022.             '此处可以填写显示与此网格行相关信息
  2023.             '<<]
  2024.         End If
  2025.     End With
  2026. End Sub
  2027. Private Sub WglrGrid_GotFocus()                                     '网格得到焦点
  2028.     '网格得到焦点,如果当前选择行为非数据行
  2029.     '则调整当前焦点至有效数据行
  2030.     With WglrGrid
  2031.         If .Row < .FixedRows And .Rows > .FixedRows Then
  2032.             Changelock = True
  2033.             .Select .FixedRows, .Col
  2034.             Changelock = False
  2035.         End If
  2036.         If .Col < Qslz Then
  2037.             Changelock = True
  2038.             .Select .Row, Qslz
  2039.             Changelock = False
  2040.         End If
  2041.     End With
  2042. End Sub
  2043. Private Sub WglrGrid_LostFocus()                                    '录入网格失去焦点
  2044.     '用以屏蔽调用其它窗体时发生网格失去焦点事件
  2045.     If Changelock Then
  2046.         Exit Sub
  2047.     End If
  2048.     '引发网格RowcolChange事件
  2049.     With WglrGrid
  2050.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  2051.             .Select 0, 0
  2052.         End If
  2053.     End With
  2054. End Sub
  2055. Private Sub WglrGrid_AfterScroll(ByVal OldTopRow As Long, ByVal OldLeftCol As Long, ByVal NewTopRow As Long, ByVal NewLeftCol As Long)                                       '限制用户在录入过程中滚动鼠标
  2056.     If Gdtlock Then
  2057.         Exit Sub
  2058.     End If
  2059.  
  2060.     With WglrGrid
  2061.         If Ydtext.Visible Or YdCombo.Visible Then
  2062.             Gdtlock = True
  2063.             .TopRow = Dqtoprow
  2064.             .LeftCol = Dqleftcol
  2065.             Gdtlock = False
  2066.             Exit Sub
  2067.         End If
  2068.         HjGrid.LeftCol = .LeftCol
  2069.     End With
  2070. End Sub
  2071. Private Sub WglrGrid_LeaveCell()                                    '离开单元格
  2072.     
  2073.     If Changelock Then
  2074.         Exit Sub
  2075.     End If
  2076.     '记录刚刚离开网格单元的行列值
  2077.     Dqlkwgh = WglrGrid.Row
  2078.     Dqlkwgl = WglrGrid.Col
  2079.     '判断是否需要录入数据回写
  2080.     If Not (Ydtext.Visible Or YdCombo.Visible) Then
  2081.         Exit Sub
  2082.     End If
  2083.     Call Lrsjhx
  2084. End Sub
  2085. Private Sub WglrGrid_RowColChange()                                '网格录入行列发生变化时,进行有效性判断
  2086.     Valilock = True       '屏蔽文本框失去焦点进行有效性判断
  2087.     With WglrGrid
  2088.         If Changelock Then
  2089.             Exit Sub
  2090.         End If
  2091.         If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  2092.             Exit Sub
  2093.         End If
  2094.         If .Row <> Dqlkwgh Then
  2095.             If Not Sjhzyxxpd(Dqlkwgh) Then
  2096.                 Exit Sub
  2097.             End If
  2098.         End If
  2099.     End With
  2100.    
  2101.     Call fhyxh
  2102.     Call Xldql
  2103.    
  2104. End Sub
  2105. Private Sub WglrGrid_DblClick()          '鼠标双击网格显示文本框
  2106.   
  2107.     With WglrGrid
  2108.         Call xswbk
  2109.     End With
  2110. End Sub
  2111. Private Sub Ycwbk()                      '隐藏文本框,帮助按钮,列表组合框
  2112.     
  2113.     Valilock = True
  2114.     Ydtext.Visible = False
  2115.     YdCombo.Visible = False
  2116.     Ydcommand.Visible = False
  2117. End Sub
  2118. Private Sub YdCombo_KeyDown(KeyCode As Integer, Shift As Integer)        '列表框移动
  2119.     With WglrGrid
  2120.         Select Case KeyCode
  2121.             Case vbKeyEscape                'ESC 键放弃录入
  2122.                 Valilock = True
  2123.                 .SetFocus
  2124.                 Call Ycwbk
  2125.                 Valilock = False
  2126.             Case vbKeyReturn                '回 车 键 =13
  2127.                 KeyCode = 0
  2128.                 .SetFocus
  2129.                 Call Lrsjhx
  2130.                 Rowjsq = .Row
  2131.                 Coljsq = .Col + 1
  2132.                 If Coljsq > .Cols - 1 Then
  2133.                     If Rowjsq < .Rows - 1 Then
  2134.                         Rowjsq = Rowjsq + 1
  2135.                     End If
  2136.                     Coljsq = Qslz
  2137.                 End If
  2138.                 Do While Rowjsq <= .Rows - 1
  2139.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2140.                         Coljsq = Coljsq + 1
  2141.                         If Coljsq > .Cols - 1 Then
  2142.                             Rowjsq = Rowjsq + 1
  2143.                             Coljsq = Qslz
  2144.                         End If
  2145.                     Else
  2146.                         Exit Do
  2147.                     End If
  2148.                 Loop
  2149.                 .Select Rowjsq, Coljsq
  2150.             Case vbKeyLeft                  '左 箭 头 =37
  2151.                 If .Col - 1 = Qslz Then
  2152.                     If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  2153.                         GoTo jzzx
  2154.                     End If
  2155.                 End If
  2156.                 If .Col > Qslz Then
  2157.                     KeyCode = 0
  2158.                     .SetFocus
  2159.                     Call Lrsjhx
  2160.                     Coljsq = .Col - 1
  2161.                     Do While Coljsq > Qslz
  2162.                         If Coljsq - 1 = Qslz Then
  2163.                             If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  2164.                                 GoTo jzzx
  2165.                             End If
  2166.                         End If
  2167.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2168.                             Coljsq = Coljsq - 1
  2169.                         Else
  2170.                             Exit Do
  2171.                         End If
  2172.                     Loop
  2173.                     .Select .Row, Coljsq
  2174.                 End If
  2175.             Case vbKeyRight                 '右 箭 头 =39
  2176.                 KeyCode = 0
  2177.                 .SetFocus
  2178.                 Call Lrsjhx
  2179.                 Rowjsq = .Row
  2180.                 Coljsq = .Col + 1
  2181.                 If Coljsq > .Cols - 1 Then
  2182.                     If Rowjsq < .Rows - 1 Then
  2183.                         Rowjsq = Rowjsq + 1
  2184.                     End If
  2185.                     Coljsq = Qslz
  2186.                 End If
  2187.                 Do While Rowjsq <= .Rows - 1
  2188.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2189.                         Coljsq = Coljsq + 1
  2190.                         If Coljsq > .Cols - 1 Then
  2191.                             Rowjsq = Rowjsq + 1
  2192.                             Coljsq = Qslz
  2193.                         End If
  2194.                     Else
  2195.                         Exit Do
  2196.                     End If
  2197.                 Loop
  2198.                 .Select Rowjsq, Coljsq
  2199.         Case Else
  2200.    End Select
  2201.    
  2202. jzzx:
  2203.    
  2204.     End With
  2205. End Sub
  2206. Private Sub YdCombo_LostFocus()
  2207.   
  2208.     With WglrGrid                                    '因为选中网格会先发生Rowcolchange事件置Valiock
  2209.         If Not Valilock Then                           '为TRUE
  2210.             Call Lrsjhx
  2211.             If Not Sjhzyxxpd(Dqlrwgh) Then
  2212.                 Exit Sub
  2213.             End If
  2214.         End If
  2215.     End With
  2216. End Sub
  2217. Private Sub Ydcommand_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  2218.     Call Lrzdbz
  2219. End Sub
  2220. Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer)
  2221.     Dim Rowjsq As Long, Coljsq As Long
  2222.     With WglrGrid
  2223.         Select Case KeyCode
  2224.             Case vbKeyF2
  2225.                 Call Lrzdbz
  2226.             Case vbKeyEscape                'ESC 键放弃录入
  2227.                 Valilock = True
  2228.                 Call Ycwbk
  2229.                 .SetFocus
  2230.             Case vbKeyReturn                '回 车 键 =13
  2231.                 KeyCode = 0
  2232.                 .SetFocus
  2233.                 Call Lrsjhx
  2234.                 Rowjsq = .Row
  2235.                 Coljsq = .Col + 1
  2236.                 If Coljsq > .Cols - 1 Then
  2237.                     If Rowjsq < .Rows - 1 Then
  2238.                         Rowjsq = Rowjsq + 1
  2239.                     End If
  2240.                     Coljsq = Qslz
  2241.                 End If
  2242.                 Do While Rowjsq <= .Rows - 1
  2243.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2244.                         Coljsq = Coljsq + 1
  2245.                         If Coljsq > .Cols - 1 Then
  2246.                             Rowjsq = Rowjsq + 1
  2247.                             Coljsq = Qslz
  2248.                         End If
  2249.                     Else
  2250.                         Exit Do
  2251.                     End If
  2252.                 Loop
  2253.                 If Rowjsq <= .Rows - 1 Then
  2254.                     .Select Rowjsq, Coljsq
  2255.                 End If
  2256.             Case vbKeyUp                    '上 箭 头 =38
  2257.                 KeyCode = 0
  2258.                 .SetFocus
  2259.                 Call Lrsjhx
  2260.                 If .Row > .FixedRows Then
  2261.                     .Row = .Row - 1
  2262.                 End If
  2263.             Case vbKeyDown                  '下 箭 头 =40
  2264.                 KeyCode = 0
  2265.                 .SetFocus
  2266.                 Call Lrsjhx
  2267.                 If .Row < .Rows - 1 Then
  2268.                     .Row = .Row + 1
  2269.                 End If
  2270.             Case vbKeyLeft                  '左 箭 头 =37
  2271.                 If .Col - 1 = Qslz Then
  2272.                     If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  2273.                         GoTo jzzx
  2274.                     End If
  2275.                 End If
  2276.                 If Ydtext.SelStart = 0 And .Col > Qslz Then
  2277.                     KeyCode = 0
  2278.                     .SetFocus
  2279.                     Call Lrsjhx
  2280.                     Coljsq = .Col - 1
  2281.                     Do While Coljsq > Qslz
  2282.                         If Coljsq - 1 = Qslz Then
  2283.                             If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  2284.                                 GoTo jzzx
  2285.                             End If
  2286.                         End If
  2287.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2288.                             Coljsq = Coljsq - 1
  2289.                         Else
  2290.                             Exit Do
  2291.                         End If
  2292.                     Loop
  2293.                     .Select .Row, Coljsq
  2294.                 End If
  2295. jzzx:
  2296.             Case vbKeyRight                 '右 箭 头 =39
  2297.                 wblong = Len(Ydtext.Text)
  2298.                 If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
  2299.                     KeyCode = 0
  2300.                     .SetFocus
  2301.                     Call Lrsjhx
  2302.                     Rowjsq = .Row
  2303.                     Coljsq = .Col + 1
  2304.                     If Coljsq > .Cols - 1 Then
  2305.                         If Rowjsq < .Rows - 1 Then
  2306.                             Rowjsq = Rowjsq + 1
  2307.                         End If
  2308.                         Coljsq = Qslz
  2309.                     End If
  2310.                     Do While Rowjsq <= .Rows - 1
  2311.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2312.                             Coljsq = Coljsq + 1
  2313.                             If Coljsq > .Cols - 1 Then
  2314.                                 Rowjsq = Rowjsq + 1
  2315.                                 Coljsq = Qslz
  2316.                             End If
  2317.                         Else
  2318.                             Exit Do
  2319.                         End If
  2320.                     Loop
  2321.                     .Select Rowjsq, Coljsq
  2322.                 End If
  2323.             Case Else
  2324.         End Select
  2325.     End With
  2326. End Sub
  2327. Private Sub ydtext_KeyPress(KeyAscii As Integer)         '录入字符事中控制
  2328.     
  2329.     Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  2330.     If KeyAscii <> 0 Then
  2331.         Call Xyxhbz(Dqlrwgh)
  2332.     End If
  2333. End Sub
  2334. Private Sub ydtext_Change()                              '录入事中变化处理
  2335.     '防止程序改变但不进行处理
  2336.     If Wbkbhlock Then
  2337.         Exit Sub
  2338.     End If
  2339.     With WglrGrid
  2340.         '限制字段录入长度
  2341.         Wbkbhlock = True
  2342.         
  2343.         Call TextChangeLimit(Ydtext, GridInt(.Col, 1))  '去掉无效字符
  2344.         
  2345.         Select Case GridInt(.Col, 1)
  2346.             Case 8, 11   '金额型
  2347.                 Call Sjgskz(Ydtext, Xtjezws - Xtjexsws - 1, Xtjexsws)
  2348.             Case 9, 12   '数量型
  2349.                 Call Sjgskz(Ydtext, Xtslzws - Xtslxsws - 1, Xtslxsws)
  2350.             Case 10      '单价型
  2351.                 Call Sjgskz(Ydtext, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  2352.             Case Else    '其他类型
  2353.                 If GridInt(.Col, 3) <> 0 Or GridInt(.Col, 4) <> 0 Then
  2354.                     Call Sjgskz(Ydtext, GridInt(.Col, 3), GridInt(.Col, 4))
  2355.                 End If
  2356.         End Select
  2357.         Wbkbhlock = False
  2358.     End With
  2359. End Sub
  2360. Private Sub ydtext_LostFocus()            '如果由于选中网格之外的控件而发生有效性判断(选中网格会先发生Rowcolchange事件置Valiock为TRUE)
  2361.   
  2362.     With WglrGrid
  2363.         If Not Valilock Then
  2364.             Call Lrsjhx
  2365.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  2366.                 Exit Sub
  2367.             End If
  2368.             If Not Sjhzyxxpd(Dqlrwgh) Then
  2369.                 Exit Sub
  2370.             End If
  2371.         End If
  2372.     End With
  2373. End Sub
  2374. Private Sub xswbk()                       '在当前选中单元显示文本框,列表框,帮助按钮(通用)
  2375.     
  2376.     Dim Wbkpy As Integer, Wbkpy1 As Integer '文本框偏移量
  2377.   
  2378.     '当某种条件成立时禁止文本框激活使单据处于录入状态
  2379.     If Not Fun_AllowInput Then
  2380.         Exit Sub
  2381.     End If
  2382.   
  2383.     '显示文本框前返回有效行列(解决滚动条问题)
  2384.     Call Xldqh
  2385.     Call Xldql
  2386.   
  2387.     '隐藏文本框,帮助按钮,列表组合框
  2388.     Call Ycwbk
  2389.   
  2390.     With WglrGrid
  2391.         Dqlrwgh = .Row
  2392.         Dqlrwgl = .Col
  2393.         If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  2394.             Exit Sub
  2395.         End If
  2396.      
  2397.         Wbkpy = 30
  2398.         Wbkpy1 = 15
  2399.     
  2400.         On Error Resume Next
  2401.         
  2402.         If GridBoolean(.Col, 3) Then
  2403.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  2404.             YdCombo.Top = .CellTop + .Top + Wbkpy
  2405.             YdCombo.Width = .CellWidth - Wbkpy1
  2406.             Call Wbkcl
  2407.             YdCombo.Visible = True
  2408.             YdCombo.SetFocus
  2409.             Ydcommand.Visible = False
  2410.             Ydtext.Visible = False
  2411.         Else
  2412.             If GridBoolean(.Col, 2) Then
  2413.                 Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
  2414.                 Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
  2415.                 Ydcommand.Visible = True
  2416.             Else
  2417.                 Ydcommand.Visible = False
  2418.             End If
  2419.              
  2420.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  2421.             Ydtext.Top = .CellTop + .Top + Wbkpy
  2422.             If Ydcommand.Visible Then
  2423.                 If Sfblbzkd Then
  2424.                     Ydtext.Width = .CellWidth - Ydcommand.Width
  2425.                 Else
  2426.                     Ydtext.Width = .CellWidth - Wbkpy1
  2427.                 End If
  2428.             Else
  2429.                 Ydtext.Width = .CellWidth - Wbkpy1
  2430.             End If
  2431.             Ydtext.Height = .CellHeight - Wbkpy1
  2432.         
  2433.             If GridInt(.Col, 2) <> 0 Then
  2434.                 Ydtext.MaxLength = GridInt(.Col, 2)
  2435.             Else
  2436.                 Ydtext.MaxLength = 3000
  2437.             End If
  2438.       
  2439.             Call Wbkcl
  2440.       
  2441.             Ydtext.Visible = True
  2442.             Ydtext.SetFocus
  2443.         End If
  2444.         Dqtoprow = .TopRow
  2445.         Dqleftcol = .LeftCol
  2446.         
  2447.         '重置锁值
  2448.         Valilock = False
  2449.         Wbkbhlock = False
  2450.     End With
  2451. End Sub
  2452. Private Function Fun_AllowInput() As Boolean                           '当某种条件成立时禁止文本框激活使单据处于录入状态
  2453.    
  2454.     '如果单据操作状态为浏览状态则不能显示录入载体(通用)
  2455.     If Trim(Lab_OperStatus.Caption) = "1" Then
  2456.         Exit Function
  2457.     End If
  2458.    
  2459.     '[>>
  2460.     
  2461.     '此处可以填写禁止文本框激活使单据处于录入状态的理由
  2462.     If Trim(LrText(3).Text) = "" Then
  2463.         Tsxx = "请先输入仓库!"
  2464.         Call Xtxxts(Tsxx, 0, 1)
  2465.         LrText(3).SetFocus
  2466.         Exit Function
  2467.     End If
  2468.     '<<]
  2469.    
  2470.     Fun_AllowInput = True
  2471. End Function
  2472. Private Sub Cxxswbk()                                                  'Formresize中重新显示文本框,列表框,帮助按钮(通用)
  2473.                    
  2474.     Dim Wbkpy As Integer, Wbkpy1 As Integer
  2475.     Wbkpy = 30
  2476.     Wbkpy1 = 15
  2477.     With WglrGrid
  2478.         If YdCombo.Visible Then
  2479.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  2480.             YdCombo.Top = .CellTop + .Top + Wbkpy
  2481.             YdCombo.Width = .CellWidth - Wbkpy1
  2482.         End If
  2483.         If Ydcommand.Visible Then
  2484.             Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
  2485.             Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
  2486.         End If
  2487.         If Ydtext.Visible Then
  2488.             If Ydcommand.Visible Then
  2489.                 If Sfblbzkd Then
  2490.                     Ydtext.Width = .CellWidth - Ydcommand.Width
  2491.                 Else
  2492.                     Ydtext.Width = .CellWidth - Wbkpy1
  2493.                 End If
  2494.             Else
  2495.                 Ydtext.Width = .CellWidth - Wbkpy1
  2496.             End If
  2497.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  2498.             Ydtext.Top = .CellTop + .Top + Wbkpy
  2499.             Ydtext.Height = .CellHeight - Wbkpy1
  2500.         End If
  2501.     End With
  2502. End Sub
  2503. Private Sub Lrsjhx()                                                   '文本框录入数据回写
  2504.     
  2505.     With WglrGrid
  2506.         If YdCombo.Visible Then
  2507.             .Text = Trim(YdCombo.Text)
  2508.         End If
  2509.         If Ydtext.Visible Then
  2510.             .Text = Trim(Ydtext.Text)
  2511.         End If
  2512.         
  2513.         '(如果字段录入内容发生变化,则打开有效性判断锁)
  2514.         If Zdlrqnr <> Trim(.Text) Then
  2515.             Yxxpdlock = False
  2516.             Hyxxpdlock = False
  2517.         End If
  2518.     
  2519.         '如果字段录入内容不为空则写数据行有效性标志
  2520.         If Len(Trim(.Text)) <> 0 Then
  2521.             Call Xyxhbz(.Row)
  2522.         End If
  2523.     
  2524.         '隐藏文本框,帮助按钮,列表组合框
  2525.         Call Ycwbk
  2526.     End With
  2527. End Sub
  2528. Private Sub WglrGrid_KeyDown(KeyCode As Integer, Shift As Integer)    '网格录入增行,删行快捷键
  2529.   
  2530.     '如果单据操作状态为浏览状态则不能显示录入载体
  2531.     If Trim(Lab_OperStatus.Caption) = "1" Then
  2532.         Exit Sub
  2533.     End If
  2534.     Select Case KeyCode
  2535.         Case vbKeyF2                   '按F2键参照
  2536.             Call xswbk
  2537.             Call Lrzdbz
  2538.         Case vbKeyDelete               '删行
  2539.             Call Scdqfl
  2540.         Case vbKeyInsert               '增行
  2541.             Call zjlrfl
  2542.     End Select
  2543. End Sub
  2544. Private Sub WglrGrid_KeyPress(KeyAscii As Integer)                             '网格接受键盘录入
  2545.     '当某种条件成立时禁止文本框激活使单据处于录入状态
  2546.     If Not Fun_AllowInput Then
  2547.         Exit Sub
  2548.     End If
  2549.   
  2550.     With WglrGrid
  2551.         '屏 蔽 回 车 键
  2552.         If KeyAscii = vbKeyReturn Then
  2553.             KeyAscii = 0
  2554.             Rowjsq = .Row
  2555.             Coljsq = .Col + 1
  2556.             If Coljsq > .Cols - 1 Then
  2557.                 If Rowjsq < .Rows - 1 Then
  2558.                     Rowjsq = Rowjsq + 1
  2559.                 End If
  2560.                 Coljsq = Qslz
  2561.             End If
  2562.             Do While Rowjsq <= .Rows - 1
  2563.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  2564.                     Coljsq = Coljsq + 1
  2565.                     If Coljsq > .Cols - 1 Then
  2566.                         Rowjsq = Rowjsq + 1
  2567.                         Coljsq = Qslz
  2568.                     End If
  2569.                 Else
  2570.                     Exit Do
  2571.                 End If
  2572.             Loop
  2573.             If Rowjsq <= .Rows - 1 Then
  2574.                 .Select Rowjsq, Coljsq
  2575.             End If
  2576.             Exit Sub
  2577.         End If
  2578.      
  2579.         '接受用户录入
  2580.         Select Case KeyAscii
  2581.             Case 0 To 32             '用户输入KeyAscii为0-32的键 如空格
  2582.                 '显示录入载体
  2583.                 Call xswbk
  2584.             Case Else
  2585.                 '防止非编辑字段SendKeys()出现死循环
  2586.                 If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  2587.                     Exit Sub
  2588.                 End If
  2589.                 '如果此字段为列表框录入则调入相应列表框
  2590.                 If GridBoolean(.Col, 3) Then
  2591.                     '列表框录入
  2592.                     Call xswbk
  2593.                 Else
  2594.                     Ydtext.Text = ""
  2595.                     '录入限制
  2596.                     Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  2597.                     If KeyAscii = 0 Then
  2598.                         Exit Sub
  2599.                     End If
  2600.                     '如果录入字符有效则写有效行数据标志
  2601.                     Call Xyxhbz(.Row)
  2602.                     Call xswbk
  2603.                     Ydtext.Text = ""
  2604.                     Valilock = True
  2605.                     SendKeys Chr(KeyAscii), True
  2606.                     DoEvents
  2607.                     Valilock = False
  2608.                 End If
  2609.         End Select
  2610.     End With
  2611. End Sub
  2612. Private Sub zjlrfl()                                                    '增加录入分录
  2613.     
  2614.     With WglrGrid
  2615.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  2616.             If Not Fun_Drfrmyxxpd Then
  2617.                 Exit Sub
  2618.             End If
  2619.         Else
  2620.             Exit Sub
  2621.         End If
  2622.         If .Row < .FixedRows Then
  2623.             Exit Sub
  2624.         End If
  2625.         .AddItem "", .Row
  2626.         .RowHeight(.Row) = Sjhgd
  2627.         If .Row <> .Rows - 1 Then
  2628.             If .TextMatrix(.Row + 1, 0) = "*" Then
  2629.                 .TextMatrix(.Row, 0) = "*"
  2630.             Else
  2631.                 .RemoveItem .Rows - 1
  2632.             End If
  2633.         End If
  2634.         Call Xldqh
  2635.         Call Xldql
  2636.         Hyxxpdlock = False
  2637.     End With
  2638. End Sub
  2639. Private Sub Scdqfl()                                                    '删除当前分录
  2640.     Dim Answer As Integer, Scqwghz As Long, Scqwglz As Long, Hjlzte As Long, Sflrzt As Boolean
  2641.     With WglrGrid
  2642.         Scqwghz = .Row
  2643.         Scqwglz = .Col
  2644.         If .TextMatrix(.Row, 0) = "*" Then
  2645.             '判断是否为录入状态
  2646.             If Ydtext.Visible Or YdCombo.Visible Then
  2647.                 Sflrzt = True
  2648.                 Validate = True
  2649.                 Call Lrsjhx
  2650.                 Validate = False
  2651.             End If
  2652.             Call Xldqh
  2653.             Changelock = True
  2654.             .Select .Row, 0
  2655.             Changelock = False
  2656.             If Shsfts Then
  2657.                 .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = QBColor(12)
  2658.                 Tsxx = "请确认是否删除当前记录?"
  2659.                 yhAnswer = Xtxxts(Tsxx, 2, 2)
  2660.                 If yhAnswer = 2 Then
  2661.                     .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = &H80000005
  2662.                     Changelock = True
  2663.                     .Select Scqwghz, Scqwglz
  2664.                     Changelock = False
  2665.                     
  2666.                     '如为录入状态,则恢复录入
  2667.                     If Sflrzt Then
  2668.                         Call xswbk
  2669.                     End If
  2670.                     Exit Sub
  2671.                 End If
  2672.             End If
  2673.             .RemoveItem .Row
  2674.             If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  2675.                 .AddItem ""
  2676.                 .RowHeight(.Rows - 1) = Sjhgd
  2677.             End If
  2678.             Changelock = True
  2679.             .Select .Row, Scqwglz
  2680.             Changelock = False
  2681.    
  2682.             '重新计算合计数据
  2683.             For Hjlzte = Qslz To .Cols - 1
  2684.                 Call Sjhj(Hjlzte)
  2685.             Next Hjlzte
  2686.         End If
  2687.     End With
  2688. End Sub
  2689. Private Sub Sjhj(Hjwgl As Long)                                         '网格列数据合计
  2690.     
  2691.     Dim Hjjg As Double
  2692.     If Not GridBoolean(Hjwgl, 4) Then
  2693.         Exit Sub
  2694.     End If
  2695.     With WglrGrid
  2696.         Hjjg = 0
  2697.         For Jsqte = .FixedRows To .Rows - 1
  2698.             If .TextMatrix(Jsqte, 0) = "*" Then
  2699.                 Hjjg = Hjjg + Val(.TextMatrix(Jsqte, Hjwgl))
  2700.             End If
  2701.         Next Jsqte
  2702.         If GridBoolean(Hjwgl, 5) And Hjjg = 0 Then
  2703.             HjGrid.TextMatrix(0, Hjwgl) = ""
  2704.         Else
  2705.             HjGrid.TextMatrix(0, Hjwgl) = Hjjg
  2706.         End If
  2707.     End With
  2708. End Sub
  2709. Private Sub Qkwlzd(sjh As Long, Sjl As Long)                            '清空为零字段
  2710.     
  2711.     If Not GridBoolean(Sjl, 5) Then
  2712.         Exit Sub
  2713.     End If
  2714.     With WglrGrid
  2715.         If Val(Trim(.TextMatrix(sjh, Sjl))) = 0 Then
  2716.             .TextMatrix(sjh, Sjl) = ""
  2717.         End If
  2718.     End With
  2719. End Sub
  2720. Private Sub fhyxh()                                                     '返回录入数据有效行,同时让得到焦点网格可见
  2721.     
  2722.     With WglrGrid
  2723.         If .Row >= .FixedRows Then
  2724.             If .TextMatrix(.Row, 0) <> "*" Then
  2725.                 For Rowjsq = .FixedRows To .Rows - 1
  2726.                     If .TextMatrix(Rowjsq, 0) <> "*" Then
  2727.                         Exit For
  2728.                     End If
  2729.                 Next Rowjsq
  2730.                 If Rowjsq <= .Rows - 1 Then
  2731.                     Changelock = True
  2732.                     .Select Rowjsq, .Col
  2733.                     Changelock = False
  2734.                 Else
  2735.                     Changelock = True
  2736.                     .Select .Rows - 1, .Col
  2737.                     Changelock = False
  2738.                 End If
  2739.             End If
  2740.             Call Xldqh
  2741.         End If
  2742.   End With
  2743.   
  2744. End Sub
  2745. Private Sub Xldqh()                                                      '显露当前行
  2746.   
  2747.     Dim Toprowte As Long
  2748.     With WglrGrid
  2749.         Toprowte = 0
  2750.         Do While .CellTop + .RowHeight(.Row) + Fzxwghs * Sjhgd > .Height And .TopRow <> Toprowte
  2751.             Toprowte = .TopRow
  2752.             .TopRow = .TopRow + 1
  2753.         Loop
  2754.         Toprowte = 0
  2755.         Do While .CellTop < .FixedRows * .RowHeight(0) And .TopRow <> Toprowte
  2756.             Toprowte = .TopRow
  2757.             If .TopRow > 1 Then
  2758.                 .TopRow = .TopRow - 1
  2759.             End If
  2760.         Loop
  2761.     End With
  2762. End Sub
  2763. Private Sub Xldql()                                                     '显露当前列
  2764.     
  2765.     Dim Leftcolte As Long
  2766.     With WglrGrid
  2767.         If .Col >= Qslz And .Col >= .FixedCols Then
  2768.             If .LeftCol > .Col Then
  2769.                 .LeftCol = .Col
  2770.             End If
  2771.             Leftcolte = 0
  2772.             Do While .CellLeft + .CellWidth > .Width And .LeftCol <> Leftcolte
  2773.                 Leftcolte = .LeftCol
  2774.                 .LeftCol = .LeftCol + 1
  2775.             Loop
  2776.         End If
  2777.     End With
  2778. End Sub
  2779. Private Function pdhwk(sjh As Long)                                     '判断网格行是否为空行(所有录入字段均为空*非录入字段除外)
  2780.     
  2781.     With WglrGrid
  2782.         For Coljsq = Qslz To .Cols - 1
  2783.             If Len(Trim(.TextMatrix(sjh, Coljsq))) <> 0 And GridBoolean(Coljsq, 1) Then
  2784.                 pdhwk = False
  2785.                 Exit Function
  2786.             End If
  2787.         Next Coljsq
  2788.         pdhwk = True
  2789.     End With
  2790. End Function
  2791. Private Sub Xyxhbz(sjh As Long)                                         '写行有效性标志,并判断是否增行
  2792.     
  2793.     With WglrGrid
  2794.         If .TextMatrix(sjh, 0) = "*" Then
  2795.             Exit Sub
  2796.         End If
  2797.         .TextMatrix(sjh, 0) = "*"
  2798.         If sjh >= .Rows - Fzxwghs - 1 Then
  2799.             .AddItem ""
  2800.             .RowHeight(.Rows - 1) = Sjhgd
  2801.         End If
  2802.     End With
  2803. End Sub
  2804. '*****************************以下为文本框录入处理程序(固定不变部分)*******************************'
  2805. Private Sub Wbklrwbcl(Index As Integer)    '文本框录入事后处理程序
  2806.     '以下为依据实际情况自定义部分[
  2807.     
  2808.     '在此填写文本框录入事后处理程序
  2809.     
  2810.     If Index = 3 Then
  2811.       
  2812.         If Trim(LrText(Index).Text) = "" Then
  2813.             LrText(0).Text = ""
  2814.             Exit Sub
  2815.         End If
  2816.        
  2817.         LrText(0).Text = CreatBillCode(BillCode, False, , , Trim(LrText(3).Tag))
  2818.         
  2819.     End If
  2820.     
  2821.     ']以上为依据实际情况自定义部分
  2822. End Sub
  2823. Private Sub LrText_Change(Index As Integer)
  2824.     '屏蔽程序改变控制
  2825.     If TextChangeLock Then
  2826.         Exit Sub
  2827.     End If
  2828.    
  2829.     TextValiJudgeLock(Index) = False    '打开有效性判断锁
  2830.         
  2831.     '限制字段录入长度
  2832.           
  2833.     TextChangeLock = True  '加锁(防止执行Lrtext_Change)
  2834.     
  2835.     Call TextChangeLimit(LrText(Index), Textint(Index, 1))  '去掉无效字符
  2836.     
  2837.     Select Case Textint(Index, 1)
  2838.         Case 8, 11       '金额型
  2839.             Call Sjgskz(LrText(Index), Xtjezws - Xtjexsws - 1, Xtjexsws)
  2840.         Case 9, 12       '数量型
  2841.             Call Sjgskz(LrText(Index), Xtslzws - Xtslxsws - 1, Xtslxsws)
  2842.         Case 10          '单价型
  2843.             Call Sjgskz(LrText(Index), Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  2844.         Case Else        '其他小数类型控制
  2845.             If Textint(Index, 6) <> 0 Or Textint(Index, 7) <> 0 Then
  2846.                 Call Sjgskz(LrText(Index), Textint(Index, 6), Textint(Index, 7))
  2847.             End If
  2848.     End Select
  2849.     
  2850.     TextChangeLock = False '解锁
  2851.      
  2852. End Sub
  2853. Private Sub LrText_GotFocus(Index As Integer)                                                 '文本框得到焦点,显示相应信息
  2854.     Call TextShow(Index)
  2855. End Sub
  2856. Private Sub LrText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)            '字段按F2键提供帮助
  2857.     
  2858.     Select Case KeyCode
  2859.         Case vbKeyF2
  2860.             Call Text_Help(Index)
  2861.     End Select
  2862. End Sub
  2863. Private Sub LrText_KeyPress(Index As Integer, KeyAscii As Integer)                            '文本框录入事中控制
  2864.     Call InputFieldLimit(LrText(Index), Textint(Index, 1), KeyAscii)
  2865. End Sub
  2866. Private Sub LrText_LostFocus(Index As Integer)                                                '文本框失去焦点进行有效性判断及相应处理
  2867.     
  2868.     If Textint(Index, 9) = 0 Or Textint(Index, 9) = 1 Then '事中判断
  2869.         Call TextYxxpd(Index)
  2870.     End If
  2871. End Sub
  2872. Private Sub Ydcommand1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) '点击按钮
  2873.     Call Text_Help(Ydcommand1.Tag)
  2874. End Sub
  2875. Private Sub Text_Help(Index As Integer)                                                       '录入字段帮助
  2876.     
  2877.     If Not Ydcommand1.Visible Then
  2878.         Exit Sub
  2879.     End If
  2880.     TextValiLock = True
  2881.     Call Drbmhelp(Textint(Index, 2), Textstr(Index, 4), Trim(LrText(Index).Text))
  2882.     If Len(Xtfhcs) <> 0 Then
  2883.         If Textint(Index, 3) = 1 Then
  2884.             LrText(Index).Text = Xtfhcsfz
  2885.             LrText(Index).Tag = Xtfhcs
  2886.         Else
  2887.             LrText(Index).Text = Xtfhcs
  2888.             LrText(Index).Tag = Xtfhcsfz
  2889.         End If
  2890.     End If
  2891.     TextValiLock = False
  2892.     LrText(Index).SetFocus
  2893. End Sub
  2894. Private Sub TextShow(Index As Integer)        '文本框得到焦点,显示相应信息
  2895.     '如果文本框有帮助,则显示帮助按钮
  2896.     If Textboolean(Index, 1) Then
  2897.         Ydcommand1.Visible = True
  2898.         Ydcommand1.Move LrText(Index).Left + LrText(Index).Width, LrText(Index).Top
  2899.         Ydcommand1.Tag = Index
  2900.     Else
  2901.         Ydcommand1.Tag = ""
  2902.         Ydcommand1.Visible = False
  2903.     End If
  2904.     
  2905.     '[>>
  2906.     '可在此处定义其他处理动作
  2907.     '<<]
  2908. End Sub
  2909. Private Sub Wbkcsh()                          '录入文本框初始化
  2910.     Dim Int_TabIndex As Integer         'Tab焦点计数器
  2911.   
  2912.     '单据录入中文本框焦点由0开始
  2913.     LrText(0).TabIndex = 0
  2914.   
  2915.     '最大录入文本框索引值
  2916.     Max_Text_Index = Textvar(1)
  2917.   
  2918.     ReDim TextValiJudgeLock(Max_Text_Index)
  2919.     For Jsqte = 0 To Max_Text_Index
  2920.         
  2921.         '判断此文本框录入索引号是否存在,如存在则对其进行初始化
  2922.         If Len(Trim(Textstr(Jsqte, 1))) <> 0 Then
  2923.         
  2924.             '自动装入录入文本框和其解释标签
  2925.             If Jsqte <> 0 Then
  2926.                 Load LrText(Jsqte)
  2927.                 Load tsLabel(Jsqte)
  2928.            
  2929.                 '判断录入文本框是否显示
  2930.                 If Textboolean(Jsqte, 4) Then
  2931.                     LrText(Jsqte).Visible = True
  2932.                     tsLabel(Jsqte).Visible = True
  2933.                 Else
  2934.                     LrText(Jsqte).Visible = False
  2935.                     tsLabel(Jsqte).Visible = False
  2936.                 End If
  2937.             
  2938.                 '判断文本框是否可编辑
  2939.                 If Textboolean(Jsqte, 5) Then
  2940.                     LrText(Jsqte).Enabled = True
  2941.                 Else
  2942.                     LrText(Jsqte).Enabled = False
  2943.                 End If
  2944.             End If
  2945.            
  2946.            '初始化其内容
  2947.             TextChangeLock = True
  2948.             LrText(Jsqte).Text = ""
  2949.             LrText(Jsqte).Tag = ""
  2950.             If Textint(Jsqte, 5) <> 0 Then
  2951.                 LrText(Jsqte).MaxLength = Textint(Jsqte, 5)
  2952.             End If
  2953.             TextChangeLock = False
  2954.         
  2955.             '设置文本框位置及大小,并设置相应标签内容及其位置
  2956.             LrText(Jsqte).Move Textint(Jsqte, 13), Textint(Jsqte, 12), Textint(Jsqte, 11), Textint(Jsqte, 10)
  2957.             tsLabel(Jsqte).Caption = Textstr(Jsqte, 7) & ":"
  2958.             tsLabel(Jsqte).Move Textint(Jsqte, 13) - tsLabel(Jsqte).Width - 20, Textint(Jsqte, 12) + (Textint(Jsqte, 10) - tsLabel(Jsqte).Height) / 2 - 30
  2959.             
  2960.         End If
  2961.      
  2962.         '将文本框有效性判断进行加锁,在文本框内容发生变化时将锁打开
  2963.         TextValiJudgeLock(Jsqte) = True
  2964.         
  2965.     Next Jsqte
  2966.     
  2967.     '设置文本框焦点转移顺序(前提文本焦点从0至Max_Text_Index)
  2968.     For Int_TabIndex = 0 To Max_Text_Index
  2969.         For Jsqte = 0 To Max_Text_Index
  2970.             If Textint(Jsqte, 14) = Int_TabIndex Then
  2971.                LrText(Jsqte).TabIndex = Int_TabIndex
  2972.             End If
  2973.         Next Jsqte
  2974.     Next Int_TabIndex
  2975.   
  2976. End Sub
  2977. Private Function TextYxxpd(Index As Integer) As Boolean           '文本框有效性判断
  2978.   
  2979.     Dim SqlStr As String
  2980.     Dim Findrec As New ADODB.Recordset
  2981.   
  2982.     '按帮助不进行有效性判断
  2983.   
  2984.     If TextValiLock Then
  2985.         TextValiLock = False
  2986.         TextYxxpd = True
  2987.         Exit Function
  2988.     End If
  2989.   
  2990.     '文本框内容未曾改变不进行有效性判断
  2991.     If Index <> 3 Then
  2992.         If TextValiJudgeLock(Index) Then
  2993.             Ydcommand1.Visible = False
  2994.             TextYxxpd = True
  2995.             Exit Function
  2996.         End If
  2997.     End If
  2998.     
  2999.     '文本框内容为空认为有效,并清空其Tag值
  3000.   
  3001.     If Trim(LrText(Index)) = "" Then
  3002.         LrText(Index).Tag = ""
  3003.         Call Wbklrwbcl(Index)
  3004.         Ydcommand1.Visible = False
  3005.         TextValiJudgeLock(Index) = True
  3006.         TextYxxpd = True
  3007.         Exit Function
  3008.     End If
  3009.    
  3010.     '[>>
  3011.       
  3012.     '可在此加入不做有效性判断的理由(参照上面程序)
  3013.       
  3014.     '<<]
  3015.   
  3016.     Select Case Textint(Index, 4)
  3017.         Case 1      '编码型
  3018.             SqlStr = Trim(Textstr(Index, 5))
  3019.             SqlStr = Replace(SqlStr, "@", "'" + Trim(LrText(Index).Text) + "'")
  3020.             SqlStr = Replace(SqlStr, "$$", "'" + Trim(Xtczybm) + "'")
  3021.             Set Findrec = Cw_DataEnvi.DataConnect.Execute(SqlStr)
  3022.             If Findrec.EOF Then
  3023.                 Call Xtxxts(Trim(Textstr(Index, 6)), 0, 1)
  3024.                 LrText(Index).SetFocus
  3025.                 Exit Function
  3026.             Else
  3027.                 Select Case Textint(Index, 3)
  3028.                     Case 0
  3029.                         If Len(Trim(Textstr(Index, 2))) <> 0 Then
  3030.                             LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
  3031.                         End If
  3032.                         If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
  3033.                             LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
  3034.                         End If
  3035.                     Case 1
  3036.                         If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
  3037.                             LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
  3038.                         End If
  3039.                         If Len(Trim(Textstr(Index, 2))) <> 0 Then
  3040.                             LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
  3041.                         End If
  3042.                 End Select
  3043.             End If
  3044.             
  3045.         Case 2      '日期型
  3046.             If IsDate(LrText(Index).Text) Then
  3047.                 LrText(Index).Text = Format(LrText(Index).Text, "yyyy-mm-dd")
  3048.                 If Val(Mid(LrText(Index), 1, 4)) < 1900 Then
  3049.                     LrText(Index).Text = "1900" + Mid(LrText(Index), 5, 6)
  3050.                 End If
  3051.             Else
  3052.                 Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
  3053.                 Call Xtxxts(Tsxx, 0, 1)
  3054.                 LrText(Index).SetFocus
  3055.                 Exit Function
  3056.             End If
  3057.         Case 3      '其他类型
  3058.     End Select
  3059.     
  3060.     If Index = 3 Then
  3061.         '此仓库已期末处理,不允许增加单据
  3062.         Set Findrec = Cw_DataEnvi.DataConnect.Execute("select whcode,whname,pricemode from Gy_warehouse " & _
  3063.                 " where whcode='" & Trim(LrText(Index).Tag) & "' and enddealflagchhs=0 ")
  3064.         If Findrec.EOF Then
  3065.             Tsxx = "此仓库已期末处理,不允许增加单据!"
  3066.             TextValiJudgeLock(Index) = False
  3067.             LrText(Index).SetFocus
  3068.             Ydcommand1.Visible = True
  3069.             Call Xtxxts(Tsxx, 0, 1)
  3070.             Exit Function
  3071.         Else
  3072.             PriceMode = Trim(Findrec.Fields("pricemode"))
  3073.         End If
  3074.     End If
  3075.     
  3076.     '隐藏帮助按钮
  3077.     Ydcommand1.Visible = False
  3078.    
  3079.     '如果有效则加锁,用户不改变内容则不再进行有效性判断
  3080.     TextValiJudgeLock(Index) = True
  3081.     '调用文本框事后处理程序
  3082.     Call Wbklrwbcl(Index)
  3083.    
  3084.     '有效性判断通过则返回True
  3085.     TextYxxpd = True
  3086.     
  3087. End Function