frmBookin1.frm
资源名称:宾馆管理信息系统1.rar [点击查看]
上传用户:fulizhu2
上传日期:2007-06-21
资源大小:34k
文件大小:16k
源码类别:
酒店行业
开发平台:
Visual Basic
- VERSION 5.00
- Begin VB.Form frmBookin1
- BorderStyle = 3 'Fixed Dialog
- Caption = "订房信息"
- ClientHeight = 4368
- ClientLeft = 48
- ClientTop = 336
- ClientWidth = 8112
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4368
- ScaleWidth = 8112
- ShowInTaskbar = 0 'False
- StartUpPosition = 1 'CenterOwner
- Begin VB.TextBox txtNo
- Height = 270
- Left = 2520
- TabIndex = 23
- TabStop = 0 'False
- Top = 3960
- Visible = 0 'False
- Width = 735
- End
- Begin VB.Frame Frame2
- Caption = "顾客信息"
- Height = 3492
- Left = 4080
- TabIndex = 18
- Top = 240
- Width = 3735
- Begin VB.TextBox txtItem
- Height = 1440
- Index = 4
- Left = 1320
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 9
- Top = 1800
- Width = 2175
- End
- Begin VB.TextBox txtItem
- Height = 270
- Index = 0
- Left = 1320
- MaxLength = 5
- TabIndex = 5
- Top = 360
- Width = 2175
- End
- Begin VB.TextBox txtItem
- Height = 270
- Index = 1
- Left = 1320
- MaxLength = 18
- TabIndex = 6
- Top = 720
- Width = 2175
- End
- Begin VB.TextBox txtItem
- Height = 270
- Index = 2
- Left = 1320
- MaxLength = 10
- TabIndex = 7
- Top = 1080
- Width = 2172
- End
- Begin VB.TextBox txtItem
- Height = 270
- Index = 3
- Left = 1320
- MaxLength = 3
- TabIndex = 8
- Top = 1440
- Width = 1572
- End
- Begin VB.Label Label2
- Caption = "%"
- Height = 252
- Index = 8
- Left = 3120
- TabIndex = 25
- Top = 1440
- Width = 492
- End
- Begin VB.Label Label2
- Caption = "备 注 信 息:"
- Height = 252
- Index = 7
- Left = 240
- TabIndex = 24
- Top = 1800
- Width = 972
- End
- Begin VB.Label Label2
- Caption = "入 住 时 间:"
- Height = 252
- Index = 11
- Left = 240
- TabIndex = 22
- Top = 1080
- Width = 972
- End
- Begin VB.Label Label2
- Caption = "折 扣:"
- Height = 252
- Index = 6
- Left = 240
- TabIndex = 21
- Top = 1440
- Width = 972
- End
- Begin VB.Label Label2
- Caption = "身份证号码:"
- Height = 255
- Index = 5
- Left = 240
- TabIndex = 20
- Top = 720
- Width = 975
- End
- Begin VB.Label Label2
- Caption = "顾 客 姓 名:"
- Height = 255
- Index = 4
- Left = 240
- TabIndex = 19
- Top = 360
- Width = 975
- End
- End
- Begin VB.Frame Frame1
- Caption = "客房信息"
- Height = 3492
- Left = 240
- TabIndex = 12
- Top = 240
- Width = 3735
- Begin VB.TextBox txtItem
- Height = 960
- Index = 5
- Left = 1320
- MaxLength = 5
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 4
- Top = 2400
- Width = 2175
- End
- Begin VB.ComboBox cboItem
- Height = 300
- Index = 3
- Left = 1320
- Style = 2 'Dropdown List
- TabIndex = 3
- Top = 1920
- Width = 2175
- End
- Begin VB.ComboBox cboItem
- Height = 300
- Index = 2
- Left = 1320
- Style = 2 'Dropdown List
- TabIndex = 2
- Top = 1440
- Width = 2175
- End
- Begin VB.ComboBox cboItem
- Height = 300
- Index = 1
- Left = 1320
- Style = 2 'Dropdown List
- TabIndex = 1
- Top = 960
- Width = 2175
- End
- Begin VB.ComboBox cboItem
- Height = 300
- Index = 0
- Left = 1320
- Style = 2 'Dropdown List
- TabIndex = 0
- Top = 480
- Width = 2175
- End
- Begin VB.Label Label2
- Caption = "客房单价:"
- Height = 255
- Index = 3
- Left = 240
- TabIndex = 17
- Top = 1920
- Width = 975
- End
- Begin VB.Label Label2
- Caption = "客房编号:"
- Height = 255
- Index = 0
- Left = 240
- TabIndex = 16
- Top = 480
- Width = 975
- End
- Begin VB.Label Label2
- Caption = "客房种类:"
- Height = 255
- Index = 1
- Left = 240
- TabIndex = 15
- Top = 960
- Width = 975
- End
- Begin VB.Label Label2
- Caption = "客房备注:"
- Height = 255
- Index = 2
- Left = 240
- TabIndex = 14
- Top = 2400
- Width = 975
- End
- Begin VB.Label Label2
- Caption = "客房位置:"
- Height = 255
- Index = 16
- Left = 240
- TabIndex = 13
- Top = 1440
- Width = 975
- End
- End
- Begin VB.CommandButton cmdExit
- Caption = "返回 (&X)"
- Height = 375
- Left = 6120
- TabIndex = 11
- Top = 3840
- Width = 1215
- End
- Begin VB.CommandButton cmdSave
- Caption = "保存 (&S)"
- Height = 375
- Left = 4680
- TabIndex = 10
- Top = 3840
- Width = 1215
- End
- End
- Attribute VB_Name = "frmBookin1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- '是否改动过记录,ture为改过
- Dim mblChange As Boolean
- Dim mrc As ADODB.Recordset
- Public txtSQL As String
- Private Sub cboItem_Change(Index As Integer)
- '有变化设置gblchange
- mblChange = True
- End Sub
- Private Sub cboItem_Click(Index As Integer)
- Dim mrcc As ADODB.Recordset
- Dim intCount As Integer
- Dim MsgText As String
- If gintBmode = 1 Then
- If Index = 0 Then
- txtSQL = "select * from rooms where roomNO = '" & Trim(cboItem(0)) & "' and putup <> '是'"
- Set mrcc = ExecuteSQL(txtSQL, MsgText)
- For intCount = 1 To 3
- cboItem(intCount).Clear
- cboItem(intCount).AddItem mrcc.Fields(intCount)
- cboItem(intCount).ListIndex = 0
- Next intCount
- txtItem(5) = mrcc.Fields(5)
- mrcc.Close
- End If
- End If
- End Sub
- Private Sub cboItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
- EnterToTab KeyCode
- End Sub
- Private Sub cmdExit_Click()
- If mblChange And cmdSave.Enabled Then
- If MsgBox("保存当前记录的变化吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
- '保存
- Call cmdSave_Click
- End If
- End If
- Unload Me
- End Sub
- Private Sub cmdSave_Click()
- Dim intCount As Integer
- Dim sMeg As String
- Dim mrcc As ADODB.Recordset
- Dim MsgText As String
- For intCount = 0 To 3
- If Trim(txtItem(intCount) & " ") = "" Then
- Select Case intCount
- Case 0
- sMeg = "顾客姓名"
- Case 1
- sMeg = "身份证号码"
- Case 2
- sMeg = "折扣"
- Case 3
- sMeg = "入住时间"
- End Select
- sMeg = sMeg & "不能为空!"
- MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
- txtItem(intCount).SetFocus
- Exit Sub
- End If
- Next intCount
- For intCount = 0 To 3
- If Trim(cboItem(intCount) & " ") = "" Then
- Select Case intCount
- Case 0
- sMeg = "客房编号"
- Case 1
- sMeg = "客房种类"
- Case 2
- sMeg = "客房位置"
- Case 3
- sMeg = "客房单价"
- End Select
- sMeg = sMeg & "不能为空!"
- MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
- cboItem(intCount).SetFocus
- Exit Sub
- End If
- Next intCount
- If IsDate(txtItem(2)) Then
- txtItem(2) = Format(txtItem(2), "yyyy-mm-dd")
- Else
- MsgBox "入库时间应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
- txtItem(2).SetFocus
- Exit Sub
- End If
- For intCount = 1 To 3 Step 2
- If Not IsNumeric(txtItem(intCount)) Then
- MsgBox "请输入数字", vbOKOnly + vbExclamation, "警告"
- txtItem(intCount).SetFocus
- Exit Sub
- End If
- Next intCount
- If gintBmode = 2 Then
- txtSQL = "delete from bookin where bookno = '" & Trim(txtNo) & "'"
- Set mrcc = ExecuteSQL(txtSQL, MsgText)
- End If
- txtSQL = "select * from bookin"
- Set mrcc = ExecuteSQL(txtSQL, MsgText)
- mrcc.AddNew
- mrcc.Fields(0) = txtNo
- For intCount = 0 To 1
- mrcc.Fields(intCount + 1) = txtItem(intCount)
- Next intCount
- mrcc.Fields(3) = cboItem(0)
- For intCount = 2 To 4
- mrcc.Fields(intCount + 2) = txtItem(intCount)
- Next intCount
- mrcc.Fields(8) = 0
- mrcc.Update
- mrcc.Close
- txtSQL = "select * from rooms where roomNO = '" & Trim(cboItem(0)) & "'"
- Set mrcc = ExecuteSQL(txtSQL, MsgText)
- If Not mrcc.EOF Then
- mrcc!putup = "y"
- End If
- mrcc.Update
- mrcc.Close
- If gintBmode = 1 Then
- MsgBox "添加订房信息成功!", vbOKOnly + vbExclamation, "添加订房消息"
- Unload Me
- If flagBedit Then
- Unload frmBookin
- End If
- frmBookin.txtSQL = "select bookno,customname,customID,roomno,indate,discount,inmemo from bookin where ammount = '0'"
- frmBookin.Show
- Else
- MsgBox "修改订房信息成功!", vbOKOnly + vbExclamation, "修改订房消息"
- Unload Me
- If flagBedit Then
- Unload frmBookin
- End If
- frmBookin.txtSQL = "select bookno,customname,customID,roomno,indate,discount,inmemo from bookin where ammount = '0'"
- frmBookin.Show
- End If
- End Sub
- Private Sub Form_Load()
- Dim sSql As String
- Dim intCount As Integer
- Dim MsgText As String
- If flagSedit Then
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- If Not mrc.EOF Then
- For intCount = 0 To 3
- cboItem(intCount).AddItem mrc.Fields(intCount)
- cboItem(intCount).ListIndex = 0
- Next intCount
- txtItem(5) = mrc.Fields(5)
- End If
- mrc.Close
- txtNo = GetRkno()
- gintBmode = 1
- Else
- If gintBmode = 1 Then
- Me.Caption = Me.Caption & "添加"
- '初始化客房信息
- txtSQL = "select DISTINCT roomNO from rooms where putup <> 'y'"
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- If Not mrc.EOF Then
- Do While Not mrc.EOF
- cboItem(0).AddItem Trim(mrc.Fields(0))
- mrc.MoveNext
- Loop
- Else
- MsgBox "请先进行客房登记!", vbOKOnly + vbExclamation, "警告"
- cmdSave.Enabled = False
- Exit Sub
- End If
- mrc.Close
- txtNo = GetRkno
- ElseIf gintBmode = 2 Then
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- If mrc.EOF = False Then
- With mrc
- txtNo = !bookno
- For intCount = 0 To 1
- If Not IsNull(.Fields(intCount + 1)) Then
- txtItem(intCount) = .Fields(intCount + 1)
- End If
- Next intCount
- cboItem(0).AddItem !roomno
- cboItem(0).ListIndex = 0
- For intCount = 2 To 4
- If Not IsNull(.Fields(intCount + 2)) Then
- txtItem(intCount) = .Fields(intCount + 2)
- End If
- Next intCount
- End With
- End If
- mrc.Close
- Me.Caption = Me.Caption & "修改"
- txtSQL = "select * from rooms where roomNO = '" & Trim(cboItem(0)) & "'"
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- If Not mrc.EOF Then
- For intCount = 1 To 3
- cboItem(intCount).AddItem mrc.Fields(intCount)
- cboItem(intCount).ListIndex = 0
- Next intCount
- txtItem(5) = mrc.Fields(5)
- End If
- mrc.Close
- End If
- End If
- mblChange = False
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- gintBmode = 0
- End Sub
- Private Sub txtItem_Change(Index As Integer)
- '有变化设置gblchange
- mblChange = True
- End Sub
- Private Sub txtItem_GotFocus(Index As Integer)
- txtItem(Index).SelStart = 0
- txtItem(Index).SelLength = Len(txtItem(Index))
- End Sub
- Private Sub txtItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
- EnterToTab KeyCode
- End Sub
- Private Function GetRkno() As String
- GetRkno = Format(Now, "yymmddhhmmss")
- Randomize
- GetRkno = GetRkno & Int((99 - 10 + 1) * Rnd + 10)
- End Function