⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmpreshow.frm

📁 1:首先要导入hotel数据
💻 FRM
字号:
VERSION 5.00
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form frmPreShow 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   " 预订转入住"
   ClientHeight    =   4185
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   8340
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4185
   ScaleWidth      =   8340
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox txtName 
      Height          =   270
      Left            =   1080
      TabIndex        =   3
      ToolTipText     =   "输入名字"
      Top             =   3720
      Width           =   855
   End
   Begin CSCommand.Command cmdDel 
      Height          =   255
      Left            =   5640
      TabIndex        =   2
      Top             =   3720
      Width           =   975
      _ExtentX        =   1720
      _ExtentY        =   450
      IconAlign       =   0
      Icon            =   "frmPreShow.frx":0000
      Caption         =   "删 除(&D)"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin CSCommand.Command cmdBack 
      Cancel          =   -1  'True
      Height          =   255
      Left            =   6720
      TabIndex        =   1
      Top             =   3720
      Width           =   975
      _ExtentX        =   1720
      _ExtentY        =   450
      IconAlign       =   0
      Icon            =   "frmPreShow.frx":001C
      Caption         =   "返 回(&B)"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MSHierarchicalFlexGridLib.MSHFlexGrid msgList 
      Height          =   2655
      Left            =   120
      TabIndex        =   0
      Top             =   840
      Width           =   8055
      _ExtentX        =   14208
      _ExtentY        =   4683
      _Version        =   393216
      _NumberOfBands  =   1
      _Band(0).Cols   =   2
   End
   Begin CSCommand.Command cmdSeach 
      Height          =   255
      Left            =   2160
      TabIndex        =   4
      Top             =   3720
      Width           =   855
      _ExtentX        =   1508
      _ExtentY        =   450
      IconAlign       =   0
      Icon            =   "frmPreShow.frx":0038
      Caption         =   "显 示(&S)"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Label Label2 
      Caption         =   "查看预定客房的顾客"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   600
      TabIndex        =   6
      Top             =   120
      Width           =   5655
   End
   Begin VB.Label Label1 
      Caption         =   "按姓名"
      Height          =   255
      Left            =   480
      TabIndex        =   5
      Top             =   3765
      Width           =   615
   End
End
Attribute VB_Name = "frmPreShow"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim preCon As ADODB.Connection
Dim preRs As ADODB.Recordset
Dim preStr As String

Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim str As String

Dim RoomCon As ADODB.Connection
Dim RoomRs As ADODB.Recordset
Dim RoomStr As String

Dim PreDel As String
Dim Room_State As String


Private Sub chkAll_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    txtName.Text = ""
End Sub

Private Sub cmdBack_Click()
    Unload Me
End Sub



Private Sub cmdDel_Click()
    preStr = "select * from preconcert where pre_id='" & PreDel & "'"
    If mdlCon.connectTotable(preCon, preRs, preStr) Then
    End If
    If MsgBox("真的要删除此预订顾客信息吗?", vbQuestion + vbOKCancel, "删除信息") = vbOK Then
        preRs.Delete
        preRs.Update
        
'删除后房间状态更新
        RoomStr = "select room_state from rooms where room_id ='" & Room_State & "'"
        If mdlCon.connectTotable(RoomCon, RoomRs, RoomStr) Then
            RoomRs!Room_State = "空房"
            RoomRs.Update
            RoomRs.Close
            RoomCon.Close
        End If
        MsgBox "此顾客的预订信息已经删除!"
    End If
    preRs.Close
    preCon.Close
    
    
    
'    RoomStr = "select room_state from rooms where room_id = '" & PreDel & "'"
'    If mdlCon.connectTotable(RoomCon, RoomRs, RoomStr) Then
'        RoomRs!room_state = "空房"
'        RoomRs.Update
'    End If
'    RoomRs.Close
'    RoomCon.Close
End Sub

