📄 form5.frm
字号:
VERSION 5.00
Begin VB.Form Form5
Caption = "定购信息"
ClientHeight = 4065
ClientLeft = 60
ClientTop = 450
ClientWidth = 8175
LinkTopic = "Form5"
ScaleHeight = 4065
ScaleWidth = 8175
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "查询定购"
Height = 495
Left = 4440
TabIndex = 12
Top = 1200
Width = 1695
End
Begin VB.Frame Frame1
Height = 3735
Left = 120
TabIndex = 0
Top = 120
Width = 7935
Begin VB.TextBox Text7
Height = 375
Left = 1320
TabIndex = 20
Top = 3240
Width = 1815
End
Begin VB.TextBox Text4
Height = 375
Left = 1320
TabIndex = 18
Top = 2640
Width = 1815
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 495
Left = 4320
TabIndex = 16
Top = 3000
Width = 1695
End
Begin VB.TextBox Text6
Height = 375
Left = 1320
TabIndex = 15
Top = 2160
Width = 1815
End
Begin VB.CommandButton Command2
Caption = "退票"
Height = 495
Left = 4320
TabIndex = 13
Top = 2160
Width = 1695
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "网上订票1.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 285
Left = 4200
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "乘客信息"
Top = 720
Visible = 0 'False
Width = 1815
End
Begin VB.TextBox Text5
Height = 375
Left = 1320
TabIndex = 11
Top = 1680
Width = 1815
End
Begin VB.TextBox Text3
Height = 375
Left = 1320
TabIndex = 10
Top = 1200
Width = 1815
End
Begin VB.TextBox Text2
Height = 375
Left = 1320
TabIndex = 9
Top = 720
Width = 1815
End
Begin VB.TextBox Text1
Height = 375
Left = 1320
TabIndex = 8
Top = 240
Width = 1815
End
Begin VB.Label label10
Caption = "总价"
Height = 375
Left = 120
TabIndex = 19
Top = 3240
Width = 855
End
Begin VB.Label Label4
Caption = "票务类型"
Height = 375
Left = 120
TabIndex = 17
Top = 2640
Width = 975
End
Begin VB.Label Label9
Caption = "票数"
Height = 375
Left = 120
TabIndex = 14
Top = 2160
Width = 975
End
Begin VB.Label Label8
Height = 255
Left = 4200
TabIndex = 7
Top = 1224
Width = 975
End
Begin VB.Label Label7
Height = 255
Left = 4200
TabIndex = 6
Top = 480
Width = 975
End
Begin VB.Label Label6
Height = 255
Left = 4200
TabIndex = 5
Top = 1920
Width = 975
End
Begin VB.Label Label5
Caption = "日期"
Height = 375
Left = 120
TabIndex = 4
Top = 1800
Width = 975
End
Begin VB.Label Label3
Caption = "手机号码"
Height = 375
Left = 120
TabIndex = 3
Top = 1320
Width = 975
End
Begin VB.Label Label2
Caption = "车次"
Height = 375
Left = 120
TabIndex = 2
Top = 840
Width = 975
End
Begin VB.Label Label1
Caption = "客户名"
Height = 375
Left = 120
TabIndex = 1
Top = 240
Width = 975
End
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Data1.Recordset.MoveFirst
Do While Data1.Recordset.EOF <> True
If Data1.Recordset.Fields("客户名").Value = Text1.Text Then
Text5.Text = Data1.Recordset.Fields("日期").Value
Text3.Text = Data1.Recordset.Fields("手机电话").Value
Text2.Text = Data1.Recordset.Fields("车次").Value
Text6.Text = Data1.Recordset.Fields("票数").Value
Text4.Text = Data1.Recordset.Fields("票务类型").Value
Exit Do
End If
Data1.Recordset.MoveNext
Loop
If Data1.Recordset.EOF <> False Then
MsgBox ("对不起,没有您的信息!!")
End If
Dim a, b, u, v, t As Single
If Data1.Recordset.Fields("票务类型").Value = Form2.Label4.Caption And Form2.Adodc1.Recordset.Fields("硬座票数").Value - Data1.Recordset.Fields("票数").Value >= 0 Then
a = Form2.Adodc1.Recordset.Fields("硬座票数").Value
b = Data1.Recordset.Fields("票数").Value
a = a - b
v = Form2.Adodc1.Recordset.Fields("硬座价").Value
u = b * v
Form2.Adodc1.Recordset.Fields("硬座票数").Value = CStr(a)
Text7.Text = CStr(u)
Else: t = a * v
a = 0
Form2.Adodc1.Recordset.Fields("硬座票数").Value = CStr(a)
Text7.Text = CStr(t)
MsgBox ("票数不够")
End If
Dim c, d, k, g, i As Single
If Data1.Recordset.Fields("票务类型").Value = Form2.Label5.Caption And Form2.Adodc1.Recordset.Fields("卧铺票数").Value - Data1.Recordset.Fields("票数").Value >= 0 Then
c = Form2.Adodc1.Recordset.Fields("卧铺票数").Value
d = Data1.Recordset.Fields("票数").Value
c = c - d
k = Form2.Adodc1.Recordset.Fields("卧铺价").Value
g = k * d
Form2.Adodc1.Recordset.Fields("卧铺票数").Value = CStr(c)
Text7.Text = CStr(g)
Else: i = c * d
c = 0
Form2.Adodc1.Recordset.Fields("卧铺票数").Value = CStr(i)
Text7.Text = CStr(g)
MsgBox ("票数不够")
End If
Data1.Recordset.AddNew
End Sub
Private Sub Command2_Click()
Data1.Recordset.MoveFirst
Do While Data1.Recordset.EOF <> True
If Data1.Recordset.Fields("客户名").Value = Text1.Text Then
Text5.Text = Data1.Recordset.Fields("日期").Value
Text3.Text = Data1.Recordset.Fields("手机电话").Value
Text2.Text = Data1.Recordset.Fields("车次").Value
Text6.Text = Data1.Recordset.Fields("票数").Value
Exit Do
End If
Data1.Recordset.MoveNext
Loop
If Data1.Recordset.EOF <> False Then
MsgBox ("对不起,没有您的信息!!")
End If
Dim a, b As Single
If Data1.Recordset.Fields("票务类型").Value = Form2.Label4.Caption Then
a = Form2.Adodc1.Recordset.Fields("硬座票数").Value
b = Data1.Recordset.Fields("票数").Value
a = a + b
Form2.Adodc1.Recordset.Fields("硬座票数").Value = CStr(a)
End If
Dim c, d As Single
If Data1.Recordset.Fields("票务类型").Value = Form2.Label5.Caption Then
c = Form2.Adodc1.Recordset.Fields("卧铺票数").Value
d = Data1.Recordset.Fields("票数").Value
c = c + d
Form2.Adodc1.Recordset.Fields("卧铺票数").Value = CStr(c)
End If
Data1.Recordset.Delete
msg ("退票成功!!")
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -