Public Class Form1

    Dim dr As Bunifu.Framework.UI.Drag = New Bunifu.Framework.UI.Drag()
    Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

    Private Sub panelHeader_MouseDown(sender As Object, e As MouseEventArgs) Handles pnlHeader.MouseDown
        dr.Grab(Me)
    End Sub

    Private Sub panelHeader_MouseUp(sender As Object, e As MouseEventArgs) Handles pnlHeader.MouseUp
        dr.Release()
    End Sub

    Private Sub panelHeader_MouseMove(sender As Object, e As MouseEventArgs) Handles pnlHeader.MouseMove
        dr.MoveObject()
    End Sub
#Region "Hover"
    Private Sub Label2_MouseHover(sender As Object, e As EventArgs) Handles Label2.MouseHover
        Label2.ForeColor = Color.FromArgb(225, 0, 0)
    End Sub
    Private Sub Label2_MouseLeave(sender As Object, e As EventArgs) Handles Label2.MouseLeave
        Label2.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub

    Private Sub btnBookaRoom_MouseHover(sender As Object, e As EventArgs) Handles btnWeeklyReport.MouseHover
        btnWeeklyReport.ForeColor = Color.FromArgb(225, 0, 0)
    End Sub
    Private Sub btnWeeklyReport_MouseLeave(sender As Object, e As EventArgs) Handles btnWeeklyReport.MouseLeave
        btnWeeklyReport.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub
    Private Sub btnReserveaRoom_MouseHover(sender As Object, e As EventArgs) Handles btnReserveaRoom.MouseHover
        btnReserveaRoom.ForeColor = Color.FromArgb(255, 0, 0)
    End Sub
    Private Sub btnReserveaRoom_MouseLeave(sender As Object, e As EventArgs) Handles btnReserveaRoom.MouseLeave
        btnReserveaRoom.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub
    Private Sub btnBookaRoom_MouseHover_1(sender As Object, e As EventArgs) Handles btnBookaRoom.MouseHover
        btnBookaRoom.ForeColor = Color.FromArgb(255, 0, 0)
    End Sub
    Private Sub btnBookaRoom_MouseLeave(sender As Object, e As EventArgs) Handles btnBookaRoom.MouseLeave
        btnBookaRoom.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub
    Private Sub btnBookingHistory_MouseHover(sender As Object, e As EventArgs) Handles btnBookingHistory.MouseHover
        btnBookingHistory.ForeColor = Color.FromArgb(255, 0, 0)
    End Sub
    Private Sub btnBookingHistory_MouseLeave(sender As Object, e As EventArgs) Handles btnBookingHistory.MouseLeave
        btnBookingHistory.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub
    Private Sub btnReservationHistory_MouseHover_1(sender As Object, e As EventArgs) Handles btnReservationHistory.MouseHover
        btnReservationHistory.ForeColor = Color.FromArgb(255, 0, 0)
    End Sub
    Private Sub btnReservationHistory_MouseLeave(sender As Object, e As EventArgs) Handles btnReservationHistory.MouseLeave
        btnReservationHistory.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub
    Private Sub btnRooms_MouseHover(sender As Object, e As EventArgs) Handles btnRooms.MouseHover
        btnRooms.ForeColor = Color.FromArgb(255, 0, 0)
    End Sub
    Private Sub btnRooms_MouseLeave(sender As Object, e As EventArgs) Handles btnRooms.MouseLeave
        btnRooms.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub
    Private Sub btnGuest_MouseHover_1(sender As Object, e As EventArgs) Handles btnGuest.MouseHover
        btnGuest.ForeColor = Color.FromArgb(255, 0, 0)
    End Sub
    Private Sub btnGuest_MouseLeave(sender As Object, e As EventArgs) Handles btnGuest.MouseLeave
        btnGuest.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub
    Private Sub btnAddons_MouseHover_1(sender As Object, e As EventArgs) Handles btnAddons.MouseHover
        btnAddons.ForeColor = Color.FromArgb(255, 0, 0)
    End Sub
    Private Sub btnAddons_MouseLeave(sender As Object, e As EventArgs) Handles btnAddons.MouseLeave
        btnAddons.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub
    Private Sub btnType_MouseHover_1(sender As Object, e As EventArgs) Handles btnType.MouseHover
        btnType.ForeColor = Color.FromArgb(255, 0, 0)
    End Sub
    Private Sub btnType_MouseLeave(sender As Object, e As EventArgs) Handles btnType.MouseLeave
        btnType.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub
    Private Sub btnUser_MouseHover_1(sender As Object, e As EventArgs) Handles btnUser.MouseHover
        btnUser.ForeColor = Color.FromArgb(255, 0, 0)
    End Sub
    Private Sub btnUser_MouseLeave(sender As Object, e As EventArgs) Handles btnUser.MouseLeave
        btnUser.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub

    Private Sub btnDailyReport_MouseHover_1(sender As Object, e As EventArgs) Handles btnDailyReport.MouseHover
        btnDailyReport.ForeColor = Color.FromArgb(255, 0, 0)
    End Sub
    Private Sub btnDailyReport_MouseLeave(sender As Object, e As EventArgs) Handles btnDailyReport.MouseLeave
        btnDailyReport.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub

    Private Sub btnMonthReport_MouseHover_1(sender As Object, e As EventArgs) Handles btnMonthReport.MouseHover
        btnMonthReport.ForeColor = Color.FromArgb(255, 0, 0)
    End Sub
    Private Sub btnMonthReport_MouseLeave(sender As Object, e As EventArgs) Handles btnMonthReport.MouseLeave
        btnMonthReport.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub
    Private Sub btnInclusiveReport_MouseHover_1(sender As Object, e As EventArgs) Handles btnInclusiveReport.MouseHover
        btnInclusiveReport.ForeColor = Color.FromArgb(255, 0, 0)
    End Sub
    Private Sub btnInclusiveReport_MouseLeave(sender As Object, e As EventArgs) Handles btnInclusiveReport.MouseLeave
        btnInclusiveReport.ForeColor = Color.FromArgb(255, 255, 255)
    End Sub
#End Region

    Public Sub addContent(frm As UserControl, lbl As Label)

        Panel1.Controls.Clear()
        'frm.TopLevel = False
        frm.Dock = DockStyle.Fill
        frm.Show()
        Panel1.Controls.Add(frm)
        animation.HideSync(frm)
        animation.ShowSync(frm)

        pnlActive.Height = lbl.Height
        pnlActive.Location = New Point(41, lbl.Location.Y)
    End Sub

    Private Sub btnUser_Click(sender As Object, e As EventArgs) Handles btnUser.Click
        lblMainTitle.Text = "Hotel Management System | " & btnUser.Text
        addContent(FrmUser1, btnUser)

    End Sub

    Private Sub btnBookaRoom_Click(sender As Object, e As EventArgs) Handles btnBookaRoom.Click
        lblMainTitle.Text = "Hotel Management System | " & btnBookaRoom.Text
        addContent(FrmBooking1, btnBookaRoom)



    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        lblMainTitle.Text = "Hotel Management System | " & btnBookaRoom.Text
        btnBookaRoom_Click(sender, e)
    End Sub

    Private Sub btnReserveaRoom_Click(sender As Object, e As EventArgs) Handles btnReserveaRoom.Click
        lblMainTitle.Text = "Hotel Management System | " & btnReserveaRoom.Text
        addContent(FrmReserve1, btnReserveaRoom)




    End Sub

    Private Sub btnBookingHistory_Click(sender As Object, e As EventArgs) Handles btnBookingHistory.Click
        lblMainTitle.Text = "Hotel Management System | " & btnBookingHistory.Text
        addContent(FrmBookingHistory1, btnBookingHistory)

        sql = BookedRooms() & "  and  concat (`ROOMNUM`,' ', `ROOM`,' ',`G_FNAME` , ' ' , `G_LNAME`) LIKE '%" & FrmBookingHistory1.txtSearch.Text & "%'"
        RETRIEVEDTG(FrmBookingHistory1.dtgList, sql)
    End Sub

    Private Sub btnReservationHistory_Click(sender As Object, e As EventArgs) Handles btnReservationHistory.Click
        lblMainTitle.Text = "Hotel Management System | " & btnReservationHistory.Text
        addContent(FrmReservationHistory1, btnReservationHistory)

        sql = ReservedRooms()
        RETRIEVEDTG(FrmReservationHistory1.dtgList, sql)
    End Sub

    Private Sub btnRooms_Click(sender As Object, e As EventArgs) Handles btnRooms.Click
        lblMainTitle.Text = "Hotel Management System | " & btnRooms.Text
        addContent(FrmRooms1, btnRooms)
    End Sub

    Private Sub btnGuest_Click(sender As Object, e As EventArgs) Handles btnGuest.Click
        lblMainTitle.Text = "Hotel Management System | " & btnGuest.Text
        addContent(FrmGuest1, btnGuest)
    End Sub

    Private Sub btnAddons_Click(sender As Object, e As EventArgs) Handles btnAddons.Click
        lblMainTitle.Text = "Hotel Management System | " & btnAddons.Text
        addContent(FrmAddOns1, btnAddons)
    End Sub

    Private Sub btnType_Click(sender As Object, e As EventArgs) Handles btnType.Click
        lblMainTitle.Text = "Hotel Management System | " & btnType.Text
        addContent(FrmTypes1, btnType)
    End Sub

    Private Sub btnDailyReport_Click(sender As Object, e As EventArgs) Handles btnDailyReport.Click
        sql = "SELECT p.`TRANSNUM` as 'TrasactionNo.',concat(`G_FNAME`,' ', `G_LNAME`) as 'Name', `ROOMNUM` AS 'RoomNo.', `ROOM` as 'Room', date(`ARRIVAL`) as 'Checked-in', date(`DEPARTURE`)  as 'Checked-out', `SPRICE` AS 'TotalPrice', p.`STATUS` as 'Status'  FROM  `tblroom` rm,`tblreservation` r, `tblpayment` p , `tblguest` g WHERE rm.`ROOMID` = r.`ROOMID` and r.`TRANSNUM`=p.`TRANSNUM` AND p.`GUESTID`=g.`GUESTID`  AND DAY(r.`TRANSDATE`) = DAY(Now())"
        reports(sql, "DailyReport", FrmReports1.CrystalReportViewer1)
        lblMainTitle.Text = "Hotel Management System | " & btnDailyReport.Text
        addContent(FrmReports1, btnDailyReport)
    End Sub

    Private Sub btnWeeklyReport_Click(sender As Object, e As EventArgs) Handles btnWeeklyReport.Click
        sql = "SELECT p.`TRANSNUM` as 'TrasactionNo.',concat(`G_FNAME`,' ', `G_LNAME`) as 'Name', `ROOMNUM` AS 'RoomNo.', `ROOM` as 'Room', date(`ARRIVAL`) as 'Checked-in', date(`DEPARTURE`)  as 'Checked-out', `SPRICE` AS 'TotalPrice', p.`STATUS` as 'Status'  FROM  `tblroom` rm,`tblreservation` r, `tblpayment` p , `tblguest` g WHERE rm.`ROOMID` = r.`ROOMID` and r.`TRANSNUM`=p.`TRANSNUM` AND p.`GUESTID`=g.`GUESTID`  AND WEEK(r.`TRANSDATE`) = WEEK(Now())"
        reports(sql, "WeeklyReport", FrmReports1.CrystalReportViewer1)
        lblMainTitle.Text = "Hotel Management System | " & btnWeeklyReport.Text
        addContent(FrmReports1, btnWeeklyReport)
    End Sub

    Private Sub btnMonthReport_Click(sender As Object, e As EventArgs) Handles btnMonthReport.Click
        sql = "SELECT p.`TRANSNUM` as 'TrasactionNo.',concat(`G_FNAME`,' ', `G_LNAME`) as 'Name', `ROOMNUM` AS 'RoomNo.', `ROOM` as 'Room', date(`ARRIVAL`) as 'Checked-in', date(`DEPARTURE`)  as 'Checked-out', `SPRICE` AS 'TotalPrice', p.`STATUS` as 'Status'  FROM  `tblroom` rm,`tblreservation` r, `tblpayment` p , `tblguest` g WHERE rm.`ROOMID` = r.`ROOMID` and r.`TRANSNUM`=p.`TRANSNUM` AND p.`GUESTID`=g.`GUESTID`  AND MONTH(r.`TRANSDATE`) = MONTH(Now())"
        reports(sql, "MonthlyReport", FrmReports1.CrystalReportViewer1)
        lblMainTitle.Text = "Hotel Management System | " & btnMonthReport.Text
        addContent(FrmReports1, btnMonthReport)
    End Sub

    Private Sub btnInclusiveReport_Click(sender As Object, e As EventArgs) Handles btnInclusiveReport.Click
        frmDates.ShowDialog()
        lblMainTitle.Text = "Hotel Management System | " & btnInclusiveReport.Text
    End Sub

    Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
        With frmLogin
            .Show()
            .UsernameTextBox.Clear()
            .PasswordTextBox.Clear()
            .UsernameTextBox.Focus()

        End With
    End Sub

    Private Sub btnYoutube_Click(sender As Object, e As EventArgs) Handles btnYoutube.Click
        Process.Start("https://bit.ly/2LPn9Wu")
    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
        Process.Start("https://bit.ly/2LPn9Wu")
    End Sub

    Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
        lblMainTitle.Text = "Hotel Management System | " & Label2.Text
        addContent(FrmBookingHistory1, Label2)
    End Sub


End Class
