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

📄 main_tf.frm

📁 酒店客房管理系统(vb^+SQLServer2000+使用说明)
💻 FRM
📖 第 1 页 / 共 4 页
字号:
        Texgzdw.Visible = False     '设置Texgzdw不可见
        Texgzdw.text = ""
    End If
End Sub
Private Sub Combo3_Click()
 Texfjf.SetFocus     'Texfjf获得焦点
 Texfjf.text = "0"     '赋值给Texfjf.text
End Sub
Private Sub combo4_Click()
    If Combo4.text <> "" Then
        '查询住宿登记信息
        Adodc1.RecordSource = "select * from tb_djb where 凭证号码='" + Combo4.text + "'"
        Adodc1.Refresh
        bh.text = "T" & Combo4.text
        If Adodc1.Recordset.RecordCount > 0 Then   '如果记录数大于零
            If Adodc1.Recordset.Fields("姓名") <> "" Then Texxm.text = Adodc1.Recordset.Fields("姓名")
            If Adodc1.Recordset.Fields("证件名称") <> "" Then Combo1.text = Adodc1.Recordset.Fields("证件名称")
            If Adodc1.Recordset.Fields("证件号码") <> "" Then Texsfz.text = Adodc1.Recordset.Fields("证件号码")
            If Adodc1.Recordset.Fields("详细地址") <> "" Then Texdz.text = Adodc1.Recordset.Fields("详细地址")
            If Adodc1.Recordset.Fields("房间号") <> "" Then DBCombo3.text = Adodc1.Recordset.Fields("房间号")
            If Adodc1.Recordset.Fields("客房类型") <> "" Then DBCombo1.text = Adodc1.Recordset.Fields("客房类型")
            If Adodc1.Recordset.Fields("客房价格") <> "" Then DBCombo2.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 Texts.text = Adodc1.Recordset.Fields("住宿天数")
            If Adodc1.Recordset.Fields("预收金额") <> "" Then Texyj.text = Adodc1.Recordset.Fields("预收金额") Else Texyj.text = "0"
            If Adodc1.Recordset.Fields("结款方式") <> "" Then Combo2.text = Adodc1.Recordset.Fields("结款方式")
            If Adodc1.Recordset.Fields("折扣") <> "" Then Texzk.text = Adodc1.Recordset.Fields("折扣")
        End If
        '计算住宿天数
        If DTP2.Value > DTP1.Value Then
            'DTPicker控件返回包含于字符串内的数字,字符串中是一个适当类型的数值。
            If tim2.Value > #11:59:00 AM# Then
                If tim2.Value > #6:00:00 PM# Then
                    Texts.text = DTP2.Value - CDate(DTP1.Value) + 1
                    'CDate函数都可以强制将一个表达式转换成某种特定数据类型。
                Else
                    Texts.text = DTP2.Value - CDate(DTP1.Value) + 0.5
                End If
            Else
                Texts.text = DTP2.Value - CDate(DTP1.Value)
            End If
        Else
            If tim1.Value < #6:00:00 PM# Then
                If tim2.Value > #6:00:00 PM# Then Texts.text = 1 Else Texts.text = "0.5"
            Else
                Texts.text = "0.5"
            End If
        End If
        Texxf.text = Val(Texts.text) * Val(DBCombo2.text)     '计算宿费
        Texzhje.text = Val(Texxf.text) * Val(Texzk.text) / 100     '计算折后金额
        Texthje.text = Val(Texyj.text) - Val(Texzhje.text) - Val(Texzf.text) - Val(Texdhf.text)      '计算退还金额
    End If
End Sub
Private Sub combo4_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Texzk.SetFocus     '按回车键Texzk获得焦点
End Sub



Private Sub TIM2_Change()
    Call JS     '调用函数
End Sub
Private Sub DTP2_Change()
    Call JS     '调用函数
End Sub
Private Sub texxm_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Texsfz.SetFocus     '按回车键Texsfz获得焦点
End Sub
Private Sub texzhje_Change()
    Call ssje     '调用函数
