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

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.Form Tr_TrainAccountcxtj 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "铁运台帐查询条件"
  5.    ClientHeight    =   2625
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   4695
  9.    Icon            =   "铁运统计_铁运台帐查询.frx":0000
  10.    KeyPreview      =   -1  'True
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   2625
  15.    ScaleWidth      =   4695
  16.    ShowInTaskbar   =   0   'False
  17.    StartUpPosition =   1  '所有者中心
  18.    Begin VB.Frame Frame1 
  19.       Height          =   2145
  20.       Left            =   45
  21.       TabIndex        =   9
  22.       Top             =   -15
  23.       Width           =   4605
  24.       Begin VB.CommandButton Ydcommand1 
  25.          Height          =   300
  26.          Index           =   5
  27.          Left            =   4200
  28.          Picture         =   "铁运统计_铁运台帐查询.frx":1042
  29.          Style           =   1  'Graphical
  30.          TabIndex        =   16
  31.          Top             =   1710
  32.          Width           =   300
  33.       End
  34.       Begin VB.CommandButton Ydcommand1 
  35.          Height          =   300
  36.          Index           =   3
  37.          Left            =   4200
  38.          Picture         =   "铁运统计_铁运台帐查询.frx":13CC
  39.          Style           =   1  'Graphical
  40.          TabIndex        =   15
  41.          Top             =   975
  42.          Width           =   300
  43.       End
  44.       Begin VB.TextBox LrText 
  45.          Height          =   300
  46.          Index           =   5
  47.          Left            =   990
  48.          TabIndex        =   5
  49.          Text            =   "5"
  50.          Top             =   1710
  51.          Width           =   3195
  52.       End
  53.       Begin VB.TextBox LrText 
  54.          Height          =   300
  55.          Index           =   3
  56.          Left            =   990
  57.          TabIndex        =   3
  58.          Text            =   "3"
  59.          Top             =   975
  60.          Width           =   3195
  61.       End
  62.       Begin VB.TextBox LrText 
  63.          Height          =   300
  64.          Index           =   1
  65.          Left            =   2955
  66.          TabIndex        =   1
  67.          Text            =   "1"
  68.          Top             =   225
  69.          Width           =   1245
  70.       End
  71.       Begin VB.TextBox LrText 
  72.          Height          =   300
  73.          Index           =   0
  74.          Left            =   990
  75.          TabIndex        =   0
  76.          Text            =   "0"
  77.          Top             =   225
  78.          Width           =   1335
  79.       End
  80.       Begin VB.TextBox LrText 
  81.          Height          =   300
  82.          Index           =   2
  83.          Left            =   990
  84.          TabIndex        =   2
  85.          Text            =   "2"
  86.          Top             =   600
  87.          Width           =   3195
  88.       End
  89.       Begin VB.CommandButton Ydcommand1 
  90.          Height          =   300
  91.          Index           =   0
  92.          Left            =   2325
  93.          Picture         =   "铁运统计_铁运台帐查询.frx":1756
  94.          Style           =   1  'Graphical
  95.          TabIndex        =   14
  96.          Top             =   225
  97.          Width           =   300
  98.       End
  99.       Begin VB.CommandButton Ydcommand1 
  100.          Height          =   300
  101.          Index           =   1
  102.          Left            =   4170
  103.          Picture         =   "铁运统计_铁运台帐查询.frx":1AE0
  104.          Style           =   1  'Graphical
  105.          TabIndex        =   13
  106.          Top             =   225
  107.          Width           =   300
  108.       End
  109.       Begin VB.TextBox LrText 
  110.          Height          =   300
  111.          Index           =   4
  112.          Left            =   990
  113.          TabIndex        =   4
  114.          Text            =   "4"
  115.          Top             =   1350
  116.          Width           =   3195
  117.       End
  118.       Begin VB.CommandButton Ydcommand1 
  119.          Height          =   300
  120.          Index           =   4
  121.          Left            =   4200
  122.          Picture         =   "铁运统计_铁运台帐查询.frx":1E6A
  123.          Style           =   1  'Graphical
  124.          TabIndex        =   12
  125.          Top             =   1350
  126.          Width           =   300
  127.       End
  128.       Begin VB.CommandButton Ydcommand1 
  129.          Height          =   300
  130.          Index           =   2
  131.          Left            =   4200
  132.          Picture         =   "铁运统计_铁运台帐查询.frx":21F4
  133.          Style           =   1  'Graphical
  134.          TabIndex        =   11
  135.          Top             =   600
  136.          Width           =   300
  137.       End
  138.       Begin VB.Label Label1 
  139.          AutoSize        =   -1  'True
  140.          Caption         =   "车辆类型:"
  141.          Height          =   180
  142.          Index           =   1
  143.          Left            =   135
  144.          TabIndex        =   21
  145.          Top             =   1770
  146.          Width           =   810
  147.       End
  148.       Begin VB.Label Label1 
  149.          AutoSize        =   -1  'True
  150.          Caption         =   "发车日期:"
  151.          Height          =   180
  152.          Index           =   2
  153.          Left            =   135
  154.          TabIndex        =   20
  155.          Top             =   285
  156.          Width           =   810
  157.       End
  158.       Begin VB.Line Line2 
  159.          Index           =   1
  160.          X1              =   2655
  161.          X2              =   2895
  162.          Y1              =   375
  163.          Y2              =   375
  164.       End
  165.       Begin VB.Label Label1 
  166.          AutoSize        =   -1  'True
  167.          Caption         =   "接收单位:"
  168.          Height          =   180
  169.          Index           =   11
  170.          Left            =   135
  171.          TabIndex        =   19
  172.          Top             =   1035
  173.          Width           =   810
  174.       End
  175.       Begin VB.Label Label1 
  176.          AutoSize        =   -1  'True
  177.          Caption         =   "车号:"
  178.          Height          =   180
  179.          Index           =   0
  180.          Left            =   135
  181.          TabIndex        =   18
  182.          Top             =   660
  183.          Width           =   450
  184.       End
  185.       Begin VB.Label Label1 
  186.          AutoSize        =   -1  'True
  187.          Caption         =   "货物编码:"
  188.          Height          =   180
  189.          Index           =   4
  190.          Left            =   135
  191.          TabIndex        =   17
  192.          Top             =   1410
  193.          Width           =   810
  194.       End
  195.    End
  196.    Begin VB.CheckBox UnloadCheck 
  197.       Caption         =   "卸载窗体"
  198.       Height          =   615
  199.       Left            =   5655
  200.       TabIndex        =   10
  201.       Top             =   34500
  202.       Width           =   34532
  203.    End
  204.    Begin VB.CommandButton QdCommand 
  205.       Caption         =   "确定(&O)"
  206.       Height          =   300
  207.       Left            =   2295
  208.       TabIndex        =   6
  209.       Top             =   2250
  210.       Width           =   1120
  211.    End
  212.    Begin VB.CommandButton QxCommand 
  213.       Caption         =   "取消(&C)"
  214.       Height          =   300
  215.       Left            =   3525
  216.       TabIndex        =   7
  217.       Top             =   2250
  218.       Width           =   1120
  219.    End
  220.    Begin VB.CommandButton Cmd_Clear 
  221.       Caption         =   "全清"
  222.       Height          =   300
  223.       Left            =   45
  224.       TabIndex        =   8
  225.       Top             =   2250
  226.       Width           =   1120
  227.    End
  228. End
  229. Attribute VB_Name = "Tr_TrainAccountcxtj"
  230. Attribute VB_GlobalNameSpace = False
  231. Attribute VB_Creatable = False
  232. Attribute VB_PredeclaredId = True
  233. Attribute VB_Exposed = False
  234. '******************************************************************
  235. '*    模 块 名 称 :安全库存预警查询条件
  236. '*    功 能 描 述 :
  237. '*    程序员姓名  :徐强
  238. '*    最后修改人  :徐强
  239. '*    最后修改时间:2001/12/10
  240. '*    备        注:程序中所有依实际情况自定义部分均用[>>  <<]括起
  241. '******************************************************************
  242. Dim Tsxx As String                       '系统信息提示
  243. '以下为固定使用变量(文本框)
  244. Dim Textvar() As Variant                 '存储变体型文本框信息
  245. Dim Textboolean() As Boolean             '存储布尔型文本框信息
  246. Dim Textint() As Integer                 '存储整型文本框信息
  247. Dim Textstr() As String                  '存储字符型文本框信息
  248. Dim Max_Text_Index As Integer            '最大录入文本框索引值
  249. Dim TextGroupCode As String              '文本框录入分组编码
  250. Dim TextValiLock As Boolean              '文本框失去焦点是否进行有效性控制判断
  251. Dim TextValiJudgeLock() As Boolean       '文本框录入有效性判断控制锁
  252. Dim CurTextIndex As Integer              '当前文本框索引值
  253. Dim TextChangeLock As Boolean            '文本框内容变换控制锁
  254. Dim Bln_Cancel As Boolean                '取消按钮信息传递
  255. Private Sub Form_KeyPress(KeyAscii As Integer)    '控 制 焦 点 转 移(Fixed)
  256.     Dim jdzygs As Integer                         '控件焦点转移个数
  257.     jdzygs = 8
  258.     Select Case KeyAscii
  259.         Case vbKeyReturn
  260.             If Kjjdzy(jdzygs) Then
  261.                 KeyAscii = 0
  262.             End If
  263.         Case 39           '屏蔽"'"
  264.             KeyAscii = 0
  265.     End Select
  266. End Sub
  267. Private Sub Form_Load()
  268.     '以下为文本框处理程序(Fixed)
  269.     TextGroupCode = "tr_trainaccountcxtj"
  270.     Call Drwbkxx(TextGroupCode, Textvar(), Textboolean(), Textint(), Textstr())  '读入文本框录入信息
  271.     Call Wbkcsh
  272.     '[>>初始化查询条件默认值
  273.     '<<]
  274. End Sub
  275. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)          '查询条件窗体卸载
  276.     '查询条件窗体卸载时判断是否因为结果窗体卸载,如是则卸载,否则隐藏
  277.     If UnloadCheck.Value <> 1 Then
  278.         Cancel = 1
  279.         Me.Hide
  280.     End If
  281.     
  282. End Sub
  283. Private Sub QdCommand_Click()                                   '确 定
  284.     '录入条件有效性判断(Fixed)
  285.     If Not Lrtjyxxpd Then
  286.         Exit Sub
  287.     End If
  288.     Me.Hide
  289.         
  290.     '[>>激活查询过程结果窗体
  291.     
  292.     Tr_TrainAccount.Timer1.Enabled = True
  293.     Tr_TrainAccount.SetFocus
  294.     
  295.     '<<]
  296. End Sub
  297. Private Sub QxCommand_Click()                                    '取消(Fixed)
  298.     Me.Hide
  299. End Sub
  300. Private Function Lrtjyxxpd() As Boolean                          '用户录入条件有效性判断
  301.     Dim jsqte As Integer
  302.     Lrtjyxxpd = False
  303.  
  304.     '对需要进行事后判断的文本框录入内容进行有效性判断 (Fixed)
  305.     For jsqte = 0 To Max_Text_Index
  306.         If Textint(jsqte, 9) = 0 Or Textint(jsqte, 9) = 2 Then
  307.             If Not TextYxxpd(jsqte) Then
  308.                 Exit Function
  309.             End If
  310.         End If
  311.     Next jsqte
  312.    
  313.     '[>>以下为依据实际情况自定义部分
  314.     If LrText(0).Text > LrText(1).Text And Trim(LrText(1).Text) <> "" Then
  315.         Tsxx = "发车日期范围应由小到大!"
  316.         Call Xtxxts(Tsxx, 0, 4)
  317.         LrText(0).SetFocus
  318.         Exit Function
  319.     End If
  320.   
  321.     '<<]以上为依据实际情况自定义部分
  322.  
  323.     Lrtjyxxpd = True
  324. End Function
  325. Private Sub Cmd_Clear_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)    '将用户输入条件全部清除(可选)
  326.     '清除文本框(Fixed)
  327.     For jsqte = 0 To Max_Text_Index
  328.         LrText(jsqte).Tag = ""
  329.         LrText(jsqte).Text = ""
  330.     Next jsqte
  331.     '[>>
  332.     '此处可以写入其他清除条件程序
  333.     '<<]
  334.   
  335. End Sub
  336. '*************以下为文本框录入处理程序(固定不变部分)*************'
  337. Private Sub Wbklrwbcl(Index As Integer)    '文本框录入事后处理程序
  338.   
  339.     '以下为依据实际情况自定义部分[
  340.     '在此填写文本框录入事后处理程序
  341.     ']以上为依据实际情况自定义部分
  342.   
  343. End Sub
  344. Private Sub LrText_Change(Index As Integer)
  345.    
  346.     '屏蔽程序改变控制
  347.     If TextChangeLock Then
  348.         Exit Sub
  349.     End If
  350.     
  351.     TextValiJudgeLock(Index) = False    '打开有效性判断锁
  352.     
  353.     '限制字段录入长度
  354.           
  355.     TextChangeLock = True  '加锁(防止执行Lrtext_Change)
  356.         
  357.     Select Case Textint(Index, 1)
  358.         Case 8, 11      '金额型
  359.             Call Sjgskz(LrText(Index), Xtjezws - Xtjexsws - 1, Xtjexsws)
  360.         Case 9, 12      '数量型
  361.             Call Sjgskz(LrText(Index), Xtslzws - Xtslxsws - 1, Xtslxsws)
  362.         Case 10          '单价型
  363.             Call Sjgskz(LrText(Index), Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  364.         Case Else        '其他小数类型控制
  365.             If Textint(Index, 6) <> 0 Or Textint(Index, 7) <> 0 Then
  366.                 Call Sjgskz(LrText(Index), Textint(Index, 6), Textint(Index, 7))
  367.             End If
  368.     End Select
  369.         
  370.     TextChangeLock = False '解锁
  371. End Sub
  372. Private Sub LrText_GotFocus(Index As Integer)                                                 '文本框得到焦点,显示相应信息
  373.     Call TextShow(Index)
  374.     CurTextIndex = Index
  375.     LrText(Index).SelStart = Len(LrText(Index))
  376. End Sub
  377. Private Sub LrText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)            '字段按F2键提供帮助
  378.     
  379.     Select Case KeyCode
  380.         Case vbKeyF2
  381.             Call Text_Help(Index)
  382.     End Select
  383. End Sub
  384. Private Sub LrText_KeyPress(Index As Integer, KeyAscii As Integer)                            '文本框录入事中控制
  385.     Call InputFieldLimit(LrText(Index), Textint(Index, 1), KeyAscii)
  386. End Sub
  387. Private Sub LrText_LostFocus(Index As Integer)                                                '文本框失去焦点
  388.     '显示相应信息但不能进行有效性判断
  389.   
  390. End Sub
  391. Private Sub Ydcommand1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)     '按钮提供帮助
  392.     Call Text_Help(Index)
  393. End Sub
  394. Private Sub Text_Help(Index As Integer)                                                       '录入字段帮助
  395.     If Not Textboolean(Index, 1) Then
  396.         Exit Sub
  397.     End If
  398.      
  399.     '调用帮助
  400.     Call Drbmhelp(Textint(Index, 2), Textstr(Index, 4), Trim(LrText(Index).Text))
  401.   
  402.     '根据设置选择显示编码和名称,并进行存储
  403.     If Len(Xtfhcs) <> 0 Then
  404.         If Textint(Index, 3) = 1 Then
  405.             LrText(Index).Text = Xtfhcsfz
  406.             LrText(Index).Tag = Xtfhcs
  407.         Else
  408.             LrText(Index).Text = Xtfhcs
  409.             LrText(Index).Tag = Xtfhcsfz
  410.         End If
  411.     End If
  412.    
  413.     LrText(Index).SetFocus
  414. End Sub
  415. Private Sub TextShow(Index As Integer)        '文本框得到焦点,显示相应信息
  416.     '填写文本框得到焦点,进行相应信息处理程序
  417.    
  418. End Sub
  419. Private Sub Wbkcsh()                          '录入文本框初始化
  420.     
  421.     Dim jsqte As Long
  422.   
  423.     '最大录入文本框索引值
  424.     Max_Text_Index = Textvar(1)
  425.   
  426.     ReDim TextValiJudgeLock(Max_Text_Index)
  427.     For jsqte = 0 To Max_Text_Index
  428.         If Len(Trim(Textstr(jsqte, 1))) <> 0 Then
  429. '            If Textboolean(jsqte, 1) Then
  430. '                If jsqte <> 0 And Not Textboolean(jsqte, 3) Then
  431. '                    Load Ydcommand1(jsqte)
  432. '                End If
  433. '                Ydcommand1(jsqte).Visible = True
  434. '                Ydcommand1(jsqte).Move LrText(jsqte).Left + LrText(jsqte).Width, LrText(jsqte).Top
  435. '            End If
  436.             TextChangeLock = True
  437.             LrText(jsqte).Text = ""
  438.             LrText(jsqte).Tag = ""
  439.             If Textint(jsqte, 5) <> 0 Then
  440.                 LrText(jsqte).MaxLength = Textint(jsqte, 5)
  441.             End If
  442.             TextChangeLock = False
  443.         End If
  444.         TextValiJudgeLock(jsqte) = True
  445.     Next jsqte
  446. End Sub
  447. Private Function TextYxxpd(Index As Integer) As Boolean           '文本框有效性判断
  448.     
  449.     Dim Sqlstr As String
  450.     Dim Findrec As ADODB.Recordset
  451.   
  452.     '文本框内容未曾改变不进行有效性判断
  453.     If TextValiJudgeLock(Index) Then
  454.         TextYxxpd = True
  455.         Exit Function
  456.     End If
  457.   
  458.     '文本框内容为空认为有效,并清空其Tag值
  459.     If Trim(LrText(Index)) = "" Then
  460.         LrText(Index).Tag = ""
  461.         Call Wbklrwbcl(Index)
  462.         TextValiJudgeLock(Index) = True
  463.         TextYxxpd = True
  464.         Exit Function
  465.     End If
  466.   
  467.     '可在此加入不做有效性判断的理由
  468.   
  469.     Select Case Textint(Index, 4)
  470.         Case 1      '编码型
  471.             Sqlstr = Trim(Textstr(Index, 5))
  472.             Sqlstr = Replace(Sqlstr, "@", "'" + Trim(LrText(Index).Text) + "'")
  473.             Set Findrec = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  474.             If Findrec.EOF Then
  475.                 Call Xtxxts(Trim(Textstr(Index, 6)), 0, 1)
  476.                 LrText(Index).SetFocus
  477.                 Exit Function
  478.             Else
  479.                 Select Case Textint(Index, 3)
  480.                     Case 0
  481.                         If Len(Trim(Textstr(Index, 2))) <> 0 Then
  482.                             LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
  483.                         End If
  484.                         If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
  485.                             LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
  486.                         End If
  487.                     Case 1
  488.                         If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
  489.                             LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
  490.                         End If
  491.                         If Len(Trim(Textstr(Index, 2))) <> 0 Then
  492.                             LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
  493.                         End If
  494.                 End Select
  495.             End If
  496.         Case 2      '日期型
  497.             If IsDate(LrText(Index).Text) Then
  498.                 LrText(Index).Text = Format(LrText(Index).Text, "yyyy-mm-dd")
  499.                 If Val(Mid(LrText(Index), 1, 4)) < 1900 Then
  500.                     LrText(Index).Text = "1900" + Mid(LrText(Index), 5, 6)
  501.                 End If
  502.             Else
  503.                 Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
  504.                 Call Xtxxts(Tsxx, 0, 1)
  505.                 LrText(Index).SetFocus
  506.                 Exit Function
  507.             End If
  508.         Case 3      '其他类型
  509.     End Select
  510.     
  511.     '如果有效则加锁,用户不改变内容则不再进行有效性判断
  512.     TextValiJudgeLock(Index) = True
  513.     '调用文本框事后处理程序
  514.     Call Wbklrwbcl(Index)
  515.    
  516.     '有效性判断通过则返回True
  517.     TextYxxpd = True
  518.    
  519. End Function