Exemplo n.º 1
0
        private void CheckEmployeePayRate()
        {
            int intCounter;
            int intNumberOfRecords;
            int intEmployeeID;
            int intRecordsReturned;
            bool blnFatalError = false;

            try
            {
                TheFindActiveEmployeesDataSet = TheEmployeeClass.FindActiveEmployees();

                intNumberOfRecords = TheFindActiveEmployeesDataSet.FindActiveEmployees.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    intEmployeeID = TheFindActiveEmployeesDataSet.FindActiveEmployees[intCounter].EmployeeID;

                    TheFindEmployeeLaborRateDataSet = TheEmployeeLaborRateClass.FindEmployeeLaborRate(intEmployeeID);

                    intRecordsReturned = TheFindEmployeeLaborRateDataSet.FindEmployeeLaborRate.Rows.Count;

                    if(intRecordsReturned == 0)
                    {
                        blnFatalError = TheEmployeeLaborRateClass.InsertEmployeeLaborRate(intEmployeeID, 1);

                        if (blnFatalError == true)
                            throw new Exception();
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Event Log Tracker // Cheeck Employee Pay Rate " + Ex.Message);

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

            
            
        }
Exemplo n.º 2
0
        private void cboSelectEmployee_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //setting local variables
            int intSelectedIndex;
            int intRecordsReturned;

            try
            {
                intSelectedIndex = cboSelectEmployee.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    MainWindow.gintEmployeeID = TheComboEmployeeDataSet.employees[intSelectedIndex].EmployeeID;

                    TheFindEmployeeLaborRateDataSet = TheEmployeeLaborRateClass.FindEmployeeLaborRate(MainWindow.gintEmployeeID);

                    intRecordsReturned = TheFindEmployeeLaborRateDataSet.FindEmployeeLaborRate.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        gblnNewRecord     = true;
                        txtLaborRate.Text = "None Found";
                    }
                    else if (intRecordsReturned > 0)
                    {
                        gblnNewRecord     = false;
                        txtLaborRate.Text = Convert.ToString(TheFindEmployeeLaborRateDataSet.FindEmployeeLaborRate[0].PayRate);
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Employee Labor Rate // Combo Selection Changed Event " + Ex.Message);

                TheSendEmailClass.SendEventLog(Ex.ToString());

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemplo n.º 3
0
        private void cboSelectManager_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int      intSelectedIndex;
            bool     blnFatalError      = false;
            bool     blnThereIsAProblem = false;
            string   strErrorMessage    = "";
            string   strValueForValidation;
            DateTime datTransactionDate;
            DateTime datLimitingDate;
            string   strFirstName;
            string   strLastName;
            decimal  decProductivityHours;
            double   douPunchedHours;
            decimal  decLaborRate;
            decimal  decPunchedHours;
            int      intEmployeeID;
            int      intCounter;
            int      intNumberOfRecords;
            int      intRecordsReturned;
            decimal  decStraightHours  = 0;
            decimal  decOverTimeHours  = 0;
            decimal  decStraightCost   = 0;
            decimal  decOverTimeCosts  = 0;
            decimal  decOverTimeRate   = 0;
            double   douTotalLaborCost = 0;
            decimal  decHourVariance   = 0;

            try
            {
                intSelectedIndex = cboSelectManager.SelectedIndex - 1;
                TheEmployeePunchesProductivityDataSet.employeepunchesproductivity.Rows.Clear();

                if (intSelectedIndex > -1)
                {
                    strValueForValidation = txtStartDate.Text;
                    blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                    if (blnThereIsAProblem == true)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Start Date is not a Date\n";
                    }
                    else
                    {
                        gdatStartDate = Convert.ToDateTime(strValueForValidation);
                    }
                    strValueForValidation = txtEndDate.Text;
                    blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                    if (blnThereIsAProblem == true)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The End Date is not a Date\n";
                    }
                    else
                    {
                        gdatEndDate = Convert.ToDateTime(strValueForValidation);
                    }
                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage(strErrorMessage);
                        return;
                    }
                    else
                    {
                        blnFatalError = TheDataValidationClass.verifyDateRange(gdatStartDate, gdatEndDate);
                        if (blnFatalError == true)
                        {
                            TheMessagesClass.ErrorMessage("The Start Date is after the End Date");
                            return;
                        }
                    }

                    gintManagerID = TheFindProductionManagersDataSet.FindProductionManagers[intSelectedIndex].EmployeeID;

                    TheFindSortedManagerHourlyemployeesDataSet = TheEmployeeClass.FindSortedManagersHourlyEmployees(gintManagerID);

                    intNumberOfRecords = TheFindSortedManagerHourlyemployeesDataSet.FindSortedManagersHourlyEmployees.Rows.Count - 1;

                    datTransactionDate = gdatStartDate;
                    datLimitingDate    = TheDateSearchClass.AddingDays(datTransactionDate, 1);
                    datLimitingDate    = datLimitingDate.AddSeconds(-1);

                    while (datLimitingDate <= gdatEndDate)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            intEmployeeID = TheFindSortedManagerHourlyemployeesDataSet.FindSortedManagersHourlyEmployees[intCounter].EmployeeID;

                            TheFindEmployeeProductionHoursOverPayPeriodDataSet = TheEmployeeProjectAssignmentClass.FindEmployeeProductionHoursOverPayPeriodDataSet(intEmployeeID, datTransactionDate, datTransactionDate);

                            intRecordsReturned = TheFindEmployeeProductionHoursOverPayPeriodDataSet.FindEmployeeProductionHoursOverPayPeriod.Rows.Count;

                            if (intRecordsReturned < 1)
                            {
                                decProductivityHours = 0;
                            }
                            else
                            {
                                decProductivityHours = TheFindEmployeeProductionHoursOverPayPeriodDataSet.FindEmployeeProductionHoursOverPayPeriod[0].ProductionHours;
                            }

                            TheFindAlohaEmployeeHoursOverDateRangeDataSet = TheEmployeePunchedHoursClass.FindAlohaEmployeeHoursOverDateRange(intEmployeeID, datTransactionDate, datLimitingDate);

                            intRecordsReturned = TheFindAlohaEmployeeHoursOverDateRangeDataSet.FindAlohaEmployeeHoursOverDateRange.Rows.Count;

                            if (intRecordsReturned > 0)
                            {
                                decPunchedHours = TheFindAlohaEmployeeHoursOverDateRangeDataSet.FindAlohaEmployeeHoursOverDateRange[0].TotalHours;

                                if (decPunchedHours > 8)
                                {
                                    decStraightHours = 8;
                                    decOverTimeHours = decPunchedHours - 8;
                                }
                                else
                                {
                                    decStraightHours = decPunchedHours;
                                    decOverTimeHours = 0;
                                }

                                TheFindEmployeeLaborRateDataSet = TheEmployeeLaborRateClass.FindEmployeeLaborRate(intEmployeeID);

                                decLaborRate = TheFindEmployeeLaborRateDataSet.FindEmployeeLaborRate[0].PayRate;

                                decStraightCost  = decStraightHours * decLaborRate;
                                decOverTimeRate  = decLaborRate * Convert.ToDecimal(1.5);
                                decOverTimeCosts = decOverTimeHours * decOverTimeRate;

                                strFirstName = TheFindSortedManagerHourlyemployeesDataSet.FindSortedManagersHourlyEmployees[intCounter].FirstName;
                                strLastName  = TheFindSortedManagerHourlyemployeesDataSet.FindSortedManagersHourlyEmployees[intCounter].LastName;

                                douTotalLaborCost = Math.Round(Convert.ToDouble(decStraightCost + decOverTimeCosts), 2);

                                if (decPunchedHours != 0)
                                {
                                    decHourVariance = decProductivityHours - decPunchedHours;

                                    EmployeePunchesProductivityDataSet.employeepunchesproductivityRow NewProductivityRow = TheEmployeePunchesProductivityDataSet.employeepunchesproductivity.NewemployeepunchesproductivityRow();

                                    NewProductivityRow.Date            = datTransactionDate;
                                    NewProductivityRow.FirstName       = strFirstName;
                                    NewProductivityRow.LastName        = strLastName;
                                    NewProductivityRow.TotalLaborCost  = Convert.ToDecimal(douTotalLaborCost);
                                    NewProductivityRow.HoursProductive = decProductivityHours;
                                    NewProductivityRow.HoursPunched    = decPunchedHours;
                                    NewProductivityRow.HourVariance    = decHourVariance;

                                    TheEmployeePunchesProductivityDataSet.employeepunchesproductivity.Rows.Add(NewProductivityRow);
                                }
                            }
                        }

                        datTransactionDate = datLimitingDate.AddSeconds(1);
                        datLimitingDate    = TheDateSearchClass.AddingDays(datLimitingDate, 1);
                    }

                    dgrResults.ItemsSource = TheEmployeePunchesProductivityDataSet.employeepunchesproductivity;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Manager Hourly Daily Report // Manager Selection " + Ex.Message);

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