?? 機票預~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 + -