📄 预订车票.frm
字号:
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.TextBox Text1
DataField = "站名"
DataSource = "Adodc1"
Height = 270
Left = 9960
TabIndex = 15
Top = 3960
Visible = 0 'False
Width = 495
End
Begin VB.ComboBox Combo3
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
ItemData = "预订车票.frx":00D1
Left = 8760
List = "预订车票.frx":012F
TabIndex = 14
Top = 2160
Width = 1335
End
Begin VB.ComboBox Combo2
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
ItemData = "预订车票.frx":01A2
Left = 8760
List = "预订车票.frx":01CA
TabIndex = 13
Top = 1560
Width = 1335
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 8640
Top = 3960
Visible = 0 'False
Width = 1215
_ExtentX = 2143
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=车站售票管理系统"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=车站售票管理系统"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "站名"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.TextBox Text3
Height = 495
Left = 4200
TabIndex = 12
Text = "1"
Top = 3960
Width = 1215
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
ItemData = "预订车票.frx":01F5
Left = 8280
List = "预订车票.frx":01F7
TabIndex = 5
Top = 840
Width = 1815
End
Begin VB.CommandButton Cmdfind
Caption = "查找"
Default = -1 'True
Height = 495
Left = 7920
TabIndex = 4
Top = 3120
Width = 1095
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1200
Locked = -1 'True
TabIndex = 2
Top = 3240
Width = 1215
End
Begin VB.CommandButton Cmdok
Caption = "预订"
Height = 495
Left = 9240
TabIndex = 1
Top = 3120
Width = 975
End
Begin VB.TextBox Text4
DataField = " "
Height = 495
Left = 1440
Locked = -1 'True
TabIndex = 0
Top = 3960
Width = 975
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "预订车票.frx":01F9
Height = 2775
Left = 120
TabIndex = 3
Top = 240
Width = 7695
_ExtentX = 13573
_ExtentY = 4895
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label5
Caption = "顾客名称:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2880
TabIndex = 17
Top = 3240
Width = 1455
End
Begin VB.Label Label6
Caption = "订票数:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2880
TabIndex = 11
Top = 3960
Width = 1095
End
Begin VB.Label Label1
Caption = "目标站名:"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 8160
TabIndex = 10
Top = 240
Width = 1695
End
Begin VB.Label Label2
Caption = "月:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 8160
TabIndex = 9
Top = 1560
Width = 735
End
Begin VB.Label Label3
Caption = "日:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 8160
TabIndex = 8
Top = 2160
Width = 735
End
Begin VB.Label Label4
Caption = "票价:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 240
TabIndex = 7
Top = 3240
Width = 1095
End
Begin VB.Label Label7
Caption = "剩余车票:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 120
TabIndex = 6
Top = 3960
Width = 1455
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmdfind_Click()
Dim zm As String
zm = "select 发车时刻表.车次,途径表.站名,车型,发车时间,检票口,发车时刻表.站名 as 班车 from 发车时刻表,途径表,车辆 where 发车时刻表.车次=途径表.车次 and 发车时刻表.车辆编号=车辆.车辆编号 and 途径表.站名='" & Combo1.Text & "'order by 发车时间 asc"
Adodc2.RecordSource = zm
Adodc2.Refresh
Text1.Text = ""
Text1.Refresh
End Sub
Private Sub Cmdok_Click()
If Not LTrim$(RTrim$(Text6.Text)) = "" Then
Adodc5.Recordset.AddNew
Text13.Text = Year(Date) & "/" & Combo2.Text & "/" & Combo3.Text
Text14.Text = Text5.Text
Text17.Text = Text3.Text
Text18.Text = Combo1.Text
Text19.Text = Text6.Text
Adodc5.Recordset.Update
Adodc5.Refresh
MsgBox "预订成功", 48, "成功"
Else
MsgBox "顾客名不能为空", 16, "错误"
End If
End Sub
Private Sub Combo2_LostFocus()
If Val(Combo2.Text) Mod 2 = 0 Then
If Val(Combo3.List(Combo3.ListCount - 1)) = 31 Then
Combo3.RemoveItem (Combo3.ListCount - 1)
End If
Else
If Val(Combo3.List(Combo3.ListCount - 1)) <> 31 Then
Combo3.AddItem "31"
End If
End If
End Sub
Private Sub DataGrid1_Click()
Dim cc As String, ss As Integer
ss = 0
Adodc1.Recordset.MoveFirst
Adodc2.Recordset.MoveFirst
Adodc3.Recordset.MoveFirst
Adodc4.Recordset.MoveFirst
cc = "车型='" & Text7.Text & "'"
Adodc3.Recordset.Find cc
cc = "站名='" & Text1.Text & "'"
Adodc1.Recordset.Find cc
Text2.Text = Int(Val(Text8.Text) * Val(Text9.Text) + 0.5)
While Not Adodc4.Recordset.EOF
If Year(Text10.Text) = Year(Date) And Month(Text10.Text) = Combo2.Text And Day(Text10.Text) = Combo3.Text And Text5.Text = Text11.Text And Text12.Text = "F" Then
ss = ss + 1
End If
Adodc4.Recordset.MoveNext
Wend
While Not Adodc5.Recordset.EOF
If Year(Text13.Text) = Year(Date) And Month(Text13.Text) = Combo2.Text And Day(Text13.Text) = Combo3.Text And Text14.Text = Text5.Text Then
ss = ss + Val(Text17.Text)
End If
Adodc5.Recordset.MoveNext
Wend
cc = "车次='" & Text5.Text & "'"
Adodc6.Recordset.Find cc
cc = "车辆编号='" & Text15.Text & "'"
Adodc7.Recordset.Find cc
Text4.Text = Val(Text16.Text) - ss
Text4.Refresh
End Sub
Private Sub Form_Load()
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
Combo1.AddItem Text1.Text
Adodc1.Recordset.MoveNext
Wend
Combo2.Text = Month(Date)
Combo3.Text = Day(Date)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -