Public Class frmMain
    Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles Panel1.Paint

    End Sub

    Private Sub btnAddStudents_Click(sender As Object, e As EventArgs) Handles btnAddStudents.Click
        frmStudent.ShowDialog()
    End Sub

    Private Sub btnListStudents_Click(sender As Object, e As EventArgs) Handles btnListStudents.Click
        frmListofStudents.ShowDialog()
    End Sub

    Private Sub btnCourse_Click(sender As Object, e As EventArgs) Handles btnCourse.Click
        frmCourse.ShowDialog()
    End Sub

    Private Sub btnExcuseSlip_Click(sender As Object, e As EventArgs) Handles btnExcuseSlip.Click
        frmExcuseSlip.ShowDialog()
    End Sub

    Private Sub btnListExcuseSlip_Click(sender As Object, e As EventArgs) Handles btnListExcuseSlip.Click
        frmListofExcuseSlip.ShowDialog()
    End Sub

    Private Sub btnComplains_Click(sender As Object, e As EventArgs) Handles btnComplains.Click
        frmComplains.ShowDialog()
    End Sub

    Private Sub btnUser_Click(sender As Object, e As EventArgs) Handles btnUser.Click
        frmUser.ShowDialog()
    End Sub

    Private Sub btnLogout_Click(sender As Object, e As EventArgs) Handles btnLogout.Click
        Me.Close()
        LoginForm1.Show()
    End Sub

    Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        sql = "SELECT  s.`StudentID`,concat(`FirstName`, ' ', `MiddleName`,' ' , `LastName`) as Name,`Sex`, `CityAddress`, `ProvincialAddress`, `EmailAddress`, `MobileNo`,CourseYear,GROUP_CONCAT(`Subject`) as Subject, `ExcusedDate`, `InclusiveDate`, `Reasons`, `StudentPresented`, `Remarks` FROM  `tblstudent` s,`tblexcuseslip` e WHERE s.`StudentID`=e.`StudentID`  AND DATE(`ExcusedDate`) BETWEEN '" & formatMySQLdate(Now()) & "' AND '" & formatMySQLdate(Now()) & "' GROUP BY SlipNo"
        'sql = "SELECT  * FROM  `tblstudent` s,`tblexcuseslip` e WHERE s.`StudentID`=e.`StudentID`  AND DATE(`ExcusedDate`) BETWEEN '" & formatMySQLdate(dtpFrom.Text) & "' AND '" & formatMySQLdate(dtpTo.Text) & "' GROUP BY SlipNo"

        '  sql = "SELECT  s.`StudentID`,concat(`FirstName`, ' ', `MiddleName`,' ' , `LastName`) as Name,`Sex`, `CityAddress`, `ProvincialAddress`, `EmailAddress`, `MobileNo`,concat(`COURSE`,' ',`S_Level`,' /', `S_Section`) as CourseYear,`Subject`, `ExcusedDate`, `InclusiveDate`, `Reasons` FROM `tblstudent`  s, `tblcourse`  c, `tblexcuseslip` e " &
        '" WHERE s.`COURSEID`=c.`COURSEID` AND s.`StudentID`=e.`StudentID` AND DATE(`ExcusedDate`) BETWEEN '" & formatMySQLdate(dtpFrom.Text) & "' AND '" & formatMySQLdate(dtpTo.Text) & "'"
        reports(sql, "listofstudents", CrystalReportViewer2)
    End Sub
End Class