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

📄 main_htgl_fjthgl.frm

📁 用vb做的一套餐饮管理系统的,可以方便的实现餐饮行业的管理
💻 FRM
📖 第 1 页 / 共 2 页
字号:
   Begin MSDataGridLib.DataGrid DataGrid1 
      Bindings        =   "main_htgl_fjthgl.frx":5631
      Height          =   3600
      Left            =   30
      TabIndex        =   12
      Top             =   1185
      Width           =   9870
      _ExtentX        =   17410
      _ExtentY        =   6350
      _Version        =   393216
      AllowUpdate     =   -1  'True
      HeadLines       =   1
      RowHeight       =   15
      FormatLocked    =   -1  'True
      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     =   8
      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
      BeginProperty Column02 
         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 Column03 
         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 Column04 
         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 Column05 
         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 Column06 
         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 Column07 
         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 
            ColumnWidth     =   1154.835
         EndProperty
         BeginProperty Column01 
            ColumnWidth     =   1785.26
         EndProperty
         BeginProperty Column02 
            ColumnWidth     =   1275.024
         EndProperty
         BeginProperty Column03 
            ColumnWidth     =   1170.142
         EndProperty
         BeginProperty Column04 
            ColumnWidth     =   840.189
         EndProperty
         BeginProperty Column05 
            ColumnWidth     =   2085.166
         EndProperty
         BeginProperty Column06 
            ColumnWidth     =   1365.165
         EndProperty
         BeginProperty Column07 
            ColumnWidth     =   1094.74
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "main_htgl_fjthgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer     '定义整型变量
'定义数据集对象
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Dim rs4 As New ADODB.Recordset
Private Sub Form_Activate()
  '打开"部门信息表"
  rs1.Open "select 部门名称 from 部门信息表 order by 部门编号", cnn, adOpenKeyset, adLockOptimistic
  '添加部门列表
  If rs1.BOF = False Then rs1.MoveFirst
  For i = 0 To rs1.RecordCount - 1
      Combo2.AddItem (Trim(rs1.Fields("部门名称")))
      rs1.MoveNext
  Next i
  If Combo2.ListCount > 0 Then Combo2.ListIndex = 0
  rs1.Close
  rs2.Open "select 类型说明 from 房间台号类型表 group by 类型说明", cnn, adOpenKeyset, adLockOptimistic
  '添加房间类型列表
  If rs2.BOF = False Then rs2.MoveFirst
  For i = 0 To rs2.RecordCount - 1
      Combo1.AddItem (Trim(rs2.Fields("类型说明")))
      rs2.MoveNext
  Next i
  If Combo1.ListCount > 0 Then Combo1.ListIndex = 0
  rs2.Close
  '添加房间状态列表
  Combo5.AddItem ("空闲"): Combo5.AddItem ("营业"): Combo5.AddItem ("维修")
  Combo5.ListIndex = 0
  '添加查询内容列表
  Combo3.AddItem ("编号"): Combo3.AddItem ("房台名称"): Combo3.AddItem ("所属部门")
  Combo3.ListIndex = 0
  '查询所有房间台号,并按"编号"排序
  Adodc1.RecordSource = "select * from 房间台号信息表 order by 编号"
  Adodc1.Refresh
  Me.Caption = Me.Caption & "    " & frm_main.St1.Panels(3).text
End Sub
Private Sub Form_Unload(Cancel As Integer)
  frm_main.Enabled = True
End Sub
Private Sub Combo1_Click()
 rs3.Open "select * from 房间台号类型表 where 类型说明='" + Trim(Combo1.text) + "'", cnn, adOpenKeyset, adLockOptimistic
 If rs3.RecordCount > 0 Then
  Labrs.Caption = Trim(rs3.Fields("容纳人数"))     '赋值给labrs.caption
 End If
 rs3.Close
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
  Select Case Index
    Case Is = Index
      If KeyCode = vbKeyReturn And Index = 1 Then Combo1.SetFocus     '按回车键combo1获得焦点
      If KeyCode = vbKeyReturn And Index = 2 Then Combo5.SetFocus
      If KeyCode = vbKeyReturn And Index = 3 Then ComSave.SetFocus     '按回车键comsave获得焦点
  End Select
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Combo2.SetFocus     '按回车键combo2获得焦点
End Sub
Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Text1(2).SetFocus
End Sub
Private Sub Combo5_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Text1(3).SetFocus
End Sub
Private Sub CmdMD_Click(Index As Integer)
 Select Case Index
 Case Is = 0     '移到第一条记录
  If Not Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst
 Case Is = 1     '移到上一条记录
  If Adodc1.Recordset.RecordCount <> 0 Then
   If Adodc1.Recordset.BOF = False Then Adodc1.Recordset.MovePrevious
   If Adodc1.Recordset.BOF = True Then Adodc1.Recordset.MoveFirst
  End If
 Case Is = 2     '移到下一条记录
  If Adodc1.Recordset.RecordCount <> 0 Then
   If Adodc1.Recordset.EOF = False Then Adodc1.Recordset.MoveNext
   If Adodc1.Recordset.EOF = True Then Adodc1.Recordset.MoveLast
  End If
 Case Is = 3     '移到最后一条记录
   If Adodc1.Recordset.EOF = False Then Adodc1.Recordset.MoveLast
 End Select
