frmRoomsurplus.frm
上传用户:fulizhu2
上传日期:2007-06-21
资源大小:34k
文件大小:6k
源码类别:

酒店行业

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.Form frmRoomsurplus 
  3.    Caption         =   "剩余客房查询"
  4.    ClientHeight    =   3120
  5.    ClientLeft      =   48
  6.    ClientTop       =   348
  7.    ClientWidth     =   4080
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   3120
  10.    ScaleWidth      =   4080
  11.    StartUpPosition =   2  'CenterScreen
  12.    Begin VB.ComboBox Combo1 
  13.       Height          =   288
  14.       Index           =   2
  15.       Left            =   1440
  16.       Style           =   2  'Dropdown List
  17.       TabIndex        =   10
  18.       Top             =   1680
  19.       Width           =   1692
  20.    End
  21.    Begin VB.Frame Frame1 
  22.       Caption         =   "客房单价"
  23.       Height          =   1572
  24.       Left            =   600
  25.       TabIndex        =   6
  26.       Top             =   720
  27.       Width           =   2652
  28.       Begin VB.ComboBox Combo1 
  29.          Height          =   288
  30.          Index           =   1
  31.          Left            =   840
  32.          Style           =   2  'Dropdown List
  33.          TabIndex        =   9
  34.          Top             =   360
  35.          Width           =   1692
  36.       End
  37.       Begin VB.Label lblitem 
  38.          Caption         =   "大于"
  39.          Height          =   252
  40.          Index           =   2
  41.          Left            =   240
  42.          TabIndex        =   8
  43.          Top             =   960
  44.          Width           =   372
  45.       End
  46.       Begin VB.Label lblitem 
  47.          Caption         =   "小于"
  48.          Height          =   252
  49.          Index           =   0
  50.          Left            =   240
  51.          TabIndex        =   7
  52.          Top             =   360
  53.          Width           =   372
  54.       End
  55.    End
  56.    Begin VB.CommandButton cmdExit 
  57.       Caption         =   "取消 (&X)"
  58.       Height          =   375
  59.       Left            =   2280
  60.       TabIndex        =   4
  61.       Top             =   2520
  62.       Width           =   1215
  63.    End
  64.    Begin VB.CommandButton cmdOk 
  65.       Caption         =   "确定 (&O)"
  66.       Default         =   -1  'True
  67.       Height          =   375
  68.       Left            =   720
  69.       TabIndex        =   3
  70.       Top             =   2520
  71.       Width           =   1215
  72.    End
  73.    Begin VB.CheckBox chkItem 
  74.       Caption         =   "Check1"
  75.       Height          =   180
  76.       Index           =   0
  77.       Left            =   240
  78.       TabIndex        =   2
  79.       TabStop         =   0   'False
  80.       Top             =   240
  81.       Value           =   1  'Checked
  82.       Width           =   132
  83.    End
  84.    Begin VB.ComboBox Combo1 
  85.       Height          =   288
  86.       Index           =   0
  87.       Left            =   1440
  88.       Style           =   2  'Dropdown List
  89.       TabIndex        =   1
  90.       Top             =   240
  91.       Width           =   1692
  92.    End
  93.    Begin VB.CheckBox chkItem 
  94.       Caption         =   "Check1"
  95.       Height          =   180
  96.       Index           =   1
  97.       Left            =   240
  98.       TabIndex        =   0
  99.       TabStop         =   0   'False
  100.       Top             =   840
  101.       Width           =   132
  102.    End
  103.    Begin VB.Label lblitem 
  104.       Caption         =   "客房种类:"
  105.       Height          =   252
  106.       Index           =   1
  107.       Left            =   600
  108.       TabIndex        =   5
  109.       Top             =   240
  110.       Width           =   1092
  111.    End
  112. End
  113. Attribute VB_Name = "frmRoomsurplus"
  114. Attribute VB_GlobalNameSpace = False
  115. Attribute VB_Creatable = False
  116. Attribute VB_PredeclaredId = True
  117. Attribute VB_Exposed = False
  118. Private Sub chkItem_Click(Index As Integer)
  119.     If Index = 0 Then
  120.         If chkItem(Index).Value = vbChecked Then
  121.             Combo1(Index).Enabled = True
  122.         End If
  123.     Else
  124.         If chkItem(Index).Value = vbChecked Then
  125.             Combo1(1).Enabled = True
  126.             Combo1(2).Enabled = True
  127.         End If
  128.     End If
  129.     
  130.         
  131.         
  132. End Sub
  133. Private Sub cmdExit_Click()
  134.     Me.Hide
  135. End Sub
  136. Private Sub cmdOk_Click()
  137.     Dim sQSql As String
  138.     
  139.     
  140.     If chkItem(0).Value = vbChecked Then
  141.         sQSql = " roomtype = '" & Trim(Combo1(0) & " ") & "'"
  142.     End If
  143.     
  144.     If chkItem(1).Value = vbChecked Then
  145.         If Trim(sQSql & " ") = "" Then
  146.             If Trim(Combo1(1) & " ") <> "" And Trim(Combo1(2) & " ") <> "" Then
  147.                 sQSql = " roomprice <='" & Trim(Combo1(1) & " ") & "'and roomprice >= '" & Trim(Combo1(2) & " ") & "'"
  148.             ElseIf Trim(Combo1(1) & " ") = "" And Trim(Combo1(2) & " ") <> "" Then
  149.                 sQSql = " roomprice >='" & Trim(Combo1(2) & " ") & "'"
  150.             ElseIf Trim(Combo1(1) & " ") <> "" And Trim(Combo1(2) & " ") = "" Then
  151.                 sQSql = " roomprice <='" & Trim(Combo1(1) & " ") & "'"
  152.             End If
  153.             
  154.         Else
  155.             If Trim(Combo1(1) & " ") <> "" And Trim(Combo1(2) & " ") <> "" Then
  156.                 sQSql = sQSql & " and roomprice >='" & Trim(Combo1(1) & " ") & "'and roomprice >= '" & Trim(Combo1(2) & " ") & "'"
  157.             ElseIf Trim(Combo1(1) & " ") = "" And Trim(Combo1(2) & " ") <> "" Then
  158.                 sQSql = sQSql & " and roomprice >='" & Trim(Combo1(2) & " ") & "'"
  159.             ElseIf Trim(Combo1(1) & " ") <> "" And Trim(Combo1(2) & " ") = "" Then
  160.                 sQSql = sQSql & " and roomprice <='" & Trim(Combo1(1) & " ") & "'"
  161.             End If
  162.         End If
  163.     End If
  164.     
  165.     
  166.     If Trim(sQSql) = "" Then
  167.         MsgBox "请设置查询条件!", vbOKOnly + vbExclamation, "警告"
  168.         Exit Sub
  169.     Else
  170.         If flagRedit Then
  171.             Unload frmRoom
  172.         End If
  173.         
  174.         frmRoom.txtSQL = "select * from rooms where" & sQSql & "and putup <> 'y'"
  175.         frmRoom.Show
  176.         flagSedit = True
  177.     End If
  178.     Me.Hide
  179. End Sub
  180. Private Sub Form_Load()
  181.     Dim txtSQL As String
  182.     Dim MsgText As String
  183.     Dim mrc As ADODB.Recordset
  184.     
  185.     txtSQL = "select distinct typename from roomtype"
  186.     Set mrc = ExecuteSQL(txtSQL, MsgText)
  187.     If Not mrc.EOF Then
  188.         Do While Not mrc.EOF
  189.             Combo1(0).AddItem mrc.Fields(0)
  190.             mrc.MoveNext
  191.         Loop
  192.     End If
  193.     mrc.Close
  194.     
  195.     txtSQL = "select distinct price from roomtype"
  196.     Set mrc = ExecuteSQL(txtSQL, MsgText)
  197.     If Not mrc.EOF Then
  198.         Do While Not mrc.EOF
  199.             Combo1(1).AddItem mrc.Fields(0)
  200.             Combo1(2).AddItem mrc.Fields(0)
  201.             mrc.MoveNext
  202.         Loop
  203.     End If
  204.     mrc.Close
  205.     
  206.     
  207. End Sub