End Sub
Private Sub texzf_Change()
    Call ssje     '调用函数
End Sub
Private Sub texdhf_Change()
    Call ssje     '调用函数
End Sub
Private Sub texssje_Change()
    Texxf.text = Val(Texts.text) * Val(DBCombo2.text)     '计算宿费
    Call ssje     '调用函数

End Sub
Private Sub texssje_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Texbz.SetFocus
    
End Sub
Private Sub texpcf_Change()
    Call ssje     '调用函数
End Sub
Private Sub texhyf_Change()
    Call ssje     '调用函数
End Sub
Private Sub texfjf_Change()
    Texfjf.text = Val(Texfjf.text)
    'Val 函数返回包含于字符串内的数字,字符串中是一个适当类型的数值。
    If Combo3.text = "电话费" Then Texdhf.text = Val(Texfjf.text)
    If Combo3.text = "杂费" Then Texzf.text = Val(Texfjf.text)
    If Combo3.text = "会议费" Then Texhyf.text = Val(Texfjf.text)
    If Combo3.text = "停车费" Then Textcf.text = Val(Texfjf.text)
    If Combo3.text = "赔偿费" Then Texpcf.text = Val(Texfjf.text)
End Sub
Private Sub texfjf_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Texssje.SetFocus
End Sub
Private Sub textcf_Change()
 Call ssje     '调用函数
End Sub
Private Sub texts_Change()
    Texxf.text = Val(Texts.text) * Val(DBCombo2.text)     '计算宿费
    Texzhje.text = Val(Texxf.text) * Val(Texzk.text) / 100   '计算折后金额
    '计算退还金额
    Texthje.text = Val(Texyj.text) - Val(Texzhje.text) - Val(Texzf.text) - Val(Texdhf.text)
End Sub
Private Sub texts_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Texzk.SetFocus     '回车Texzk获得焦点
End Sub
Private Sub texts_LostFocus()
    Texts.text = Format(Val(Texts.text), "0.0")     '格式化天数
End Sub
Private Sub texzk_Change()
    If Combo2.text = "折扣" Then
        Texzk.text = Val(Texzk.text)
        Texzhje.text = Val(Texxf.text) * Val(Texzk.text) / 100     '计算折后金额
        '计算退还金额
        Texthje.text = Val(Texyj.text) - Val(Texzhje.text) - Val(Texzf.text) - Val(Texdhf.text)
    End If
    If Combo2.text = "挂账" Then
    Texzhje.text = Val(Texxf.text) * Val(Texzk.text) / 100
        Texssje.text = Val(Texzhje.text) + Val(Texzf.text) + Val(Texdhf.text) + Val(Texpcf.text) + Val(Texhyf.text) + Val(Textcf.text) - Val(Texyj.text)
    End If
End Sub
Private Sub texbz_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Comok.SetFocus  '按回车键Comok获得焦点
End Sub
Private Sub zj_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Texts.SetFocus  '按回车键Texts获得焦点
End Sub
Private Sub texsfz_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Texdz.SetFocus  '按回车键Texdz获得焦点
End Sub
Private Sub texzk_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Texfjf.SetFocus  '按回车键Textfjf获得焦点
End Sub
Private Sub comdj_Click()      '登记
    Texxm.text = "": Texsfz.text = "": Texfjf.text = "": Texdz.text = "": Texts.text = ""
    Texzk.text = "": Texyj.text = "": Combo4.text = "": Texzhje.text = "": Texthje.text = ""
    Texxf.text = "": DBCombo1.text = "": DBCombo2.text = "": DBCombo3.text = "": Texbz.text = ""
    Textcf.text = "0": Texzf.text = "0": Texdhf.text = "0": Texssje.text = "0": Texpcf.text = "0"
    Texhyf.text = "0"
    Comok.Enabled = True: Comcancel.Enabled = True: Comdj.Enabled = False
    Comprint.Enabled = False: Combo4.Enabled = True: Texzk.Enabled = True
    Combo4.SetFocus
    Lab10.Visible = False: Texgzdw.Visible = False
     Lab11.Caption = "实收金额": Label3.Visible = True: Texthje.Visible = True
