private void btnSubmit_Click(object sender, RoutedEventArgs e)
 {
     if (dtpStart.SelectedDate == null)
     {
         MessageBox.Show("Please select the start date!", "START DATE MISSING", MessageBoxButton.OK, MessageBoxImage.Exclamation);
         popFilter.IsOpen = true;
     }
     else if (dtpEnd.SelectedDate == null)
     {
         MessageBox.Show("Please select the end date!", "START DATE MISSING", MessageBoxButton.OK, MessageBoxImage.Exclamation);
         popFilter.IsOpen = true;
     }
     else if (dtpEnd.SelectedDate < dtpStart.SelectedDate)
     {
         MessageBox.Show("The start date cannot be greater than the end date!", "INVALID FILTER", MessageBoxButton.OK, MessageBoxImage.Exclamation);
         popFilter.IsOpen = true;
     }
     else if (cmbInstructor.SelectedValue == null && chkAll.IsChecked == false)
     {
         MessageBox.Show("Please select the instructor!", "INSTRUCTOR MISSING", MessageBoxButton.OK, MessageBoxImage.Exclamation);
         popFilter.IsOpen = true;
     }
     else
     {
         var mainWindow = Application.Current.Windows.Cast <Window>().FirstOrDefault(window => window is MainWindow) as MainWindow;
         SummarisedIncomeExpenditure nwIncomeExpenditure = new SummarisedIncomeExpenditure();
         mainWindow.grdMain.Children.Clear();
         nwIncomeExpenditure.instructorID = Globals.instructorID;
         nwIncomeExpenditure.start        = Convert.ToDateTime(dtpStart.SelectedDate);
         nwIncomeExpenditure.end          = Convert.ToDateTime(dtpEnd.SelectedDate);
         nwIncomeExpenditure.Isfiltered   = true;
         mainWindow.grdMain.Children.Add(nwIncomeExpenditure);
     }
 }
        private void btnIncomeExpenditure_Click(object sender, RoutedEventArgs e)
        {
            SummarisedIncomeExpenditure nwReport = new SummarisedIncomeExpenditure();

            this.grdMain.Children.Clear();
            this.grdMain.Children.Add(nwReport);
        }
        private void btnClearFilter_Click(object sender, RoutedEventArgs e)
        {
            var mainWindow = Application.Current.Windows.Cast <Window>().FirstOrDefault(window => window is MainWindow) as MainWindow;
            SummarisedIncomeExpenditure nwIncomeExpenditure = new SummarisedIncomeExpenditure();

            mainWindow.grdMain.Children.Clear();
            nwIncomeExpenditure.instructorID = Globals.instructorID;
            nwIncomeExpenditure.Isfiltered   = false;
            mainWindow.grdMain.Children.Add(nwIncomeExpenditure);
        }