Private Sub cmdSeach_Click()
    str = "select pre_id,pre_name,pre_sex,pre_roomid,pre_tel,pre_prdate,pre_prtime,pre_comedate,pre_cometime,pre_consumer,pre_state,pre_operator from preconcert where pre_state='ding' and pre_name like '%" & txtName.Text & "%'"
    If mdlCon.connectTotable(con, rs, str) Then
        With msgList
            .Rows = 2
                Do While Not rs.EOF
                    .Rows = .Rows + 1
                    For i = 1 To preRs.Fields.Count
                        .TextMatrix(.Rows - 1, i) = rs.Fields(i - 1)
                    Next i
                    rs.MoveNext
                Loop
        End With
    Else
        MsgBox "没有找到客人的信息!", vbInformation + vbOKOnly, "预订查询"
    End If
End Sub

Private Sub Form_Activate()
    txtName.SetFocus
    Form_Load
End Sub

Private Sub Form_Load()
    ShowTitle
    preStr = "select pre_id,pre_name,pre_sex,pre_roomid,pre_tel,pre_prdate,pre_prtime,pre_comedate,pre_cometime,pre_consumer,pre_state,pre_operator from preconcert where pre_state='ding' order by pre_id"
    If mdlCon.connectTotable(preCon, preRs, preStr) Then
    End If
    ShowData
    preRs.Close
    preCon.Close
    
End Sub

'表头排序、约束
Sub ShowTitle()
    With msgList
        .Cols = 13
        .TextMatrix(0, 1) = "预订编号"
        .TextMatrix(0, 2) = " 姓名"
        .TextMatrix(0, 3) = "性别"
        .TextMatrix(0, 4) = " 房间"
        .TextMatrix(0, 5) = " 电话"
        .TextMatrix(0, 6) = "预订日期"
        .TextMatrix(0, 7) = "预订时间"
        .TextMatrix(0, 8) = "入住日期"
        .TextMatrix(0, 9) = "入住时间"
        .TextMatrix(0, 10) = "预定人数"
        .TextMatrix(0, 11) = "当前状态"
        .TextMatrix(0, 12) = "操作员"
        .FixedRows = 1
        
        For i = 0 To 12
            .ColAlignment(i) = 0
        Next i
        .ColWidth(0) = 300
        .ColWidth(1) = 800
        .ColWidth(2) = 800
        .ColWidth(3) = 500
        .ColWidth(4) = 800
        .ColWidth(5) = 800
        .ColWidth(6) = 1000
        .ColWidth(7) = 1000
        .ColWidth(8) = 1000
        .ColWidth(9) = 1000
        .ColWidth(10) = 800
        .ColWidth(11) = 800
        .ColWidth(12) = 1000
        
    End With
End Sub
'显示数据函数
Sub ShowData()
    With msgList
        .Rows = 2
        If Not preRs.EOF Then
            For i = 1 To preRs.Fields.Count
                .TextMatrix(.Rows - 1, i) = preRs.Fields(i - 1)
            Next i
            preRs.MoveNext
        End If
        Do While Not preRs.EOF
            .Rows = .Rows + 1
            For i = 1 To preRs.Fields.Count
                .TextMatrix(.Rows - 1, i) = preRs.Fields(i - 1)
            Next i
            preRs.MoveNext
        Loop
    End With
End Sub

Private Sub msgList_Click()
    PreDel = msgList.TextMatrix(Me.msgList.Row, 1)              '单击传递预订编号行值
    Room_State = msgList.TextMatrix(Me.msgList.Row, 4)          '单击传递房间编号
End Sub

Private Sub msgList_DblClick()                  '双击出现入住窗体
    mdlCon.PreIn = Me.msgList.TextMatrix(Me.msgList.Row, 1)
    If mdlCon.PreIn = "" Then
        MsgBox "没有选预订信息,请重新选择!"
    Else
        frmPreIn.Show vbModal
    End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -