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

企业管理

开发平台:

Visual Basic

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