VB宾馆管理系统 第7页

VB宾馆管理系统 第7页
主要窗体的源代码:
1:订房信息窗体的源代码:
Option Explicit
'是否改动过记录,ture为改过
Dim mblChange As Boolean
Dim mrc As ADODB.Recordset
Public txtSQL As String
Private Sub cboItem_Change(Index As Integer)
    '有变化设置gblchange
       mblChange = True
    End Sub
Private Sub cboItem_Click(Index As Integer)
    Dim mrcc As ADODB.Recordset
    Dim intCount As Integer
    Dim MsgText As String
   
    If gintBmode = 1 Then
        If Index = 0 Then
            txtSQL = "select * from rooms where roomNO = '" & Trim(cboItem(0)) & "' and putup <> '是'"
            Set mrcc = ExecuteSQL(txtSQL, MsgText)
            For intCount = 1 To 3
                cboItem(intCount).Clear
                cboItem(intCount).AddItem mrcc.Fields(intCount)
                cboItem(intCount).ListIndex = 0
            Next intCount
            txtItem(5) = mrcc.Fields(5)
            mrcc.Close
        End If
    End If
End Sub

Private Sub cboItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
    EnterToTab KeyCode
   
End Sub

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 mrcc As ADODB.Recordset
    Dim MsgText As String
   
    For intCount = 0 To 3
        If Trim(txtItem(intCount) & " ") = "" Then
            Select Case intCount
                Case 0
                    sMeg = "顾客姓名"
                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 3
        If Trim(cboItem(intCount) & " ") = "" Then
            Select Case intCount
                Case 0
                    sMeg = "客房编号"
                Case 1
                    sMeg = "客房种类"
                Case 2
                    sMeg = "客房位置"
                Case 3
                    sMeg = "客房单价"
            End Select
            sMeg = sMeg & "不能为空!"
            MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
            cboItem(intCount).SetFocus
       
            Exit Sub
        End If
    Next intCount
   
  
    If IsDate(txtItem(2)) Then
        txtItem(2) = Format(txtItem(2), "yyyy-mm-dd")
    Else
        MsgBox "入库时间应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
        txtItem(2).SetFocus
        Exit Sub
    End If
   
    For intCount = 1 To 3 Step 2
        If Not IsNumeric(txtItem(intCount)) Then
            MsgBox "请输入数字", vbOKOnly + vbExclamation, "警告"
            txtItem(intCount).SetFocus
            Exit Sub
        End If
    Next intCount
   
    If gintBmode = 2 Then
        txtSQL = "delete from bookin where bookno = '" & Trim(txtNo) & "'"
        Set mrcc = ExecuteSQL(txtSQL, MsgText)
    End If
   
    txtSQL = "select * from bookin"
    Set mrcc = ExecuteSQL(txtSQL, MsgText)
    mrcc.AddNew
    mrcc.Fields(0) = txtNo
    For intCount = 0 To 1
        mrcc.Fields(intCount + 1) = txtItem(intCount)
    Next intCount
   
    mrcc.Fields(3) = cboItem(0)
   
    For intCount = 2 To 4
        mrcc.Fields(intCount + 2) = txtItem(intCount)
    Next intCount
    mrcc.Fields(8) = 0
   
   
    mrcc.Update
    mrcc.Close
   
    txtSQL = "select * from rooms where roomNO = '" & Trim(cboItem(0)) & "'"
    Set mrcc = ExecuteSQL(txtSQL, MsgText)
    If Not mrcc.EOF Then
        mrcc!putup = "y"
    End If
    mrcc.Update
    mrcc.Close
       
   
    If gintBmode = 1 Then
        MsgBox "添加订房信息成功!", vbOKOnly + vbExclamation, "添加订房消息"
        Unload Me
        If flagBedit Then
            Unload frmBookin
        End If
        frmBookin.txtSQL = "select bookno,customname,customID,roomno,indate,discount,inmemo from bookin where ammount = '0'"
        frmBookin.Show
    Else
 751com.cn
nd If
        frmBookin.txtSQL = "select bookno,customname,customID,roomno,indate,discount,inmemo from bookin where ammount = '0'"
        frmBookin.Show
    End If

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页

  • 上一篇文章:
  • 下一篇文章:
  • Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有