Public Class frmBooking

    Private Sub frmBooking_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Disable_previous_date(dtpCheckin, dtpCheckout)
        Load_Room_Type()
        Availability_Search()
        lblMessage.Text = "Available Room(s) from " & dtpCheckin.Text & " to " & dtpCheckout.Text
    End Sub

    Private Sub btnAvailSeach_Click(sender As Object, e As EventArgs) Handles btnAvailSeach.Click
        Availability_Search()
        lblMessage.Text = "Available Room(s) from " & dtpCheckin.Text & " to " & dtpCheckout.Text
    End Sub


    Private Sub lstRoomType_Click(sender As Object, e As EventArgs) Handles lstRoomType.Click
        Availability_Search_Type()
    End Sub

    Private Sub btnReserve_Click(sender As Object, e As EventArgs) Handles btnReserve.Click
        Try

            With Form1.FrmBookingDetails1
                Dim tot As Double
                sql = bookingDetails(dtpCheckin, dtpCheckout) & " AND ROOMID =" & dtgList.CurrentRow.Cells(0).Value
                reloadDtg(sql, .dtgList)
                For Each r As DataGridViewRow In .dtgList.Rows
                    tot += r.Cells(9).Value * r.Cells(3).Value
                Next
                .txtSubtotal.Text = tot.ToString("n2")
                .txtTotal.Text = .txtSubtotal.Text

                .dtgAddons.Rows.Clear()

                .txtfname.Clear()
                .txtlname.Clear()
                .txtAddress.Clear()
                .txtage.Clear()
                .txtContact.Clear()
            End With

        Catch ex As Exception
            MsgBox("Please select a room", MsgBoxStyle.Exclamation)

            ' MsgBox(ex.Message)
        End Try
        Form1.addContent(Form1.FrmBookingDetails1, Form1.btnBookaRoom)

    End Sub
End Class
