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

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  3. Begin VB.Form Dev_LubricatEditFrom 
  4.    BackColor       =   &H00E9F4FA&
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "单据处理"
  7.    ClientHeight    =   6120
  8.    ClientLeft      =   675
  9.    ClientTop       =   720
  10.    ClientWidth     =   8220
  11.    HelpContextID   =   2507001
  12.    Icon            =   "润滑管理_润滑标准编辑.frx":0000
  13.    KeyPreview      =   -1  'True
  14.    LinkTopic       =   "Form4"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   6120
  18.    ScaleWidth      =   8220
  19.    StartUpPosition =   1  '所有者中心
  20.    Begin VB.CommandButton Ydcommand1 
  21.       Height          =   300
  22.       Index           =   0
  23.       Left            =   7710
  24.       Picture         =   "润滑管理_润滑标准编辑.frx":1042
  25.       Style           =   1  'Graphical
  26.       TabIndex        =   9
  27.       TabStop         =   0   'False
  28.       Top             =   660
  29.       Visible         =   0   'False
  30.       Width           =   300
  31.    End
  32.    Begin MSComctlLib.ImageList ImageList1 
  33.       Left            =   6420
  34.       Top             =   630
  35.       _ExtentX        =   1005
  36.       _ExtentY        =   1005
  37.       BackColor       =   -2147483643
  38.       ImageWidth      =   16
  39.       ImageHeight     =   16
  40.       MaskColor       =   12632256
  41.       _Version        =   393216
  42.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  43.          NumListImages   =   37
  44.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  45.             Picture         =   "润滑管理_润滑标准编辑.frx":13CC
  46.             Key             =   "sz"
  47.          EndProperty
  48.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  49.             Picture         =   "润滑管理_润滑标准编辑.frx":1766
  50.             Key             =   "dy"
  51.          EndProperty
  52.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  53.             Picture         =   "润滑管理_润滑标准编辑.frx":1B00
  54.             Key             =   "yl"
  55.          EndProperty
  56.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  57.             Picture         =   "润滑管理_润滑标准编辑.frx":1E9A
  58.             Key             =   "xg"
  59.          EndProperty
  60.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  61.             Picture         =   "润滑管理_润滑标准编辑.frx":2234
  62.             Key             =   "zh"
  63.          EndProperty
  64.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  65.             Picture         =   "润滑管理_润滑标准编辑.frx":25CE
  66.             Key             =   "sh"
  67.          EndProperty
  68.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  69.             Picture         =   "润滑管理_润滑标准编辑.frx":2968
  70.             Key             =   "bc"
  71.          EndProperty
  72.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  73.             Picture         =   "润滑管理_润滑标准编辑.frx":2D02
  74.             Key             =   "fq"
  75.          EndProperty
  76.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  77.             Picture         =   "润滑管理_润滑标准编辑.frx":309C
  78.             Key             =   "bz"
  79.          EndProperty
  80.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  81.             Picture         =   "润滑管理_润滑标准编辑.frx":3436
  82.             Key             =   "tc"
  83.          EndProperty
  84.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  85.             Picture         =   "润滑管理_润滑标准编辑.frx":37D0
  86.             Key             =   "bcgs"
  87.          EndProperty
  88.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  89.             Picture         =   "润滑管理_润滑标准编辑.frx":3B6A
  90.             Key             =   "mrlk"
  91.          EndProperty
  92.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  93.             Picture         =   "润滑管理_润滑标准编辑.frx":3F04
  94.             Key             =   "xsxm"
  95.          EndProperty
  96.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  97.             Picture         =   "润滑管理_润滑标准编辑.frx":429E
  98.             Key             =   "first"
  99.          EndProperty
  100.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  101.             Picture         =   "润滑管理_润滑标准编辑.frx":4638
  102.             Key             =   "prev"
  103.          EndProperty
  104.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  105.             Picture         =   "润滑管理_润滑标准编辑.frx":49D2
  106.             Key             =   "next"
  107.          EndProperty
  108.          BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  109.             Picture         =   "润滑管理_润滑标准编辑.frx":4D6C
  110.             Key             =   "last"
  111.          EndProperty
  112.          BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  113.             Picture         =   "润滑管理_润滑标准编辑.frx":5106
  114.             Key             =   "xx"
  115.          EndProperty
  116.          BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  117.             Picture         =   "润滑管理_润滑标准编辑.frx":54A0
  118.             Key             =   "define"
  119.          EndProperty
  120.          BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  121.             Picture         =   "润滑管理_润滑标准编辑.frx":583A
  122.             Key             =   "exec"
  123.          EndProperty
  124.          BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  125.             Picture         =   "润滑管理_润滑标准编辑.frx":5BD4
  126.             Key             =   "xz"
  127.          EndProperty
  128.          BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  129.             Picture         =   "润滑管理_润滑标准编辑.frx":5F6E
  130.             Key             =   "sc"
  131.          EndProperty
  132.          BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  133.             Picture         =   "润滑管理_润滑标准编辑.frx":6308
  134.             Key             =   "sx"
  135.          EndProperty
  136.          BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  137.             Picture         =   "润滑管理_润滑标准编辑.frx":66A2
  138.             Key             =   "cx"
  139.          EndProperty
  140.          BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  141.             Picture         =   "润滑管理_润滑标准编辑.frx":6A3C
  142.             Key             =   "zd"
  143.          EndProperty
  144.          BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  145.             Picture         =   "润滑管理_润滑标准编辑.frx":6DD6
  146.             Key             =   "dz"
  147.          EndProperty
  148.          BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  149.             Picture         =   "润滑管理_润滑标准编辑.frx":7170
  150.             Key             =   "ph"
  151.          EndProperty
  152.          BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  153.             Picture         =   "润滑管理_润滑标准编辑.frx":750A
  154.             Key             =   "fz"
  155.          EndProperty
  156.          BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  157.             Picture         =   "润滑管理_润滑标准编辑.frx":78A4
  158.             Key             =   "dw"
  159.          EndProperty
  160.          BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  161.             Picture         =   "润滑管理_润滑标准编辑.frx":7C3E
  162.             Key             =   "hf"
  163.          EndProperty
  164.          BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  165.             Picture         =   "润滑管理_润滑标准编辑.frx":7FD8
  166.             Key             =   "pz"
  167.          EndProperty
  168.          BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  169.             Picture         =   "润滑管理_润滑标准编辑.frx":8372
  170.             Key             =   "check"
  171.          EndProperty
  172.          BeginProperty ListImage33 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  173.             Picture         =   "润滑管理_润滑标准编辑.frx":870C
  174.             Key             =   "qs"
  175.          EndProperty
  176.          BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  177.             Picture         =   "润滑管理_润滑标准编辑.frx":8AA6
  178.             Key             =   "fullcheck"
  179.          EndProperty
  180.          BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  181.             Picture         =   "润滑管理_润滑标准编辑.frx":8E40
  182.             Key             =   "qq"
  183.          EndProperty
  184.          BeginProperty ListImage36 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  185.             Picture         =   "润滑管理_润滑标准编辑.frx":91DA
  186.             Key             =   "bcw"
  187.          EndProperty
  188.          BeginProperty ListImage37 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  189.             Picture         =   "润滑管理_润滑标准编辑.frx":9574
  190.             Key             =   "ye"
  191.          EndProperty
  192.       EndProperty
  193.    End
  194.    Begin MSComctlLib.Toolbar Tlb_Action 
  195.       Align           =   1  'Align Top
  196.       Height          =   570
  197.       Left            =   0
  198.       TabIndex        =   1
  199.       Top             =   0
  200.       Width           =   8220
  201.       _ExtentX        =   14499
  202.       _ExtentY        =   1005
  203.       ButtonWidth     =   820
  204.       ButtonHeight    =   953
  205.       AllowCustomize  =   0   'False
  206.       Wrappable       =   0   'False
  207.       Appearance      =   1
  208.       Style           =   1
  209.       ImageList       =   "ImageList1"
  210.       _Version        =   393216
  211.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  212.          NumButtons      =   17
  213.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  214.             Caption         =   "打印"
  215.             Key             =   "dy"
  216.             Object.ToolTipText     =   "打印当前单据或Ctrl+P"
  217.             ImageKey        =   "dy"
  218.          EndProperty
  219.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  220.             Caption         =   "预览"
  221.             Key             =   "yl"
  222.             ImageKey        =   "yl"
  223.          EndProperty
  224.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  225.             Key             =   "fgh0"
  226.             Style           =   3
  227.          EndProperty
  228.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  229.             Caption         =   "新增"
  230.             Key             =   "xz"
  231.             Object.ToolTipText     =   "新增加一张单据或F5"
  232.             ImageKey        =   "xz"
  233.          EndProperty
  234.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  235.             Caption         =   "修改"
  236.             Key             =   "xg"
  237.             Object.ToolTipText     =   "修改当前单据或F3"
  238.             ImageKey        =   "xg"
  239.          EndProperty
  240.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  241.             Caption         =   "删除"
  242.             Key             =   "sc"
  243.             Object.ToolTipText     =   "删除当前单据"
  244.             ImageKey        =   "sc"
  245.          EndProperty
  246.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  247.             Key             =   "fgh2"
  248.             Style           =   3
  249.          EndProperty
  250.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  251.             Caption         =   "保存"
  252.             Key             =   "bc"
  253.             Object.ToolTipText     =   "保存单据或F6"
  254.             ImageKey        =   "bc"
  255.          EndProperty
  256.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  257.             Caption         =   "放弃"
  258.             Key             =   "fq"
  259.             Object.ToolTipText     =   "放弃此次操作"
  260.             ImageKey        =   "fq"
  261.          EndProperty
  262.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  263.             Key             =   "fgh3"
  264.             Style           =   3
  265.          EndProperty
  266.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  267.             Caption         =   "首张"
  268.             Key             =   "first"
  269.             ImageKey        =   "first"
  270.          EndProperty
  271.          BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  272.             Caption         =   "上张"
  273.             Key             =   "prev"
  274.             ImageKey        =   "prev"
  275.          EndProperty
  276.          BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  277.             Caption         =   "下张"
  278.             Key             =   "next"
  279.             ImageKey        =   "next"
  280.          EndProperty
  281.          BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  282.             Caption         =   "末张"
  283.             Key             =   "last"
  284.             ImageKey        =   "last"
  285.          EndProperty
  286.          BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  287.             Key             =   "fgh5"
  288.             Style           =   3
  289.          EndProperty
  290.          BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  291.             Caption         =   "帮助"
  292.             Key             =   "bz"
  293.             ImageKey        =   "bz"
  294.          EndProperty
  295.          BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  296.             Caption         =   "退出"
  297.             Key             =   "fh"
  298.             ImageKey        =   "tc"
  299.          EndProperty
  300.       EndProperty
  301.       BorderStyle     =   1
  302.    End
  303.    Begin VB.Timer Timer1 
  304.       Interval        =   1
  305.       Left            =   9690
  306.       Top             =   150
  307.    End
  308.    Begin VB.TextBox LrText 
  309.       ForeColor       =   &H00000000&
  310.       Height          =   300
  311.       Index           =   0
  312.       Left            =   990
  313.       TabIndex        =   0
  314.       Text            =   "0"
  315.       Top             =   1470
  316.       Width           =   1650
  317.    End
  318.    Begin VB.Label Lab_BillId 
  319.       AutoSize        =   -1  'True
  320.       BackColor       =   &H0080C0FF&
  321.       Height          =   270
  322.       Left            =   6390
  323.       TabIndex        =   7
  324.       Top             =   1320
  325.       Visible         =   0   'False
  326.       Width           =   1230
  327.    End
  328.    Begin VB.Label Lab_Djclzt 
  329.       BackColor       =   &H0000FFFF&
  330.       Caption         =   "1"
  331.       ForeColor       =   &H00808080&
  332.       Height          =   255
  333.       Left            =   7170
  334.       TabIndex        =   6
  335.       Top             =   660
  336.       Visible         =   0   'False
  337.       Width           =   285
  338.    End
  339.    Begin VB.Label Lab_OperStatus 
  340.       BackColor       =   &H000080FF&
  341.       Caption         =   "1"
  342.       Height          =   345
  343.       Left            =   7710
  344.       TabIndex        =   5
  345.       Top             =   1260
  346.       Visible         =   0   'False
  347.       Width           =   345
  348.    End
  349.    Begin VB.Label Lab_Title 
  350.       AutoSize        =   -1  'True
  351.       BackColor       =   &H80000018&
  352.       BackStyle       =   0  'Transparent
  353.       Caption         =   "单据标题自动调整"
  354.       BeginProperty Font 
  355.          Name            =   "宋体"
  356.          Size            =   15
  357.          Charset         =   134
  358.          Weight          =   700
  359.          Underline       =   0   'False
  360.          Italic          =   0   'False
  361.          Strikethrough   =   0   'False
  362.       EndProperty
  363.       ForeColor       =   &H00000000&
  364.       Height          =   300
  365.       Left            =   2730
  366.       TabIndex        =   8
  367.       Top             =   750
  368.       Width           =   2520
  369.    End
  370.    Begin VB.Label Lab_Bill 
  371.       Appearance      =   0  'Flat
  372.       BackColor       =   &H80000005&
  373.       BackStyle       =   0  'Transparent
  374.       ForeColor       =   &H00000000&
  375.       Height          =   225
  376.       Left            =   9030
  377.       TabIndex        =   4
  378.       Top             =   6330
  379.       Width           =   735
  380.    End
  381.    Begin VB.Label Lab_Checker 
  382.       Appearance      =   0  'Flat
  383.       BackColor       =   &H80000005&
  384.       BackStyle       =   0  'Transparent
  385.       ForeColor       =   &H00000000&
  386.       Height          =   225
  387.       Left            =   7170
  388.       TabIndex        =   3
  389.       Top             =   6360
  390.       Width           =   735
  391.    End
  392.    Begin VB.Label TsLabel 
  393.       Alignment       =   1  'Right Justify
  394.       AutoSize        =   -1  'True
  395.       BackStyle       =   0  'Transparent
  396.       Caption         =   "单据号:"
  397.       Height          =   180
  398.       Index           =   0
  399.       Left            =   210
  400.       TabIndex        =   2
  401.       Top             =   1530
  402.       Width           =   765
  403.    End
  404. End
  405. Attribute VB_Name = "Dev_LubricatEditFrom"
  406. Attribute VB_GlobalNameSpace = False
  407. Attribute VB_Creatable = False
  408. Attribute VB_PredeclaredId = True
  409. Attribute VB_Exposed = False
  410. '***********************************************************************************************************
  411. '*    模 块 名 称 :设备润滑标准登记
  412. '*    程序员姓名  :王哲
  413. '*    最后修改人  :王哲
  414. '*    最后修改时间:2001/12/18
  415. '*    备        注:程序中所有依实际情况自定义部分均用[>>  <<]括起
  416. '*
  417. '*    1.每次调入外部功能窗体,均要加锁ChangeLock=True,窗体关闭后解锁ChangeLock=false
  418. '*                                    TextValiLock=True             TextValiLock=false
  419. '*
  420. '*    2.Lab_OperStatus 用此标签来标识单据录入状态(默认值为1) "1"-浏览 "2"-新增 "3"-修改
  421. '*
  422. '*    3.Lab_Djclzt 用此标签来标识单据处理状态(默认值为1) "1"-填制单据  "2"-查询单据列表  "3"-明细帐联查单据
  423. '*
  424. '*    4.原则:只要单据能够存盘(无论修改或新增)则其必须接受完整性及有效性规则检查
  425. '*
  426. '*    5.支持热键操作:打印:Ctrl+P 新增:F5 修改:F3 存盘:F6
  427. '***********************************************************************************************************
  428.  
  429. '[以下为根据实际情况设置变量
  430. Dim Bln_BillChange As Boolean                   '标识单据是否发生改动
  431. Dim Rec_Query As New ADODB.Recordset            '单据组查询结果动态集(保存当前单据组ID)
  432. Public Str_QueryCondi As String                 '单据组查询条件(接收单据列表传递查询条件)
  433. ']
  434. '以下为固定使用变量(单据)
  435. Dim BillCode As String                          '单据设计编码(索引号)
  436. Dim Var_Bill() As Variant                       '用来返回单据设计信息
  437. Dim ReportTitle As String                       '报表主标题
  438. Dim Tsxx As String                              '系统提示信息
  439. Dim Dyymctbl As New DY_Dyymsz                   '打印页面窗体变量
  440. '以下为固定使用变量(文本框)
  441. Dim Textvar() As Variant                        '存储变体型文本框信息
  442. Dim Textboolean() As Boolean                    '存储布尔型文本框信息
  443. Dim Textint() As Integer                        '存储整型文本框信息
  444. Dim Textstr() As String                         '存储字符型文本框信息
  445. Dim Max_Text_Index As Integer                   '最大录入文本框索引值
  446. Dim TextGroupCode As String                     '文本框录入分组编码
  447. Dim TextValiLock As Boolean                     '文本框失去焦点是否进行有效性控制判断
  448. Dim TextValiJudgeLock() As Boolean              '文本框录入有效性判断控制锁
  449. Dim TextChangeLock As Boolean                   '文本框内容变换控制锁
  450.     
  451. Private Sub Form_KeyPress(KeyAscii As Integer)      '控 制 焦 点 转 移
  452.    
  453.     Dim jdzygs As Integer
  454.     jdzygs = 50
  455.     Select Case KeyAscii
  456.         Case vbKeyReturn
  457.             If Kjjdzy(jdzygs) Then
  458.                 KeyAscii = 0
  459.             End If
  460.         Case 39           '屏蔽字符"'"
  461.             KeyAscii = 0
  462.     End Select
  463. End Sub
  464. Private Sub Form_Load()                                                        '窗 体 装 入
  465.     '初始化各种锁值(Fixed)
  466.     Changelock = False             '网格行列改变控制锁
  467.     Gdtlock = False                '滚动条滚动控制
  468.     Yxxpdlock = True               '字段有效性判断锁
  469.     Hyxxpdlock = True              '行有效性判断锁
  470.     Wbkbhlock = False              '文本框内容改变锁
  471.    
  472.     '调入单据信息(需要修改BillCode)
  473.     BillCode = "2511"
  474.     Call Sub_ReadBillInfo(BillCode, Me, Var_Bill())
  475.     Lab_Title = Var_Bill(2)
  476.     Lab_Title.Move (Me.Width - Lab_Title.Width) / 2, 800
  477.     
  478.     '报表编码
  479.     XtReportCode = Var_Bill(5)
  480.     Load Dyymctbl
  481.   
  482.     '以下为文本框处理程序(Fixed)
  483.     TextGroupCode = Var_Bill(3)
  484.  
  485.     Call Drwbkxx(TextGroupCode, Textvar(), Textboolean(), Textint(), Textstr())  '读入文本框录入信息
  486.     Call Wbkcsh
  487.       
  488.     '单据变动置为False(Fixed)
  489.     Bln_BillChange = False
  490.     
  491.     '调入数据初始化模块(Fixed)
  492.     Lab_Djclzt.Caption = Xtcdcs
  493.     Call Sjcsh(Trim(Lab_Djclzt.Caption))
  494.       
  495. End Sub
  496. Private Sub Form_Unload(Cancel As Integer)           '窗体卸载
  497.     '是否保存已修改单据
  498.     Dim YAnswer As Integer
  499.     If Lab_OperStatus.Caption = "2" Or Lab_OperStatus.Caption = "3" Then
  500.         Tsxx = "单据尚未保存,是否退出?"
  501.         YAnswer = Xtxxts(Tsxx, 2, 2)
  502.         If YAnswer <> 1 Then
  503.             Cancel = 1
  504.             Exit Sub
  505.         End If
  506.     End If
  507.     
  508.     '卸载打印页面窗体
  509.     Unload Dyymctbl
  510.     
  511.     '判断单据是否发生变化,并返回相应标识
  512.     If Bln_BillChange Then
  513.         Xtfhcs = "1"
  514.     Else
  515.         Xtfhcs = "0"
  516.     End If
  517.    
  518. End Sub
  519. Private Sub Sjcsh(Str_Pzclzt As String)              '数据初始化模块(根据实际情况)
  520.     Dim Sqlstr As String       '查询单据列表条件
  521.     '[>>根据实际情况初始化
  522.     Select Case Str_Pzclzt
  523.         Case "1"   '填制单据
  524.       
  525.             '调入用户查询结果动态集
  526.             Sqlstr = "SELECT LubricatefileID From Dev_LubricateFile  ORDER BY LubricatefileID"
  527.             Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  528.       
  529.             '新增单据
  530.             Call Sub_AddBill
  531.         Case "2"   '查询单据(单据列表)
  532.         
  533.             '填充查询单据标识
  534.             Lab_BillId.Caption = XT_BillID
  535.             Str_QueryCondi = Xtcdcsfz
  536.                 
  537.             Call Sub_ShowBill
  538.        
  539.             Call Sub_OperStatus("10")
  540.       
  541.             '调入用户查询结果动态集,并定位该单据
  542.             Sqlstr = "SELECT LubricatefileID From Dev_V_LubricateFile  " & Str_QueryCondi & " ORDER BY LubricatefileID"
  543.             Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  544.             Rec_Query.Find "LubricatefileID=" & Val(Lab_BillId.Caption)
  545.         Case "3"   '明细帐联查单据
  546.             '设置工具条显示
  547.             With Tlb_Action
  548.                 .Buttons("xz").Enabled = False             '新增
  549.                 .Buttons("xg").Enabled = False             '修改
  550.                 .Buttons("sc").Enabled = False             '删除
  551.                 .Buttons("fgh0").Enabled = False           '分隔行
  552.                 .Buttons("zh").Enabled = False             '增行
  553.                 .Buttons("sh").Enabled = False             '删行
  554.                 .Buttons("fgh1").Enabled = False           '分隔行
  555.                 .Buttons("bc").Enabled = False             '保存
  556.                 .Buttons("fq").Enabled = False             '放弃
  557.                 .Buttons("shsh").Enabled = False           '审核
  558.                 .Buttons("shqs").Enabled = False           '弃审
  559.                 .Buttons("fgh2").Enabled = False           '分隔行
  560.                 .Buttons("first").Enabled = False          '首张
  561.                 .Buttons("prev").Enabled = False           '上张
  562.                 .Buttons("next").Enabled = False           '下张
  563.                 .Buttons("last").Enabled = False           '末张
  564.                 .Buttons("fgh5").Enabled = False           '分割行
  565.             End With
  566.             Call Sub_ShowBill
  567.       
  568.             '设置操作状态为浏览
  569.             Lab_OperStatus.Caption = "1"
  570.       
  571.             '录入文本框
  572.             For jsqte = Max_Text_Index To 0 Step -1
  573.                 LrText(jsqte).Enabled = False
  574.             Next jsqte
  575.     End Select
  576.   
  577.     '<<]
  578.   
  579. End Sub
  580. Private Sub Sub_ShowBill()                                          '根据当前单据ID显示整张单据内容
  581.    
  582.     '过程默认参数为当前窗体中单据ID:Lab_BillID
  583.     Dim Sqlstr As String                           '临时使用字符串
  584.     Dim RecTemp As New ADODB.Recordset             '临时使用动态集
  585.     Dim jsqte As Long                              '临时计数器
  586.     '本张单据查询字符串
  587.     Sqlstr = "SELECT Dev_V_LubricateFile.* FROM Dev_V_LubricateFile " & _
  588.             " Where LubricatefileID=" & Val(Lab_BillId.Caption)
  589.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  590.       
  591.     With RecTemp
  592.         If Not .EOF Then
  593.             '[>>显示单据
  594.             TextChangeLock = True     '文本框加锁
  595.             LrText(0).Text = Trim(.Fields("LubricateFileCode"))         '标准单号
  596.             LrText(1).Text = Trim(.Fields("DEVID") & "")                '设备编号
  597.             LrText(2).Text = Trim(.Fields("DName"))                     '设备名称
  598.             LrText(3).Text = Trim(.Fields("Model") & "")                '规格型号
  599.             LrText(4).Text = Trim(.Fields("DeptName") & "")             '所属部门
  600.             LrText(5).Text = Trim(.Fields("LubricateName") & "")        '润滑油名称
  601.             LrText(5).Tag = Trim(.Fields("LubricateCode") & "")         '润滑油编号
  602.             LrText(6).Text = Trim(.Fields("LubricateModel") & "")       '规格型号
  603.             LrText(7).Text = Trim(.Fields("LubricatePoint") & "")       '加油点
  604.             LrText(8).Text = Val(.Fields("ExChange"))                   '换油量
  605.             LrText(9).Text = Val(.Fields("ExchangeCyc"))                '换油周期
  606.             LrText(10).Text = Val(.Fields("CheckCyc"))                  '检查周期
  607.             LrText(11).Text = Val(.Fields("YearWastage"))               '年消耗量
  608.             TextChangeLock = False    '文本框解锁
  609.             '<<]
  610.         End If
  611.     End With
  612.       
  613.     '设置审核弃审按钮状态
  614.     Call Sub_CheckStatus
  615.        
  616. End Sub
  617. Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
  618.      
  619.     '屏蔽文本框,下拉组合框有效性判断
  620.     Valilock = True
  621.      
  622.     '屏蔽网格失去焦点产生的有效性判断
  623.     Changelock = True
  624.        
  625.     Select Case Button.Key
  626.         Case "yl"                                            '预 览
  627.             BillTextPrint Lab_Title, LrText, TextGroupCode, XtReportCode, False
  628.         Case "dy"                                            '打 印
  629.             Dim Yhanswer As Integer      '打印提示
  630.             
  631.             '用户确认是否打印单据
  632.             Tsxx = "请确认是否打印当前单据?"
  633.             Yhanswer = Xtxxts(Tsxx, 2, 2)
  634.             If Yhanswer = 2 Then
  635.                 Exit Sub
  636.             End If
  637.             BillTextPrint Lab_Title, LrText, TextGroupCode, XtReportCode, True
  638.         Case "xz"                                            '新 增
  639.             Call Sub_AddBill
  640.         Case "xg"                                            '修 改
  641.             Call Sub_EditBill
  642.         Case "sc"                                            '删 除
  643.             Call Sub_DeleteBill
  644.         Case "bc"                                            '保 存
  645.             Call Sub_SaveBill
  646.         Case "fq"                                            '放 弃
  647.             Call Sub_AbandonBill
  648.         Case "shsh"                                          '审 核
  649.             Call Sub_CheckBill
  650.         Case "shqs"                                          '弃 审
  651.             Call Sub_AbandonCheck
  652.         Case "first"                                         '首 张
  653.             Call Sub_First
  654.         Case "prev"                                          '上 张
  655.             Call Sub_Prev
  656.         Case "next"                                          '下 张
  657.             Call Sub_Next
  658.         Case "last"                                          '末 张
  659.             Call Sub_Last
  660.         Case "bz"                                            '帮 助
  661.             Call F1bz
  662.         Case "fh"                                            '退 出
  663.             Unload Me
  664.     End Select
  665.        
  666.     '解 锁
  667.     Valilock = False
  668.     Changelock = False
  669.     TextChangeLock = False
  670.         
  671. End Sub
  672. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)     '支持热键操作
  673.    
  674.     Select Case KeyCode
  675.         Case vbKeyF5          '增加单据
  676.             If Tlb_Action.Buttons("xz").Enabled And Tlb_Action.Buttons("xz").Visible Then
  677.                 Call Sub_AddBill
  678.             End If
  679.         Case vbKeyF3          '修改单据
  680.             If Tlb_Action.Buttons("xg").Enabled And Tlb_Action.Buttons("xg").Visible Then
  681.                 Call Sub_EditBill
  682.             End If
  683.         Case vbKeyF6          '保存单据
  684.             If Tlb_Action.Buttons("bc").Enabled And Tlb_Action.Buttons("bc").Visible Then
  685.                 Call Sub_SaveBill
  686.             End If
  687.     End Select
  688. End Sub
  689. Private Sub Sub_OperStatus(Str_Status As String)                 '工具条依据不同状态所进行的变化
  690.   
  691.     With Tlb_Action
  692.         Select Case Str_Status
  693.             Case "10"   '浏览((列表)调入单据处理时的进入状态、(列表)新增状态时放弃录入)
  694.                 '工具条
  695.                 .Buttons("dy").Enabled = True       '打印
  696.                 .Buttons("yl").Enabled = True       '预览
  697.                 .Buttons("xz").Enabled = True       '新增
  698.                 .Buttons("xg").Enabled = True       '修改
  699.                 .Buttons("sc").Enabled = True       '删除
  700.                 .Buttons("bc").Enabled = False      '保存
  701.                 .Buttons("fq").Enabled = False      '放弃
  702.                 .Buttons("first").Enabled = True    '首张
  703.                 .Buttons("prev").Enabled = True     '上张
  704.                 .Buttons("next").Enabled = True     '下张
  705.                 .Buttons("last").Enabled = True     '末张
  706.                 .Buttons("bz").Enabled = True       '帮助
  707.                 .Buttons("fh").Enabled = True       '退出
  708.                 
  709.                 '设置审核弃审按钮状态
  710.                 Call Sub_CheckStatus
  711.                 
  712.                 '设置文本框录入状态
  713.                 Call Sub_LrtextStatus(False)
  714.             Case "20"   '新增单据((录入)新增一张单据 、(列表)新增一张单据)
  715.                  '工具条
  716.                  .Buttons("dy").Enabled = False      '打印
  717.                  .Buttons("yl").Enabled = False      '预览
  718.                  .Buttons("xz").Enabled = False      '新增
  719.                  .Buttons("xg").Enabled = False      '修改
  720.                  .Buttons("sc").Enabled = False      '删除
  721.                  .Buttons("bc").Enabled = True       '保存
  722.                  .Buttons("fq").Enabled = True       '放弃
  723.                  .Buttons("first").Enabled = False   '首张
  724.                  .Buttons("prev").Enabled = False    '上张
  725.                  .Buttons("next").Enabled = False    '下张
  726.                  .Buttons("last").Enabled = False    '末张
  727.                  .Buttons("bz").Enabled = True       '帮助
  728.                  .Buttons("fh").Enabled = True       '退出
  729.                  
  730.                  '设置文本框录入状态
  731.                  Call Sub_LrtextStatus(True)
  732.             Case "30"   '修改((录入)调入修改功能、(列表)调入修改功能)
  733.                 '工具条
  734.                 .Buttons("dy").Enabled = False      '打印
  735.                 .Buttons("yl").Enabled = False      '预览
  736.                 .Buttons("xz").Enabled = False      '新增
  737.                 .Buttons("xg").Enabled = False      '修改
  738.                 .Buttons("sc").Enabled = False      '删除
  739.                 .Buttons("bc").Enabled = True       '保存
  740.                 .Buttons("fq").Enabled = True       '放弃
  741.                 .Buttons("first").Enabled = False   '首张
  742.                 .Buttons("prev").Enabled = False    '上张
  743.                 .Buttons("next").Enabled = False    '下张
  744.                 .Buttons("last").Enabled = False    '末张
  745.                 .Buttons("bz").Enabled = True       '帮助
  746.                 .Buttons("fh").Enabled = True       '退出
  747.                 
  748.                 '设置文本框录入状态
  749.                 Call Sub_LrtextStatus(True)
  750.         End Select
  751.     End With
  752.     
  753. End Sub
  754. Private Sub Sub_LrtextStatus(TextEnabled As Boolean)                            '设置录入文本框状态
  755.     '录入文本框状态设置
  756.     If TextEnabled Then
  757.         For jsqte = Max_Text_Index To 0 Step -1
  758.             '判断文本框是否可编辑
  759.             If Textboolean(jsqte, 5) Then
  760.                 LrText(jsqte).Enabled = True
  761.             Else
  762.                 LrText(jsqte).Enabled = False
  763.             End If
  764.         Next jsqte
  765.     Else
  766.         For jsqte = Max_Text_Index To 0 Step -1
  767.             LrText(jsqte).Enabled = False
  768.         Next jsqte
  769.     End If
  770. End Sub
  771. Private Sub Sub_CheckStatus()                                       '设置审核弃审按钮状态(亦可设置其他动作按钮状态)
  772.     
  773.     '根据当前单据状态来确定审核弃审按钮状态
  774.     
  775. End Sub
  776. Private Sub Sub_AddBill()                                                '新增一张单据
  777.     
  778.     Dim RecTemp As New ADODB.Recordset            '临时使用动态集
  779.     Dim jsqte As Long                             '临时计数器
  780.      If Not Security_Log("Dev_LubricateCardEdit", Xtczybm, 1, True) Then
  781.         Exit Sub
  782.      End If
  783.     '设置操作状态为新增(Fixed)
  784.     Lab_OperStatus.Caption = "2"
  785.    
  786.     '设置工具条状态(Fixed)
  787.     Call Sub_OperStatus("20")
  788.    
  789.     '清空VouchID(Fixed)
  790.     Lab_BillId.Caption = ""
  791.    
  792.     '录入文本框清除内容
  793.     For jsqte = Max_Text_Index To 0 Step -1
  794.         LrText(jsqte).Tag = ""
  795.         LrText(jsqte).Text = ""
  796.     Next jsqte
  797.    
  798.     '[>>显示制单人,清空审核人,此处还可以设置录入默认值如自动生成单据号、默认单据录入日期注意加锁
  799.     TextChangeLock = True
  800.     LrText(0).Enabled = False
  801.     LrText(2).Enabled = False
  802.     LrText(3).Enabled = False
  803.     LrText(4).Enabled = False
  804.     LrText(6).Enabled = False
  805.     TextChangeLock = False
  806.     
  807.     '读取最新的单据编码
  808.     LrText(0).Text = CreatBillCode(BillCode, False)
  809.    
  810.     '<<]
  811.    
  812.     '让第一个录入项得到焦点(Fixed)
  813.     On Error Resume Next
  814.     LrText(1).SetFocus
  815.    
  816. End Sub
  817. Private Sub Sub_EditBill()                                                '修改一张单据
  818.     
  819.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  820.      If Not Security_Log("Dev_LubricateCardEdit", Xtczybm, 1, True) Then
  821.         Exit Sub
  822.      End If
  823.     '非有效单据不予进行修改动作
  824.     If Val(Lab_BillId.Caption) = 0 Then
  825.         Exit Sub
  826.     End If
  827.    
  828.     '判断当前单据是否允许修改
  829.     If Not Fun_AllowEdit Then
  830.         Exit Sub
  831.     End If
  832.    
  833.     '设置操作状态为修改
  834.     Lab_OperStatus.Caption = "3"
  835.    
  836.     '设置工具条状态
  837.     Call Sub_OperStatus("30")
  838.       
  839.     '显示制单人
  840.     LrText(0).Enabled = False
  841.     LrText(2).Enabled = False
  842.     LrText(3).Enabled = False
  843.     LrText(4).Enabled = False
  844.     LrText(6).Enabled = False
  845. '    LrText(10).Text = Xtczy
  846.    
  847. End Sub
  848. Private Sub Sub_DeleteBill()                                               '删除当前单据
  849.     
  850.     Dim YAnswer As Integer               '确认是否删除当前单据
  851.     Dim jsqte As Long                    '临时使用计数器
  852.      If Not Security_Log("Dev_LubricateCardEdit", Xtczybm, 1, True) Then
  853.         Exit Sub
  854.      End If
  855.     '非有效单据不予进行删除动作
  856.     If Val(Lab_BillId.Caption) = 0 Then
  857.         Exit Sub
  858.     End If
  859.    
  860.     Tsxx = "请确认是否删除当前单据?"
  861.     YAnswer = Xtxxts(Tsxx, 2, 2)
  862.    
  863.     If YAnswer = 1 Then
  864.         
  865.         '判断当前单据是否允许删除
  866.         If Not Fun_AllowEdit Then
  867.             Exit Sub
  868.         End If
  869.         
  870.         '进行事务处理
  871.         On Error GoTo Swcwcl
  872.         Cw_DataEnvi.DataConnect.BeginTrans
  873.         
  874.         '1.删除单据所有内容
  875.         Cw_DataEnvi.DataConnect.Execute ("Delete Dev_LubricateFile Where LubricatefileID=" & Val(Lab_BillId.Caption))
  876.         Cw_DataEnvi.DataConnect.CommitTrans
  877.         
  878.         '标识单据发生改动
  879.         Bln_BillChange = True
  880.         
  881.         '单据ID置0
  882.         Lab_BillId.Caption = 0
  883.     Else
  884.         Exit Sub
  885.     End If
  886.      
  887.     '删除单据后重置状态
  888.         
  889.     '1.显示下一张单据
  890.     Call Sub_Next
  891.         
  892.     '2.如果无下一张单据则搜索上一张单据
  893.     If Val(Lab_BillId.Caption) = 0 Then
  894.         Call Sub_Prev
  895.     End If
  896.         
  897.     '3.如无单据则置单据为空状态
  898.     If Val(Lab_BillId.Caption) = 0 Then
  899.         '清除录入文本框
  900.         For jsqte = Max_Text_Index To 0 Step -1
  901.             LrText(jsqte).Tag = ""
  902.             LrText(jsqte).Text = ""
  903.         Next jsqte
  904.         '设置操作状态为浏览
  905.         Lab_OperStatus = "1"
  906.         Call Sub_OperStatus("10")
  907.     End If
  908.     
  909.     Rec_Query.Requery
  910.     Rec_Query.Find "LubricatefileID=" & Val(Lab_BillId.Caption)
  911.     Exit Sub
  912. Swcwcl:          '单据删除时出现错误
  913.     Cw_DataEnvi.DataConnect.RollbackTrans
  914.     Tsxx = "单据删除过程中出现未知错误,程序自动恢复保存前状态!"
  915.     Call Xtxxts(Tsxx, 0, 1)
  916.     Exit Sub
  917. End Sub
  918. Private Sub Sub_AbandonBill()                                              '放弃对当前单据的操作
  919.  
  920.     Dim jsqte As Long                    '临时使用计数器
  921.   
  922.     '如果单据有效则重新显示当前单据,置单据为空状态
  923.     If Not Rec_Query.EOF Then
  924.         Lab_BillId.Caption = Rec_Query.Fields("LubricatefileID")
  925.         Call Sub_ShowBill
  926.     Else
  927.         '单据ID置为0
  928.         Lab_BillId.Caption = 0
  929.      
  930.         '清除录入文本框
  931.         For jsqte = Max_Text_Index To 0 Step -1
  932.             LrText(jsqte).Tag = ""
  933.             LrText(jsqte).Text = ""
  934.         Next jsqte
  935.     End If
  936.     
  937.     '设置操作状态为浏览
  938.     Lab_OperStatus = "1"
  939.     Call Sub_OperStatus("10")
  940. End Sub
  941. Private Function Sub_SaveBill() As Boolean                                   '保 存 单 据
  942.     
  943.     Dim RecTemp As New ADODB.Recordset                    '临时使用动态集
  944.     Dim Rec_Bill As New ADODB.Recordset                   '单据表动态集
  945.     Dim jsqte As Integer                                  '临时计数器
  946.       
  947.     Sub_SaveBill = False
  948.   
  949.     '一.============先对单据内容进行有效性判断==============='
  950.   
  951.     '先进行字段不能为空或不能为零有效性判断(Fixed)
  952.     For jsqte = 0 To Max_Text_Index
  953.         If Textint(jsqte, 8) = 1 Then     '字段不能为空
  954.             If Len(Trim(LrText(jsqte).Text)) = 0 Then
  955.                 Tsxx = Textstr(jsqte, 7) & "不能为空!"
  956.                 Call Xtxxts(Tsxx, 0, 1)
  957.                 LrText(jsqte).SetFocus
  958.                 Exit Function
  959.             End If
  960.         Else
  961.             If Textint(jsqte, 8) = 2 Then   '字段不能为零
  962.                 If Val(Trim(LrText(jsqte).Text)) = 0 Then
  963.                     Tsxx = Textstr(jsqte, 7) & "不能为零!"
  964.                     Call Xtxxts(Tsxx, 0, 1)
  965.                     LrText(jsqte).SetFocus
  966.                     Exit Function
  967.                 End If
  968.             End If
  969.         End If
  970.     Next jsqte
  971.     
  972.     '对需要进行事后判断的文本框录入内容进行有效性判断 (Fixed)
  973.     For jsqte = 0 To Max_Text_Index
  974.         If Textint(jsqte, 9) = 0 Or Textint(jsqte, 9) = 2 Then
  975.             If Not TextYxxpd(jsqte) Then
  976.                 Exit Function
  977.             End If
  978.         End If
  979.     Next jsqte
  980.   
  981.     '[>>
  982.   
  983.     '可在此区域写入其他对单据表头内容的有效性判断,具体格式参照如下
  984.    
  985.     '<<]
  986.   
  987.     '二.=============如果以上有效性检查均顺利通过,则执行存盘动作============'
  988.    
  989.     '对存盘进行事务处理(Fixed)
  990.     On Error GoTo Swcwcl
  991.     Cw_DataEnvi.DataConnect.BeginTrans
  992.     
  993.     '判断单据状态以进行不同处理
  994.     
  995.     '1.先对单据主表进行处理
  996.     If Trim(Lab_OperStatus) = "2" Then
  997.         '新增单据
  998.         
  999.         '1.对于某些单据号自动生成的单据则可在此处自动生成
  1000.         LrText(0).Text = CreatBillCode(BillCode, True)
  1001.         
  1002.         '2.开始存盘
  1003.          
  1004.         '打开单据表动态集
  1005.         If Rec_Bill.State = 1 Then Rec_Bill.Close
  1006.         Rec_Bill.Open "Select * From Dev_LubricateFile Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  1007.         With Rec_Bill
  1008.             .AddNew
  1009.             .Fields("LubricatefileID") = CreatBillID(BillCode)          '标准ID
  1010.             .Fields("LubricateFileCode") = Trim(LrText(0).Text)         '标准单号
  1011.             .Fields("DEVID") = Trim(LrText(1).Text)                     '设备编号
  1012.             .Fields("LubricateCode") = Trim(LrText(5).Tag)              '润滑油编号
  1013.             .Fields("LubricatePoint") = Trim(LrText(7).Text)            '润滑点
  1014.             .Fields("ExChange") = Val(LrText(8).Text)                   '换油量
  1015.             .Fields("ExChangeCyc") = Val(LrText(9).Text)                '换油周期
  1016.             .Fields("CheckCyc") = Val(LrText(10).Text)                  '检查周期
  1017.             .Fields("YearWastage") = Val(LrText(11).Text)               '年消耗量
  1018.             
  1019.             .Update
  1020.             
  1021.             '系统读出单据ID写入Lab_BillID
  1022.             Lab_BillId.Caption = .Fields("LubricatefileID")
  1023.         End With
  1024.     Else
  1025.         '修改单据
  1026.        
  1027.         '打开单据表动态集
  1028.         If Rec_Bill.State = 1 Then Rec_Bill.Close
  1029.         Rec_Bill.Open "Select * From Dev_LubricateFile  Where LubricatefileID=" & Val(Lab_BillId.Caption), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  1030.         With Rec_Bill
  1031.             .Fields("LubricateFileCode") = Trim(LrText(0).Text)         '标准单号
  1032.             .Fields("DEVID") = Trim(LrText(1).Text)                     '设备编号
  1033.             .Fields("LubricateCode") = Trim(LrText(5).Tag)              '润滑油编号
  1034.             .Fields("LubricatePoint") = Trim(LrText(7).Text)            '润滑点
  1035.             .Fields("ExChange") = Val(LrText(8).Text)                   '换油量
  1036.             .Fields("ExChangeCyc") = Val(LrText(9).Text)                '换油周期
  1037.             .Fields("CheckCyc") = Val(LrText(10).Text)                  '检查周期
  1038.             .Fields("YearWastage") = Val(LrText(11).Text)               '年消耗量
  1039.             .Update
  1040.         End With
  1041.     End If
  1042.          
  1043.     Cw_DataEnvi.DataConnect.CommitTrans
  1044.     Sub_SaveBill = True
  1045.     Tsxx = "单据存盘完毕! 单据号:" & Trim(LrText(0).Text)
  1046.     Call Xtxxts(Tsxx, 0, 4)
  1047.   
  1048.     '标识单据发生改动
  1049.     Bln_BillChange = True
  1050.   
  1051.     '设置单据改变后的状态
  1052.     Lab_OperStatus = "1"
  1053.     Call Sub_OperStatus("10")
  1054.     Rec_Query.Requery
  1055.     Rec_Query.Find "LubricatefileID=" & Val(Lab_BillId.Caption)
  1056.     Exit Function
  1057. Swcwcl:       '数据存盘时出现错误
  1058.     Cw_DataEnvi.DataConnect.RollbackTrans
  1059.     Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
  1060.     Call Xtxxts(Tsxx, 0, 1)
  1061.     Exit Function
  1062. End Function
  1063. '选择首张,上张,下张,末张(此4个过程只需用您的单据ID字段名替换"LubricatefileID"即可)
  1064. Private Sub Sub_First()             '首 张
  1065.     
  1066.     With Rec_Query
  1067.         If .RecordCount = 0 Then
  1068.             Exit Sub
  1069.         End If
  1070.         .MoveFirst
  1071.         Lab_BillId.Caption = .Fields("LubricatefileID")
  1072.         Call Sub_ShowBill
  1073.     End With
  1074. End Sub
  1075. Private Sub Sub_Prev()             '上 张
  1076.     
  1077.     With Rec_Query
  1078.         If .RecordCount = 0 Then
  1079.             Exit Sub
  1080.         End If
  1081.         If Not .BOF Then
  1082.             .MovePrevious
  1083.         End If
  1084.        
  1085.         If Not .BOF Then
  1086.             Lab_BillId.Caption = .Fields("LubricatefileID")
  1087.         Else
  1088.             .MoveNext
  1089.         End If
  1090.       
  1091.         Call Sub_ShowBill
  1092.     End With
  1093. End Sub
  1094. Private Sub Sub_Next()             '下 张
  1095.     
  1096.     With Rec_Query
  1097.         If .RecordCount = 0 Then
  1098.             Exit Sub
  1099.         End If
  1100.         If Not .EOF Then
  1101.             .MoveNext
  1102.         End If
  1103.       
  1104.         If Not .EOF Then
  1105.             Lab_BillId.Caption = .Fields("LubricatefileID")
  1106.         Else
  1107.             .MovePrevious
  1108.         End If
  1109.      
  1110.         Call Sub_ShowBill
  1111.     End With
  1112. End Sub
  1113. Private Sub Sub_Last()              '末 张
  1114.     
  1115.     With Rec_Query
  1116.         If .RecordCount = 0 Then
  1117.             Exit Sub
  1118.         End If
  1119.         .MoveLast
  1120.         Lab_BillId.Caption = .Fields("LubricatefileID")
  1121.         Call Sub_ShowBill
  1122.     End With
  1123. End Sub
  1124.     
  1125. '[>>===================以下为根据实际业务需要自定义过程区域=============================<<]
  1126. '审核,弃审
  1127. Private Sub Sub_CheckBill()             '审 核
  1128.     '[>>
  1129.     
  1130.     '此处可以写入禁止单据审核的理由
  1131.        
  1132.     '<<]
  1133.     
  1134.     '将单据写入审核标识
  1135.     Cw_DataEnvi.DataConnect.Execute ("Update Dev_LubricateFile Set Checker='" & Xtczy & "' Where LubricatefileID=" & Val(Lab_BillId.Caption))
  1136.     
  1137.     '写入系统操作员
  1138.     LrText(12).Text = Xtczy
  1139.     
  1140.     '设置审核弃审按钮状态
  1141.     Call Sub_CheckStatus
  1142.     
  1143.     '标识单据发生变化
  1144.     Bln_BillChange = True
  1145. End Sub
  1146. Private Sub Sub_AbandonCheck()          '弃 审
  1147.    '[>>
  1148.     
  1149.     '此处可以写入禁止单据弃审的理由
  1150.        
  1151.     '<<]
  1152.    
  1153.     '将单据清除审核标识
  1154.     Cw_DataEnvi.DataConnect.Execute ("Update Dev_LubricateFile Set Checker='' Where LubricatefileID=" & Val(Lab_BillId.Caption))
  1155.     
  1156.     '清空单据审核人
  1157.     LrText(12).Text = ""
  1158.     
  1159.     '设置审核弃审按钮状态
  1160.     Call Sub_CheckStatus
  1161.     
  1162.     '标识单据发生变化
  1163.     Bln_BillChange = True
  1164.   
  1165. End Sub
  1166. Private Function Fun_AllowEdit() As Boolean                      '判断当前单据是否允许编辑或删除
  1167.   
  1168.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  1169.     Fun_AllowEdit = False
  1170.     Sqlstr = "Select LubricateFileCode From Dev_LubricateField Where LubricateFileCode='" & Trim(LrText(0).Text) & "'"
  1171.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  1172.     With RecTemp
  1173.         If Not .EOF Then
  1174.             If Trim(.Fields("LubricateFileCode") & "") <> "" Then
  1175.                 Tsxx = "该标准已用,不能修改或删除!"
  1176.                 Call Xtxxts(Tsxx, 0, 4)
  1177.                 Exit Function
  1178.             End If
  1179.             End If
  1180.     End With
  1181.     Fun_AllowEdit = True
  1182. End Function
  1183. '[>>===================以上为根据实际业务需要自定义过程区域=============================<<]
  1184. '*****************************以下为文本框录入处理程序(固定不变部分)*******************************'
  1185. '************以下为文本框录入处理程序(固定不变部分)*************'
  1186. Private Sub Wbklrwbcl(Index As Integer)    '文本框录入事后处理程序
  1187.   Dim RecTemp As New ADODB.Recordset
  1188.   
  1189.     '以下为依据实际情况自定义部分[
  1190.   
  1191.     '在此填写文本框录入事后处理程序
  1192.     Select Case Index
  1193.         Case 1
  1194.             Sqlstr = "SELECT Dev_Main.*,Gy_Department.DeptName" & _
  1195.                 " FROM Dev_Main LEFT OUTER JOIN Gy_Department ON Dev_Main.DeptCode = Gy_Department.DeptCode " & _
  1196.                 " Where DEVID='" & Trim(LrText(1).Text) & "'"
  1197.             Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  1198.             If Not RecTemp.EOF Then
  1199.                 LrText(2).Text = RecTemp.Fields("Dname")
  1200.                 LrText(3).Text = RecTemp.Fields("Model")
  1201.                 LrText(4).Text = RecTemp.Fields("Deptname")
  1202.                 LrText(4).Tag = RecTemp.Fields("Deptcode")
  1203.             End If
  1204.         Case 5
  1205.             Sqlstr = "SELECT * FROM Dev_LubricateCord Where LubricateCode='" & Trim(LrText(5).Tag) & "'"
  1206.             Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  1207.             If Not RecTemp.EOF Then
  1208.                 LrText(6).Text = RecTemp.Fields("LubricateModel")
  1209.             End If
  1210.     End Select
  1211.     ']以上为依据实际情况自定义部分
  1212.   
  1213. End Sub
  1214. Private Sub LrText_Change(Index As Integer)
  1215.     
  1216.     '屏蔽程序改变控制
  1217.     If TextChangeLock Then
  1218.         Exit Sub
  1219.     End If
  1220.     
  1221.     TextValiJudgeLock(Index) = False    '打开有效性判断锁
  1222.     
  1223.     '限制字段录入长度
  1224.           
  1225.     TextChangeLock = True  '加锁(防止执行Lrtext_Change)
  1226.     Call TextChangeLimit(LrText(Index), Textint(Index, 1))  '去掉无效字符
  1227.     Select Case Textint(Index, 1)
  1228.         Case 8, 11      '金额型
  1229.             Call Sjgskz(LrText(Index), Xtjezws - Xtjexsws - 1, Xtjexsws)
  1230.         Case 9, 12      '数量型
  1231.             Call Sjgskz(LrText(Index), Xtslzws - Xtslxsws - 1, Xtslxsws)
  1232.         Case 10          '单价型
  1233.             Call Sjgskz(LrText(Index), Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  1234.         Case Else        '其他小数类型控制
  1235.             If Textint(Index, 6) <> 0 Or Textint(Index, 7) <> 0 Then
  1236.                 Call Sjgskz(LrText(Index), Textint(Index, 6), Textint(Index, 7))
  1237.             End If
  1238.     End Select
  1239.         
  1240.     TextChangeLock = False '解锁
  1241. End Sub
  1242. Private Sub LrText_GotFocus(Index As Integer)                                                 '文本框得到焦点,显示相应信息
  1243.     
  1244.     Call TextShow(Index)
  1245.     CurTextIndex = Index
  1246.     LrText(Index).SelStart = Len(LrText(Index))
  1247. End Sub
  1248. Private Sub LrText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)            '字段按F2键提供帮助
  1249.     
  1250.     Select Case KeyCode
  1251.         Case vbKeyF2
  1252.             Call Text_Help(Index)
  1253.     End Select
  1254. End Sub
  1255. Private Sub LrText_KeyPress(Index As Integer, KeyAscii As Integer)                            '文本框录入事中控制
  1256.     Call InputFieldLimit(LrText(Index), Textint(Index, 1), KeyAscii)
  1257. End Sub
  1258. Private Sub LrText_LostFocus(Index As Integer)                                                '文本框失去焦点
  1259.     '显示相应信息但不能进行有效性判断
  1260.     Select Case Index
  1261.         Case 1
  1262.             If Trim(LrText(1).Text) = "" Then
  1263.                 Exit Sub
  1264.             Else
  1265.                 Call Wbklrwbcl(Index)
  1266.             End If
  1267.         Case 5
  1268.             If Trim(LrText(5).Text) = "" Then
  1269.                 Exit Sub
  1270.             Else
  1271.                 Call Wbklrwbcl(Index)
  1272.             End If
  1273.     End Select
  1274. End Sub
  1275. Private Sub Ydcommand1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)     '按钮提供帮助
  1276.     '文本框处于非录入状态时不允许调入帮助
  1277.     If Not LrText(Index).Enabled Then
  1278.         Exit Sub
  1279.     End If
  1280.    
  1281.     Call Text_Help(Index)
  1282. End Sub
  1283. Private Sub Text_Help(Index As Integer)                                                       '录入字段帮助
  1284.     
  1285.     If Not Textboolean(Index, 1) Then
  1286.         Exit Sub
  1287.     End If
  1288.      
  1289.     '调用帮助
  1290.     Call Drbmhelp(Textint(Index, 2), Textstr(Index, 4), Trim(LrText(Index).Text))
  1291.   
  1292.     '根据设置选择显示编码和名称,并进行存储
  1293.     If Len(Xtfhcs) <> 0 Then
  1294.         If Textint(Index, 3) = 1 Then
  1295.             LrText(Index).Text = Xtfhcsfz
  1296.             LrText(Index).Tag = Xtfhcs
  1297.         Else
  1298.             LrText(Index).Text = Xtfhcs
  1299.             LrText(Index).Tag = Xtfhcsfz
  1300.         End If
  1301.     End If
  1302.    
  1303.     LrText(Index).SetFocus
  1304.     
  1305.      If Index = 1 And Len(Xtfhcs) <> 0 Then
  1306.         Call Wbklrwbcl(Index)
  1307.      End If
  1308.      If Index = 5 And Len(Xtfhcs) <> 0 Then
  1309.         Call Wbklrwbcl(Index)
  1310.      End If
  1311.     
  1312. End Sub
  1313. Private Sub TextShow(Index As Integer)        '文本框得到焦点,显示相应信息
  1314.     '填写文本框得到焦点,进行相应信息处理程序
  1315.    
  1316. End Sub
  1317. Private Sub Wbkcsh()                          '录入文本框初始化
  1318.     Dim Int_TabIndex As Integer         'Tab焦点计数器
  1319.   
  1320.     '单据录入中文本框焦点由0开始
  1321.     LrText(0).TabIndex = 0
  1322.   
  1323.     '最大录入文本框索引值
  1324.     Max_Text_Index = Textvar(1)
  1325.   
  1326.     ReDim TextValiJudgeLock(Max_Text_Index)
  1327.     For jsqte = 0 To Max_Text_Index
  1328.         
  1329.         '判断此文本框录入索引号是否存在,如存在则对其进行初始化
  1330.         If Len(Trim(Textstr(jsqte, 1))) <> 0 Then
  1331.         
  1332.             '自动装入录入文本框和其解释标签
  1333.             If jsqte <> 0 Then
  1334.                 Load LrText(jsqte)
  1335.                 Load tsLabel(jsqte)
  1336.            
  1337.                 '判断录入文本框是否显示
  1338.                 If Textboolean(jsqte, 4) Then
  1339.                     LrText(jsqte).Visible = True
  1340.                     tsLabel(jsqte).Visible = True
  1341.                 End If
  1342.             
  1343.                 '判断文本框是否可编辑
  1344.                 If Textboolean(jsqte, 5) Then
  1345.                     LrText(jsqte).Enabled = True
  1346.                 Else
  1347.                     LrText(jsqte).Enabled = False
  1348.                 End If
  1349.                 
  1350.                  '判断文本框是否提供帮助
  1351.                 If Textboolean(jsqte, 1) Then
  1352.                     If Not Textboolean(jsqte, 3) Then
  1353.                         Load Ydcommand1(jsqte)
  1354.                     End If
  1355.                 End If
  1356.             End If
  1357.            
  1358.            '初始化其内容
  1359.             TextChangeLock = True
  1360.             LrText(jsqte).Text = ""
  1361.             LrText(jsqte).Tag = ""
  1362.             If Textint(jsqte, 5) <> 0 Then
  1363.                 LrText(jsqte).MaxLength = Textint(jsqte, 5)
  1364.             End If
  1365.             TextChangeLock = False
  1366.         
  1367.             '设置文本框位置及大小,并设置相应标签内容及其位置
  1368.             LrText(jsqte).Move Textint(jsqte, 13), Textint(jsqte, 12), Textint(jsqte, 11), Textint(jsqte, 10)
  1369.             tsLabel(jsqte).Caption = Textstr(jsqte, 7) & ":"
  1370.             tsLabel(jsqte).Move Textint(jsqte, 13) - tsLabel(jsqte).Width - 20, Textint(jsqte, 12) + (Textint(jsqte, 10) - tsLabel(jsqte).Height) / 2 - 30
  1371.             
  1372.             '判断文本框是否提供帮助
  1373.             If Textboolean(jsqte, 1) Then
  1374.                 Ydcommand1(jsqte).Visible = True
  1375.                 Ydcommand1(jsqte).Move LrText(jsqte).Left + LrText(jsqte).Width, LrText(jsqte).Top
  1376.             End If
  1377.             
  1378.             
  1379.         End If
  1380.      
  1381.         '将文本框有效性判断进行加锁,在文本框内容发生变化时将锁打开
  1382.         TextValiJudgeLock(jsqte) = True
  1383.       
  1384.     Next jsqte
  1385.     
  1386.     '设置文本框焦点转移顺序(前提文本焦点从0至Max_Text_Index)
  1387.     For Int_TabIndex = 0 To Max_Text_Index
  1388.         For jsqte = 0 To Max_Text_Index
  1389.             If Textint(jsqte, 14) = Int_TabIndex Then
  1390.                LrText(jsqte).TabIndex = Int_TabIndex
  1391.             End If
  1392.         Next jsqte
  1393.     Next Int_TabIndex
  1394.   
  1395. End Sub
  1396. Private Function TextYxxpd(Index As Integer) As Boolean           '文本框有效性判断
  1397.   
  1398.     Dim Sqlstr As String
  1399.     Dim Findrec As ADODB.Recordset
  1400.   
  1401.     '文本框内容未曾改变不进行有效性判断
  1402.     If TextValiJudgeLock(Index) Then
  1403.         TextYxxpd = True
  1404.         Exit Function
  1405.     End If
  1406.   
  1407.     '文本框内容为空认为有效,并清空其Tag值
  1408.     If Trim(LrText(Index)) = "" Then
  1409.         LrText(Index).Tag = ""
  1410.         Call Wbklrwbcl(Index)
  1411.         TextValiJudgeLock(Index) = True
  1412.         TextYxxpd = True
  1413.         Exit Function
  1414.     End If
  1415.   
  1416.     '可在此加入不做有效性判断的理由
  1417.   
  1418.     Select Case Textint(Index, 4)
  1419.         Case 1      '编码型
  1420.             Sqlstr = Trim(Textstr(Index, 5))
  1421.             Sqlstr = Replace(Sqlstr, "@", "'" + Trim(LrText(Index).Text) + "'")
  1422.             Set Findrec = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  1423.             If Findrec.EOF Then
  1424.                 Call Xtxxts(Trim(Textstr(Index, 6)), 0, 1)
  1425.                 LrText(Index).SetFocus
  1426.                 Exit Function
  1427.             Else
  1428.                 Select Case Textint(Index, 3)
  1429.                     Case 0
  1430.                         If Len(Trim(Textstr(Index, 2))) <> 0 Then
  1431.                             LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
  1432.                         End If
  1433.                         If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
  1434.                             LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
  1435.                         End If
  1436.                     Case 1
  1437.                         If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
  1438.                             LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
  1439.                         End If
  1440.                         If Len(Trim(Textstr(Index, 2))) <> 0 Then
  1441.                             LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
  1442.                         End If
  1443.                 End Select
  1444.             End If
  1445.         Case 2      '日期型
  1446.             If IsDate(LrText(Index).Text) Then
  1447.                 LrText(Index).Text = Format(LrText(Index).Text, "yyyy-mm-dd")
  1448.                 If Val(Mid(LrText(Index), 1, 4)) < 1900 Then
  1449.                     LrText(Index).Text = "1900" + Mid(LrText(Index), 5, 6)
  1450.                 End If
  1451.             Else
  1452.                 Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
  1453.                 Call Xtxxts(Tsxx, 0, 1)
  1454.                 LrText(Index).SetFocus
  1455.                 Exit Function
  1456.             End If
  1457.         Case 3      '其他类型
  1458.     End Select
  1459.     
  1460.     '如果有效则加锁,用户不改变内容则不再进行有效性判断
  1461.     TextValiJudgeLock(Index) = True
  1462.     '调用文本框事后处理程序
  1463.     Call Wbklrwbcl(Index)
  1464.        
  1465.     '有效性判断通过则返回True
  1466.     TextYxxpd = True
  1467.    
  1468. End Function