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

📄 main_zjyj.frm

📁 酒店客房管理系统(vb^+SQLServer2000+使用说明)
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   180
         TabIndex        =   14
         Top             =   1365
         Width           =   6780
      End
      Begin VB.Label Lab7 
         BackStyle       =   0  'Transparent
         Caption         =   "住宿时间                 提醒时间                退宿时间"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   180
         TabIndex        =   13
         Top             =   1935
         Width           =   6525
      End
      Begin VB.Label Lab4 
         BackStyle       =   0  'Transparent
         Caption         =   "姓    名                 已交押金                住宿天数"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   180
         TabIndex        =   10
         Top             =   270
         Width           =   8025
      End
      Begin VB.Label Lab5 
         BackStyle       =   0  'Transparent
         Caption         =   "房间号码                 房间类型                房间价格"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   180
         TabIndex        =   9
         Top             =   810
         Width           =   6585
      End
   End
   Begin VB.Label lab1 
      BackStyle       =   0  'Transparent
      Caption         =   "凭证号码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   525
      TabIndex        =   27
      Top             =   645
      Width           =   1155
   End
   Begin VB.Label Lab2 
      BackStyle       =   0  'Transparent
      Caption         =   "追加押金"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   4410
      TabIndex        =   26
      Top             =   645
      Width           =   1230
   End
   Begin VB.Label Lab8 
      BackStyle       =   0  'Transparent
      Caption         =   "操作员"
      ForeColor       =   &H000000C0&
      Height          =   240
      Left            =   15
      TabIndex        =   7
      Top             =   3885
      Width           =   735
   End
   Begin VB.Label Lab0 
      BackColor       =   &H8000000B&
      Caption         =   "   追加押金"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00008000&
      Height          =   390
      Left            =   2520
      TabIndex        =   5
      Top             =   45
      Width           =   2190
   End
End
Attribute VB_Name = "main_zjyj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
    '自动识别数据库路径
    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
   Adodc1.RecordSource = "select * from tb_djb"
   Adodc1.Refresh
    Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
    Adodc2.RecordSource = "select * from tb_djys"
    Adodc2.Refresh
    Combo1.Enabled = False
End Sub
Private Sub Form_Activate()
    Dim i As Integer
    czy.text = Main.StatusBar1.Panels(4).text     '赋值给czy.text
    '查询住宿登记信息
    Adodc1.RecordSource = "select 凭证号码 from tb_djb where 标志= '1'order by 凭证号码"
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
        For i = 1 To Adodc1.Recordset.RecordCount
            Combo1.AddItem Adodc1.Recordset.Fields("凭证号码").Value
            Adodc1.Recordset.MoveNext
        Next i
    End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
  Main.Enabled = True     '设置主窗体有效
End Sub
Private Sub Combo1_Click()
    Text1.text = "": Text2.text = "": Text3.text = "": Text4.text = "":
    Text5.text = "": Text6.text = "": Text7.text = ""
    '初始化日期
    DTP1.Value = Date: DTP2.Value = Date: DTP3.Value = Date
    '查询住宿登记信息
    Adodc1.RecordSource = "select * from tb_djb where 凭证号码='" & Combo1.text & "'"
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then     '当记录大于零时赋值给text2等
        If Adodc1.Recordset.Fields("姓名") <> "" Then Text2.text = Adodc1.Recordset.Fields("姓名")
        If Adodc1.Recordset.Fields("预收金额") <> "" Then Text3.text = Adodc1.Recordset.Fields("预收金额")
        If Adodc1.Recordset.Fields("住宿天数") <> "" Then Text4.text = Adodc1.Recordset.Fields("住宿天数")
        If Adodc1.Recordset.Fields("房间号") <> "" Then Text5.text = Adodc1.Recordset.Fields("房间号")
        If Adodc1.Recordset.Fields("客房类型") <> "" Then Text6.text = Adodc1.Recordset.Fields("客房类型")
        If Adodc1.Recordset.Fields("客房价格") <> "" Then Text7.text = Adodc1.Recordset.Fields("客房价格")
        If Adodc1.Recordset.Fields("住宿日期") <> "" Then DTP1.Value = Adodc1.Recordset.Fields("住宿日期")
        If Adodc1.Recordset.Fields("住宿时间") <> "" Then tim1.Value = Adodc1.Recordset.Fields("住宿时间")
        If Adodc1.Recordset.Fields("提醒日期") <> "" Then DTP2.Value = Adodc1.Recordset.Fields("提醒日期")
        If Adodc1.Recordset.Fields("提醒时间") <> "" Then tim2.Value = Adodc1.Recordset.Fields("提醒时间")
        If Adodc1.Recordset.Fields("退宿日期") <> "" Then DTP3.Value = Adodc1.Recordset.Fields("退宿日期")
        If Adodc1.Recordset.Fields("退宿时间") <> "" Then tim3.Value = Adodc1.Recordset.Fields("退宿时间")
    End If

End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
      If KeyCode = vbKeyReturn Then Text1.SetFocus
End Sub
Private Sub Text1_Change()   '计算提醒日期及时间
   On Error Resume Next
    DTP2.Value = DTP1.Value + Int(Val(Text3.text) + Val(Text1.text)) / Val(Text7.text)
    'Val函数返回包含于字符串内的数字,字符串中是一个适当类型的数值。
   If (Val(Text3.text) + Val(Text1.text)) Mod Val(Text7.text) > 0.5 * Val(Text7.text) Then
        tim2.Value = #6:00:00 PM#
    Else
        tim2.Value = #12:00:00 AM#
    End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Command1.SetFocus  '按回车键Command1获得焦点
