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

企业管理

开发平台:

Visual Basic

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