コード例 #1
0
        public FindAllEmployeeProductionOverAWeekDataSet FindAllEmployeeProductionOverAWeek(DateTime datStartDate, DateTime datEndDate)
        {
            try
            {
                aFindAllEmployeeProductionOverAWeekDataSet      = new FindAllEmployeeProductionOverAWeekDataSet();
                aFindAllEmployeeProductionOverAWeekTableAdapter = new FindAllEmployeeProductionOverAWeekDataSetTableAdapters.FindAllEmployeeProductionOverAWeekTableAdapter();
                aFindAllEmployeeProductionOverAWeekTableAdapter.Fill(aFindAllEmployeeProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek, datStartDate, datEndDate);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Employee Project Assignment // Find All Employee Production Over a Week " + Ex.Message);
            }

            return(aFindAllEmployeeProductionOverAWeekDataSet);
        }
コード例 #2
0
        private void GenerateReport()
        {
            //setting up the data
            string   strErrorMessage = "";
            bool     blnFatalError   = false;
            int      intCounter;
            int      intNumberOfRecords;
            int      intEmployeeID = -1;
            decimal  decTotalHours = 0;
            decimal  decMultiplier = 1;
            decimal  decTotalCost  = 0;
            decimal  decReportedHours;
            decimal  decPayRate;
            decimal  decDifference;
            int      intProjectCounter;
            bool     blnItemFound;
            int      intProjectID;
            bool     blnMonday;
            DateTime datTransactionDate;

            try
            {
                TheCompleteProjectProductivityDataSet.completeprojectproductivity.Rows.Clear();
                TheEmployeeProductivityDataSet.employeeproductivity.Rows.Clear();

                if (gblnStartDateSelected == false)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Start Date was not Selected\n";
                }
                else
                {
                    if (gdatStartDate.DayOfWeek != DayOfWeek.Monday)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Start Date is not a Monday\n";
                    }
                }
                if (gblnEndDateSelected == false)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The End Date Was Not Selected\n";
                }
                else
                {
                    if (gdatEndDate.DayOfWeek != DayOfWeek.Sunday)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The End Date is not a Sunday\n";
                    }
                }
                if (blnFatalError == true)
                {
                    TheMessageClass.ErrorMessage(strErrorMessage);
                    return;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                TheFindAllEmployeesProductionOverAWeekDataSet = TheEmployeeProjectAssignmentClass.FindAllEmployeeProductionOverAWeek(gdatStartDate, gdatEndDate);

                intNumberOfRecords = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek.Rows.Count - 1;
                blnMonday          = false;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    decPayRate         = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].PayRate;
                    decReportedHours   = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].TotalHours;
                    datTransactionDate = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].TransactionDate;

                    if ((datTransactionDate.DayOfWeek == DayOfWeek.Monday) && (blnMonday == false))
                    {
                        decTotalHours = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].TotalHours;
                        intEmployeeID = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].EmployeeID;
                        blnMonday     = true;
                        decMultiplier = 1;
                    }
                    else if (intEmployeeID != TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].EmployeeID)
                    {
                        decTotalHours = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].TotalHours;
                        intEmployeeID = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].EmployeeID;
                        decMultiplier = 1;
                    }
                    else if (intEmployeeID == TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].EmployeeID)
                    {
                        decTotalHours += TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].TotalHours;

                        if (datTransactionDate.DayOfWeek != DayOfWeek.Monday)
                        {
                            blnMonday = false;
                        }
                    }

                    if (decMultiplier == 1)
                    {
                        if (decTotalHours <= 40)
                        {
                            decTotalCost = decPayRate * decReportedHours;
                        }
                        if (decTotalHours > 40)
                        {
                            decDifference = decTotalHours - 40;
                            decMultiplier = Convert.ToDecimal(1.5);
                            decTotalCost  = ((decReportedHours - decDifference) * decPayRate) + (decDifference * decPayRate * decMultiplier);
                        }
                    }
                    if (decMultiplier == Convert.ToDecimal(1.5))
                    {
                        decTotalCost = decReportedHours * decPayRate * decMultiplier;
                    }

                    EmployeeProductivityDataSet.employeeproductivityRow NewProductivityRow = TheEmployeeProductivityDataSet.employeeproductivity.NewemployeeproductivityRow();

                    NewProductivityRow.AssignedProjectID = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].AssignedProjectID;
                    NewProductivityRow.CalculatedHours   = decTotalHours;
                    NewProductivityRow.EmployeeID        = intEmployeeID;
                    NewProductivityRow.FirstName         = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].FirstName;
                    NewProductivityRow.LastName          = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].LastName;
                    NewProductivityRow.Multiplier        = decMultiplier;
                    NewProductivityRow.PayRate           = decPayRate;
                    NewProductivityRow.ProjectID         = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].ProjectID;
                    NewProductivityRow.ProjectName       = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].ProjectName;
                    NewProductivityRow.TotalCost         = decTotalCost;
                    NewProductivityRow.TotalHours        = decReportedHours;
                    NewProductivityRow.TransactionDate   = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].TransactionDate;

                    TheEmployeeProductivityDataSet.employeeproductivity.Rows.Add(NewProductivityRow);
                }

                TheFindAllDesignEmployeeProductivityOverAWeekDataSet = TheDesignProductivityClass.FindAllDesignEmployeeProductivityOverAWeek(gdatStartDate, gdatEndDate);

                intNumberOfRecords = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek.Rows.Count - 1;
                blnMonday          = false;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    decPayRate         = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].PayRate;
                    decReportedHours   = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].TotalHours;
                    datTransactionDate = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].TransactionDate;

                    if ((datTransactionDate.DayOfWeek == DayOfWeek.Monday) && (blnMonday == false))
                    {
                        decTotalHours = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].TotalHours;
                        intEmployeeID = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].EmployeeID;
                        blnMonday     = true;
                        decMultiplier = 1;
                    }
                    else if (intEmployeeID != TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].EmployeeID)
                    {
                        decTotalHours = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].TotalHours;
                        intEmployeeID = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].EmployeeID;
                        decMultiplier = 1;
                    }
                    else if (intEmployeeID == TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].EmployeeID)
                    {
                        decTotalHours += TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].TotalHours;

                        if (datTransactionDate.DayOfWeek != DayOfWeek.Monday)
                        {
                            blnMonday = false;
                        }
                    }

                    if (decMultiplier == 1)
                    {
                        if (decTotalHours <= 40)
                        {
                            decTotalCost = decPayRate * decReportedHours;
                        }
                        if (decTotalHours > 40)
                        {
                            decDifference = decTotalHours - 40;
                            decMultiplier = Convert.ToDecimal(1.5);
                            decTotalCost  = ((decReportedHours - decDifference) * decPayRate) + (decDifference * decPayRate * decMultiplier);
                        }
                    }
                    if (decMultiplier == Convert.ToDecimal(1.5))
                    {
                        decTotalCost = decReportedHours * decPayRate * decMultiplier;
                    }

                    EmployeeProductivityDataSet.employeeproductivityRow NewProductivityRow = TheEmployeeProductivityDataSet.employeeproductivity.NewemployeeproductivityRow();

                    NewProductivityRow.AssignedProjectID = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].AssignedProjectID;
                    NewProductivityRow.CalculatedHours   = decTotalHours;
                    NewProductivityRow.EmployeeID        = intEmployeeID;
                    NewProductivityRow.FirstName         = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].FirstName;
                    NewProductivityRow.LastName          = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].LastName;
                    NewProductivityRow.Multiplier        = decMultiplier;
                    NewProductivityRow.PayRate           = decPayRate;
                    NewProductivityRow.ProjectID         = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].ProjectID;
                    NewProductivityRow.ProjectName       = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].ProjectName;
                    NewProductivityRow.TotalCost         = decTotalCost;
                    NewProductivityRow.TotalHours        = decReportedHours;
                    NewProductivityRow.TransactionDate   = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].TransactionDate;

                    TheEmployeeProductivityDataSet.employeeproductivity.Rows.Add(NewProductivityRow);
                }

                intNumberOfRecords         = TheEmployeeProductivityDataSet.employeeproductivity.Rows.Count - 1;
                gintProjectCounter         = 0;
                gintProjectNumberOfRecords = 0;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    blnItemFound  = false;
                    intProjectID  = TheEmployeeProductivityDataSet.employeeproductivity[intCounter].ProjectID;
                    decTotalHours = TheEmployeeProductivityDataSet.employeeproductivity[intCounter].TotalHours;
                    decTotalCost  = TheEmployeeProductivityDataSet.employeeproductivity[intCounter].TotalCost;

                    if (gintProjectCounter > 0)
                    {
                        for (intProjectCounter = 0; intProjectCounter <= gintProjectNumberOfRecords; intProjectCounter++)
                        {
                            if (intProjectID == TheCompleteProjectProductivityDataSet.completeprojectproductivity[intProjectCounter].ProjectID)
                            {
                                TheCompleteProjectProductivityDataSet.completeprojectproductivity[intProjectCounter].TotalHours += decTotalHours;
                                TheCompleteProjectProductivityDataSet.completeprojectproductivity[intProjectCounter].TotalCosts += decTotalCost;
                                blnItemFound = true;
                            }
                        }
                    }

                    if (blnItemFound == false)
                    {
                        CompleteProjectProductivityDataSet.completeprojectproductivityRow NewProjectRow = TheCompleteProjectProductivityDataSet.completeprojectproductivity.NewcompleteprojectproductivityRow();

                        decTotalCost = Math.Round(decTotalCost, 2);

                        NewProjectRow.AssignedProjectID = TheEmployeeProductivityDataSet.employeeproductivity[intCounter].AssignedProjectID;
                        NewProjectRow.ProjectID         = intProjectID;
                        NewProjectRow.ProjectName       = TheEmployeeProductivityDataSet.employeeproductivity[intCounter].ProjectName;
                        NewProjectRow.TotalCosts        = decTotalCost;
                        NewProjectRow.TotalHours        = decTotalHours;

                        TheCompleteProjectProductivityDataSet.completeprojectproductivity.Rows.Add(NewProjectRow);
                        gintProjectNumberOfRecords = gintProjectCounter;
                        gintProjectCounter++;
                    }
                }

                dgrResults.ItemsSource = TheCompleteProjectProductivityDataSet.completeprojectproductivity;

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Projects Productivity Costing // Process Button " + Ex.Message);

                TheMessageClass.ErrorMessage(Ex.ToString());
            }
        }
