📄 frmprice.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form frmPrice
BorderStyle = 3 'Fixed Dialog
Caption = "费用结算--客房管理系统"
ClientHeight = 4800
ClientLeft = 45
ClientTop = 435
ClientWidth = 4560
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4800
ScaleWidth = 4560
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc4
Height = 375
Left = 2520
Top = 5760
Width = 1935
_ExtentX = 3413
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
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=HotelRoom"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=HotelRoom"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from RoomInfo"
Caption = "Adodc4"
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 MSAdodcLib.Adodc Adodc3
Height = 330
Left = 240
Top = 5760
Width = 1935
_ExtentX = 3413
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
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=HotelRoom"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=HotelRoom"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from GuestInfo"
Caption = "Adodc3"
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 MSAdodcLib.Adodc Adodc2
Height = 330
Left = 2520
Top = 5160
Visible = 0 'False
Width = 1920
_ExtentX = 3387
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
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=HotelRoom"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=HotelRoom"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select Rprice from ViewRoomInfo"
Caption = "Adodc2"
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 MSAdodcLib.Adodc Adodc1
Height = 330
Left = 240
Top = 5160
Visible = 0 'False
Width = 1920
_ExtentX = 3387
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
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=HotelRoom"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=HotelRoom"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from ViewGuestInfo"
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.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2520
TabIndex = 3
Top = 4200
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "退房"
Height = 375
Left = 840
TabIndex = 2
Top = 4200
Width = 1215
End
Begin VB.Frame frame1
Height = 2655
Left = 120
TabIndex = 1
Top = 1320
Width = 4335
Begin RichTextLib.RichTextBox RichTextBox1
Height = 2295
Left = 120
TabIndex = 4
Top = 240
Width = 4095
_ExtentX = 7223
_ExtentY = 4048
_Version = 393217
BackColor = -2147483633
Enabled = 0 'False
TextRTF = $"frmPrice.frx":0000
End
End
Begin VB.Label Label2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 960
TabIndex = 5
Top = 720
Width = 2775
End
Begin VB.Label Label1
Caption = "费 用 结 算"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 255
Left = 1560
TabIndex = 0
Top = 240
Width = 1455
End
End
Attribute VB_Name = "frmPrice"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim time As Date
Dim e As Integer
Private Sub Command1_Click()
If MsgBox("确定退房结帐吗?", vbOKCancel + vbInformation, "提示信息") = vbOK Then
Adodc3.RecordSource = "select Couttime,Ccost,Rnum from GuestInfo where Rnum='" & frmCheckOut.DataCombo1.Text & "'and Couttime is null" '"updata GuestInfo set Couttime=" & time & ",Ccost=" & e & ""
Adodc3.Refresh
Dim rnum As String
rnum = Adodc3.Recordset.Fields(2)
Adodc3.Recordset.Fields(0) = time
Adodc3.Recordset.Fields(1) = e
Adodc3.Recordset.Update
Adodc4.RecordSource = "select * from RoomInfo where Rnum='" & rnum & "'"
Adodc4.Refresh
Adodc4.Recordset.Fields(3) = "空"
Adodc4.Recordset.Fields(4) = Null
Adodc4.Recordset.Update
frmMain.Adodc1.Refresh
frmMain.Adodc6.Refresh
frmMain.DataGrid1.Refresh
MsgBox "退房成功!", vbOKOnly + vbInformation, "提示信息"
Unload frmCheckOut
Unload Me
Else
Unload frmCheckOut
Unload Me
End If
End Sub
Private Sub Command2_Click()
Unload frmCheckOut
Unload Me
End Sub
Private Sub Form_Load()
Adodc2.RecordSource = "select Rprice from ViewRoomInfo where Rnum=" & frmCheckOut.DataCombo1.Text & "" '查询房间的价格
Adodc2.Refresh
Dim price As Integer '房间价格
price = CInt(Adodc2.Recordset.Fields(0)) '获取房间价格
Label2.Caption = "房间:" + frmCheckOut.DataCombo1.Text + " " + "单价:" + CStr(price) + "元/天"
Adodc1.RecordSource = "select * from ViewGuestInfo where Rnum='" & frmCheckOut.DataCombo1.Text & "'and Couttime is null" '查询客户信息
Adodc1.Refresh
frame1.Caption = "编号:" + Trim(Adodc1.Recordset.Fields(0).Value) + " 姓名:" + Trim(Adodc1.Recordset.Fields(1).Value) + " 性别:" + Trim(Adodc1.Recordset.Fields(2).Value) + " 年龄:" + Trim(Adodc1.Recordset.Fields(3).Value)
Dim a As Double
Dim b As Integer
Dim c As Double
Dim d As Integer
time = Now()
a = CDbl(time - Adodc1.Recordset.Fields(6)) '精确时间
b = CInt(time - Adodc1.Recordset.Fields(6)) '对时间取整
c = a - b '计算出小于一天的时间
If c > 0 Then
d = b + 1 '不足一天算一天
Else
d = b
End If
e = d * price '计算住宿费
RichTextBox1.Text = vbCrLf + " " + "入住时间:" + Trim(Adodc1.Recordset.Fields(6).Value) + vbCrLf + vbCrLf + " " + "当前时间:" + Trim(time) + vbCrLf + vbCrLf + " " + "共住 " + CStr(a) + " 天" + " " + "计 " + CStr(d) + " 天" + vbCrLf + vbCrLf + " " + "住宿费:" + CStr(e) + "元 " + "押金:" + Trim(Adodc1.Recordset.Fields(10).Value) + "元 " + "应收:" + Trim(e - CInt(Adodc1.Recordset.Fields(10))) + "元"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -