private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string   strProjectID;
            int      intRecordsReturned;
            int      intCounter;
            int      intNumberOfRecords;
            DateTime datTransactionDate;
            string   strWorkTask;
            int      intSecondCounter;
            int      intSecondNumberOfRecords;
            bool     blnItemFound;
            int      intFootage;
            int      intSummaryCounter;
            decimal  decHours;
            decimal  decLaborCosts;
            DateTime datStartDate = DateTime.Now;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                strProjectID = txtEnterProjectID.Text;
                TheCompleteProjectInfoDataSet.projectinfo.Rows.Clear();
                TheProjectWorkSummaryDataSet.worksummary.Rows.Clear();
                gintSummaryCounter    = 0;
                gintSummaryUpperLimit = 0;

                gdecTotalHours = 0;
                gdecLaborCosts = 0;

                TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProjectID);

                intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    TheMessagesClass.ErrorMessage("Project Not Found");
                    return;
                }

                MainWindow.gintProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;

                datStartDate = TheDateSearchClass.SubtractingDays(datStartDate, 1500);

                TheFindProjectHoursDataSet = TheEmployeeProjectAssignmentClass.FindProjectHours(MainWindow.gintProjectID, datStartDate);

                intNumberOfRecords       = TheFindProjectHoursDataSet.FindProjectHours.Rows.Count - 1;
                intSecondNumberOfRecords = 0;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        blnItemFound       = false;
                        gdecTotalHours    += TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalHours;
                        gdecLaborCosts    += TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalEmployeeCost;
                        datTransactionDate = TheFindProjectHoursDataSet.FindProjectHours[intCounter].TransactionDate;
                        strWorkTask        = TheFindProjectHoursDataSet.FindProjectHours[intCounter].WorkTask;
                        decHours           = TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalHours;
                        decLaborCosts      = TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalEmployeeCost;

                        if (intSecondNumberOfRecords > 0)
                        {
                            for (intSecondCounter = 0; intSecondCounter < intSecondNumberOfRecords; intSecondCounter++)
                            {
                                if (strWorkTask == TheCompleteProjectInfoDataSet.projectinfo[intSecondCounter].WorkTask)
                                {
                                    if (datTransactionDate == TheCompleteProjectInfoDataSet.projectinfo[intSecondCounter].TransactionDate)
                                    {
                                        TheCompleteProjectInfoDataSet.projectinfo[intSecondCounter].Hours      += decHours;
                                        TheCompleteProjectInfoDataSet.projectinfo[intSecondCounter].LaborCosts += decLaborCosts;
                                        blnItemFound = true;
                                    }
                                }
                            }
                        }

                        if (blnItemFound == false)
                        {
                            CompleteProjectInfoDataSet.projectinfoRow NewTaskRow = TheCompleteProjectInfoDataSet.projectinfo.NewprojectinfoRow();

                            NewTaskRow.FootagePieces   = 0;
                            NewTaskRow.TransactionDate = datTransactionDate;
                            NewTaskRow.WorkTask        = strWorkTask;
                            NewTaskRow.Hours           = decHours;
                            NewTaskRow.LaborCosts      = decLaborCosts;

                            TheCompleteProjectInfoDataSet.projectinfo.Rows.Add(NewTaskRow);
                            intSecondNumberOfRecords++;
                        }
                    }
                }

                intNumberOfRecords = TheCompleteProjectInfoDataSet.projectinfo.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    intFootage         = 0;
                    strWorkTask        = TheCompleteProjectInfoDataSet.projectinfo[intCounter].WorkTask;
                    datTransactionDate = TheCompleteProjectInfoDataSet.projectinfo[intCounter].TransactionDate;

                    TheFindWorkTaskByWorkTaskDataSet = TheWorkTaskClass.FindWorkTaskByWorkTask(strWorkTask);

                    MainWindow.gintWorkTaskID = TheFindWorkTaskByWorkTaskDataSet.FindWorkTaskByWorkTask[0].WorkTaskID;

                    TheFindSpecificProjectWorkTaskDataSet = TheProjectTaskClass.FindSpecificProjectWorkTask(MainWindow.gintProjectID, MainWindow.gintWorkTaskID);

                    intSecondNumberOfRecords = TheFindSpecificProjectWorkTaskDataSet.FindSpecificProjectWorkTask.Rows.Count - 1;

                    for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                    {
                        if (TheCompleteProjectInfoDataSet.projectinfo[intCounter].FootagePieces == 0)
                        {
                            if (datTransactionDate == TheFindSpecificProjectWorkTaskDataSet.FindSpecificProjectWorkTask[intSecondCounter].TransactionDate)
                            {
                                intFootage = Convert.ToInt32(TheFindSpecificProjectWorkTaskDataSet.FindSpecificProjectWorkTask[intSecondCounter].FootagePieces);

                                TheCompleteProjectInfoDataSet.projectinfo[intCounter].FootagePieces = intFootage;
                            }
                        }
                    }
                }

                intNumberOfRecords = TheCompleteProjectInfoDataSet.projectinfo.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    blnItemFound = false;

                    strWorkTask = TheCompleteProjectInfoDataSet.projectinfo[intCounter].WorkTask;

                    if (gintSummaryCounter > 0)
                    {
                        for (intSummaryCounter = 0; intSummaryCounter <= gintSummaryUpperLimit; intSummaryCounter++)
                        {
                            if (strWorkTask == TheProjectWorkSummaryDataSet.worksummary[intSummaryCounter].WorkTask)
                            {
                                TheProjectWorkSummaryDataSet.worksummary[intSummaryCounter].FootagePieces += TheCompleteProjectInfoDataSet.projectinfo[intCounter].FootagePieces;
                                TheProjectWorkSummaryDataSet.worksummary[intSummaryCounter].Hours         += TheCompleteProjectInfoDataSet.projectinfo[intCounter].Hours;
                                blnItemFound = true;
                            }
                        }
                    }

                    if (blnItemFound == false)
                    {
                        ProjectWorkSummaryDataSet.worksummaryRow NewTaskRow = TheProjectWorkSummaryDataSet.worksummary.NewworksummaryRow();

                        NewTaskRow.FootagePieces = TheCompleteProjectInfoDataSet.projectinfo[intCounter].FootagePieces;
                        NewTaskRow.WorkTask      = strWorkTask;
                        NewTaskRow.Hours         = TheCompleteProjectInfoDataSet.projectinfo[intCounter].Hours;
                        NewTaskRow.LaborCosts    = TheCompleteProjectInfoDataSet.projectinfo[intCounter].LaborCosts;

                        TheProjectWorkSummaryDataSet.worksummary.Rows.Add(NewTaskRow);

                        gintSummaryUpperLimit = gintSummaryCounter;
                        gintSummaryCounter++;
                    }
                }

                dgrResults.ItemsSource = TheProjectWorkSummaryDataSet.worksummary;
                txtTotalHours.Text     = Convert.ToString(gdecTotalHours);
                txtLaborCosts.Text     = Convert.ToString(gdecLaborCosts);

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                PleaseWait.Close();

                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Find Project Hours // Generate Report Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string   strProjectID;
            int      intRecordsReturned;
            int      intCounter;
            int      intNumberOfRecords;
            DateTime datTransactionDate;
            string   strWorkTask;
            int      intSecondCounter;
            int      intSecondNumberOfRecords;
            bool     blnItemFound;
            int      intFootage;
            decimal  decHours;
            decimal  decLaborCosts;

            try
            {
                strProjectID = txtEnterProjectID.Text;
                TheCompleteProjectInfoDataSet.projectinfo.Rows.Clear();
                MainWindow.ProjectMaterialWindow.Visibility = Visibility.Hidden;

                gdecTotalHours      = 0;
                gdecTotalLaborCosts = 0;

                TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProjectID);

                intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    TheMessagesClass.ErrorMessage("Project Not Found");
                    return;
                }

                MainWindow.gintProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;

                TheFindProjectHoursTotalDataSet = TheEmployeeProjectAssignmentClass.FindProjectHoursTotal(MainWindow.gintProjectID);

                intNumberOfRecords       = TheFindProjectHoursTotalDataSet.FindProjectHourTotals.Rows.Count - 1;
                intSecondNumberOfRecords = 0;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        blnItemFound         = false;
                        decHours             = TheFindProjectHoursTotalDataSet.FindProjectHourTotals[intCounter].TotalHours;
                        decLaborCosts        = TheFindProjectHoursTotalDataSet.FindProjectHourTotals[intCounter].TotalEmployeeCost;
                        gdecTotalHours      += decHours;
                        gdecTotalLaborCosts += decLaborCosts;
                        datTransactionDate   = TheFindProjectHoursTotalDataSet.FindProjectHourTotals[intCounter].TransactionDate;
                        strWorkTask          = TheFindProjectHoursTotalDataSet.FindProjectHourTotals[intCounter].WorkTask;

                        if (intSecondNumberOfRecords > 0)
                        {
                            for (intSecondCounter = 0; intSecondCounter < intSecondNumberOfRecords; intSecondCounter++)
                            {
                                if (strWorkTask == TheCompleteProjectInfoDataSet.projectinfo[intSecondCounter].WorkTask)
                                {
                                    if (datTransactionDate == TheCompleteProjectInfoDataSet.projectinfo[intSecondCounter].TransactionDate)
                                    {
                                        blnItemFound = true;
                                    }
                                }
                            }
                        }

                        if (blnItemFound == false)
                        {
                            CompleteProjectInfoDataSet.projectinfoRow NewTaskRow = TheCompleteProjectInfoDataSet.projectinfo.NewprojectinfoRow();

                            NewTaskRow.FootagePieces   = 0;
                            NewTaskRow.TransactionDate = datTransactionDate;
                            NewTaskRow.WorkTask        = strWorkTask;
                            NewTaskRow.Hours           = decHours;
                            NewTaskRow.LaborCosts      = decLaborCosts;

                            TheCompleteProjectInfoDataSet.projectinfo.Rows.Add(NewTaskRow);
                            intSecondNumberOfRecords++;
                        }
                    }
                }

                intNumberOfRecords = TheCompleteProjectInfoDataSet.projectinfo.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    intFootage         = 0;
                    strWorkTask        = TheCompleteProjectInfoDataSet.projectinfo[intCounter].WorkTask;
                    datTransactionDate = TheCompleteProjectInfoDataSet.projectinfo[intCounter].TransactionDate;

                    TheFindWorkTaskByWorkTaskDataSet = TheWorkTaskClass.FindWorkTaskByWorkTask(strWorkTask);

                    MainWindow.gintWorkTaskID = TheFindWorkTaskByWorkTaskDataSet.FindWorkTaskByWorkTask[0].WorkTaskID;

                    TheFindSpecificProjectWorkTaskDataSet = TheProjectTaskClass.FindSpecificProjectWorkTask(MainWindow.gintProjectID, MainWindow.gintWorkTaskID);

                    intSecondNumberOfRecords = TheFindSpecificProjectWorkTaskDataSet.FindSpecificProjectWorkTask.Rows.Count - 1;

                    for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                    {
                        if (datTransactionDate == TheFindSpecificProjectWorkTaskDataSet.FindSpecificProjectWorkTask[intSecondCounter].TransactionDate)
                        {
                            intFootage += Convert.ToInt32(TheFindSpecificProjectWorkTaskDataSet.FindSpecificProjectWorkTask[intSecondCounter].FootagePieces);
                        }
                    }

                    TheCompleteProjectInfoDataSet.projectinfo[intCounter].FootagePieces = intFootage;
                }

                dgrResults.ItemsSource = TheCompleteProjectInfoDataSet.projectinfo;
                txtTotalHours.Text     = Convert.ToString(gdecTotalHours);
                txtLaborCost.Text      = Convert.ToString(gdecTotalLaborCosts);

                MainWindow.ProjectMaterialWindow.Visibility = Visibility.Visible;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Total Project Information // Generate Report Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }