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

企业管理

开发平台:

Visual Basic

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