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

📄 frmcopysite.frm

📁 星级酒店管理系统(附带系统自写控件源码)
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmCopysite 
   BackColor       =   &H80000000&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "在需要选定的餐桌前打勾。"
   ClientHeight    =   4500
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7350
   Icon            =   "frmCopySite.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4500
   ScaleWidth      =   7350
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin VB.CheckBox chkBook 
      Caption         =   "显示预定餐桌"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   150
      TabIndex        =   4
      Top             =   3885
      Width           =   1605
   End
   Begin VB.ListBox lstSite 
      BackColor       =   &H00E0E0E0&
      Columns         =   8
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3180
      Left            =   135
      Style           =   1  'Checkbox
      TabIndex        =   2
      Top             =   540
      Width           =   6975
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "关闭(&C)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   5850
      TabIndex        =   1
      Top             =   3855
      Width           =   1305
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "开始复制"
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   4515
      TabIndex        =   0
      Top             =   3855
      Width           =   1305
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "所有〖空闲餐桌〗列表:在需要选定的餐桌前打勾,缺省预定餐桌不显示。"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00808080&
      Height          =   210
      Index           =   1
      Left            =   135
      TabIndex        =   5
      Top             =   210
      Width           =   6825
   End
   Begin VB.Shape Shape1 
      BorderColor     =   &H00FFFFFF&
      FillColor       =   &H00808080&
      FillStyle       =   0  'Solid
      Height          =   3300
      Left            =   90
      Top             =   495
      Width           =   7080
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "所有〖空闲餐桌〗列表:在需要选定的餐桌前打勾,缺省预定餐桌不显示。"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   210
      Index           =   0
      Left            =   120
      TabIndex        =   3
      Top             =   195
      Width           =   6825
   End
End
Attribute VB_Name = "frmCopysite"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Private Sub chkBook_Click()

  If chkBook.Value = vbChecked Then
     GetListAndBook
    Else
     GetList
  End If
  
End Sub

Private Sub cmdCancel_Click()

 Unload Me
 
End Sub

Private Sub cmdOK_Click()

 '如果选择为空时退出
 If lstSite.SelCount = 0 Then
    MsgBox "对不起,请选择【预订】桌号?   ", vbInformation
    Exit Sub
 End If

 '复制桌号
   '循环得到选择项
 Dim x As Integer
 For x = 0 To lstSite.ListCount - 1
     If lstSite.Selected(x) = True Then
        'UpdateIt
        UpdateIt lstSite.List(x)
     End If
 Next
  
 MsgBox "恭喜,【 " & lstSite.SelCount & " 】桌酒席已经复制完毕!  " & vbCrLf & vbCrLf & "请记住复制桌所有菜与原桌相同。 ", vbInformation

 Unload Me
 
End Sub

Private Sub Form_Load()

  GetFormSet Me, Screen
  GetList
  
End Sub

Private Sub Form_Unload(Cancel As Integer)

 SaveFormSet Me
 
End Sub

Private Sub GetList()
 
 On Error GoTo GetERR
 
 Dim DB As Connection
 Dim EF As Recordset
 Dim sTmp As String
     
     lstSite.Clear
     
     Set DB = CreateObject("ADODB.Connection")
     Set EF = CreateObject("AdODB.Recordset")
         DB.Open Constr
         sTmp = "Select Class From SiteType Where SiteStatus=0"   '空闲座位
         EF.Open sTmp, DB, adOpenStatic, adLockReadOnly, adCmdText
         If Not (EF.EOF And EF.BOF) Then
            Do While Not EF.EOF
               lstSite.AddItem EF("Class")
               EF.MoveNext
            Loop
         End If
      EF.Close
      DB.Close
  Set EF = Nothing
  Set DB = Nothing
  
  Exit Sub
GetERR:
  MsgBox "给出座位错误:" & Err.descriptin, vbCritical
  Exit Sub
  
End Sub

Private Sub GetListAndBook()
 
 On Error GoTo GetERR
 
 Dim DB As Connection
 Dim EF As Recordset
 Dim sTmp As String
     
     lstSite.Clear
     
     Set DB = CreateObject("ADODB.Connection")
     Set EF = CreateObject("AdODB.Recordset")
         DB.Open Constr
         sTmp = "Select Class From SiteType Where SiteStatus<2"   '空闲座位+预订座位
         EF.Open sTmp, DB, adOpenStatic, adLockReadOnly, adCmdText
         If Not (EF.EOF And EF.BOF) Then
            Do While Not EF.EOF
               lstSite.AddItem EF("Class")
               EF.MoveNext
            Loop
         End If
      EF.Close
      DB.Close
  Set EF = Nothing
  Set DB = Nothing
  
  Exit Sub
GetERR:
  MsgBox "给出座位错误:" & Err.descriptin, vbCritical
  Exit Sub
  
End Sub

Private Sub UpdateIt(sSites As String)

  On Error GoTo ERR_UI
  
  Dim DB As Connection
  Dim sTmp As String
  Set DB = CreateObject("ADODB.Connection")
      DB.Open Constr
      DB.BeginTrans
  
     '清除临时库
      sTmp = "Delete  From tmpSite1"
      DB.Execute sTmp
      sTmp = "Delete  From tmpCust1"
      DB.Execute sTmp
      sTmp = "Delete  From tmpST1"
      DB.Execute sTmp
     '放置临时库
      sTmp = "Insert into tmpSite1 Select * From tmpSite Where Site='" & sPubSite & "'"
      DB.Execute sTmp
      sTmp = "Insert into tmpCust1 Select * From tmpCust Where Site='" & sPubSite & "'"
      DB.Execute sTmp
      sTmp = "Insert into tmpST1 Select * From tmpST Where Site='" & sPubSite & "'"
      DB.Execute sTmp
     '更新
      sTmp = "Update tmpSite1 Set Site='" & sSites & "'"
      DB.Execute sTmp
      sTmp = "Update tmpCust1 Set Site='" & sSites & "'"
      DB.Execute sTmp
      sTmp = "Update tmpST1 Set Site='" & sSites & "'"
      DB.Execute sTmp
     '插入
      sTmp = "Insert into tmpSite Select * From tmpSite1"
      DB.Execute sTmp
      sTmp = "Insert into tmpCust Select * From tmpCust1"
      DB.Execute sTmp
      sTmp = "Insert into tmpST Select * From tmpST1"
      DB.Execute sTmp
     '更新座位为上台标记
      sTmp = "Update SiteType Set SiteStatus=2 Where Class='" & sSites & "'"
      DB.Execute sTmp

      DB.CommitTrans
      DB.Close
  
  Exit Sub
  
ERR_UI:
  MsgBox "复制出错: " & Err.Description, vbInformation
  Exit Sub
  
End Sub

⌨️ 快捷键说明

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