End Sub
Private Sub comok_Click()        '保存退宿信息
    If Combo2.text = "挂账" And Texgzdw.text = "" Then
        MsgBox "挂账单位为空,请填写挂账单位!", , "系统提示"
        Exit Sub
    End If
    If Texxm.text <> "" And Texts.text <> "" Then
        adocon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
        adoRs.Open "select * from tb_tfd", adocon, adOpenKeyset, adLockOptimistic
        adoRs.AddNew  '添加退宿记录
        If bh.text <> "" Then adoRs.Fields("凭证号码") = bh.text
        If Texxm.text <> "" Then adoRs.Fields("姓名") = Texxm.text
        If Combo1.text <> "" Then adoRs.Fields("证件名称") = Combo1.text
        If Texsfz.text <> "" Then adoRs.Fields("证件号码") = Texsfz.text
        If Texdz.text <> "" Then adoRs.Fields("详细地址") = Texdz.text
        If Textcf.text <> "" Then adoRs.Fields("工作单位") = Textcf.text
        If DBCombo3.text <> "" Then adoRs.Fields("房间号") = DBCombo3.text
        If DBCombo1.text <> "" Then adoRs.Fields("客房类型") = DBCombo1.text
        If DBCombo2.text <> "" Then adoRs.Fields("客房价格") = DBCombo2.text
        If DTP1.Value <> "" Then adoRs.Fields("住宿日期") = DTP1.Value
        If tim1.Value <> "" Then adoRs.Fields("住宿时间") = tim1.Value
        If DTP2.Value <> "" Then adoRs.Fields("退房日期") = DTP2.Value
        If tim2.Value <> "" Then adoRs.Fields("退房时间") = tim2.Value
        If Texts.text <> "" Then adoRs.Fields("住宿天数") = Val(Texts.text)
        If Texzk.text <> "" Then adoRs.Fields("折扣") = Val(Texzk.text)
        If Combo2.text <> "" Then adoRs.Fields("折扣或招待") = Combo2.text
        If Texxf.text <> "" Then adoRs.Fields("宿费") = Format(Texxf.text, "0.00")
        If Texzhje.text <> "" Then adoRs.Fields("应收宿费") = Texzhje.text
        If Texyj.text <> "" Then adoRs.Fields("预收宿费") = Texyj.text
        If Texthje.text <> "" Then adoRs.Fields("退还宿费") = Texthje.text
        If Texzf.text <> "" Then adoRs.Fields("杂费") = Val(Texzf.text) Else adoRs.Fields("杂费") = "0"
        If Texdhf.text <> "" Then adoRs.Fields("电话费") = Val(Texdhf.text) Else adoRs.Fields("电话费") = "0"
        If Texhyf.text <> "" Then adoRs.Fields("会议费") = Val(Texhyf.text) Else adoRs.Fields("会议费") = "0"
        If Texpcf.text <> "" Then adoRs.Fields("赔偿费") = Val(Texpcf.text) Else adoRs.Fields("赔偿费") = "0"
        If Textcf.text <> "" Then adoRs.Fields("存车费") = Val(Textcf.text) Else adoRs.Fields("存车费") = "0"
        If Texssje.text <> "" Then adoRs.Fields("金额总计") = Val(Texssje.text)
        If Texbz.text <> "" Then adoRs.Fields("备注") = Texbz.text
        adoRs.Fields("BZ") = Val(Left(Date, 4) & Right(Left(Date, 7), 2) & Right(Date, 2) & Left(Time, 2) & Left(Right(Time, 5), 2))
        'Val函数返回包含于字符串内的数字,字符串中是一个适当类型的数值。
        adoRs.Update     '更新记录
        adocon.Close
        Adodc1.RecordSource = "select * from tb_djb where 凭证号码 ='" + Combo4.text + "'"
        If Adodc1.Recordset.RecordCount > 0 Then
            Adodc1.Recordset.Fields("标志") = "0"
            Adodc1.Recordset.Update '更新记录
        End If

        Adodc4.RecordSource = "select * from tb_djys where 凭证号码='" + Combo4.text + "'"
        Adodc4.Refresh
        If Adodc4.Recordset.RecordCount > 0 Then
            Adodc4.Recordset.Fields("标志") = "0"
            Adodc4.Recordset.Update
        End If

        Adodc2.RecordSource = "select * from tb_kf where 房间号='" + DBCombo3.text + "'"
        Adodc2.Refresh
        Adodc2.Recordset.Fields("房态") = "空房"
        Adodc2.Recordset.Update
        If Combo2.text = "挂账" Then
            Adodc3.RecordSource = "select * from tb_gzmx where 挂账单位='" + Texgzdw.text + "'order by 日期,时间"
            Adodc3.Refresh
            If Adodc3.Recordset.RecordCount > 0 Then
                If Adodc3.Recordset.Fields("金额累计") <> "" Then gzje.text = Adodc3.Recordset.Fields("金额累计")
            Else
                '添加挂账记录
                Adodc3.Recordset.AddNew
                Adodc3.Recordset.Fields("日期") = Date
                Adodc3.Recordset.Fields("时间") = Time
                Adodc3.Recordset.Fields("票号") = "T" & Combo4.text
                Adodc3.Recordset.Fields("日期") = Date
                Adodc3.Recordset.Fields("姓名") = Texxm.text
                Adodc3.Recordset.Fields("证件号码") = Texsfz.text
                Adodc3.Recordset.Fields("房间标准") = DBCombo1.text
                Adodc3.Recordset.Fields("房间价格") = DBCombo2.text
                Adodc3.Recordset.Fields("时间") = Time
                Adodc3.Recordset.Fields("挂账单位") = Texgzdw.text
                Adodc3.Recordset.Fields("住宿金额") = Texssje.text
                Adodc3.Recordset.Fields("摘要") = "住宿日期:" & DTP1.Value & " 住宿天数: " & Texts.text
                Adodc3.Recordset.Fields("欠款金额") = Val(Texssje.text)
                Adodc3.Recordset.Fields("金额累计") = Val(Texssje.text) + Val(gzje.text)
                Adodc3.Recordset.Update     '更新记录
            End If
        End If
    Else
        MsgBox "请录入正确的数据", , "系统提示"
    End If
    Adodc2.RecordSource = "select * from tb_kf where 房态='空房'"
    Adodc2.Refresh
    Adodc1.Refresh
    '设置控件有效或无效
    Comprint.Enabled = True: Comok.Enabled = False: Comcancel.Enabled = False
    Comdj.Enabled = True: Comprint.SetFocus: Combo4.Enabled = False
     If Combo4.ListCount > 0 Then
        Combo4.RemoveItem (Combo4.ListIndex)
    End If
