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

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.Form SC_FrmIncomeCostC 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "收入成本分析查询条件"
  5.    ClientHeight    =   2730
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   3435
  9.    Icon            =   "收入成本_分析查询条件.frx":0000
  10.    KeyPreview      =   -1  'True
  11.    LinkTopic       =   "Form2"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   2730
  15.    ScaleWidth      =   3435
  16.    StartUpPosition =   2  '屏幕中心
  17.    Begin VB.Frame Frame1 
  18.       Caption         =   "比较日期"
  19.       Height          =   1065
  20.       Index           =   1
  21.       Left            =   55
  22.       TabIndex        =   8
  23.       Top             =   1200
  24.       Width           =   3315
  25.       Begin VB.ComboBox Combo_SelYear 
  26.          Height          =   300
  27.          Left            =   120
  28.          Style           =   2  'Dropdown List
  29.          TabIndex        =   2
  30.          Top             =   225
  31.          Width           =   3075
  32.       End
  33.       Begin VB.ComboBox Combo_CompDate 
  34.          Height          =   300
  35.          Left            =   105
  36.          Style           =   2  'Dropdown List
  37.          TabIndex        =   3
  38.          Top             =   615
  39.          Width           =   3105
  40.       End
  41.    End
  42.    Begin VB.Frame Frame1 
  43.       Caption         =   "分析日期"
  44.       Height          =   1065
  45.       Index           =   0
  46.       Left            =   60
  47.       TabIndex        =   7
  48.       Top             =   60
  49.       Width           =   3315
  50.       Begin VB.ComboBox Combo_Type 
  51.          Height          =   300
  52.          Left            =   105
  53.          Style           =   2  'Dropdown List
  54.          TabIndex        =   0
  55.          Top             =   210
  56.          Width           =   3075
  57.       End
  58.       Begin VB.ComboBox Combo_BaseDate 
  59.          Height          =   300
  60.          Left            =   120
  61.          Style           =   2  'Dropdown List
  62.          TabIndex        =   1
  63.          Top             =   615
  64.          Width           =   3075
  65.       End
  66.    End
  67.    Begin VB.CommandButton QdCommand 
  68.       Caption         =   "确定(&O)"
  69.       Height          =   300
  70.       Left            =   1050
  71.       TabIndex        =   4
  72.       Top             =   2340
  73.       Width           =   1120
  74.    End
  75.    Begin VB.CommandButton QxCommand 
  76.       Caption         =   "取消(&C)"
  77.       Height          =   300
  78.       Left            =   2250
  79.       TabIndex        =   5
  80.       Top             =   2340
  81.       Width           =   1120
  82.    End
  83.    Begin VB.CheckBox UnloadCheck 
  84.       Caption         =   "卸载窗体"
  85.       Height          =   615
  86.       Left            =   3870
  87.       TabIndex        =   6
  88.       Top             =   1920
  89.       Visible         =   0   'False
  90.       Width           =   825
  91.    End
  92.    Begin VB.Label Lbl_Comment 
  93.       Height          =   525
  94.       Left            =   90
  95.       TabIndex        =   9
  96.       Top             =   2850
  97.       Visible         =   0   'False
  98.       Width           =   1245
  99.    End
  100. End
  101. Attribute VB_Name = "SC_FrmIncomeCostC"
  102. Attribute VB_GlobalNameSpace = False
  103. Attribute VB_Creatable = False
  104. Attribute VB_PredeclaredId = True
  105. Attribute VB_Exposed = False
  106. '****************************************************************
  107. '*    模 块 名 称 : 收入成本分析查询条件
  108. '*    功 能 描 述 :
  109. '*    程序员姓名  : 魏永生
  110. '*    最后修改人  :
  111. '*    最后修改时间:2002/1/21
  112. '*    备        注:程序中所有依实际情况自定义部分均用[>>  <<]括起
  113. '****************************************************************
  114.     
  115. Dim Int_Curr_year As Integer            '分析期年
  116. Dim Int_Curr_month1 As Integer          '分析期开始月
  117. Dim Int_Curr_month2 As Integer          '分析期结束月
  118. Dim Int_Comp_year As Integer            '比较期年
  119. Dim Int_Comp_month1 As Integer          '比较期开始月
  120. Dim Int_Comp_month2 As Integer          '比较期结束月
  121. Dim Tsxx As String                      '系统信息提示
  122. Private UsedYear() As String            '已使用年数据,如:UsedYear(0)="1999",UsedYear(1)="2000"
  123. Private iHowManyYears As Integer        '已使用的年数
  124. Private iMaxMonth As Integer            '最大使用月份
  125. Private Sub Form_KeyPress(KeyAscii As Integer)   '控 制 焦 点 转 移
  126.     Dim jdzygs As Integer                         '控件焦点转移个数
  127.     jdzygs = 6
  128.     Select Case KeyAscii
  129.     Case vbKeyReturn
  130.         If Kjjdzy(jdzygs) Then
  131.             KeyAscii = 0
  132.         End If
  133.     Case 39                                 '屏蔽"'"
  134.         KeyAscii = 0
  135.     End Select
  136. End Sub
  137. Private Sub Form_Load()
  138.     
  139.     Str_ReportSubTitle = ""
  140.     Me.Caption = Str_Title & "查询条件"
  141.     Call GetUsedYear
  142.     Call GetUsedMonth
  143.     '填充
  144.     Call FillCombo(Combo_Type, "cwfx_AccountC", "", 0)
  145.     Call FillMonth(Combo_BaseDate, Xtyear)
  146.     Call FillYear(Combo_SelYear)
  147.     If Combo_SelYear.ListIndex <> -1 Then
  148.         Combo_CompDate.Enabled = True
  149.         Call FillMonth(Combo_CompDate, Combo_SelYear.Text)
  150.     End If
  151. End Sub
  152.                                      
  153. Private Sub FillThisYear(PastComb As ComboBox)
  154.     With PastComb
  155.         .Clear
  156.         .AddItem Xtyear
  157.         .Text = Xtyear
  158.     End With
  159. End Sub
  160. Private Sub FillYear(PastComb As ComboBox)
  161.     Dim i As Integer
  162.     With PastComb
  163.        .Clear
  164.        .AddItem ""
  165.        For i = 0 To iHowManyYears
  166.             .AddItem UsedYear(i)
  167.        Next
  168.        .Text = Xtyear
  169.     End With
  170. End Sub
  171. Private Sub FillMonth(PastComb As ComboBox, ByVal PastYear As String)
  172.     Dim i As Integer
  173.     With PastComb
  174.         .Clear
  175.         If iMaxMonth < 1 Then Exit Sub
  176.        .AddItem ""
  177.         For i = 1 To iMaxMonth
  178.             .AddItem PastYear & "." & Format(i, "00")
  179.         Next
  180.         .Text = Xtyear & "." & Format(Xtmm, "00")
  181.     End With
  182. End Sub
  183. Private Sub FillThreeMonth(PastComb As ComboBox, ByVal PastYear As String)
  184.     Dim i As Integer
  185.     With PastComb
  186.         .Clear
  187.         If iMaxMonth < 1 Then Exit Sub
  188.        .AddItem ""
  189.         For i = 1 To 4
  190.             .AddItem PastYear & "." & Format(((i - 1) * 3 + 1), "00") & "-" & PastYear & "." & Format((i * 3), "00")
  191.         Next
  192.     End With
  193. End Sub
  194. Private Sub GetUsedYear()
  195.     '由Form_Load 调用,得到此帐套已使用的年度,存于UsedYear()数据中
  196.     Dim temRs As New ADODB.Recordset
  197.     Dim strSql As String
  198.     Dim i As Integer
  199.     strSql = "SELECT DISTINCT kjyear AS cYear FROM gy_kjrlb"
  200.     Set temRs = Cw_DataEnvi.DataConnect.Execute(strSql)
  201.     iHowManyYears = temRs.RecordCount - 1
  202.     ReDim UsedYear(iHowManyYears)
  203.     With temRs
  204.         Do Until .EOF
  205.             UsedYear(i) = !cYear
  206.             i = i + 1
  207.             .MoveNext
  208.         Loop
  209.     End With
  210.     If temRs.State = adStateOpen Then temRs.Close
  211.     Set temRs = Nothing
  212. End Sub
  213. Private Sub GetUsedMonth()
  214.     '由Form_Load 调用,得到此帐套已使用的最大月份,存于iMaxMonth数据中
  215.     
  216.     Dim temRs As New ADODB.Recordset
  217.     Dim strSql As String
  218.     Dim i As Integer
  219.     strSql = "SELECT Max(period) AS cMonth FROM gy_kjrlb"
  220.     Set temRs = Cw_DataEnvi.DataConnect.Execute(strSql)
  221.     With temRs
  222.         If Not (.EOF And .BOF) Then
  223.             iMaxMonth = !cMonth
  224.         End If
  225.     End With
  226.     If temRs.State = adStateOpen Then temRs.Close
  227.     Set temRs = Nothing
  228. End Sub
  229. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  230.     If UnloadCheck.Value <> 1 Then
  231.         Cancel = 1
  232.         Me.Hide
  233.     End If
  234. End Sub
  235. Private Sub QdCommand_Click()                                   '确 定
  236.     '录入条件有效性判断
  237.     If Not Lrtjyxxpd Then
  238.         Exit Sub
  239.     End If
  240.     Me.Hide
  241.     
  242.     Lbl_Comment.Caption = "分析期间:" & Combo_BaseDate.Text & "      比较期间:" & _
  243.     IIf(Len(Combo_CompDate.Text) <> 0, Combo_CompDate.Text, Combo_SelYear.Text)
  244.     
  245.     '激活查询过程
  246.     Frm_AnalysisA.Timer1.Enabled = True
  247.     Frm_AnalysisA.SetFocus
  248.     
  249. End Sub
  250. Private Sub QxCommand_Click()                                    '取消
  251.     Me.Hide
  252. End Sub
  253. Private Function Lrtjyxxpd() As Boolean                          '用户录入条件有效性判断
  254.     
  255.     Lrtjyxxpd = False
  256.     
  257.     
  258.     '[>>以下为依据实际情况自定义部分
  259.     If Trim(Combo_BaseDate.Text) = "" Then
  260.         Xtxxts "请选择分析期间!", 0, 1
  261.         Lrtjyxxpd = False
  262.         Combo_BaseDate.SetFocus
  263.         Exit Function
  264.     End If
  265.     If Combo_SelYear.ListIndex > 0 And Combo_Type.ListIndex <> 2 Then
  266.         If Combo_CompDate.ListIndex < 1 Then
  267.             Xtxxts "请选择比较期间!", 0, 1
  268.             Lrtjyxxpd = False
  269.             Combo_CompDate.SetFocus
  270.             Exit Function
  271.         End If
  272.     End If
  273.     '<<]以上为依据实际情况自定义部分
  274.     
  275.     Lrtjyxxpd = True
  276. End Function
  277. Private Sub Combo_SelYear_Click()
  278.     If Combo_SelYear.ListIndex = 0 Then
  279.         Combo_CompDate.Enabled = False
  280.         Combo_CompDate.Clear
  281.         Exit Sub
  282.     End If
  283.     Select Case Combo_Type.ListIndex
  284.     Case 0
  285.         Combo_CompDate.Enabled = True
  286.         Call FillMonth(Combo_CompDate, Combo_SelYear.Text)
  287.     Case 1
  288.         Combo_CompDate.Enabled = True
  289.         Call FillThreeMonth(Combo_CompDate, Combo_SelYear.Text)
  290.     Case 2
  291.         Combo_CompDate.Enabled = False
  292.     End Select
  293. End Sub
  294. Private Sub Combo_Type_Click()
  295.     Select Case Combo_Type.ListIndex
  296.     Case 0
  297.         Call FillMonth(Combo_BaseDate, Xtyear)
  298.         If Combo_SelYear.ListIndex <> -1 Then
  299.             Combo_CompDate.Enabled = True
  300.             Call FillMonth(Combo_CompDate, Combo_SelYear.Text)
  301.         End If
  302.     Case 1
  303.         Call FillThreeMonth(Combo_BaseDate, Xtyear)
  304.         If Combo_SelYear.ListIndex <> -1 Then
  305.             Combo_CompDate.Enabled = True
  306.             Call FillThreeMonth(Combo_CompDate, Combo_SelYear.Text)
  307.         End If
  308.     Case 2
  309.         Call FillThisYear(Combo_BaseDate)
  310.         Combo_CompDate.Clear
  311.         Combo_CompDate.Enabled = False
  312.     End Select
  313. End Sub