End Sub
Private Sub Command1_Click()
    '保存追加押金信息
    If Text1.text <> "" And Combo1.text <> "" Then
        '查询住宿登记信息
        Adodc1.RecordSource = "select * from tb_djb where 凭证号码='" & Combo1.text & "'"
        Adodc1.Refresh '刷新记录
        If Adodc1.Recordset.EOF = False And Adodc1.Recordset.BOF = False Then '如果不在记录的开始和末尾
            If Adodc1.Recordset.RecordCount > 0 Then '如果记录数大于0
                '打开数据库
                adocon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
                '查询数据表中凭证号码等于Combo1.text的内容
                adoRs.Open "select * from tb_djb where 凭证号码='" + Combo1.text + "'", adocon, adOpenKeyset, adLockOptimistic
                adoRs.Fields("预收金额") = Val(Text3.text) + Val(Text1.text)  '把已收押金和追加押金的和赋给预收金额字段
                adoRs.Fields("提醒日期") = DTP2.Value '把DTP2的值赋给提醒日期字段
                adoRs.Fields("提醒时间") = tim2.Value '把tim2的值赋给提醒时间字段
                adoRs.Update     '更新数据
                adocon.Close '关闭数据库
                '查询住宿登记预收信息
                Adodc2.RecordSource = "select * from tb_djys where 凭证号码='" & Combo1.text & "'"
                Adodc2.Refresh '刷新数据
                '编辑住宿登记预收信息
                If Adodc2.Recordset.RecordCount > 0 Then '如果记录数大于0
                    '打开数据库
                    adocon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
                    '查询数据表
                    adoRs.Open "select * from tb_djys", adocon, adOpenKeyset, adLockOptimistic
                    adoRs.Fields("预收金额") = Val(Text3.text) + Val(Text1.text) '把已收押金和追加押金的和赋给预收金额字段
                    adoRs.Fields("提醒日期") = DTP2.Value '把DTP2的值赋给提醒日期字段
                    adoRs.Fields("提醒时间") = tim2.Value '把tim2的值赋给提醒时间字段
                    adoRs.Update     '更新数据
                    adocon.Close '关闭数据库
                End If
                '设置控件有效或无效
                Command1.Enabled = False: Command2.Enabled = False: Command4.Enabled = True
                Command5.Enabled = True: Command3.Enabled = True
                Command5.SetFocus     'Command5获得焦点
            Else
                MsgBox "请检查凭证号码是否有效,再保存!", , "系统提示" '凭证号码不存在,提示消息
            End If
        End If
    Else
        MsgBox "请填写完整的数据,再保存!", , "系统提示" '如果凭证号码为空或追加押金为空,提示消息
    End If
End Sub
Private Sub Command2_Click()                  '取消操作
    Combo1.Enabled = False: Command1.Enabled = False: Command2.Enabled = False
    Command4.Enabled = False: Command5.Enabled = True: Command3.Enabled = True
    '清空数据
    Text1.text = "": Text2.text = "": Text3.text = "": Text4.text = "":
    Text5.text = "": Text6.text = "": Text7.text = ""
    '初始化日期
    DTP1.Value = Date: DTP2.Value = Date: DTP3.Value = Date
End Sub
Private Sub Command3_Click()
 Unload Me
 Main.Enabled = True     '设置主窗体有效
End Sub
Private Sub Command4_Click()
    '打印追加押金单据
    On Error GoTo 1
    Printer.Height = 8000: Printer.Width = 8000
    Printer.CurrentX = 1100: Printer.CurrentY = 300
    Printer.FontSize = 12
    Printer.Print "旺隆酒店客房追加押金凭证 "
    Dim A, B, C, d As Integer
    A = 100: B = 500: C = 4800: d = 400
    Printer.FontSize = 10
    Printer.CurrentX = 100 + A
    Printer.CurrentY = B + 200
    Printer.Print Date & " " & Time & "  NO." & Combo1.text
    B = B + d
    Printer.Line (A, B + 100)-(C, B + 100)
    Printer.CurrentX = 100 + A
    Printer.CurrentY = B + 200
    Printer.Print "姓名:" & Text1.text
    Printer.CurrentX = 100 + A
    Printer.CurrentY = B + 200
    Printer.Print "房间号:" & Text5.text
    B = B + d
    Printer.CurrentX = 100 + A
    Printer.CurrentY = B + 200
    Printer.Print "追加押金:" & Format(Text1.text, "0.00")
    B = B + d
    Printer.CurrentX = 100 + A
    Printer.CurrentY = B + 200
    Printer.Print "补交日期:    " & DTP2.Value
    B = B + d
    Printer.Line (A, B + 100)-(C, B + 100)
    Printer.CurrentX = 100 + A
    Printer.CurrentY = B + 200
    Printer.Print "操作员: " & czy.text & "             欢迎光临"
    Printer.EndDoc
    Exit Sub
1    If Err.Number = 482 Then
        MsgBox "请连接打印机", , "系统提示"
        Err.Clear
     End If
End Sub
Private Sub Command5_Click()     '登记
    Combo1.Enabled = True: Command1.Enabled = True
    Command2.Enabled = True: Command3.Enabled = False: Command4.Enabled = True
    Command5.Enabled = False
    Text1.text = "": Text2.text = "": Text3.text = "": Text4.text = ""
    Text5.text = "": Text6.text = "": Text7.text = ""
    Combo1.SetFocus     'combo1获得焦点
End Sub

⌨️ 快捷键说明

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