End Sub
Private Sub comcancel_Click()     '取消操作
 Texxm.text = "": Texsfz.text = "": Texfjf.text = "": Texdz.text = "": Texts.text = ""
 Texzk.text = "": Texyj.text = "": Combo4.text = "": Texzhje.text = "": Texthje.text = ""
 Texxf.text = "": DBCombo1.text = "": DBCombo2.text = "": DBCombo3.text = "": Texbz.text = ""
 Textcf.text = "0": Texzf.text = "0": Texdhf.text = "0": Texssje.text = "0": Texpcf.text = "0"
 Texhyf.text = "0"
 Comdj.Enabled = True: Comcancel.Enabled = False: Comok.Enabled = False: Comprint.Enabled = False
  Lab11.Caption = "实收金额": Label3.Visible = True: Texthje.Visible = True
  Lab10.Visible = False: Texgzdw.Visible = False: Combo4.Enabled = False
End Sub
Private Sub comprint_Click()        '打印退宿信息
    On Error GoTo 1
    Printer.Height = 7000: Printer.Width = 12000
    Printer.CurrentX = 4000: Printer.CurrentY = 800
    Printer.FontSize = 16
    Printer.Print "  旺隆酒店客房退宿结账单 "
    Dim A, B, C, d As Integer
    A = 360: B = 1100: C = 3800: d = 350
    Printer.FontSize = 10
    Printer.CurrentX = 100 + A
    Printer.CurrentY = B + 200
    Printer.Print Date & " " & Time & "  NO." & bh.text
    B = B + d
    Printer.Line (60 + A, B + 100)-(11000 + A, B + 100)
    Printer.CurrentX = 100 + A
    Printer.CurrentY = B + 200
    Printer.Print "姓名:" & Texxm.text
    B = B + d
    Printer.CurrentX = 100 + A
    Printer.CurrentY = B + 200
    Printer.Print "房间号:" & DBCombo3.text
    B = B + d
    Printer.CurrentX = 100 + A
    Printer.CurrentY = B + 200
    Printer.Print "房价:" & Format(DBCombo2.text, "0.00") & "元" & "    " & "入住天数: " & Texts.text & "天     " & "宿费 " & Format(Texxf.text, "0.00") & "元    " & Combo2.text & ":" & Texzk.text & "%"
    If Texdhf.text <> "0" Then
        B = B + d
        Printer.CurrentX = 100 + A
        Printer.CurrentY = B + 200
        Printer.Print "电话费:" & Format(Texdhf.text, "0.00") & "元"
    End If
    If Texzf.text <> "0" Then
        B = B + d
        Printer.CurrentX = 100 + A
        Printer.CurrentY = B + 200
        Printer.Print "杂费:" & Format(Texzf.text, "0.00") & "元"
    End If
    If Texhyf.text <> "0" Then
        B = B + d
        Printer.CurrentX = 100 + A
        Printer.CurrentY = B + 200
        Printer.Print "会议费:" & Format(Texhyf.text, "0.00") & "元"
    End If
    If Textcf.text <> "0" Then
        B = B + d
        Printer.CurrentX = 100 + A
        Printer.CurrentY = B + 200
        Printer.Print "停车费:" & Format(Textcf.text, "0.00") & "元"
    End If
    If Texpcf.text <> "0" Then
        B = B + d
        Printer.CurrentX = 100 + A
        Printer.CurrentY = B + 200
        Printer.Print "赔偿费:" & Format(Texpcf.text, "0.00") & "元"
    End If
    B = B + d
    Printer.CurrentX = 100 + A
    Printer.CurrentY = B + 200
    Printer.Print "实收金额:" & Format(Texssje.text, "0.00") & "元 " & "押金: " & Format(Texyj.text, "0.00") & "元 " & "退还金额: " & Format(Texthje.text, "0.00") & "元"
    B = B + d
    Printer.CurrentX = 100 + A
    Printer.CurrentY = B + 200
    Printer.Print "备注:" & Texbz.text
    B = B + d
    Printer.Line (60 + A, B + 100)-(11000 + A, B + 100)
    Printer.CurrentX = 400
    Printer.CurrentY = B + 200
    Printer.Print "日期: "; Date & "  " & Time
    Printer.CurrentX = 3000 + A
    Printer.CurrentY = B + 200
    Printer.Print "操作员: " & czy.text
    Printer.CurrentX = 6000 + A
    Printer.CurrentY = B + 200
    Printer.Print "顾客签名:                     签章: "
    Printer.EndDoc
    Exit Sub
1   If Err.Number = 482 Then
        MsgBox "请连接打印机", , "系统提示"
        Err.Clear
    End If
End Sub
Private Sub comend_Click()
 Unload Me
 Main.Enabled = True
End Sub

⌨️ 快捷键说明

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