コード例 #3
0
        public void RunAutomatedProductionReports()
        {
            bool     blnFatalError = false;
            int      intCounter;
            int      intNumberOfRecords;
            int      intEmployeeID = -1;
            decimal  decTotalHours = 0;
            decimal  decMultiplier = 1;
            decimal  decTotalCost  = 0;
            decimal  decReportedHours;
            decimal  decPayRate;
            decimal  decDifference;
            int      intProjectCounter;
            bool     blnItemFound;
            int      intProjectID;
            bool     blnMonday;
            DateTime datTransactionDate;
            DateTime datStartDate;
            DateTime datEndDate;
            string   strFileName;
            string   strPath   = "\\\\bjc\\shares\\Documents\\ProductivityReports\\";
            string   strHeader = "Project Productivity Report";
            string   strMessage;
            string   strEmailAddress;
            double   douTotalPrice;

            try
            {
                datEndDate   = DateTime.Now;
                datStartDate = TheDateSearchClass.SubtractingDays(datEndDate, 90);
                TheEmployeeProductivityDataSet.employeeproductivity.Rows.Clear();
                TheCompleteProjectProductivityDataSet.completeprojectproductivity.Rows.Clear();

                TheFindAllEmployeesProductionOverAWeekDataSet = TheEmployeeProjectAssignmentClass.FindAllEmployeeProductionOverAWeek(datStartDate, datEndDate);

                intNumberOfRecords = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek.Rows.Count - 1;
                blnMonday          = false;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    decPayRate         = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].PayRate;
                    decReportedHours   = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].TotalHours;
                    datTransactionDate = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].TransactionDate;

                    if ((datTransactionDate.DayOfWeek == DayOfWeek.Monday) && (blnMonday == false))
                    {
                        decTotalHours = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].TotalHours;
                        intEmployeeID = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].EmployeeID;
                        blnMonday     = true;
                        decMultiplier = 1;
                    }
                    else if (intEmployeeID != TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].EmployeeID)
                    {
                        decTotalHours = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].TotalHours;
                        intEmployeeID = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].EmployeeID;
                        decMultiplier = 1;
                    }
                    else if (intEmployeeID == TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].EmployeeID)
                    {
                        decTotalHours += TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].TotalHours;

                        if (datTransactionDate.DayOfWeek != DayOfWeek.Monday)
                        {
                            blnMonday = false;
                        }
                    }

                    if (decMultiplier == 1)
                    {
                        if (decTotalHours <= 40)
                        {
                            decTotalCost = decPayRate * decReportedHours;
                        }
                        if (decTotalHours > 40)
                        {
                            decDifference = decTotalHours - 40;
                            decMultiplier = Convert.ToDecimal(1.5);
                            decTotalCost  = ((decReportedHours - decDifference) * decPayRate) + (decDifference * decPayRate * decMultiplier);
                        }
                    }
                    if (decMultiplier == Convert.ToDecimal(1.5))
                    {
                        decTotalCost = decReportedHours * decPayRate * decMultiplier;
                    }

                    EmployeeProductivityDataSet.employeeproductivityRow NewProductivityRow = TheEmployeeProductivityDataSet.employeeproductivity.NewemployeeproductivityRow();

                    NewProductivityRow.AssignedProjectID = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].AssignedProjectID;
                    NewProductivityRow.CalculatedHours   = decTotalHours;
                    NewProductivityRow.EmployeeID        = intEmployeeID;
                    NewProductivityRow.FirstName         = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].FirstName;
                    NewProductivityRow.LastName          = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].LastName;
                    NewProductivityRow.Multiplier        = decMultiplier;
                    NewProductivityRow.PayRate           = decPayRate;
                    NewProductivityRow.ProjectID         = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].ProjectID;
                    NewProductivityRow.ProjectName       = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].ProjectName;
                    NewProductivityRow.TotalCost         = decTotalCost;
                    NewProductivityRow.TotalHours        = decReportedHours;
                    NewProductivityRow.TransactionDate   = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].TransactionDate;

                    TheEmployeeProductivityDataSet.employeeproductivity.Rows.Add(NewProductivityRow);
                }

                TheFindAllDesignEmployeeProductivityOverAWeekDataSet = TheDesignProductivityClass.FindAllDesignEmployeeProductivityOverAWeek(datStartDate, datEndDate);

                intNumberOfRecords = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    decPayRate         = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].PayRate;
                    decReportedHours   = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].TotalHours;
                    datTransactionDate = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].TransactionDate;

                    if ((datTransactionDate.DayOfWeek == DayOfWeek.Monday) && (blnMonday == false))
                    {
                        decTotalHours = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].TotalHours;
                        intEmployeeID = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].EmployeeID;
                        blnMonday     = true;
                        decMultiplier = 1;
                    }
                    else if (intEmployeeID != TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].EmployeeID)
                    {
                        decTotalHours = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].TotalHours;
                        intEmployeeID = TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].EmployeeID;
                        decMultiplier = 1;
                    }
                    else if (intEmployeeID == TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].EmployeeID)
                    {
                        decTotalHours += TheFindAllDesignEmployeeProductivityOverAWeekDataSet.FindAllDesignEmployeeProductivityOverAWeek[intCounter].TotalHours;

                        if (datTransactionDate.DayOfWeek != DayOfWeek.Monday)
                        {
                            blnMonday = false;
                        }
                    }

                    if (decMultiplier == 1)
                    {
                        if (decTotalHours <= 40)
                        {
                            decTotalCost = decPayRate * decReportedHours;
                        }
                        if (decTotalHours > 40)
                        {
                            decDifference = decTotalHours - 40;
                            decMultiplier = Convert.ToDecimal(1.5);
                            decTotalCost  = ((decReportedHours - decDifference) * decPayRate) + (decDifference * decPayRate * decMultiplier);
                        }
                    }
                    if (decMultiplier == Convert.ToDecimal(1.5))
                    {
                        decTotalCost = decReportedHours * decPayRate * decMultiplier;
                    }

                    EmployeeProductivityDataSet.employeeproductivityRow NewProductivityRow = TheEmployeeProductivityDataSet.employeeproductivity.NewemployeeproductivityRow();

                    NewProductivityRow.AssignedProjectID = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].AssignedProjectID;
                    NewProductivityRow.CalculatedHours   = decTotalHours;
                    NewProductivityRow.EmployeeID        = intEmployeeID;
                    NewProductivityRow.FirstName         = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].FirstName;
                    NewProductivityRow.LastName          = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].LastName;
                    NewProductivityRow.Multiplier        = decMultiplier;
                    NewProductivityRow.PayRate           = decPayRate;
                    NewProductivityRow.ProjectID         = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].ProjectID;
                    NewProductivityRow.ProjectName       = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].ProjectName;
                    NewProductivityRow.TotalCost         = decTotalCost;
                    NewProductivityRow.TotalHours        = decReportedHours;
                    NewProductivityRow.TransactionDate   = TheFindAllEmployeesProductionOverAWeekDataSet.FindAllEmployeeProductionOverAWeek[intCounter].TransactionDate;

                    TheEmployeeProductivityDataSet.employeeproductivity.Rows.Add(NewProductivityRow);
                }

                intNumberOfRecords         = TheEmployeeProductivityDataSet.employeeproductivity.Rows.Count - 1;
                gintProjectCounter         = 0;
                gintProjectNumberOfRecords = 0;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    blnItemFound  = false;
                    intProjectID  = TheEmployeeProductivityDataSet.employeeproductivity[intCounter].ProjectID;
                    decTotalHours = TheEmployeeProductivityDataSet.employeeproductivity[intCounter].TotalHours;
                    decTotalCost  = TheEmployeeProductivityDataSet.employeeproductivity[intCounter].TotalCost;

                    if (gintProjectCounter > 0)
                    {
                        for (intProjectCounter = 0; intProjectCounter <= gintProjectNumberOfRecords; intProjectCounter++)
                        {
                            if (intProjectID == TheCompleteProjectProductivityDataSet.completeprojectproductivity[intProjectCounter].ProjectID)
                            {
                                TheCompleteProjectProductivityDataSet.completeprojectproductivity[intProjectCounter].TotalHours += decTotalHours;
                                TheCompleteProjectProductivityDataSet.completeprojectproductivity[intProjectCounter].TotalCosts += decTotalCost;
                                blnItemFound = true;
                            }
                        }
                    }

                    if (blnItemFound == false)
                    {
                        CompleteProjectProductivityDataSet.completeprojectproductivityRow NewProjectRow = TheCompleteProjectProductivityDataSet.completeprojectproductivity.NewcompleteprojectproductivityRow();

                        NewProjectRow.AssignedProjectID = TheEmployeeProductivityDataSet.employeeproductivity[intCounter].AssignedProjectID;
                        NewProjectRow.ProjectID         = intProjectID;
                        NewProjectRow.ProjectName       = TheEmployeeProductivityDataSet.employeeproductivity[intCounter].ProjectName;
                        NewProjectRow.TotalCosts        = decTotalCost;
                        NewProjectRow.TotalHours        = decTotalHours;

                        TheCompleteProjectProductivityDataSet.completeprojectproductivity.Rows.Add(NewProjectRow);
                        gintProjectNumberOfRecords = gintProjectCounter;
                        gintProjectCounter++;
                    }
                }

                strMessage  = "<h1>Project Productivity Report</h1>";
                strMessage += "<h1>An Excel Copy of the Report Can Be Found At " + strPath + "</h1>";
                strMessage += "<table>";
                strMessage += "<tr>";
                strMessage += "<td><b>Assigned PProject ID</b></td>";
                strMessage += "<td><b>Project Name</b></td>";
                strMessage += "<td><b>Total Hours</b></td>";
                strMessage += "<td><b>Labor Costs</b></td>";
                strMessage += "</tr>";
                strMessage += "<p>               </p>";


                intNumberOfRecords = TheCompleteProjectProductivityDataSet.completeprojectproductivity.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strMessage += "<tr>";
                    strMessage += "<td><b>" + TheCompleteProjectProductivityDataSet.completeprojectproductivity[intCounter].AssignedProjectID + "</b></td>";
                    strMessage += "<td><b>" + TheCompleteProjectProductivityDataSet.completeprojectproductivity[intCounter].ProjectName + "</b></td>";
                    strMessage += "<td><b>" + Convert.ToString(TheCompleteProjectProductivityDataSet.completeprojectproductivity[intCounter].TotalHours) + "</b></td>";
                    strMessage += "<td><b>" + Convert.ToString(TheCompleteProjectProductivityDataSet.completeprojectproductivity[intCounter].TotalCosts) + "</b></td>";
                    strMessage += "</tr>";
                }

                strMessage += "<table>";

                strEmailAddress = "*****@*****.**";

                blnFatalError = (TheSendEmailClass.SendEmail(strEmailAddress, strHeader, strMessage));

                if (blnFatalError == true)
                {
                    throw new Exception();
                }

                intNumberOfRecords = TheFindProductivityManagersForEmailDataSet.FindProductivityManagersForEmail.Rows.Count - 1;

                strFileName = "Productivity Report For " + Convert.ToString(datEndDate.Month) + "-" + Convert.ToString(datEndDate.Day) + "-" + Convert.ToString(datEndDate.Year);

                blnFatalError = ExportToExcel(strFileName, strPath);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Event Log Tracker // Automated Production Reports Class // Run Automated Production Report " + Ex.Message);

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