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

企业管理

开发平台:

Visual Basic

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