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

企业管理

开发平台:

Visual Basic

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