📄 机票预~1.frm
字号:
Top = 7800
Width = 1215
End
Begin VB.Label Label34
Caption = "时间"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5760
TabIndex = 60
Top = 7800
Width = 975
End
Begin VB.Label Label4
Caption = "计算机031班第三组制作 All Rights Reserved"
Height = 375
Left = 4920
TabIndex = 5
Top = 8160
Width = 2055
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "机 票 预 订 系 统"
BeginProperty Font
Name = "宋体"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 735
Left = 1080
TabIndex = 4
Top = 240
Width = 5175
End
Begin VB.Line Line2
X1 = 1920
X2 = 1920
Y1 = 1800
Y2 = 6840
End
Begin VB.Line Line1
X1 = 720
X2 = 1920
Y1 = 1800
Y2 = 1800
End
End
Attribute VB_Name = "机票预订系统"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Frame2.Visible = True
Frame3.Visible = False
Frame4.Visible = False
End Sub
Private Sub Command10_Click()
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
End Sub
Private Sub Command2_Click()
Frame1.Visible = True
Frame2.Visible = True
Combo2.Visible = True
Frame3.Visible = True
Frame4.Visible = False
End Sub
Private Sub Command3_Click()
Frame1.Visible = True
Frame2.Visible = True
Combo2.Visible = False
Frame3.Visible = True
Frame4.Visible = True
End Sub
Private Sub Command4_Click()
Frame1.Visible = True
Frame2.Visible = False
Frame3.Visible = False
Frame4.Visible = False
End Sub
Private Sub Command5_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim a As Integer
Dim b As Integer
Dim i As Integer
a = 0
b = 0
i = 0
Form2.Label2.Caption = ""
'打开数据库
'根据实际设置数据库位置
'On Error GoTo errhanle
Set db = DBEngine.OpenDatabase(App.Path + "\db1.mdb")
Set rst = db.OpenRecordset("SELECT * FROM 航班 ", dbOpenDynaset)
While (Not rst.EOF)
If ((rst!航班号 = Text1.Text Or Text1.Text = "") And (rst!出发城市 = Text2.Text Or Text2.Text = "") And _
(rst!到达城市 = Text4.Text Or Text4.Text = "") And (rst!出发日期 = Text3.Text Or Text3.Text = "")) Then
Form2.Label2.Caption = Form2.Label2.Caption & rst.Fields(0) & "\" & rst.Fields(1) & " " & rst.Fields(2) & "\" & rst.Fields(3) & " " & rst.Fields(4) & "\" & rst.Fields(5) & "\" & rst.Fields(6)
If (Option1.Value = True) Then
Form2.Label2.Caption = Form2.Label2.Caption & "\" & rst.Fields(10) & "\" & rst.Fields(11) & "\" & rst.Fields(12) & " "
Form2.Label4.Caption = "(头等舱)"
Else
Form2.Label2.Caption = Form2.Label2.Caption & "\" & rst.Fields(7) & "\" & rst.Fields(8) & "\" & rst.Fields(9) & " "
Form2.Label4.Caption = "(经济舱)"
End If
a = a + 1
End If
rst.MoveNext
Wend
If (a <> 0) Then
Form2.Visible = True
ElseIf a = 0 Then
MsgBox "对不起 ,无此种机票"
End If
End Sub
Private Sub Command6_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub Command7_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim a As Integer
Dim b As Integer
a = 0
b = 0
If (Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or _
Text11.Text = "" Or Text12.Text = "" Or Text13.Text = "" Or Combo1.Text = "" Or Combo2.Text = "") Then
MsgBox "必填内容没填写完全"
GoTo aaa
Else
MsgBox "确认定购"
End If
Set db = DBEngine.OpenDatabase(App.Path + "\db1.mdb")
Set rst = db.OpenRecordset("SELECT * FROM 航班", dbOpenDynaset)
While (Not rst.EOF)
If (rst!航班号 = Text11.Text) Then
If (Combo2.Text = "头等舱") Then
If (rst.Fields(10) <> 0) Then
Form1.Label11.Caption = 机票预订系统.Text5.Text
Form1.Label12.Caption = 机票预订系统.Text12.Text
Form1.Label13.Caption = 机票预订系统.Text11.Text
Form1.Label14.Caption = rst.Fields(1) & " " & rst.Fields(2)
Form1.Label15.Caption = rst.Fields(5)
Form1.Label16.Caption = rst.Fields(6)
Form1.Label17.Caption = 机票预订系统.Combo2.Text
Form1.Label20.Caption = rst.Fields(7) & rst.Fields(8) & rst.Fields(9) & rst.Fields(10) & rst.Fields(11) & rst.Fields(12)
Form1.Label18.Caption = rst.Fields(11) * rst.Fields(12) / 100
Form1.Label22.Caption = Form1.Label18.Caption * 30 / 100
rst.Edit
rst.Fields(10) = rst.Fields(10) - 1
rst.Update
b = b + 1
End If
Else
If (rst.Fields(7) <> 0) Then
Form1.Label11.Caption = 机票预订系统.Text5.Text
Form1.Label12.Caption = 机票预订系统.Text12.Text
Form1.Label13.Caption = 机票预订系统.Text11.Text
Form1.Label14.Caption = rst.Fields(1) & " " & rst.Fields(2)
Form1.Label15.Caption = rst.Fields(5)
Form1.Label16.Caption = rst.Fields(6)
Form1.Label17.Caption = 机票预订系统.Combo2.Text
Form1.Label20.Caption = rst.Fields(7) & rst.Fields(8) & rst.Fields(9) & rst.Fields(10) & rst.Fields(11) & rst.Fields(12)
Form1.Label18.Caption = rst.Fields(8) * rst.Fields(9) / 100
Form1.Label22.Caption = Form1.Label18.Caption * 5 / 100
rst.Edit
rst.Fields(7) = rst.Fields(7) - 1
rst.Update
b = b + 1
End If
End If
a = a + 1
End If
rst.MoveNext
Wend
rst.Close
If (a <> 0 And b = 0) Then
MsgBox "此票已售完"
End If
If (a = 0) Then
MsgBox "输入有误,无此种机票"
End If
If (a <> 0 And b <> 0) Then
num = num + 1
Form1.Visible = True
Set db = DBEngine.OpenDatabase(App.Path + "\db1.mdb")
Set rst = db.OpenRecordset("SELECT * FROM 旅客", dbOpenDynaset)
rst.AddNew
rst!性别 = Combo1.Text
rst!舱位 = Combo2.Text
rst!姓名 = Text5.Text
rst!出生日期 = Text6.Text
rst!电话 = Text7.Text
rst!航班号 = Text11.Text
rst!身份证号 = Text12.Text
rst!地址 = Text13.Text
rst.Update
rst.Close
Set db = DBEngine.OpenDatabase(App.Path + "\db1.mdb")
Set rst = db.OpenRecordset("SELECT * FROM 订单", dbOpenDynaset)
rst.AddNew
rst!订单号 = Form1.Label20.Caption
rst!身份证号 = Form1.Label12.Caption
rst!航班号 = Form1.Label13.Caption
rst.Update
rst.Close
End If
aaa:
End Sub
Private Sub Command8_Click()
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Combo1.Text = ""
Combo2.Text = ""
End Sub
Private Sub Command9_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim a As Integer
Dim b As Integer
a = 0
b = 0
'打开数据库
'根据实际设置数据库位置
'On Error GoTo errhanle
Set db = DBEngine.OpenDatabase(App.Path + "\db1.mdb")
Set rst = db.OpenRecordset("SELECT * FROM 订单 ", dbOpenDynaset)
While (Not rst.EOF)
If (rst!订单号 = Text15.Text And rst!身份证号 = Text16.Text) Then
a = 1
rst.Edit
rst.Delete
End If
rst.MoveNext
Wend
If (a = 0) Then
MsgBox "输入有误或没有该订单"
rst.Close
GoTo bb
End If
If (a = 1) Then
rst.Close
End If
Set db = DBEngine.OpenDatabase(App.Path + "\db1.mdb")
Set rst = db.OpenRecordset("SELECT * FROM 旅客", dbOpenDynaset)
While (Not rst.EOF)
If (rst.Fields(6) = Text11.Text And rst.Fields(4) = Text16.Text And a = 1) Then
rst.Edit
rst.Delete
b = 1
End If
rst.MoveNext
Wend
If (b = 0) Then
MsgBox "输入有误或没有该订单"
rst.Close
GoTo bb
End If
If (b = 1) Then
rst.Close
End If
Set db = DBEngine.OpenDatabase(App.Path + "\db1.mdb")
Set rst = db.OpenRecordset("SELECT * FROM 航班", dbOpenDynaset)
While (Not rst.EOF)
If (rst.Fields(0) = Form1.Label13.Caption And a = 1 And b = 1) Then
If (Combo2.Text = "头等舱") Then
rst.Edit
rst.Fields(10) = rst.Fields(10) + 1
rst.Update
Else
rst.Edit
rst.Fields(7) = rst.Fields(7) + 1
rst.Update
End If
End If
rst.MoveNext
Wend
MsgBox "已删除"
rst.Close
Set db = DBEngine.OpenDatabase(App.Path + "\db1.mdb")
Set rst = db.OpenRecordset("SELECT * FROM 意见", dbOpenDynaset)
rst.AddNew
rst!姓名 = Text5.Text
rst!身份证号 = Text12.Text
rst!意见 = Text17.Text
rst.Update
rst.Close
bb:
End Sub
Private Sub Form_Load()
Combo1.AddItem "男"
Combo1.AddItem "女"
Combo2.AddItem "头等舱"
Combo2.AddItem "经济舱"
End Sub
Private Sub Timer1_Timer()
Label35.Caption = Format(Now, "yyyy-mm-dd")
Label34.Caption = Format(Now, "hh:mm:ss")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -