📄 d
字号:
VERSION 5.00
Begin VB.Form pub_SelDate
BorderStyle = 3 'Fixed Dialog
Caption = "分析期选择"
ClientHeight = 2160
ClientLeft = 45
ClientTop = 330
ClientWidth = 4905
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2160
ScaleWidth = 4905
ShowInTaskbar = 0 'False
StartUpPosition = 1 'CenterOwner
Begin VB.CommandButton YdCommand
Caption = "取消(&C)"
Height = 300
Index = 1
Left = 3660
TabIndex = 10
Top = 1710
Width = 1120
End
Begin VB.CommandButton YdCommand
Caption = "确定(&O)"
Height = 300
Index = 0
Left = 2505
TabIndex = 9
Top = 1710
Width = 1120
End
Begin VB.Frame Frame2
Caption = "日期选择"
Height = 1455
Left = 2130
TabIndex = 4
Top = 135
Width = 2655
Begin VB.ComboBox Combo_Date
Height = 300
Index = 1
Left = 630
Style = 2 'Dropdown List
TabIndex = 8
Top = 840
Width = 1875
End
Begin VB.ComboBox Combo_Date
Height = 300
Index = 0
Left = 630
Style = 2 'Dropdown List
TabIndex = 5
Top = 300
Width = 1875
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "到:"
Height = 180
Index = 1
Left = 150
TabIndex = 7
Top = 915
Width = 270
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "从:"
Height = 180
Index = 0
Left = 150
TabIndex = 6
Top = 360
Width = 270
End
End
Begin VB.Frame Frame1
Caption = "类别选择"
Height = 1455
Left = 105
TabIndex = 0
Top = 135
Width = 1875
Begin VB.OptionButton DateType
Caption = "按年"
Height = 255
Index = 2
Left = 195
TabIndex = 3
Top = 1110
Width = 945
End
Begin VB.OptionButton DateType
Caption = "按季"
Height = 255
Index = 1
Left = 195
TabIndex = 2
Top = 675
Width = 945
End
Begin VB.OptionButton DateType
Caption = "按月"
Height = 255
Index = 0
Left = 195
TabIndex = 1
Top = 255
Width = 945
End
End
End
Attribute VB_Name = "pub_SelDate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public bSeach As Boolean
Public strBegin As String
Public strEnd As String
'----------------------
Public iThisYear As Integer '本年
Public iCompYear As Integer '查询终止年
Public iThisMonthBegin As Integer '本年月起始
Public iThisMonthEnd As Integer '本年终止月
Public intType As Integer '比较类型,0按月、1按季、2按年
Private Tsxx As String
'----------------------
Private Sub DateType_Click(Index As Integer)
Select Case Index
Case 0 '月
Call FillMonth(Combo_Date(0))
Call FillMonth(Combo_Date(1))
Case 1 '季
Call FillThreeMonth(Combo_Date(0))
Call FillThreeMonth(Combo_Date(1))
Case 2 '年
Call FillYear(Combo_Date(0))
Call FillYear(Combo_Date(1))
End Select
intType = Index
End Sub
Private Sub Form_Load()
Me.Icon = XT_Main.Icon
Me.bSeach = False
End Sub
Private Sub YdCommand_Click(Index As Integer)
Select Case Index
Case 0 '确定
' If Combo_Date(0).ListIndex > Combo_Date(1).ListIndex Then
' Tsxx = "日期应从小到大!"
' Call Xtxxts(Tsxx, 0, 1)
' bSeach = False
' Exit Sub
' End If
iThisMonthBegin = 0
iThisMonthEnd = 0
' iCompMonthBegin = 0
' iCompMonthEnd = 0
strBegin = ""
strEnd = ""
bSeach = True
strBegin = Combo_Date(0).Text
strEnd = Combo_Date(1).Text
iThisYear = Xtyear
iCompYear = Left(strEnd, 4)
If intType <> 2 Then
iThisMonthBegin = Right(Combo_Date(0).Text, 2)
iThisMonthEnd = Right(Combo_Date(1).Text, 2)
End If
' If intType = 1 Then '季
' iThisMonthBegin = Mid(Combo_Date(0).Text, 6, 2)
' iThisMonthEnd = Right(Combo_Date(0).Text, 2)
' iCompMonthBegin = Mid(Combo_Date(1).Text, 6, 2)
' iCompMonthEnd = Right(Combo_Date(1).Text, 2)
' End If
If iThisMonthBegin > iThisMonthEnd Then
Dim item As Integer
item = iThisMonthBegin
iThisMonthBegin = iThisMonthEnd
iThisMonthEnd = item
End If
Case 1 '取消
bSeach = False
End Select
Me.Hide
End Sub
Private Sub FillMonth(PastCombo As ComboBox)
Dim iMonth As Integer
With PastCombo
.Clear
For iMonth = 1 To 12
.AddItem Xtyear & "." & Format(iMonth, "00")
Next
.ListIndex = 0
End With
End Sub
Private Sub FillThreeMonth(PastCombo As ComboBox)
Dim iThreeMonth As Integer
With PastCombo
.Clear
For iThreeMonth = 1 To 4
.AddItem Xtyear & "." & Format(((iThreeMonth - 1) * 3 + 1), "00") & "-" & Xtyear & "." & Format(iThreeMonth * 3, "00")
Next
.ListIndex = 0
End With
End Sub
Private Sub FillYear(PastCombo As ComboBox)
Dim Rs As New ADODB.Recordset
Dim strSql As String
strSql = "SELECT DISTINCT kjyear AS cYear FROM xt_kjrlb"
Set Rs = Cw_DataEnvi.DataConnect.Execute(strSql)
PastCombo.Clear
With Rs
Do Until .EOF
PastCombo.AddItem Trim(!cYear)
.MoveNext
Loop
End With
If PastCombo.ListCount > 0 Then PastCombo.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -