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

📄 frmsetupseat.frm

📁 机票销售管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmSetupSeat 
   Caption         =   "客机座位设置"
   ClientHeight    =   3360
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6360
   LinkTopic       =   "Form1"
   ScaleHeight     =   3360
   ScaleWidth      =   6360
   StartUpPosition =   1  'CenterOwner
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   4560
      TabIndex        =   18
      Text            =   "Text1"
      Top             =   2640
      Width           =   375
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取    消"
      Height          =   495
      Left            =   3000
      TabIndex        =   16
      Top             =   2640
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确    定"
      Height          =   495
      Left            =   1560
      TabIndex        =   15
      Top             =   2640
      Width           =   975
   End
   Begin VB.Frame Frame2 
      Caption         =   "座位设置"
      Height          =   735
      Left            =   120
      TabIndex        =   9
      Top             =   1680
      Width           =   6135
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   4
         Left            =   1560
         MaxLength       =   8
         TabIndex        =   12
         Top             =   240
         Width           =   1212
      End
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   5
         Left            =   4560
         MaxLength       =   8
         TabIndex        =   10
         Top             =   240
         Width           =   1212
      End
      Begin VB.Label Label2 
         Caption         =   "座    舱    排    数:"
         Height          =   255
         Index           =   4
         Left            =   3120
         TabIndex        =   17
         Top             =   240
         Width           =   1455
      End
      Begin VB.Label Label2 
         Caption         =   "单 排 座 位 数 量:"
         Height          =   255
         Index           =   3
         Left            =   120
         TabIndex        =   11
         Top             =   240
         Width           =   1575
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "客机信息:"
      Height          =   1455
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6132
      Begin VB.ComboBox Combo1 
         Height          =   315
         Left            =   1560
         TabIndex        =   14
         Text            =   "Combo1"
         Top             =   360
         Width           =   1215
      End
      Begin VB.TextBox txtItem 
         Enabled         =   0   'False
         Height          =   285
         Index           =   0
         Left            =   4560
         MaxLength       =   8
         TabIndex        =   13
         Top             =   360
         Width           =   1212
      End
      Begin VB.TextBox txtItem 
         Enabled         =   0   'False
         Height          =   270
         Index           =   1
         Left            =   1560
         MaxLength       =   20
         TabIndex        =   3
         Top             =   720
         Width           =   1212
      End
      Begin VB.TextBox txtItem 
         Enabled         =   0   'False
         Height          =   270
         Index           =   2
         Left            =   4560
         MaxLength       =   20
         TabIndex        =   2
         Top             =   720
         Width           =   1212
      End
      Begin VB.TextBox txtItem 
         Enabled         =   0   'False
         Height          =   270
         Index           =   3
         Left            =   1560
         MaxLength       =   20
         TabIndex        =   1
         Top             =   1080
         Width           =   1212
      End
      Begin VB.Label Label2 
         Caption         =   "客    机    型    号:"
         Height          =   255
         Index           =   1
         Left            =   3120
         TabIndex        =   8
         Top             =   360
         Width           =   1455
      End
      Begin VB.Label Label2 
         Caption         =   "客    机    编    号:"
         Height          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   7
         Top             =   360
         Width           =   1455
      End
      Begin VB.Label Label2 
         Caption         =   "经济舱座位数量:"
         Height          =   255
         Index           =   7
         Left            =   120
         TabIndex        =   6
         Top             =   720
         Width           =   1455
      End
      Begin VB.Label Label2 
         Caption         =   "公务舱座位数量:"
         Height          =   255
         Index           =   8
         Left            =   3120
         TabIndex        =   5
         Top             =   720
         Width           =   1455
      End
      Begin VB.Label Label2 
         Caption         =   "头等舱座位数量:"
         Height          =   255
         Index           =   2
         Left            =   120
         TabIndex        =   4
         Top             =   1080
         Width           =   1455
      End
   End
End
Attribute VB_Name = "frmSetupSeat"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim total As Integer
Private Sub Combo1_Click()
    Dim txtSQL As String
    Dim mrc As ADODB.Recordset
    Dim MsgText As String
    Dim i As Integer
    
    txtSQL = "select planetype,iscommon,iscommercial,isfirst from planeinfo where planeno= '" & Trim(Combo1 & "") & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    
    If Not mrc.EOF Then
        For i = 0 To 3
            txtItem(i) = mrc.Fields(i)
        Next i
    
        mrc.Close
        
        total = CInt(txtItem(1)) + CInt(txtItem(2)) + CInt(txtItem(3))
        
        txtItem(4) = total
    End If
        
End Sub

Private Sub Command1_Click()
    Dim txtSQL As String
    Dim mrc As ADODB.Recordset
    Dim MsgText As String
    
    If Trim(Combo1) <> "" And Trim(txtItem(4)) <> "" Then
        txtSQL = "insert seatinfo values ('" & Trim(Combo1) & "','" & Trim(txtItem(4)) & "','" & Trim(txtItem(5)) & "','" & Trim(Text1) & "')"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        
        MsgBox "设置座位完成!", vbOKOnly, "设置座位"
        Unload Me
    Else
        MsgBox "请设置座位信息", vbOKOnly, "警告"
        txtItem(4).SetFocus
    End If
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Dim txtSQL As String
    Dim mrc As ADODB.Recordset
    Dim MsgText As String
    
    txtSQL = "select distinct planeno from  planeinfo"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    
    If Not mrc.EOF Then
        Combo1.Clear
        
        Do While Not mrc.EOF
            Combo1.AddItem mrc.Fields(0)
            mrc.MoveNext
        Loop
        mrc.Close
    End If
        
    
    
    
End Sub

Private Sub txtItem_Change(Index As Integer)
    Dim i As Integer
    Dim j As Integer
    Dim k As Integer
    
    If Index = 4 Then
        If Trim(Combo1) <> "" And Trim(txtItem(4)) <> "" Then
            i = txtItem(4)
            j = Int(total / i)
            k = total Mod j
            If (k = 0) Then
                txtItem(5) = j
            Else
                txtItem(5) = j + 1
            End If
            
            Text1 = k
        End If
            
    End If
End Sub

Private Sub txtItem_KeyPress(Index As Integer, KeyAscii As Integer)
    
    If Index >= 4 And Index <= 5 Then
        '非数字不能输入
        If KeyAscii > 57 Or KeyAscii < 48 Then
            txtItem(Index).Locked = True
        Else
            txtItem(Index).Locked = False
        End If
        '允许Backspace
        If KeyAscii = 8 Then
            txtItem(Index).Locked = False
        End If
        'Delete键
        If KeyAscii = 46 Then
            txtItem(Index).Locked = False
        End If
    End If
    
    
End Sub

⌨️ 快捷键说明

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