📄 qryphone.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form qryphone
Caption = "系统集成来电记录查询"
ClientHeight = 6270
ClientLeft = 60
ClientTop = 390
ClientWidth = 7845
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 6270
ScaleWidth = 7845
StartUpPosition = 1 'CenterOwner
Visible = 0 'False
Begin VB.CommandButton Command4
Cancel = -1 'True
Caption = "关 闭(&C)"
Height = 375
Left = 5640
TabIndex = 8
ToolTipText = "退出查询,返回主窗口"
Top = 5760
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "查 询(&S)"
Height = 375
Left = 960
TabIndex = 7
ToolTipText = "按您选择的条件开始查询"
Top = 5760
Width = 1575
End
Begin VB.Frame Frame1
Caption = " 来电时间 "
Height = 975
Left = 120
TabIndex = 0
ToolTipText = "请输入查询的时间范围"
Top = 240
Width = 7575
Begin VB.TextBox Text6
Alignment = 1 'Right Justify
ForeColor = &H00C00000&
Height = 345
Left = 6240
MaxLength = 2
TabIndex = 6
Top = 360
Width = 375
End
Begin VB.TextBox Text5
Alignment = 1 'Right Justify
ForeColor = &H00C00000&
Height = 345
Left = 5400
MaxLength = 2
TabIndex = 5
Top = 360
Width = 375
End
Begin VB.TextBox Text4
Alignment = 1 'Right Justify
ForeColor = &H00C00000&
Height = 345
Left = 4200
MaxLength = 4
TabIndex = 4
Top = 360
Width = 735
End
Begin VB.TextBox Text3
Alignment = 1 'Right Justify
ForeColor = &H00C00000&
Height = 345
Left = 2640
MaxLength = 2
TabIndex = 3
Top = 360
Width = 375
End
Begin VB.TextBox Text2
Alignment = 1 'Right Justify
ForeColor = &H00C00000&
Height = 345
Left = 1800
MaxLength = 2
TabIndex = 2
Top = 360
Width = 375
End
Begin VB.TextBox Text1
Alignment = 1 'Right Justify
ForeColor = &H00C00000&
Height = 345
Left = 600
MaxLength = 4
TabIndex = 1
Top = 360
Width = 735
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "止"
ForeColor = &H000000C0&
Height = 300
Left = 7080
TabIndex = 17
Top = 480
Width = 240
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "日"
Height = 300
Left = 6720
TabIndex = 16
Top = 480
Width = 240
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "日"
Height = 300
Left = 3120
TabIndex = 15
Top = 480
Width = 240
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "月"
Height = 300
Left = 5880
TabIndex = 14
Top = 480
Width = 240
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "月"
Height = 300
Left = 2280
TabIndex = 13
Top = 480
Width = 240
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "年"
Height = 300
Left = 5040
TabIndex = 12
Top = 480
Width = 240
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "年"
Height = 300
Left = 1440
TabIndex = 11
Top = 480
Width = 240
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "至"
ForeColor = &H000000C0&
Height = 300
Left = 3600
TabIndex = 10
Top = 480
Width = 240
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "自"
ForeColor = &H000000C0&
Height = 300
Left = 240
TabIndex = 9
Top = 480
Width = 240
End
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 3735
Left = 120
TabIndex = 19
ToolTipText = "双击内容摘要可以调出来电记录详情"
Top = 1800
Width = 7635
_ExtentX = 13467
_ExtentY = 6588
_Version = 393216
Rows = 1
Cols = 1
FixedCols = 0
BackColor = -2147483639
ForeColor = 12582912
BackColorBkg = 12632256
GridColor = 49152
GridColorFixed = 8421504
Redraw = -1 'True
AllowBigSelection= 0 'False
ScrollTrack = -1 'True
TextStyleFixed = 1
HighLight = 0
FillStyle = 1
MergeCells = 2
Appearance = 0
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "查询结果"
Height = 300
Left = 360
TabIndex = 18
Top = 1440
Width = 960
End
End
Attribute VB_Name = "qryphone"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Atracts As String
Dim Rectime As String
Dim Unit As String
Dim Content As String
Dim Contact As String
Dim Duty As String
Dim PhoneNum As String
Dim Guige(100) As String
Dim StartDate As String
Dim EndDate As String
Private Sub Command1_Click()
Dim ItemNm As String
Dim i As Integer
Dim K As Integer
Static RowNum As Integer
Static SpecNum As Integer
StartDate = Text1.Text + "-" + Text2.Text + "-" + Text3.Text + " 00:00"
EndDate = Text4.Text + "-" + Text5.Text + "-" + Text6.Text + " 24:00"
If Len(StartDate) < 10 Then
rc = MsgBox("请输入查询起始时间!", vbOKOnly + vbExclamation, "输入查询条件不全")
Text1.SetFocus
Exit Sub
End If
If Len(EndDate) < 10 Then
rc = MsgBox("请输入查询截止时间!", vbOKOnly + vbExclamation, "输入查询条件不全")
Text4.SetFocus
Exit Sub
End If
RowNum = 0
With MSFlexGrid1
.Clear
.Rows = 1
.Visible = True
.FormatString = "^ 来电内容摘要 "
.Row = RowNum
End With
rc = SQLAllocStmt(hdbc, hstmt)
SQLstmt = "SELECT atract FROM phonerecord WHERE recordtime BETWEEN '" & StartDate & "' AND '" & EndDate & "'"
rc = SQLExecDirect(hstmt, SQLstmt, SQL_NTS)
If rc = SQL_ERROR Then
rc = SQLFreeStmt(hstmt, SQL_DROP)
MsgBox "1"
Exit Sub
End If
SpecNum = 0
Do While SQLFetch(hstmt) <> SQL_NO_DATA_FOUND
SpecNum = SpecNum + 1
Guige(SpecNum) = String$(50, 0)
rc = SQLGetData(hstmt, 1, SQL_C_CHAR, Guige(SpecNum), Len(Guige(SpecNum)), SQL_NULL_DATA)
Guige(SpecNum) = SpaceCut(Guige(SpecNum))
Loop
rc = SQLFreeStmt(hstmt, SQL_DROP)
If SpecNum = 0 Then
rc = MsgBox("未查到" + ItemNm, vbOKOnly + vbExclamation, "查询无结果")
Exit Sub
End If
MSFlexGrid1.Rows = MSFlexGrid1.Rows + SpecNum
MSFlexGrid1.Row = RowNum
For K = 1 To SpecNum
RowNum = RowNum + 1
With MSFlexGrid1
.Row = RowNum
'.Col = 0
.Text = Guige(K)
End With
Next K
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
MSFlexGrid1.Visible = False
MSFlexGrid1.Rows = 1
MSFlexGrid1.Cols = 1
Text1.Text = Year(Date) - 1
Text2.Text = Month(Date)
If Len(Text2.Text) < 2 Then Text2.Text = "0" + Text2.Text
Text3.Text = Day(Date)
If Len(Text3.Text) < 2 Then Text3.Text = "0" + Text3.Text
Text4.Text = Year(Date)
Text5.Text = Month(Date)
If Len(Text5.Text) < 2 Then Text5.Text = "0" + Text5.Text
Text6.Text = Day(Date)
If Len(Text6.Text) < 2 Then Text6.Text = "0" + Text6.Text
End Sub
Private Sub Form_Unload(Cancel As Integer)
MSFlexGrid1.Clear
Form1.Enabled = True
End Sub
Private Sub MSFlexGrid1_DblClick()
Atracts = Trim(MSFlexGrid1.Text)
Rectime = String(20, 0)
Unit = String(50, 0)
Content = String(240, 0)
Contact = String(10, 0)
Duty = String(10, 0)
PhoneNum = String(20, 0)
rc = SQLAllocStmt(hdbc, hstmt)
SQLstmt = "SELECT unit,recordtime,content,contact,duty,phonenum FROM phonerecord WHERE atract Like '" & Atracts & "%'"
rc = SQLExecDirect(hstmt, SQLstmt, SQL_NTS)
rc = SQLFetch(hstmt)
rc = SQLGetData(hstmt, 1, SQL_C_CHAR, Unit, Len(Unit), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 2, SQL_C_CHAR, Rectime, Len(Rectime), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 3, SQL_C_CHAR, Content, Len(Content), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 4, SQL_C_CHAR, Contact, Len(Contact), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 5, SQL_C_CHAR, Duty, Len(Duty), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 6, SQL_C_CHAR, PhoneNum, Len(PhoneNum), SQL_NULL_DATA)
rc = SQLFreeStmt(hstmt, SQL_DROP)
Rectime = Trim(Rectime)
PhoneQuery.Text1.Text = MidB(Rectime, 1, 8)
PhoneQuery.Text2.Text = MidB(Rectime, 11, 4)
PhoneQuery.Text3.Text = MidB(Rectime, 17, 4)
PhoneQuery.Text4.Text = MidB(Rectime, 23, 4)
PhoneQuery.Text5.Text = MidB(Rectime, 29, 4)
PhoneQuery.Text6.Text = Content
PhoneQuery.Text7.Text = Contact
PhoneQuery.Text8.Text = Duty
PhoneQuery.Text9.Text = PhoneNum
PhoneQuery.Text10.Text = Unit
PhoneQuery.Visible = True
qryphone.Enabled = False
End Sub
Private Sub Text2_LostFocus()
If Len(Text2.Text) < 2 Then Text2.Text = "0" + Text2.Text
End Sub
Private Sub Text3_LostFocus()
If Len(Text3.Text) < 2 Then Text3.Text = "0" + Text3.Text
End Sub
Private Sub Text5_LostFocus()
If Len(Text5.Text) < 2 Then Text5.Text = "0" + Text5.Text
End Sub
Private Sub Text6_LostFocus()
If Len(Text6.Text) < 2 Then Text6.Text = "0" + Text6.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -