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

📄 frmbook1.frm

📁 餐饮经销系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmBOOK1 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "房台预定信息"
   ClientHeight    =   6012
   ClientLeft      =   48
   ClientTop       =   336
   ClientWidth     =   6216
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6012
   ScaleWidth      =   6216
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Begin VB.Frame Frame1 
      Caption         =   "其它信息:"
      Height          =   1692
      Index           =   3
      Left            =   120
      TabIndex        =   21
      Top             =   3720
      Width           =   6012
      Begin VB.TextBox txtItem 
         Height          =   1320
         Index           =   9
         Left            =   120
         MaxLength       =   299
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   24
         Top             =   240
         Width           =   5775
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "房台信息:"
      Height          =   1572
      Index           =   2
      Left            =   120
      TabIndex        =   16
      Top             =   2040
      Width           =   6012
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   8
         Left            =   1080
         Locked          =   -1  'True
         MaxLength       =   20
         TabIndex        =   23
         Top             =   1080
         Width           =   1572
      End
      Begin VB.TextBox txtItem 
         Height          =   276
         Index           =   7
         Left            =   3720
         Locked          =   -1  'True
         MaxLength       =   200
         MultiLine       =   -1  'True
         TabIndex        =   7
         Top             =   720
         Width           =   2052
      End
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   6
         Left            =   1080
         Locked          =   -1  'True
         MaxLength       =   20
         TabIndex        =   6
         Top             =   720
         Width           =   1572
      End
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   5
         Left            =   3720
         Locked          =   -1  'True
         MaxLength       =   20
         TabIndex        =   5
         Top             =   360
         Width           =   2052
      End
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   4
         Left            =   1080
         Locked          =   -1  'True
         MaxLength       =   20
         TabIndex        =   4
         Top             =   360
         Width           =   1572
      End
      Begin VB.Label Label2 
         Caption         =   "所属部门:"
         Height          =   255
         Index           =   3
         Left            =   240
         TabIndex        =   22
         Top             =   720
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "容纳人数:"
         Height          =   255
         Index           =   11
         Left            =   240
         TabIndex        =   20
         Top             =   1080
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "所属类别:"
         Height          =   252
         Index           =   10
         Left            =   2880
         TabIndex        =   19
         Top             =   720
         Width           =   1332
      End
      Begin VB.Label Label2 
         Caption         =   "房台编号:"
         Height          =   255
         Index           =   9
         Left            =   240
         TabIndex        =   18
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "房台名称:"
         Height          =   252
         Index           =   8
         Left            =   2880
         TabIndex        =   17
         Top             =   360
         Width           =   1092
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "客人信息:"
      Height          =   852
      Index           =   1
      Left            =   120
      TabIndex        =   13
      Top             =   1080
      Width           =   6012
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   3
         Left            =   3720
         MaxLength       =   20
         TabIndex        =   25
         Top             =   360
         Width           =   1932
      End
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   2
         Left            =   1200
         MaxLength       =   20
         TabIndex        =   3
         Top             =   360
         Width           =   1572
      End
      Begin VB.Label Label2 
         Caption         =   "联系电话:"
         Height          =   252
         Index           =   7
         Left            =   2880
         TabIndex        =   15
         Top             =   360
         Width           =   1092
      End
      Begin VB.Label Label2 
         Caption         =   "客人姓名:"
         Height          =   252
         Index           =   4
         Left            =   240
         TabIndex        =   14
         Top             =   360
         Width           =   852
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "订单基本信息:"
      Height          =   852
      Index           =   0
      Left            =   120
      TabIndex        =   10
      Top             =   120
      Width           =   6012
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   1
         Left            =   6000
         MaxLength       =   20
         TabIndex        =   2
         Top             =   360
         Visible         =   0   'False
         Width           =   372
      End
      Begin VB.ComboBox Combo1 
         Height          =   288
         Index           =   0
         Left            =   3720
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   360
         Width           =   2052
      End
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   0
         Left            =   1200
         MaxLength       =   20
         TabIndex        =   0
         Top             =   360
         Width           =   1572
      End
      Begin VB.Label Label2 
         Caption         =   "预定日期:"
         Height          =   255
         Index           =   0
         Left            =   240
         TabIndex        =   12
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "业务员:"
         Height          =   252
         Index           =   1
         Left            =   2880
         TabIndex        =   11
         Top             =   360
         Width           =   1092
      End
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "返回 (&X)"
      Height          =   375
      Left            =   2880
      TabIndex        =   9
      Top             =   5520
      Width           =   1215
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "保存 (&S)"
      Height          =   375
      Left            =   1440
      TabIndex        =   8
      Top             =   5520
      Width           =   1215
   End
End
Attribute VB_Name = "frmBOOK1"
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 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 MsgText As String
    
  
    For intCount = 1 To 3
        If Trim(txtItem(intCount) & " ") = "" Then
            Select Case intCount
                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 0
        If Trim(Combo1(intCount) & " ") = "" Then
            Select Case intCount
                Case 0
                    sMeg = "业务员"
            End Select
            sMeg = sMeg & "不能为空!"
            MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
            Combo1(intCount).SetFocus
            Exit Sub
        End If
    Next intCount
    
    
   
   
    
    '再加入新记录
    txtSQL = "insert book values ('"
    
    txtSQL = txtSQL & Trim(txtItem(0)) & "','"
    
    txtSQL = txtSQL & Trim(Combo1(0).ItemData(Combo1(0).ListIndex)) & "','"
    
    For intCount = 1 To 4
        txtSQL = txtSQL & Trim(txtItem(intCount)) & "','"
    Next intCount
    txtSQL = txtSQL & Trim(txtItem(9)) & "')"
    
    
    Set mrc = ExecuteSQL(txtSQL, MsgText)
        
    If gintDHmode = 1 Then
        MsgBox "预定房台成功!", vbOKOnly + vbExclamation, "预定房台"
        For intCount = 0 To 9
            txtItem(intCount) = ""
        Next intCount
        
        For intCount = 0 To 0
            Combo1(intCount).ListIndex = 0
        Next intCount
       
        
        txtItem(0) = Format(Now, "yyyy-mm-dd")
        
        mblChange = False
        
        Unload Me
        
        Unload frmBOOK
        frmBOOK.txtSQL = "select dm_room.dm,dm_room.mc,dm_room.bmmc,dm_room.lbmc,dm_room.r_sl,book.khmc,book.lxdh from dm_room left join book on dm_room.dm =book.roomdm where dm_room.dm <> 'b' and dm_room.dm <> 'l'"
        frmBOOK.Show 0
        
    ElseIf gintDHmode = 2 Then
        Unload Me
        Unload frmBOOK
        
        frmBOOK.txtSQL = "select dm_room.dm,dm_room.mc,dm_room.bmmc,dm_room.lbmc,dm_room.r_sl,book.khmc,book.lxdh from dm_room left join book on dm_room.dm =book.roomdm where dm_room.dm <> 'b' and dm_room.dm <> 'l'"
        frmBOOK.Show 0
    End If
    
End Sub

Private Sub Combo1_Change(Index As Integer)
    mblChange = True
    
    
End Sub

Private Sub Combo1_Click(Index As Integer)
    Dim mrcc As ADODB.Recordset
    Dim mrcd As ADODB.Recordset
    Dim MsgText As String
    
    
    If Index = 1 Then
        
                txtItem(2) = Combo1(1).ItemData(Combo1(1).ListIndex)

    ElseIf Index = 2 Then
            txtSQL = "select dm,rkj  from dm_wz where mc = '" & Trim(Combo1(2)) & "'"
            Set mrcc = ExecuteSQL(txtSQL, MsgText)
                        
            If Not mrcc.EOF Then
                txtItem(3) = mrcc.Fields(0)
                txtItem(6) = mrcc.Fields(1)
            End If
            
            mrcc.Close
            
    End If

End Sub

Private Sub Form_Load()
    Dim intCount As Integer
    Dim MsgText As String
    Dim i As Integer
    Dim mrcc As ADODB.Recordset
  
        For i = 0 To 9
            txtItem(i).Text = ""
        Next i
        
        For i = 0 To 0
            Combo1(i).Clear
        Next i
        
        txtItem(1) = GetRkno()
        
        
    
        
    txtSQL = "select dm,mc from dm_ywy"
    Set mrcc = ExecuteSQL(txtSQL, MsgText)
    
    If Not mrcc.EOF Then
        If Trim(Combo1(0)) <> "" Then
            Do While Not mrcc.EOF
    
                    If Combo1(0).ItemData(Combo1(0).ListIndex) <> mrcc.Fields(0) Then
                        Combo1(0).AddItem mrcc.Fields(1)
                        Combo1(0).ItemData(Combo1(0).NewIndex) = mrcc.Fields(0)
                    End If
                
                    mrcc.MoveNext
            Loop
        Else
            Do While Not mrcc.EOF
                    Combo1(0).AddItem mrcc.Fields(1)
                    Combo1(0).ItemData(Combo1(0).NewIndex) = mrcc.Fields(0)
                  
                    mrcc.MoveNext
            Loop
        
        End If
    End If
    
    mrcc.Close
    
    txtItem(0) = Format(Now, "yyyy-mm-dd")
    txtItem(0).Enabled = False
    
    mblChange = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
    gintDHmode = 0
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

⌨️ 快捷键说明

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