End Sub
Private Sub ComAdd_Click()     '添加
 Frame1.Visible = True
 '自动创建编号
 Dim dm As Integer
 Set rs1 = New ADODB.Recordset
 rs1.Open "select * from 房间台号信息表 order by 编号", cnn, adOpenKeyset, adLockOptimistic
 If rs1.RecordCount > 0 Then
   If Not rs1.EOF Then rs1.MoveLast
   If rs1.Fields("编号") <> "" Then
      dm = Trim(rs1.Fields("编号")) + 1
      Text1(0).text = Format(dm, "000")
   End If
 Else
   Text1(0).text = "001"
 End If
 rs1.Close
 For i = 1 To 3
  Text1(i).text = ""
 Next i
 Text1(1).SetFocus
End Sub
Private Sub ComModify_Click()     '允许修改数据
 If Adodc1.Recordset.RecordCount > 0 Then
   Frame1.Visible = True
   Text1(0).text = Trim(Adodc1.Recordset.Fields("编号"))
   Text1(1).text = Trim(Adodc1.Recordset.Fields("房台名称"))
   Combo1.text = Trim(Adodc1.Recordset.Fields("类型说明"))
   Combo2.text = Trim(Adodc1.Recordset.Fields("部门"))
   Text1(2).text = Trim(Adodc1.Recordset.Fields("服务费"))
   Combo5.text = Trim(Adodc1.Recordset.Fields("状态"))
   Text1(3).text = Trim(Adodc1.Recordset.Fields("简要说明"))
   Labrs.Caption = Trim(Adodc1.Recordset.Fields("容纳人数"))
 Else
   MsgBox "没有要修改的记录,请核对!"
 End If
End Sub
Private Sub ComDelete_Click()     '删除数据
 Frame1.Visible = False
 On Error Resume Next
 Adodc1.Recordset.Delete
 Adodc1.Refresh
End Sub
Private Sub ComSave_Click()     '保存数据
 Set rs1 = New ADODB.Recordset
 '打开连接
 rs1.Open "select * from 房间台号信息表 where 编号='" & Trim(Text1(0).text) & "'order by 编号", cnn, adOpenKeyset, adLockOptimistic
 If rs1.RecordCount > 0 Then
  Dim a As String
  a = MsgBox("您确实要修改这条数据吗?", vbYesNo)
  If a = vbYes Then
     rs1.Fields("编号") = Text1(0).text
     rs1.Fields("房台名称") = Text1(1).text
     rs1.Fields("类型说明") = Combo1.text
     rs1.Fields("部门") = Combo2.text
     rs1.Fields("服务费") = Text1(2).text
     rs1.Fields("状态") = Combo5.text
     rs1.Fields("简要说明") = Text1(3).text
     rs1.Fields("容纳人数") = Val(Labrs.Caption)
     rs1.Update
     Adodc1.Refresh
  End If
 Else
  If Text1(1).text <> "" Then
   '添加房间台号信息
   rs1.AddNew
   rs1.Fields("编号") = Text1(0).text
   rs1.Fields("房台名称") = Text1(1).text
   rs1.Fields("类型说明") = Combo1.text
   rs1.Fields("部门") = Combo2.text
   rs1.Fields("服务费") = Val(Text1(2).text)
   rs1.Fields("状态") = Combo5.text
   rs1.Fields("简要说明") = Text1(3).text
   rs1.Fields("容纳人数") = Val(Labrs.Caption)
   rs1.Update     '更新数据库
   Adodc1.Refresh
  Else
   MsgBox "请填写完整的信息"
  End If
 End If
 rs1.Close     '关闭数据集对象
 Frame1.Visible = False
End Sub
Private Sub Comfind_Click()     '查询房间台号信息
 Adodc1.RecordSource = "select * from 房间台号信息表 where (房间台号信息表." & Combo3.text & " like + '" + Text2.text + "'+'%') order by 编号"
 Adodc1.Refresh
End Sub
Private Sub ComEsc_Click()     '取消操作
 Frame1.Visible = False
End Sub
Private Sub ComExit_Click()
 Unload Me
 frm_main.Enabled = True
End Sub

⌨️ 快捷键说明

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