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

企业管理

开发平台:

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