private void mitEmailReport_Click(object sender, RoutedEventArgs e)
        {
            int    intCounter;
            int    intNumberOfRecords;
            string strMessage = "<h1>Daily Vehicle Inspection Notes</h1>";
            string strHeader  = "Daily Vehicle Inspection Report - Do Not Reply";

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                strMessage += "<table>";
                strMessage += "<tr>";
                strMessage += "<td><b>Vehicle Number</b></td>";
                strMessage += "<td><b>First Name</b></td>";
                strMessage += "<td><b>Last Name</b></td>";
                strMessage += "<td><b>Home Office</b></td>";
                strMessage += "<td><b>Odometer</b></td>";
                strMessage += "<td><b>Inspection Status</b></td>";
                strMessage += "<td><b>Inspection Notes</b></td>";
                strMessage += "</tr>";
                strMessage += "<p>               </p>";

                TodaysInspections();

                intNumberOfRecords = TheDailyVehicleInspectionReportDataSet.dailyinspection.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strMessage += "<tr>";
                    strMessage += "<td>" + TheDailyVehicleInspectionReportDataSet.dailyinspection[intCounter].VehicleNumber + "</td>";
                    strMessage += "<td>" + TheDailyVehicleInspectionReportDataSet.dailyinspection[intCounter].FirstName + "</td>";
                    strMessage += "<td>" + TheDailyVehicleInspectionReportDataSet.dailyinspection[intCounter].LastName + "</td>";
                    strMessage += "<td>" + TheDailyVehicleInspectionReportDataSet.dailyinspection[intCounter].HomeOffice + "</td>";
                    strMessage += "<td>" + Convert.ToString(TheDailyVehicleInspectionReportDataSet.dailyinspection[intCounter].OdometerReading) + "</td>";
                    strMessage += "<td>" + TheDailyVehicleInspectionReportDataSet.dailyinspection[intCounter].InspectionStatus + "</td>";
                    strMessage += "<td>" + TheDailyVehicleInspectionReportDataSet.dailyinspection[intCounter].InspectionNotes + "</td>";
                    strMessage += "</tr>";
                }

                strMessage += "</table>";

                TheSendEmailClass.VehicleReports(strHeader, strMessage);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Daily Vehicle Inspection Report // Email Report Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }
Esempio n. 2
0
        private void mitEmailReport_Click(object sender, RoutedEventArgs e)
        {
            int    intCounter;
            int    intNumberOfRecords;
            string strMessage = "";
            string strHeader  = "Vehicle Exception Report - Do Not Reply";

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                intNumberOfRecords = TheVehicleExceptionDataSet.vehicleexception.Rows.Count - 1;

                strMessage  = "<h1>Vehicle Exception Report<h1>";
                strMessage += "<table>";
                strMessage += "<tr>";
                strMessage += "<td><b>Vehicle Number</b></td>";
                strMessage += "<td><b>First Name</b></td>";
                strMessage += "<td><b>Last Name</b></td>";
                strMessage += "<td><b>Home Office</b></td>";
                strMessage += "</tr>";
                strMessage += "<p>               </p>";

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strMessage += "<tr>";
                    strMessage += "<td>" + TheVehicleExceptionDataSet.vehicleexception[intCounter].VehicleNumber + "</td>";
                    strMessage += "<td>" + TheVehicleExceptionDataSet.vehicleexception[intCounter].FirstName + "</td>";
                    strMessage += "<td>" + TheVehicleExceptionDataSet.vehicleexception[intCounter].LastName + "</td>";
                    strMessage += "<td>" + TheVehicleExceptionDataSet.vehicleexception[intCounter].AssignedOffice + "</td>";
                    strMessage += "</tr>";
                }

                strMessage += "<table>";

                TheSendEmailClass.VehicleReports(strHeader, strMessage);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP //Vehicle Exception Report // Email Report Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }
Esempio n. 3
0
        private void mitPrint_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            int      intCounter;
            int      intNumberOfRecords;
            int      intVehicleID;
            DateTime datTransactionDate;
            int      intSecondCounter;
            int      intSecondNumberOfRecords;
            string   strInspectStatus;
            string   strVehicleProblem;
            string   strInspectionNotes;
            int      intThirdCounter;
            int      intThirdNumberOfRecords;


            pdProblemReport = new PrintDialog();

            if (pdProblemReport.ShowDialog().Value)
            {
                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                try
                {
                    gdatEndDate = DateTime.Now;

                    gdatEndDate = TheDateSearchClass.RemoveTime(gdatEndDate);

                    gdatStartDate = TheDateSearchClass.SubtractingDays(gdatEndDate, 200);

                    intNumberOfRecords = TheSortedDOTAuditDataSete.dotaudit.Rows.Count - 1;

                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        TheDOTVehicleInspectionDataSet.inspectionresults.Rows.Clear();

                        intVehicleID = TheSortedDOTAuditDataSete.dotaudit[intCounter].VehicleID;

                        TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet = TheInspectionsClass.FindDailyVehicleInspectionByVehicleIDAndDateRange(intVehicleID, gdatStartDate, gdatEndDate);

                        intSecondNumberOfRecords = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange.Rows.Count - 1;

                        for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                        {
                            strInspectStatus   = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intSecondCounter].InspectionStatus;
                            datTransactionDate = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intSecondCounter].InspectionDate;
                            datTransactionDate = TheDateSearchClass.RemoveTime(datTransactionDate);
                            strVehicleProblem  = "";
                            strInspectionNotes = "";

                            if (strInspectStatus == "PASSED")
                            {
                                strVehicleProblem  = "NO PROBLEM REPORTED";
                                strInspectionNotes = "NO PROBLEM REPORTED";
                            }
                            else
                            {
                                TheFindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet = TheInspectionsClass.FindDailyVehicleInspectionProblemByVehicleIDAndDateRange(intVehicleID, datTransactionDate, datTransactionDate.AddDays(1));

                                intThirdNumberOfRecords = TheFindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionProblemsByVehicleIDAndDateRange.Rows.Count - 1;

                                for (intThirdCounter = 0; intThirdCounter <= intThirdNumberOfRecords; intThirdCounter++)
                                {
                                    if (TheFindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionProblemsByVehicleIDAndDateRange[intThirdCounter].VehicleProblem == null)
                                    {
                                        strVehicleProblem = TheFindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionProblemsByVehicleIDAndDateRange[intThirdCounter].InspectionNotes + "\n";
                                    }
                                    else
                                    {
                                        strVehicleProblem = TheFindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionProblemsByVehicleIDAndDateRange[intThirdCounter].VehicleProblem + "\n";
                                    }

                                    strInspectionNotes = TheFindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionProblemsByVehicleIDAndDateRange[intThirdCounter].InspectionNotes + "\n";
                                }
                            }


                            DOTVehicleInspectionDataSet.inspectionresultsRow NewInspectionRow = TheDOTVehicleInspectionDataSet.inspectionresults.NewinspectionresultsRow();

                            NewInspectionRow.VehicleNumber    = TheSortedDOTAuditDataSete.dotaudit[intCounter].VehicleNumber;
                            NewInspectionRow.InspectionNotes  = strInspectionNotes;
                            NewInspectionRow.InspectionStatus = strInspectStatus;
                            NewInspectionRow.OdometerReading  = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intSecondCounter].OdometerReading;
                            NewInspectionRow.TransactionDate  = datTransactionDate;
                            NewInspectionRow.VehicleProblem   = strVehicleProblem;

                            TheDOTVehicleInspectionDataSet.inspectionresults.Rows.Add(NewInspectionRow);
                        }

                        PrintReports();
                    }

                    dgrResults.ItemsSource = TheDOTVehicleInspectionDataSet.inspectionresults;
                }
                catch (Exception Ex)
                {
                    TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // DOT Audit Report // Process Menu Item " + Ex.Message);

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

                PleaseWait.Close();
            }
        }
Esempio n. 4
0
        private void cboSelectWarehouse_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int      intSelectedIndex;
            int      intWarehouseID;
            DateTime datStartDate  = DateTime.Now;
            DateTime datEndDate    = DateTime.Now;
            DateTime datTodaysDate = DateTime.Now;
            int      intCounter;
            int      intNumberOfRecords;
            int      intRecordsReturned;
            int      intPartID;
            int      intLoop;
            string   strPartNumber;
            double   douAverage;
            double   douSTDev;
            int      intCount;
            bool     blnDoNotCopy;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                intSelectedIndex = cboSelectWarehouse.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    TheCalculatedInventoryStatsDataSet.inventorystats.Rows.Clear();
                    TheFinalCalculatedInventoryStatsDataSet.inventorystats.Rows.Clear();

                    intWarehouseID = TheFindPartsWarehouseDataSet.FindPartsWarehouses[intSelectedIndex].EmployeeID;

                    TheFindWarehouseInventoryDataSet = TheInventoryClass.FindWarehouseInventory(intWarehouseID);

                    intNumberOfRecords = TheFindWarehouseInventoryDataSet.FindWarehouseInventory.Rows.Count - 1;

                    datTodaysDate = TheDateSearchClass.RemoveTime(datTodaysDate);


                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        datStartDate = TheDateSearchClass.SubtractingDays(datTodaysDate, 90);
                        datEndDate   = TheDateSearchClass.AddingDays(datStartDate, 30);
                        intLoop      = 1;

                        strPartNumber = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intCounter].PartNumber;

                        TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                        intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;

                        CalculatedInventoryStatsDataSet.inventorystatsRow NewInventoryRow = TheCalculatedInventoryStatsDataSet.inventorystats.NewinventorystatsRow();

                        NewInventoryRow.PartID          = intPartID;
                        NewInventoryRow.JDEPartNumber   = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intCounter].JDEPartNumber;
                        NewInventoryRow.PartDescription = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intCounter].PartDescription;
                        NewInventoryRow.PartNumber      = strPartNumber;

                        while (datStartDate < datTodaysDate)
                        {
                            TheFindInventoryIssueStatsDataSet = TheInventoryStatsClass.FindInventoryIssueStats(intPartID, intWarehouseID, datStartDate, datEndDate);

                            intRecordsReturned = TheFindInventoryIssueStatsDataSet.FindInventoryIssueStats.Rows.Count;

                            if (intRecordsReturned == 0)
                            {
                                douAverage = 0;
                                douSTDev   = 0;
                                intCount   = 0;
                            }
                            else
                            {
                                if (TheFindInventoryIssueStatsDataSet.FindInventoryIssueStats[0].IsAverageIssuedNull() == true)
                                {
                                    douAverage = 0;
                                }
                                else
                                {
                                    douAverage = TheFindInventoryIssueStatsDataSet.FindInventoryIssueStats[0].AverageIssued;
                                }
                                if (TheFindInventoryIssueStatsDataSet.FindInventoryIssueStats[0].IsIssuedSTDEVNull() == true)
                                {
                                    douSTDev = 0;
                                }
                                else
                                {
                                    douSTDev = TheFindInventoryIssueStatsDataSet.FindInventoryIssueStats[0].IssuedSTDEV;
                                }

                                intCount = TheFindInventoryIssueStatsDataSet.FindInventoryIssueStats[0].TotalIssued;
                            }

                            if (intLoop == 1)
                            {
                                NewInventoryRow.PeriodOneAvg      = douAverage;
                                NewInventoryRow.PeriodOneCount    = intCount;
                                NewInventoryRow.PeriodOneSD       = douSTDev;
                                NewInventoryRow.PeriodOneStarDate = datStartDate;
                            }
                            else if (intLoop == 2)
                            {
                                NewInventoryRow.PeriodTwoAvg       = douAverage;
                                NewInventoryRow.PeriodTwoCount     = intCount;
                                NewInventoryRow.PeriodTwoSD        = douSTDev;
                                NewInventoryRow.PeriodTwoStartDate = datStartDate;
                            }
                            else if (intLoop == 3)
                            {
                                NewInventoryRow.PeriodThreeAvg       = douAverage;
                                NewInventoryRow.PeriodThreeCount     = intCount;
                                NewInventoryRow.PeriodThreeSD        = douSTDev;
                                NewInventoryRow.PeriodThreeStartDate = datStartDate;
                            }

                            datStartDate = datEndDate;
                            datEndDate   = TheDateSearchClass.AddingDays(datEndDate, 30);
                            intLoop++;
                        }

                        TheCalculatedInventoryStatsDataSet.inventorystats.Rows.Add(NewInventoryRow);
                    }

                    intNumberOfRecords = TheCalculatedInventoryStatsDataSet.inventorystats.Rows.Count - 1;

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

                        if (TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodOneAvg == 0)
                        {
                            if (TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodTwoAvg == 0)
                            {
                                if (TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodThreeAvg == 0)
                                {
                                    blnDoNotCopy = true;
                                }
                            }
                        }

                        if (blnDoNotCopy == false)
                        {
                            CalculatedInventoryStatsDataSet.inventorystatsRow NewStatsRow = TheFinalCalculatedInventoryStatsDataSet.inventorystats.NewinventorystatsRow();

                            NewStatsRow.JDEPartNumber        = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].JDEPartNumber;
                            NewStatsRow.PartDescription      = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PartDescription;
                            NewStatsRow.PartID               = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PartID;
                            NewStatsRow.PartNumber           = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PartNumber;
                            NewStatsRow.PeriodOneAvg         = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodOneAvg;
                            NewStatsRow.PeriodOneCount       = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodOneCount;
                            NewStatsRow.PeriodOneSD          = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodOneSD;
                            NewStatsRow.PeriodThreeAvg       = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodThreeAvg;
                            NewStatsRow.PeriodThreeCount     = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodThreeCount;
                            NewStatsRow.PeriodThreeSD        = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodThreeSD;
                            NewStatsRow.PeriodTwoAvg         = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodTwoAvg;
                            NewStatsRow.PeriodTwoCount       = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodTwoCount;
                            NewStatsRow.PeriodTwoSD          = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodTwoSD;
                            NewStatsRow.PeriodOneStarDate    = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodOneStarDate;
                            NewStatsRow.PeriodThreeStartDate = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodThreeStartDate;
                            NewStatsRow.PeriodTwoStartDate   = TheCalculatedInventoryStatsDataSet.inventorystats[intCounter].PeriodTwoStartDate;

                            TheFinalCalculatedInventoryStatsDataSet.inventorystats.Rows.Add(NewStatsRow);
                        }
                    }

                    dgrResults.ItemsSource = TheFinalCalculatedInventoryStatsDataSet.inventorystats;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Inventory Stats // Main Window // Combo Box Changed " + Ex.Message);

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

            PleaseWait.Close();
        }
        private void mitPrint_Click(object sender, RoutedEventArgs e)
        {
            int intCurrentRow = 0;
            int intCounter;
            int intColumns;
            int intNumberOfRecords;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                PrintDialog pdCancelledReport = new PrintDialog();

                if (pdCancelledReport.ShowDialog().Value)
                {
                    FlowDocument fdCancelledLines = new FlowDocument();
                    Thickness    thickness        = new Thickness(100, 50, 50, 50);
                    fdCancelledLines.PagePadding = thickness;

                    //Set Up Table Columns
                    Table cancelledTable = new Table();
                    fdCancelledLines.Blocks.Add(cancelledTable);
                    cancelledTable.CellSpacing = 0;
                    intColumns = TheProjectMaterialReportDataSet.projectmaterial.Columns.Count;

                    for (int intColumnCounter = 0; intColumnCounter < intColumns; intColumnCounter++)
                    {
                        cancelledTable.Columns.Add(new TableColumn());
                    }
                    cancelledTable.RowGroups.Add(new TableRowGroup());

                    //Title row
                    cancelledTable.RowGroups[0].Rows.Add(new TableRow());
                    TableRow newTableRow = cancelledTable.RowGroups[0].Rows[intCurrentRow];
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Project Material Report"))));
                    newTableRow.Cells[0].FontSize      = 20;
                    newTableRow.Cells[0].FontFamily    = new FontFamily("Times New Roman");
                    newTableRow.Cells[0].ColumnSpan    = intColumns;
                    newTableRow.Cells[0].TextAlignment = TextAlignment.Center;
                    newTableRow.Cells[0].Padding       = new Thickness(0, 0, 0, 20);

                    //Title row
                    cancelledTable.RowGroups[0].Rows.Add(new TableRow());
                    intCurrentRow++;
                    newTableRow = cancelledTable.RowGroups[0].Rows[intCurrentRow];
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Total Cost $" + txtProjectCost.Text))));
                    newTableRow.Cells[0].FontSize      = 16;
                    newTableRow.Cells[0].FontFamily    = new FontFamily("Times New Roman");
                    newTableRow.Cells[0].ColumnSpan    = intColumns;
                    newTableRow.Cells[0].TextAlignment = TextAlignment.Center;
                    newTableRow.Cells[0].Padding       = new Thickness(0, 0, 0, 20);

                    //Header Row
                    cancelledTable.RowGroups[0].Rows.Add(new TableRow());
                    intCurrentRow++;
                    newTableRow = cancelledTable.RowGroups[0].Rows[intCurrentRow];
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Transaction ID"))));
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Part ID"))));
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Part Number"))));
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("JDE Part Number"))));
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Description"))));
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Issued"))));
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Warehouse"))));
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Cost"))));

                    //Format Header Row
                    for (intCounter = 0; intCounter < intColumns; intCounter++)
                    {
                        newTableRow.Cells[intCounter].FontSize        = 11;
                        newTableRow.Cells[intCounter].FontFamily      = new FontFamily("Times New Roman");
                        newTableRow.Cells[intCounter].BorderBrush     = Brushes.Black;
                        newTableRow.Cells[intCounter].TextAlignment   = TextAlignment.Center;
                        newTableRow.Cells[intCounter].BorderThickness = new Thickness();
                    }

                    intNumberOfRecords = TheProjectMaterialReportDataSet.projectmaterial.Rows.Count;

                    //Data, Format Data

                    for (int intReportRowCounter = 0; intReportRowCounter < intNumberOfRecords; intReportRowCounter++)
                    {
                        cancelledTable.RowGroups[0].Rows.Add(new TableRow());
                        intCurrentRow++;
                        newTableRow = cancelledTable.RowGroups[0].Rows[intCurrentRow];
                        for (int intColumnCounter = 0; intColumnCounter < intColumns; intColumnCounter++)
                        {
                            newTableRow.Cells.Add(new TableCell(new Paragraph(new Run(TheProjectMaterialReportDataSet.projectmaterial[intReportRowCounter][intColumnCounter].ToString()))));


                            newTableRow.Cells[intColumnCounter].FontSize = 12;
                            newTableRow.Cells[0].FontFamily = new FontFamily("Times New Roman");
                            newTableRow.Cells[intColumnCounter].BorderBrush     = Brushes.LightSteelBlue;
                            newTableRow.Cells[intColumnCounter].BorderThickness = new Thickness(0, 0, 0, 1);
                            newTableRow.Cells[intColumnCounter].TextAlignment   = TextAlignment.Center;
                        }
                    }

                    //Set up page and print
                    fdCancelledLines.ColumnWidth = pdCancelledReport.PrintableAreaWidth;
                    fdCancelledLines.PageHeight  = pdCancelledReport.PrintableAreaHeight;
                    fdCancelledLines.PageWidth   = pdCancelledReport.PrintableAreaWidth;
                    pdCancelledReport.PrintDocument(((IDocumentPaginatorSource)fdCancelledLines).DocumentPaginator, "Project Material Report");
                    intCurrentRow = 0;
                }
            }
            catch (Exception Ex)
            {
                TheMessagesClass.ErrorMessage(Ex.ToString());

                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Project Material // Print Menu Item " + Ex.Message);
            }

            PleaseWait.Close();
        }
Esempio n. 6
0
        private void mitExportToExcel_Click(object sender, RoutedEventArgs e)
        {
            int intRowCounter;
            int intRowNumberOfRecords;
            int intColumnCounter;
            int intColumnNumberOfRecords;

            // Creating a Excel object.
            Microsoft.Office.Interop.Excel._Application excel     = new Microsoft.Office.Interop.Excel.Application();
            Microsoft.Office.Interop.Excel._Workbook    workbook  = excel.Workbooks.Add(Type.Missing);
            Microsoft.Office.Interop.Excel._Worksheet   worksheet = null;

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

                worksheet = workbook.ActiveSheet;

                worksheet.Name = "InventorySheet";

                int cellRowIndex    = 1;
                int cellColumnIndex = 1;
                intRowNumberOfRecords    = TheViewToolHistoryDataSet.toolhistory.Rows.Count;
                intColumnNumberOfRecords = TheViewToolHistoryDataSet.toolhistory.Columns.Count;

                for (intColumnCounter = 0; intColumnCounter < intColumnNumberOfRecords; intColumnCounter++)
                {
                    worksheet.Cells[cellRowIndex, cellColumnIndex] = TheViewToolHistoryDataSet.toolhistory.Columns[intColumnCounter].ColumnName;

                    cellColumnIndex++;
                }

                cellRowIndex++;
                cellColumnIndex = 1;

                //Loop through each row and read value from each column.
                for (intRowCounter = 0; intRowCounter < intRowNumberOfRecords; intRowCounter++)
                {
                    for (intColumnCounter = 0; intColumnCounter < intColumnNumberOfRecords; intColumnCounter++)
                    {
                        worksheet.Cells[cellRowIndex, cellColumnIndex] = TheViewToolHistoryDataSet.toolhistory.Rows[intRowCounter][intColumnCounter].ToString();

                        cellColumnIndex++;
                    }
                    cellColumnIndex = 1;
                    cellRowIndex++;
                }

                PleaseWait.Close();

                //Getting the location and file name of the excel to save from user.
                SaveFileDialog saveDialog = new SaveFileDialog();
                saveDialog.Filter      = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*";
                saveDialog.FilterIndex = 1;

                saveDialog.ShowDialog();

                workbook.SaveAs(saveDialog.FileName);
                MessageBox.Show("Export Successful");
            }
            catch (System.Exception ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Tool History // Export to Excel " + ex.Message);

                MessageBox.Show(ex.ToString());
            }
            finally
            {
                excel.Quit();
                workbook = null;
                excel    = null;
            }
        }
        private void mitImportExcel_Click(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            string strVehicleNumber;
            int    intRecordsReturned;
            string strAssignedOffice;
            string strIMEI;
            int    intGPSStatusID;
            int    intDOTStatusID;
            string strDOTStatus;
            string strGPSStatus;

            try
            {
                TheImportVehiclesDataSet.importvehicles.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

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

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strVehicleNumber = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2);

                    TheFindActiveVehicleMainShortVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainShortVehicleNumber(strVehicleNumber);

                    intRecordsReturned = TheFindActiveVehicleMainShortVehicleNumberDataSet.FindActiveVehicleMainShortVehicleNumber.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        strAssignedOffice = Convert.ToString((range.Cells[intCounter, 8] as Excel.Range).Value2).ToUpper();
                        strDOTStatus      = Convert.ToString((range.Cells[intCounter, 13] as Excel.Range).Value2).ToUpper();
                        strIMEI           = Convert.ToString((range.Cells[intCounter, 11] as Excel.Range).Value2).ToUpper();

                        MainWindow.gintEmployeeID = FindEmployeeID(strAssignedOffice);

                        if (MainWindow.gintEmployeeID < 1)
                        {
                            TheMessagesClass.ErrorMessage("Problems Find Assigned Office, Check the Spelling");

                            return;
                        }

                        TheFindDOTStatusByStatusDataSet = TheVehicleInfoClass.FindDOTStatusByStatus(strDOTStatus);

                        intRecordsReturned = TheFindDOTStatusByStatusDataSet.FindDOTStatusByStatus.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            TheMessagesClass.ErrorMessage("DOT Status Was Not Found, Check Spelling");

                            return;
                        }

                        intDOTStatusID = TheFindDOTStatusByStatusDataSet.FindDOTStatusByStatus[0].DOTStatusID;

                        if (strIMEI.Length > 12)
                        {
                            strGPSStatus = "IN USE";
                        }
                        else
                        {
                            strGPSStatus = "NOT IN USE";
                        }

                        TheFindGPSStatusByStatusDataSet = TheVehicleInfoClass.FindGPSStatusByStatus(strGPSStatus);

                        intGPSStatusID = TheFindGPSStatusByStatusDataSet.FindGPSStatusByStatus[0].GPSStatusID;

                        ImportVehiclesDataSet.importvehiclesRow NewVehicleRow = TheImportVehiclesDataSet.importvehicles.NewimportvehiclesRow();

                        NewVehicleRow.AssignedOffice      = strAssignedOffice;
                        NewVehicleRow.EmployeeID          = MainWindow.gintEmployeeID;
                        NewVehicleRow.CDLRequired         = Convert.ToString((range.Cells[intCounter, 9] as Excel.Range).Value2).ToUpper();
                        NewVehicleRow.DOTStatus           = strDOTStatus;
                        NewVehicleRow.IMEI                = strIMEI;
                        NewVehicleRow.MedicalCardRequired = Convert.ToString((range.Cells[intCounter, 10] as Excel.Range).Value2).ToUpper();
                        NewVehicleRow.OdometerReading     = Convert.ToInt32(Convert.ToString((range.Cells[intCounter, 6] as Excel.Range).Value2));
                        NewVehicleRow.TamperTag           = Convert.ToString((range.Cells[intCounter, 12] as Excel.Range).Value2).ToUpper();
                        NewVehicleRow.VehicleMake         = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();
                        NewVehicleRow.VehicleModel        = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2).ToUpper();
                        NewVehicleRow.VehicleNumber       = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                        NewVehicleRow.VINNumber           = Convert.ToString((range.Cells[intCounter, 7] as Excel.Range).Value2).ToUpper();
                        NewVehicleRow.Year                = Convert.ToInt32(Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2));
                        NewVehicleRow.DOTStatusID         = intDOTStatusID;
                        NewVehicleRow.GPSStatusID         = intGPSStatusID;
                        NewVehicleRow.LicensePlate        = Convert.ToString((range.Cells[intCounter, 5] as Excel.Range).Value2).ToUpper();

                        TheImportVehiclesDataSet.importvehicles.Rows.Add(NewVehicleRow);
                    }
                }

                PleaseWait.Close();
                dgrResults.ItemsSource = TheImportVehiclesDataSet.importvehicles;
                mitProcess.IsEnabled   = true;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Import Vehicles // Import Excel Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //setting local variables
            int     intCounter;
            int     intNumberOfRecords;
            int     intProjectID         = 0;
            int     intTaskID            = 0;
            decimal decTotalFootage      = 0;
            string  strWorkTask          = "";
            string  strAssignedProjectID = "";
            bool    blnItemFound;
            int     intSummaryCounter;
            decimal decHours;
            int     intSecondCounter;
            int     intSecondNumberOfRecords;


            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            gdecTotalHours = 0;

            try
            {
                TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(MainWindow.gintEmployeeID);

                MainWindow.gstrFirstName = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName;
                MainWindow.gstrLastName  = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].LastName;

                TheFindEmployeeTaskHoursByEmployeeIDDataSet = TheEmployeeProjectAssignmentClass.FindEmployeeTaskHoursByEmployeeID(MainWindow.gintEmployeeID, MainWindow.gdatStartDate, MainWindow.gdatEndDate);

                intNumberOfRecords = TheFindEmployeeTaskHoursByEmployeeIDDataSet.FindEmployeeTaskHoursByEmployeeID.Rows.Count - 1;

                gintSummaryCounter         = 0;
                gintSummaryNumberOfRecords = 0;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    gdecTotalHours += TheFindEmployeeTaskHoursByEmployeeIDDataSet.FindEmployeeTaskHoursByEmployeeID[intCounter].EmployeeTotalHours;
                    intProjectID    = TheFindEmployeeTaskHoursByEmployeeIDDataSet.FindEmployeeTaskHoursByEmployeeID[intCounter].ProjectID;
                    intTaskID       = TheFindEmployeeTaskHoursByEmployeeIDDataSet.FindEmployeeTaskHoursByEmployeeID[intCounter].TaskID;
                    decHours        = TheFindEmployeeTaskHoursByEmployeeIDDataSet.FindEmployeeTaskHoursByEmployeeID[intCounter].EmployeeTotalHours;
                    blnItemFound    = false;
                    TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(intProjectID);
                    strAssignedProjectID             = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].AssignedProjectID;
                    TheFindWorkTaskByTaskIDDataSet   = TheWorkTaskClass.FindWorkTaskByWorkTaskID(intTaskID);
                    strWorkTask = TheFindWorkTaskByTaskIDDataSet.FindWorkTaskByWorkTaskID[0].WorkTask;

                    if (gintSummaryCounter > 0)
                    {
                        for (intSummaryCounter = 0; intSummaryCounter <= gintSummaryNumberOfRecords; intSummaryCounter++)
                        {
                            if (strAssignedProjectID == TheEmployeeProjectSummaryDataSet.projectsummary[intSummaryCounter].AssignedProjectID)
                            {
                                if (strWorkTask == TheEmployeeProjectSummaryDataSet.projectsummary[intSummaryCounter].WorkTask)
                                {
                                    TheEmployeeProjectSummaryDataSet.projectsummary[intSummaryCounter].TotalHours += decHours;
                                    blnItemFound = true;
                                }
                            }
                        }
                    }

                    if (blnItemFound == false)
                    {
                        EmployeeProjectSummaryDataSet.projectsummaryRow NewTaskRow = TheEmployeeProjectSummaryDataSet.projectsummary.NewprojectsummaryRow();

                        NewTaskRow.AssignedProjectID  = strAssignedProjectID;
                        NewTaskRow.TotalFootagePieces = decTotalFootage;
                        NewTaskRow.TotalHours         = decHours;
                        NewTaskRow.WorkTask           = strWorkTask;
                        NewTaskRow.TaskID             = intTaskID;
                        NewTaskRow.ProjectID          = intProjectID;

                        TheEmployeeProjectSummaryDataSet.projectsummary.Rows.Add(NewTaskRow);
                        gintSummaryNumberOfRecords = gintSummaryCounter;
                        gintSummaryCounter++;
                    }
                }

                intNumberOfRecords = TheEmployeeProjectSummaryDataSet.projectsummary.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    intProjectID    = TheEmployeeProjectSummaryDataSet.projectsummary[intCounter].ProjectID;
                    intTaskID       = TheEmployeeProjectSummaryDataSet.projectsummary[intCounter].TaskID;
                    decTotalFootage = 0;

                    TheFindProjectTaskEmployeeStatsDataSet = TheEmployeeProductivityStatsClass.FindProjectTaskEmployeeStats(MainWindow.gintEmployeeID, intProjectID, MainWindow.gdatStartDate, MainWindow.gdatEndDate);

                    intSecondNumberOfRecords = TheFindProjectTaskEmployeeStatsDataSet.FindProjectTaskEmployeeStats.Rows.Count - 1;

                    if (intSecondNumberOfRecords > -1)
                    {
                        for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                        {
                            if (intTaskID == TheFindProjectTaskEmployeeStatsDataSet.FindProjectTaskEmployeeStats[intSecondCounter].WorkTaskID)
                            {
                                decTotalFootage += TheFindProjectTaskEmployeeStatsDataSet.FindProjectTaskEmployeeStats[intSecondCounter].FootagePieces;
                            }
                        }
                    }

                    TheEmployeeProjectSummaryDataSet.projectsummary[intCounter].TotalFootagePieces = decTotalFootage;
                }

                txtTotalHours.Text     = Convert.ToString(gdecTotalHours);
                dgrResults.ItemsSource = TheEmployeeProjectSummaryDataSet.projectsummary;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Find Employee Hours // Generate Report Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }
Esempio n. 9
0
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            bool     blnFatalError         = false;
            bool     blnThereIsAProblem    = false;
            string   strValueForValidation = "";
            DateTime datStartDate          = DateTime.Now;
            DateTime datEndDate            = DateTime.Now;
            string   strErrorMessage       = "";
            int      intRecordsReturned;
            int      intCounter;
            int      intNumberOfRecords;
            int      intInspectionID;
            string   strNotes;
            string   strCleanlinessNotes;
            string   strToolNotes;
            bool     blnConesCorrect;
            bool     blnSignsCorrect;
            bool     blnFirstAidKitCorrect;
            bool     blnFireExtinguisherCorrect;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                //clearing the data set
                TheAuditReportDataSet.auditreport.Rows.Clear();

                //data validation
                strValueForValidation = txtStartDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError   = true;
                    strErrorMessage = "The Start Date is not a Date\n";
                }
                else
                {
                    datStartDate = Convert.ToDateTime(strValueForValidation);
                    datStartDate = TheDateSearchClass.RemoveTime(datStartDate);
                }
                strValueForValidation = txtEndDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError   = true;
                    strErrorMessage = "The End Date is not a Date\n";
                }
                else
                {
                    datEndDate = Convert.ToDateTime(strValueForValidation);
                    datEndDate = TheDateSearchClass.RemoveTime(datEndDate);
                    datEndDate = TheDateSearchClass.AddingDays(datEndDate, 1);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    PleaseWait.Close();
                    return;
                }

                TheFindWeeklyVehicleMainInspectionbyDateRangeDataSet = TheWeeklyInspectionClass.FindWeeklyVehicleMainInspectionByDateRange(datStartDate, datEndDate);

                intNumberOfRecords = TheFindWeeklyVehicleMainInspectionbyDateRangeDataSet.FindWeeklyVehicleMainInspectionByDateRange.Rows.Count - 1;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        strNotes        = " ";
                        intInspectionID = TheFindWeeklyVehicleMainInspectionbyDateRangeDataSet.FindWeeklyVehicleMainInspectionByDateRange[intCounter].TransactionID;

                        TheFindWeeklyVehicleMainInspectionProblemsByInspectionIDDataSet = TheWeeklyInspectionClass.FindWeeklyVehicleMainInspectionProblemByInspectionID(intInspectionID);

                        TheFindWeeklyVehicleCleanlinessByInspectionIDDataSet = TheWeeklyVehicleCleanlinessClass.FindWeeklyVehicleCleanlinessbyInspectionID(intInspectionID);

                        intRecordsReturned = TheFindWeeklyVehicleCleanlinessByInspectionIDDataSet.FindWeeklyVehicleCleanlinessByInspectionID.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            strCleanlinessNotes = TheFindWeeklyVehicleCleanlinessByInspectionIDDataSet.FindWeeklyVehicleCleanlinessByInspectionID[0].CleanlinessNotes;
                        }
                        else
                        {
                            strCleanlinessNotes = "NO NOTES ENTERED";
                        }

                        intRecordsReturned = TheFindWeeklyVehicleMainInspectionProblemsByInspectionIDDataSet.FindWeeklyVehicleMainInspectionProblemByInspectionID.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            strNotes = TheFindWeeklyVehicleMainInspectionProblemsByInspectionIDDataSet.FindWeeklyVehicleMainInspectionProblemByInspectionID[0].VehicleProblem;
                        }

                        TheFindWeeklyBulkToolInspectionByInspectionIDDataSet = TheWeeklyBulkToolInspectionClass.FindWeeklyBulkToolInspectionByInspectionID(intInspectionID);

                        intRecordsReturned = TheFindWeeklyBulkToolInspectionByInspectionIDDataSet.FindWeeklyBulkToolInspectionByInspectionID.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            strToolNotes               = "NO INSPECTION NOTES WERE FOUND";
                            blnConesCorrect            = false;
                            blnSignsCorrect            = false;
                            blnFirstAidKitCorrect      = false;
                            blnFireExtinguisherCorrect = false;
                        }
                        else
                        {
                            if (TheFindWeeklyBulkToolInspectionByInspectionIDDataSet.FindWeeklyBulkToolInspectionByInspectionID[0].IsConesCorrectNull() == true)
                            {
                                blnConesCorrect = false;
                            }
                            else
                            {
                                blnConesCorrect = TheFindWeeklyBulkToolInspectionByInspectionIDDataSet.FindWeeklyBulkToolInspectionByInspectionID[0].ConesCorrect;
                            }

                            if (TheFindWeeklyBulkToolInspectionByInspectionIDDataSet.FindWeeklyBulkToolInspectionByInspectionID[0].IsSignsCorrectNull() == true)
                            {
                                blnSignsCorrect = false;
                            }
                            else
                            {
                                blnSignsCorrect = TheFindWeeklyBulkToolInspectionByInspectionIDDataSet.FindWeeklyBulkToolInspectionByInspectionID[0].SignsCorrect;
                            }

                            if (TheFindWeeklyBulkToolInspectionByInspectionIDDataSet.FindWeeklyBulkToolInspectionByInspectionID[0].IsFireExtingisherNull() == true)
                            {
                                blnFireExtinguisherCorrect = false;
                            }
                            else
                            {
                                blnFireExtinguisherCorrect = TheFindWeeklyBulkToolInspectionByInspectionIDDataSet.FindWeeklyBulkToolInspectionByInspectionID[0].FireExtingisher;
                            }

                            if (TheFindWeeklyBulkToolInspectionByInspectionIDDataSet.FindWeeklyBulkToolInspectionByInspectionID[0].IsFirstAidCorrectNull() == true)
                            {
                                blnFirstAidKitCorrect = false;
                            }
                            else
                            {
                                blnFirstAidKitCorrect = TheFindWeeklyBulkToolInspectionByInspectionIDDataSet.FindWeeklyBulkToolInspectionByInspectionID[0].FirstAidCorrect;
                            }

                            strToolNotes = TheFindWeeklyBulkToolInspectionByInspectionIDDataSet.FindWeeklyBulkToolInspectionByInspectionID[0].InspectionNotes;
                        }

                        AuditReportDataSet.auditreportRow NewInspectionRow = TheAuditReportDataSet.auditreport.NewauditreportRow();

                        NewInspectionRow.VehicleNumber           = TheFindWeeklyVehicleMainInspectionbyDateRangeDataSet.FindWeeklyVehicleMainInspectionByDateRange[intCounter].VehicleNumber;
                        NewInspectionRow.Date                    = TheFindWeeklyVehicleMainInspectionbyDateRangeDataSet.FindWeeklyVehicleMainInspectionByDateRange[intCounter].InspectionDate;
                        NewInspectionRow.Findings                = TheFindWeeklyVehicleMainInspectionbyDateRangeDataSet.FindWeeklyVehicleMainInspectionByDateRange[intCounter].InspectionStatus;
                        NewInspectionRow.FirstName               = TheFindWeeklyVehicleMainInspectionbyDateRangeDataSet.FindWeeklyVehicleMainInspectionByDateRange[intCounter].FirstName;
                        NewInspectionRow.LastName                = TheFindWeeklyVehicleMainInspectionbyDateRangeDataSet.FindWeeklyVehicleMainInspectionByDateRange[intCounter].LastName;
                        NewInspectionRow.Notes                   = strNotes;
                        NewInspectionRow.CleanlinessNotes        = strCleanlinessNotes;
                        NewInspectionRow.ToolNotes               = strToolNotes;
                        NewInspectionRow.ConesCorrect            = blnConesCorrect;
                        NewInspectionRow.SignsCorrect            = blnSignsCorrect;
                        NewInspectionRow.FirstAidCorrect         = blnFirstAidKitCorrect;
                        NewInspectionRow.FireExtinguisherCorrect = blnFireExtinguisherCorrect;

                        TheAuditReportDataSet.auditreport.Rows.Add(NewInspectionRow);
                    }
                }

                dgrResults.ItemsSource = TheAuditReportDataSet.auditreport;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Manager Weekly Inspection Report // Generate Report " + Ex.Message);

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

            PleaseWait.Close();
        }
        private void mitSelectSpreadSheet_Click(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            string strInformation = "";
            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;

            char[] chaInformation;
            int    intCharCounter;
            int    intCharLength;
            string strCompleteWord = "";
            int    intLength;

            try
            {
                TheImportedDataSet.importedjobs.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";           // Default file name
                dlg.DefaultExt = ".csv";               // Default file extension
                dlg.Filter     = "Excel (.csv)|*.csv"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

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

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count - 1;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strInformation = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2);

                    gintColumnCounter = 0;

                    chaInformation = strInformation.ToCharArray();

                    intCharLength = strInformation.Length - 1;

                    ImportedDataSet.importedjobsRow NewJobRow = TheImportedDataSet.importedjobs.NewimportedjobsRow();

                    NewJobRow.ScheduledDate = DateTime.Now;

                    for (intCharCounter = 0; intCharCounter <= intCharLength; intCharCounter++)
                    {
                        if (chaInformation[intCharCounter] != ',')
                        {
                            strCompleteWord += Convert.ToString(chaInformation[intCharCounter]);
                            strCompleteWord  = strCompleteWord.ToUpper();
                        }
                        else
                        {
                            if (gintColumnCounter == 1)
                            {
                                NewJobRow.WorkorderID = strCompleteWord;
                            }
                            else if (gintColumnCounter == 11)
                            {
                                NewJobRow.JobStatus = strCompleteWord;
                            }
                            else if (gintColumnCounter == 29)
                            {
                                strCompleteWord = strCompleteWord.Substring(2);

                                if (strCompleteWord == "MAPLE")
                                {
                                    strCompleteWord = "MAPLE HTS";
                                }

                                NewJobRow.Pool = strCompleteWord;
                            }
                            else if (gintColumnCounter == 57)
                            {
                                NewJobRow.AccountID = strCompleteWord;
                            }
                            else if (gintColumnCounter == 58)
                            {
                                NewJobRow.FirstName = strCompleteWord;
                            }
                            else if (gintColumnCounter == 59)
                            {
                                NewJobRow.LastName = strCompleteWord;
                            }
                            else if (gintColumnCounter == 60)
                            {
                                if (strCompleteWord == "(999) 999-9999")
                                {
                                    strCompleteWord = Convert.ToString(gintPhoneCounter);
                                    gintPhoneCounter++;
                                }
                                else if (strCompleteWord == "")
                                {
                                    strCompleteWord = Convert.ToString(gintPhoneCounter);
                                    gintPhoneCounter++;
                                }
                                else if (strCompleteWord == null)
                                {
                                    strCompleteWord = Convert.ToString(gintPhoneCounter);
                                    gintPhoneCounter++;
                                }

                                NewJobRow.PhoneNumber = strCompleteWord;
                            }
                            else if (gintColumnCounter == 75)
                            {
                                NewJobRow.StreetAddress = strCompleteWord;
                            }
                            else if (gintColumnCounter == 77)
                            {
                                NewJobRow.City = strCompleteWord;
                            }
                            else if (gintColumnCounter == 78)
                            {
                                NewJobRow.State = strCompleteWord;
                            }
                            else if (gintColumnCounter == 79)
                            {
                                intLength = strCompleteWord.Length;

                                if (intColumnRange > 5)
                                {
                                    strCompleteWord = strCompleteWord.Substring(0, 5);
                                }


                                NewJobRow.Zip = strCompleteWord;
                            }

                            strCompleteWord = "";
                            gintColumnCounter++;
                        }
                    }

                    TheImportedDataSet.importedjobs.Rows.Add(NewJobRow);
                }

                CheckOpenOrders();

                PleaseWait.Close();
                dgrResults.ItemsSource  = TheImportedDataSet.importedjobs;
                mitImportJobs.IsEnabled = true;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Import MDU Drop Bury Orders // Select Spreadsheet Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            string   strProjectID;
            int      intRecordsReturned;
            int      intCounter;
            int      intNumberOfRecords;
            string   strFirstName;
            string   strLastName;
            DateTime datTransactionDate;
            string   strWorkTask;
            int      intSecondCounter;
            int      intSecondNumberOfRecords;
            bool     blnItemFound;
            int      intTaskCounter;
            DateTime datStartDate = DateTime.Now;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                TheProjectDailyTaskDataSet.projecttask.Rows.Clear();
                TheProjectEmployeeHoursDataSet.employees.Rows.Clear();
                strProjectID = txtEnterProjectID.Text;
                if (strProjectID == "")
                {
                    TheMessagesClass.ErrorMessage("Project ID Was Not Entered");
                    PleaseWait.Close();
                    return;
                }

                gdecTotalHours = 0;
                TheEmployeeCrewDataSet.employeework.Rows.Clear();

                TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProjectID);

                intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    TheMessagesClass.InformationMessage("Project Was Not Found");
                    PleaseWait.Close();
                    return;
                }

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

                TheFindProjectTaskHoursByAssignedProjectIDDataSet = TheProjectTaskClass.FindProjectTaskHoursByAssignedProjectID(strProjectID);

                datStartDate = TheDataSearchClass.SubtractingDays(datStartDate, 1200);

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

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

                intSecondNumberOfRecords = 0;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strFirstName       = TheFindProjectHoursDataSet.FindProjectHours[intCounter].FirstName;
                    strLastName        = TheFindProjectHoursDataSet.FindProjectHours[intCounter].LastName;
                    strWorkTask        = TheFindProjectHoursDataSet.FindProjectHours[intCounter].WorkTask;
                    datTransactionDate = TheFindProjectHoursDataSet.FindProjectHours[intCounter].TransactionDate;
                    blnItemFound       = false;

                    gdecTotalHours += TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalHours;

                    if (intSecondNumberOfRecords > 0)
                    {
                        for (intSecondCounter = 0; intSecondCounter < intSecondNumberOfRecords; intSecondCounter++)
                        {
                            if (datTransactionDate == TheEmployeeCrewDataSet.employeework[intSecondCounter].TransactionDate)
                            {
                                if (strFirstName == TheEmployeeCrewDataSet.employeework[intSecondCounter].FirstName)
                                {
                                    if (strLastName == TheEmployeeCrewDataSet.employeework[intSecondCounter].LastName)
                                    {
                                        if (strWorkTask == TheEmployeeCrewDataSet.employeework[intSecondCounter].WorkTask)
                                        {
                                            blnItemFound = true;
                                            TheEmployeeCrewDataSet.employeework[intSecondCounter].Hours += TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalHours;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    if (blnItemFound == false)
                    {
                        EmployeeCrewDataSet.employeeworkRow NewEmployeeRow = TheEmployeeCrewDataSet.employeework.NewemployeeworkRow();

                        NewEmployeeRow.AssignedProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].AssignedProjectID;
                        NewEmployeeRow.Crew            = "";
                        NewEmployeeRow.FirstName       = strFirstName;
                        NewEmployeeRow.FootagePieces   = 0;
                        NewEmployeeRow.Hours           = TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalHours;
                        NewEmployeeRow.LastName        = strLastName;
                        NewEmployeeRow.ProjectName     = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectName;
                        NewEmployeeRow.TransactionDate = datTransactionDate;
                        NewEmployeeRow.WorkTask        = strWorkTask;

                        TheEmployeeCrewDataSet.employeework.Rows.Add(NewEmployeeRow);
                        intSecondNumberOfRecords++;
                    }
                }

                intNumberOfRecords = intSecondNumberOfRecords - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strFirstName       = TheEmployeeCrewDataSet.employeework[intCounter].FirstName;
                    strLastName        = TheEmployeeCrewDataSet.employeework[intCounter].LastName;
                    strWorkTask        = TheEmployeeCrewDataSet.employeework[intCounter].WorkTask;
                    datTransactionDate = TheEmployeeCrewDataSet.employeework[intCounter].TransactionDate;

                    TheFindWorkTaskByWorkTaskDataSet = TheWorkTaskClass.FindWorkTaskByWorkTask(strWorkTask);

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

                    MainWindow.gintEmployeeID = FindEmployeeID(strFirstName, strLastName);

                    if (MainWindow.gintEmployeeID == -1)
                    {
                        throw new Exception();
                    }

                    TheFindProjectWorkTaskDataSet = TheProjectTaskClass.FindProjectWorkTask(MainWindow.gintProjectID, MainWindow.gintEmployeeID, MainWindow.gintWorkTaskID, datTransactionDate, datTransactionDate);

                    intSecondNumberOfRecords = TheFindProjectWorkTaskDataSet.FindProjectWorkTask.Rows.Count - 1;

                    for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                    {
                        TheEmployeeCrewDataSet.employeework[intCounter].FootagePieces += TheFindProjectWorkTaskDataSet.FindProjectWorkTask[intSecondCounter].FootagePieces;
                    }

                    TheFindEmployeeCrewAssignmentByDateRange = TheEmployeeCrewAssignmentClass.FindEmployeeCrewAssignmentByDateRange(MainWindow.gintEmployeeID, datTransactionDate, datTransactionDate);

                    intSecondNumberOfRecords = TheFindEmployeeCrewAssignmentByDateRange.FindEmployeeCrewAssignmentByDateRange.Rows.Count - 1;

                    for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                    {
                        if (strProjectID == TheFindEmployeeCrewAssignmentByDateRange.FindEmployeeCrewAssignmentByDateRange[intSecondCounter].AssignedProjectID)
                        {
                            TheEmployeeCrewDataSet.employeework[intCounter].Crew = TheFindEmployeeCrewAssignmentByDateRange.FindEmployeeCrewAssignmentByDateRange[intSecondCounter].CrewID;
                        }
                    }
                }


                intNumberOfRecords  = TheEmployeeCrewDataSet.employeework.Rows.Count - 1;
                gintTaskCounter     = 0;
                gintTaskUIpperLimit = 0;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    blnItemFound       = false;
                    strWorkTask        = TheEmployeeCrewDataSet.employeework[intCounter].WorkTask;
                    datTransactionDate = TheEmployeeCrewDataSet.employeework[intCounter].TransactionDate;

                    if (gintTaskCounter > 0)
                    {
                        for (intTaskCounter = 0; intTaskCounter <= gintTaskUIpperLimit; intTaskCounter++)
                        {
                            if (datTransactionDate == TheProjectDailyTaskDataSet.projecttask[intTaskCounter].TransactionDate)
                            {
                                if (strWorkTask == TheProjectDailyTaskDataSet.projecttask[intTaskCounter].WorkTask)
                                {
                                    TheProjectDailyTaskDataSet.projecttask[intTaskCounter].Hours += TheEmployeeCrewDataSet.employeework[intCounter].Hours;
                                    blnItemFound = true;

                                    if (TheProjectDailyTaskDataSet.projecttask[intTaskCounter].Footage == 0)
                                    {
                                        TheProjectDailyTaskDataSet.projecttask[intTaskCounter].Footage = TheEmployeeCrewDataSet.employeework[intCounter].FootagePieces;
                                    }
                                }
                            }
                        }
                    }

                    if (blnItemFound == false)
                    {
                        ProjectDailyTaskDataSet.projecttaskRow NewTaskRow = TheProjectDailyTaskDataSet.projecttask.NewprojecttaskRow();

                        NewTaskRow.Crew            = TheEmployeeCrewDataSet.employeework[intCounter].Crew;
                        NewTaskRow.Footage         = TheEmployeeCrewDataSet.employeework[intCounter].FootagePieces;
                        NewTaskRow.Hours           = TheEmployeeCrewDataSet.employeework[intCounter].Hours;
                        NewTaskRow.TransactionDate = TheEmployeeCrewDataSet.employeework[intCounter].TransactionDate;
                        NewTaskRow.WorkTask        = TheEmployeeCrewDataSet.employeework[intCounter].WorkTask;

                        TheProjectDailyTaskDataSet.projecttask.Rows.Add(NewTaskRow);
                        gintTaskUIpperLimit = gintTaskCounter;
                        gintTaskCounter++;
                    }
                }

                txtTotalHours.Text = Convert.ToString(gdecTotalHours);

                intNumberOfRecords = TheFindProjectTaskHoursByAssignedProjectIDDataSet.FindProjectTaskHoursByAssignedProjectID.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    MainWindow.gintWorkTaskID = TheFindProjectTaskHoursByAssignedProjectIDDataSet.FindProjectTaskHoursByAssignedProjectID[intCounter].TaskID;
                    MainWindow.gintEmployeeID = TheFindProjectTaskHoursByAssignedProjectIDDataSet.FindProjectTaskHoursByAssignedProjectID[intCounter].EmployeeID;

                    TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(MainWindow.gintEmployeeID);

                    TheFindWorkTaskByTaskIDDataSet = TheWorkTaskClass.FindWorkTaskByWorkTaskID(MainWindow.gintWorkTaskID);

                    ProjectEmployeeHoursDataSet.employeesRow NewEmployeeRow = TheProjectEmployeeHoursDataSet.employees.NewemployeesRow();

                    NewEmployeeRow.FirstName       = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName;
                    NewEmployeeRow.LastName        = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].LastName;
                    NewEmployeeRow.TotalHours      = TheFindProjectTaskHoursByAssignedProjectIDDataSet.FindProjectTaskHoursByAssignedProjectID[intCounter].EmployeeTotalHours;
                    NewEmployeeRow.TransactionDate = TheFindProjectTaskHoursByAssignedProjectIDDataSet.FindProjectTaskHoursByAssignedProjectID[intCounter].TransactionDate;
                    NewEmployeeRow.WorkTask        = TheFindWorkTaskByTaskIDDataSet.FindWorkTaskByWorkTaskID[0].WorkTask;

                    TheProjectEmployeeHoursDataSet.employees.Rows.Add(NewEmployeeRow);
                }

                dgrResults.ItemsSource   = TheProjectDailyTaskDataSet.projecttask;
                dgrEmployees.ItemsSource = TheProjectEmployeeHoursDataSet.employees;
                bool blnFatalError = TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "Blue Jay ERP // Find Project Employee Hours // Generate Report Menu Item ");
            }
            catch (Exception Ex)
            {
                PleaseWait.Close();

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

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

            PleaseWait.Close();
        }
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            bool   blnThereIsAProblem = false;
            bool   blnFatalError      = false;
            string strValueForValidation;
            string strErrorMessage = "";
            int    intCounter;
            int    intNumberOfRecords;
            int    intInspectionID;
            int    intRecordsReturned;
            string strVehicleNumber;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                TheDailyVehicleInspectionReportDataSet.dailyinspection.Rows.Clear();

                strValueForValidation = txtStartDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "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 += "End Date is not a Date\n";
                }
                else
                {
                    gdatEndDate = Convert.ToDateTime(strValueForValidation);
                    gdatEndDate = TheDataSearchClass.RemoveTime(gdatEndDate);
                    gdatEndDate = TheDataSearchClass.AddingDays(gdatEndDate, 1);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    PleaseWait.Close();
                    return;
                }
                else
                {
                    blnFatalError = TheDataValidationClass.verifyDateRange(gdatStartDate, gdatEndDate);

                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage("Start Date is After the End Date");
                        PleaseWait.Close();
                        return;
                    }
                }

                if (gstrReportType == "DATE RANGE")
                {
                    TheFindDailyVehicleInspectionByDateRangeDataSet = TheInspectionClass.FindDailyVehicleInspectionByDateRange(gdatStartDate, gdatEndDate);

                    intNumberOfRecords = TheFindDailyVehicleInspectionByDateRangeDataSet.FindDailyVehicleInspectionByDateRange.Rows.Count - 1;

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            DailyVehicleInspectionReportDataSet.dailyinspectionRow NewInspectionRow = TheDailyVehicleInspectionReportDataSet.dailyinspection.NewdailyinspectionRow();

                            intInspectionID = TheFindDailyVehicleInspectionByDateRangeDataSet.FindDailyVehicleInspectionByDateRange[intCounter].TransactionID;

                            TheFindVehicleInspectionProblemByInsepctionIDDataSet = TheInspectionClass.FindVehicleInspectionProblemsbyInspectionID(intInspectionID);

                            intRecordsReturned = TheFindVehicleInspectionProblemByInsepctionIDDataSet.FindVehicleInspectionProblemsByInspectionID.Rows.Count;

                            if (intRecordsReturned == 0)
                            {
                                NewInspectionRow.InspectionNotes = "NO NOTES REPORTED";
                            }
                            else
                            {
                                NewInspectionRow.InspectionNotes = TheFindVehicleInspectionProblemByInsepctionIDDataSet.FindVehicleInspectionProblemsByInspectionID[0].InspectionNotes;
                            }

                            NewInspectionRow.FirstName        = TheFindDailyVehicleInspectionByDateRangeDataSet.FindDailyVehicleInspectionByDateRange[intCounter].FirstName;
                            NewInspectionRow.InspectionDate   = TheFindDailyVehicleInspectionByDateRangeDataSet.FindDailyVehicleInspectionByDateRange[intCounter].InspectionDate;
                            NewInspectionRow.InspectionID     = intInspectionID;
                            NewInspectionRow.InspectionStatus = TheFindDailyVehicleInspectionByDateRangeDataSet.FindDailyVehicleInspectionByDateRange[intCounter].InspectionStatus;
                            NewInspectionRow.LastName         = TheFindDailyVehicleInspectionByDateRangeDataSet.FindDailyVehicleInspectionByDateRange[intCounter].LastName;
                            NewInspectionRow.OdometerReading  = TheFindDailyVehicleInspectionByDateRangeDataSet.FindDailyVehicleInspectionByDateRange[intCounter].OdometerReading;
                            NewInspectionRow.VehicleID        = TheFindDailyVehicleInspectionByDateRangeDataSet.FindDailyVehicleInspectionByDateRange[intCounter].VehicleID;
                            NewInspectionRow.VehicleNumber    = TheFindDailyVehicleInspectionByDateRangeDataSet.FindDailyVehicleInspectionByDateRange[intCounter].VehicleNumber;
                            NewInspectionRow.HomeOffice       = TheFindDailyVehicleInspectionByDateRangeDataSet.FindDailyVehicleInspectionByDateRange[intCounter].AssignedOffice;

                            TheDailyVehicleInspectionReportDataSet.dailyinspection.Rows.Add(NewInspectionRow);
                        }
                    }
                }
                else if (gstrReportType == "EMPLOYEE")
                {
                    TheFindDailyVehicleInspectionByEmployeeIDAndDateRangeDataSet = TheInspectionClass.FindDailyVehicleInspectionByEmployeeIDAndDateRange(gintEmployeeID, gdatStartDate, gdatEndDate);

                    intNumberOfRecords = TheFindDailyVehicleInspectionByEmployeeIDAndDateRangeDataSet.FindDailyVehicleInspectionsByEmployeeIDAndDateRange.Rows.Count - 1;

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            DailyVehicleInspectionReportDataSet.dailyinspectionRow NewInspectionRow = TheDailyVehicleInspectionReportDataSet.dailyinspection.NewdailyinspectionRow();

                            intInspectionID = TheFindDailyVehicleInspectionByEmployeeIDAndDateRangeDataSet.FindDailyVehicleInspectionsByEmployeeIDAndDateRange[intCounter].TransactionID;

                            TheFindVehicleInspectionProblemByInsepctionIDDataSet = TheInspectionClass.FindVehicleInspectionProblemsbyInspectionID(intInspectionID);

                            intRecordsReturned = TheFindVehicleInspectionProblemByInsepctionIDDataSet.FindVehicleInspectionProblemsByInspectionID.Rows.Count;

                            if (intRecordsReturned == 0)
                            {
                                NewInspectionRow.InspectionNotes = "NO NOTES REPORTED";
                            }
                            else
                            {
                                NewInspectionRow.InspectionNotes = TheFindVehicleInspectionProblemByInsepctionIDDataSet.FindVehicleInspectionProblemsByInspectionID[0].InspectionNotes;
                            }

                            NewInspectionRow.FirstName        = TheFindDailyVehicleInspectionByEmployeeIDAndDateRangeDataSet.FindDailyVehicleInspectionsByEmployeeIDAndDateRange[intCounter].FirstName;
                            NewInspectionRow.InspectionDate   = TheFindDailyVehicleInspectionByEmployeeIDAndDateRangeDataSet.FindDailyVehicleInspectionsByEmployeeIDAndDateRange[intCounter].InspectionDate;
                            NewInspectionRow.InspectionID     = intInspectionID;
                            NewInspectionRow.InspectionStatus = TheFindDailyVehicleInspectionByEmployeeIDAndDateRangeDataSet.FindDailyVehicleInspectionsByEmployeeIDAndDateRange[intCounter].InspectionStatus;
                            NewInspectionRow.LastName         = TheFindDailyVehicleInspectionByEmployeeIDAndDateRangeDataSet.FindDailyVehicleInspectionsByEmployeeIDAndDateRange[intCounter].LastName;
                            NewInspectionRow.OdometerReading  = TheFindDailyVehicleInspectionByEmployeeIDAndDateRangeDataSet.FindDailyVehicleInspectionsByEmployeeIDAndDateRange[intCounter].OdometerReading;
                            NewInspectionRow.VehicleID        = TheFindDailyVehicleInspectionByEmployeeIDAndDateRangeDataSet.FindDailyVehicleInspectionsByEmployeeIDAndDateRange[intCounter].VehicleID;
                            NewInspectionRow.VehicleNumber    = TheFindDailyVehicleInspectionByEmployeeIDAndDateRangeDataSet.FindDailyVehicleInspectionsByEmployeeIDAndDateRange[intCounter].VehicleNumber;
                            NewInspectionRow.HomeOffice       = TheFindDailyVehicleInspectionByEmployeeIDAndDateRangeDataSet.FindDailyVehicleInspectionsByEmployeeIDAndDateRange[intCounter].AssignedOffice;

                            TheDailyVehicleInspectionReportDataSet.dailyinspection.Rows.Add(NewInspectionRow);
                        }
                    }
                }
                else if (gstrReportType == "VEHICLE NUMBER")
                {
                    strVehicleNumber = txtSearchInfo.Text;
                    if (strVehicleNumber == "")
                    {
                        TheMessagesClass.ErrorMessage("Vehicle Number Not Entered");
                        PleaseWait.Close();
                        return;
                    }

                    TheFindActiveVehicleMainByVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainByVehicleNumber(strVehicleNumber);

                    intRecordsReturned = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheMessagesClass.ErrorMessage("Vehicle Numbered Does Not Exist");
                        PleaseWait.Close();
                        return;
                    }
                    else
                    {
                        gintVehicleID = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VehicleID;
                    }

                    TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet = TheInspectionClass.FindDailyVehicleInspectionByVehicleIDAndDateRange(gintVehicleID, gdatStartDate, gdatEndDate);

                    intNumberOfRecords = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange.Rows.Count - 1;

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            DailyVehicleInspectionReportDataSet.dailyinspectionRow NewInspectionRow = TheDailyVehicleInspectionReportDataSet.dailyinspection.NewdailyinspectionRow();

                            intInspectionID = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intCounter].TransactionID;

                            TheFindVehicleInspectionProblemByInsepctionIDDataSet = TheInspectionClass.FindVehicleInspectionProblemsbyInspectionID(intInspectionID);

                            intRecordsReturned = TheFindVehicleInspectionProblemByInsepctionIDDataSet.FindVehicleInspectionProblemsByInspectionID.Rows.Count;

                            if (intRecordsReturned == 0)
                            {
                                NewInspectionRow.InspectionNotes = "NO NOTES REPORTED";
                            }
                            else
                            {
                                NewInspectionRow.InspectionNotes = TheFindVehicleInspectionProblemByInsepctionIDDataSet.FindVehicleInspectionProblemsByInspectionID[0].InspectionNotes;
                            }

                            NewInspectionRow.FirstName        = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intCounter].FirstName;
                            NewInspectionRow.InspectionDate   = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intCounter].InspectionDate;
                            NewInspectionRow.InspectionID     = intInspectionID;
                            NewInspectionRow.InspectionStatus = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intCounter].InspectionStatus;
                            NewInspectionRow.LastName         = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intCounter].LastName;
                            NewInspectionRow.OdometerReading  = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intCounter].OdometerReading;
                            NewInspectionRow.VehicleID        = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intCounter].VehicleID;
                            NewInspectionRow.VehicleNumber    = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intCounter].VehicleNumber;
                            NewInspectionRow.HomeOffice       = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intCounter].AssignedOffice;

                            TheDailyVehicleInspectionReportDataSet.dailyinspection.Rows.Add(NewInspectionRow);
                        }
                    }
                }

                dgrResults.ItemsSource = TheDailyVehicleInspectionReportDataSet.dailyinspection;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Daily Vehicle Inspection Report // Generate Report Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }
        private void mitProcess_Click(object sender, RoutedEventArgs e)
        {
            bool     blnFatalError      = false;
            DateTime datTransactionDate = DateTime.Now;
            string   strErrorMessage    = "";

            try
            {
                if (MainWindow.gintTrailerID == -1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Trailer Was Not Entered\n";
                }
                if (cboSelectEmployee.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Employee Was Not Selected\n";
                }
                if (cboDamageReported.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Damage Reported Was Not Selected\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }
                if (gblnProblemReported == false)
                {
                    MainWindow.gstrInspectionProblem = "NO PROBLEMS REPORTED";
                }
                else
                {
                    InspectionTrailerProblems InspectionTrailerProblems = new InspectionTrailerProblems();
                    InspectionTrailerProblems.ShowDialog();
                }

                blnFatalError = TheDailyTrailerInspectionClass.InsertDailyTrailerInspection(MainWindow.gintTrailerID, MainWindow.gintEmployeeID, datTransactionDate, gstrInspectionStatus, MainWindow.gstrInspectionProblem);

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

                blnFatalError = TheTrailerHistoryClass.InsertTrailerHistory(MainWindow.gintTrailerID, MainWindow.gintEmployeeID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "TRAILER SIGNED OUT");


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


                if (gstrInspectionStatus == "FAILED")
                {
                    PleaseWait pleaseWait = new PleaseWait();
                    pleaseWait.Show();

                    TheSendEmailClass.TrailerEmailMessage(txtEnterTrailerNumber.Text, MainWindow.gstrInspectionProblem);

                    pleaseWait.Close();
                }

                TheMessagesClass.InformationMessage("The Trailer Inspection Has Been Entered");

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Daily Trailer Inspection // Process Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Esempio n. 14
0
        private void mitImportExcel_Click(object sender, RoutedEventArgs e)
        {
            bool blnIsNotInteger = false;

            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            string strInformation = "";
            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            string strVehicleNumber;
            int    intVehicleID;
            int    intSecondCounter;
            int    intSecondNumberOfRecords;

            try
            {
                TheDOTAuditDataSet.dotaudit.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName = "Document"; // Default file name
                // dlg.DefaultExt = ".csv"; // Default file extension
                //dlg.Filter = "Excel (.csv)|*.csv"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

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

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count - 1;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strInformation = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2);

                    strInformation  = strInformation.Substring(4, 4);
                    blnIsNotInteger = TheDataValidationClass.VerifyIntegerData(strInformation);
                    if (blnIsNotInteger == false)
                    {
                        DOTAuditDataSet.dotauditRow NewVehicleRow = TheDOTAuditDataSet.dotaudit.NewdotauditRow();

                        strVehicleNumber = strInformation;
                        TheFindActiveVehicleBVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainByVehicleNumber(strVehicleNumber);
                        intVehicleID                = TheFindActiveVehicleBVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VehicleID;
                        NewVehicleRow.VehicleID     = intVehicleID;
                        NewVehicleRow.VehicleNumber = strVehicleNumber;
                        NewVehicleRow.VIN           = TheFindActiveVehicleBVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VINNumber;

                        TheDOTAuditDataSet.dotaudit.Rows.Add(NewVehicleRow);
                    }
                }

                ThefindActiveVehicleMainSortedDataSet = TheVehicleMainClass.FindActiveVehicleMainSorted();

                intNumberOfRecords = ThefindActiveVehicleMainSortedDataSet.FindActiveVehicleMainSorted.Rows.Count - 1;

                intSecondNumberOfRecords = TheDOTAuditDataSet.dotaudit.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    intVehicleID = ThefindActiveVehicleMainSortedDataSet.FindActiveVehicleMainSorted[intCounter].VehicleID;

                    for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                    {
                        if (intVehicleID == TheDOTAuditDataSet.dotaudit[intSecondCounter].VehicleID)
                        {
                            DOTAuditDataSet.dotauditRow NewVehicleRow = TheSortedDOTAuditDataSete.dotaudit.NewdotauditRow();

                            NewVehicleRow.VehicleNumber = TheDOTAuditDataSet.dotaudit[intSecondCounter].VehicleNumber;
                            NewVehicleRow.VehicleID     = intVehicleID;
                            NewVehicleRow.VIN           = TheDOTAuditDataSet.dotaudit[intSecondCounter].VIN;

                            TheSortedDOTAuditDataSete.dotaudit.Rows.Add(NewVehicleRow);
                        }
                    }
                }

                PleaseWait.Close();
                dgrResults.ItemsSource = TheSortedDOTAuditDataSete.dotaudit;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // DOT Audit Report // Import Excel Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void mitProcess_Click(object sender, RoutedEventArgs e)
        {
            //setting variables
            int  intTaskCounter;
            int  intTaskNumberOfRecords;
            int  intTaskID;
            int  intEmployeeCounter;
            int  intEmployeeNumberOfRecords;
            int  intTransactionID;
            bool blnFatalError = false;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                intTaskNumberOfRecords = TheOldWorkTasksDataSet.worktask.Rows.Count - 1;

                for (intTaskCounter = 0; intTaskCounter <= intTaskNumberOfRecords; intTaskCounter++)
                {
                    if (TheOldWorkTasksDataSet.worktask[intTaskCounter].ChangeItems == true)
                    {
                        intTaskID = TheOldWorkTasksDataSet.worktask[intTaskCounter].WorkTaskID;

                        TheFindEmployeeProjectAssignmentByTaskIDDataSet = TheEmployeeProjectAssignmentClass.FindEmployeeProjectAssignementByTaskID(intTaskID);

                        intEmployeeNumberOfRecords = TheFindEmployeeProjectAssignmentByTaskIDDataSet.FindEmployeeProjectAssignmentByTaskID.Rows.Count - 1;

                        for (intEmployeeCounter = 0; intEmployeeCounter <= intEmployeeNumberOfRecords; intEmployeeCounter++)
                        {
                            intTransactionID = TheFindEmployeeProjectAssignmentByTaskIDDataSet.FindEmployeeProjectAssignmentByTaskID[intEmployeeCounter].TransactionID;

                            blnFatalError = TheEmployeeProjectAssignmentClass.UpdateEmployeeProjectAssignmentTaskID(intTransactionID, gintNewTaskID);

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

                        blnFatalError = TheWorkTaskClass.UpdateWorkTaskActive(intTaskID, false);

                        TheFindProjectTaskByTaskIDDataSet = TheProjectTaskClass.FindProjectTaskByTaskID(intTaskID);

                        intEmployeeNumberOfRecords = TheFindProjectTaskByTaskIDDataSet.FindProjectTaskByTaskID.Rows.Count - 1;

                        for (intEmployeeCounter = 0; intEmployeeCounter <= intEmployeeNumberOfRecords; intEmployeeCounter++)
                        {
                            intTransactionID = TheFindProjectTaskByTaskIDDataSet.FindProjectTaskByTaskID[intEmployeeCounter].TransactionID;

                            blnFatalError = TheProjectTaskClass.UpdateProjectTaskID(intTransactionID, intTaskCounter);

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

                TheMessagesClass.InformationMessage("All Tasks Have Been Updated");
                TheOldWorkTasksDataSet.worktask.Rows.Clear();
                dgrOldTasks.ItemsSource             = TheOldWorkTasksDataSet.worktask;
                TheFindWorktaskByTaskKeywordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword("llllllllll");
                dgrNewTask.ItemsSource = TheFindWorktaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword;
                txtNewTask.Text        = "";
                txtOldTaskName.Text    = "";
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Project Work Task // Process Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }
        private void mitProcess_Click(object sender, RoutedEventArgs e)
        {
            //this will process the information
            string strValueForValidation;
            bool   blnFatalError      = false;
            bool   blnThereIsAProblem = false;
            string strErrorMessage    = "";
            string strVehicleNumber;
            int    intRecordsReturned;

            try
            {
                strVehicleNumber = txtEnterBJCNumber.Text;
                TheFindVehicleMainByVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainByVehicleNumber(strVehicleNumber);
                intRecordsReturned = TheFindVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber.Rows.Count;
                if (intRecordsReturned == 0)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Vehicle Number Entered Was Not Found\n";
                }
                else
                {
                    MainWindow.gintVehicleID = TheFindVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VehicleID;
                }
                strValueForValidation = cboEmployee.SelectedItem.ToString();
                if (strValueForValidation == "Select Employee")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Employee Was Not Selected\n";
                }
                if (rdoFailed.IsChecked == false)
                {
                    if (rdoPassed.IsChecked == false)
                    {
                        if (rdoPassedServiceRequired.IsChecked == false)
                        {
                            blnFatalError    = true;
                            strErrorMessage += "Passed, Passed Service Required, or Failure Was Not Checked\n";
                        }
                    }
                }
                strValueForValidation = txtOdometerReading.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyIntegerData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Odometer Reading is not an Integer\n";
                }
                else
                {
                    MainWindow.gintOdometerReading = Convert.ToInt32(strValueForValidation);
                }
                if (cboVehicleCleanliness.SelectedIndex == 0)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Cleanliness Was Not Selected\n";
                }

                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }


                MainWindow.gdatTransactionDate = DateTime.Now;

                blnFatalError = TheWeeklyInspectionClass.InsertWeeklyVehicleInspection(MainWindow.gintVehicleID, MainWindow.gdatTransactionDate, MainWindow.gintEmployeeID, MainWindow.gstrInspectionStatus, MainWindow.gintOdometerReading);

                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("There Was a Problem, Contact ID");
                    return;
                }

                TheFindWeeklyVehicleInspectionIDDataSet = TheWeeklyInspectionClass.FindWeelyVehicleInspectionID(MainWindow.gintVehicleID, MainWindow.gintEmployeeID, MainWindow.gintOdometerReading, MainWindow.gdatTransactionDate);

                MainWindow.gintInspectionID = TheFindWeeklyVehicleInspectionIDDataSet.FindWeeklyVehicleInspectionID[0].TransactionID;

                blnFatalError = TheWeeklyVehicleCleanlinessClass.InsertWeeklyVehicleCleanliness(MainWindow.gintInspectionID, MainWindow.gintVehicleID, gblnVehicleCleanliness, MainWindow.gstrCleanlinessNotes);

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

                if ((rdoFailed.IsChecked == true) || (rdoPassedServiceRequired.IsChecked == true))
                {
                    VehicleInspectionProblem VehicleInspectionProblem = new VehicleInspectionProblem();
                    VehicleInspectionProblem.ShowDialog();
                }
                else if (rdoPassed.IsChecked == true)
                {
                    TheFindOpenVehicleProblemsbyVehicleIDDataSet = TheVehicleProblemClass.FindOpenVehicleProblemsbyVehicleID(MainWindow.gintVehicleID);

                    intRecordsReturned = TheFindOpenVehicleProblemsbyVehicleIDDataSet.FindOpenVehicleProblemsByVehicleID.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        TheMessagesClass.ErrorMessage("There Are Open Problems with this Vehicle and\nYou Are Reporting No Problems, Please Correct");
                        return;
                    }
                }

                if (rdoFailed.IsChecked == true)
                {
                    PleaseWait PleaseWait = new PleaseWait();
                    PleaseWait.Show();

                    TheVehicleStatusClass.UpdateVehicleStatus(MainWindow.gintVehicleID, "DOWN", DateTime.Now);

                    TheSendEmailClass.EmailMessage(MainWindow.gstrVehicleNumber, MainWindow.gstrVehicleProblem);

                    PleaseWait.Close();
                }

                BulkToolsAssignedToVehicle BulkToolsAssignedToVehicle = new BulkToolsAssignedToVehicle();
                BulkToolsAssignedToVehicle.ShowDialog();

                txtEnterBJCNumber.Text = "";
                cboEmployee.Items.Clear();
                txtEnterLastName.Text               = "";
                txtOdometerReading.Text             = "";
                rdoFailed.IsChecked                 = false;
                rdoPassed.IsChecked                 = false;
                rdoPassedServiceRequired.IsChecked  = false;
                cboBodyDamageReported.SelectedIndex = 0;
                cboVehicleCleanliness.SelectedIndex = 0;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Manager Weekly Audit Data Entry // Process Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            string strValueForValidation;
            string strErrorMessage    = "";
            bool   blnThereIsAProblem = false;
            bool   blnFatalError      = false;
            int    intCounter;
            int    intNumberOfRecords;
            string strProjectID;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();
            gdecTotalHours = 0;
            TheEmployeeProjectTaskDataSet.projecttask.Rows.Clear();

            try
            {
                if (cboSelectEmployee.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "An Employee Has Not Been Selected\n";
                }
                strValueForValidation = txtEnterStartDate.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 = txtEnterEndDate.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;
                }

                blnFatalError = TheDataValidationClass.verifyDateRange(gdatStartDate, gdatEndDate);
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("The Start Date is after the End Date");
                    return;
                }

                TheFindEmployeeProjectTasksDataSet = TheEmployeeProductivityStatsClass.FindEmployeeProjectTaskStats(MainWindow.gintEmployeeID, gdatStartDate, gdatEndDate);
                TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(MainWindow.gintEmployeeID);

                intNumberOfRecords = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats.Rows.Count - 1;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        strProjectID = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].AssignedProjectID;
                        TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProjectID);

                        EmployeeProjectTaskDataSet.projecttaskRow NewProjectTaskRow = TheEmployeeProjectTaskDataSet.projecttask.NewprojecttaskRow();

                        NewProjectTaskRow.AssignedProjectID  = strProjectID;
                        NewProjectTaskRow.HomeOffice         = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].HomeOffice;
                        NewProjectTaskRow.ProjectName        = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectName;
                        NewProjectTaskRow.TotalFootagePieces = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].TotalFootage;
                        NewProjectTaskRow.TotalHours         = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].TaskTotalHours;
                        NewProjectTaskRow.WorkTask           = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].WorkTask;
                        gdecTotalHours += TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].TaskTotalHours;

                        TheEmployeeProjectTaskDataSet.projecttask.Rows.Add(NewProjectTaskRow);
                    }
                }


                dgrResults.ItemsSource = TheEmployeeProjectTaskDataSet.projecttask;
                txtTotalHours.Text     = Convert.ToString(gdecTotalHours);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Find Employee Hours // Generate Report Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }
Esempio n. 18
0
        private void mitImportPunches_Click(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int      intColumnRange = 0;
            int      intCounter;
            int      intNumberOfRecords;
            int      intPayID = 0;
            string   strValueForValidation;
            bool     blnFatalError;
            bool     blnNextRecord;
            DateTime datPunchDate = DateTime.Now;
            string   strPunchStatus;

            try
            {
                TheImportPunchesDataSet.punches.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

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

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    blnNextRecord         = true;
                    strValueForValidation = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2);
                    if (strValueForValidation == "")
                    {
                        blnNextRecord = false;
                    }
                    else
                    {
                        strValueForValidation = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2);
                        blnFatalError         = TheDataValidationClass.VerifyIntegerData(strValueForValidation);
                        if (blnFatalError == true)
                        {
                            blnNextRecord = false;
                        }
                        else
                        {
                            intPayID = Convert.ToInt32(strValueForValidation);
                        }
                        strValueForValidation = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2);
                        blnFatalError         = TheDataValidationClass.VerifyDateData(strValueForValidation);
                        if (blnFatalError == true)
                        {
                            blnNextRecord = false;
                        }
                        else
                        {
                            datPunchDate = Convert.ToDateTime(strValueForValidation);
                        }
                        strPunchStatus = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2);
                        if (strPunchStatus == "")
                        {
                            blnNextRecord = false;
                        }
                        if (blnNextRecord == true)
                        {
                            TheFindEmployeebyPayIDDataSet = TheEmployeeClass.FindEmployeeByPayID(intPayID);

                            ImportedPunchesDataSet.punchesRow NewPunchRow = TheImportPunchesDataSet.punches.NewpunchesRow();

                            NewPunchRow.EmployeeID  = TheFindEmployeebyPayIDDataSet.FindEmployeeByPayID[0].EmployeeID;
                            NewPunchRow.FirstName   = TheFindEmployeebyPayIDDataSet.FindEmployeeByPayID[0].FirstName;
                            NewPunchRow.LastName    = TheFindEmployeebyPayIDDataSet.FindEmployeeByPayID[0].LastName;
                            NewPunchRow.PayID       = intPayID;
                            NewPunchRow.PunchStatus = strPunchStatus.ToUpper();
                            NewPunchRow.PunchTime   = datPunchDate;

                            TheImportPunchesDataSet.punches.Rows.Add(NewPunchRow);
                        }
                    }
                }

                PleaseWait.Close();
                dgrResults.ItemsSource = TheImportPunchesDataSet.punches;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Import Employee  Punches // Import Excel Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void MitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string  strValueForValidation;
            string  strErrorMessage    = "";
            bool    blnThereIsAProblem = false;
            bool    blnFatalError      = false;
            int     intTaskCounter;
            int     intTaskNumberOfRecords;
            int     intProjectTaskCounter;
            int     intProjectTaskNumberOfRecords;
            decimal decTotalFootages;
            int     intWorkTaskID;
            string  strWorkTask;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                strValueForValidation = txtStartDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Start Date is not a Date\n";
                }
                else
                {
                    MainWindow.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
                {
                    MainWindow.gdatEndDate = Convert.ToDateTime(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }
                else
                {
                    blnFatalError = TheDataValidationClass.verifyDateRange(MainWindow.gdatStartDate, MainWindow.gdatEndDate);
                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage("The Start Date is after the End Date");
                        return;
                    }
                }

                TheProjectTaskTotalsDataSet.projecttasktotals.Rows.Clear();

                if (gblnAllTasks == true)
                {
                    TheFindSortedWorkTaskDataSet = TheWorkTaskClass.FindSortedWorkTask();

                    intTaskNumberOfRecords = TheFindSortedWorkTaskDataSet.FindSortedWorkTask.Rows.Count - 1;

                    for (intTaskCounter = 0; intTaskCounter <= intTaskNumberOfRecords; intTaskCounter++)
                    {
                        intWorkTaskID = TheFindSortedWorkTaskDataSet.FindSortedWorkTask[intTaskCounter].WorkTaskID;
                        strWorkTask   = TheFindSortedWorkTaskDataSet.FindSortedWorkTask[intTaskCounter].WorkTask;

                        TheFindProjectTasksForFootageDataSet = TheProjectTaskClass.FindProjectTasksForFootage(intWorkTaskID, MainWindow.gdatStartDate, MainWindow.gdatEndDate);

                        intProjectTaskNumberOfRecords = TheFindProjectTasksForFootageDataSet.FindProjectTasksForFootage.Rows.Count - 1;

                        if (intProjectTaskNumberOfRecords > -1)
                        {
                            decTotalFootages = 0;

                            for (intProjectTaskCounter = 0; intProjectTaskCounter <= intProjectTaskNumberOfRecords; intProjectTaskCounter++)
                            {
                                decTotalFootages += TheFindProjectTasksForFootageDataSet.FindProjectTasksForFootage[intProjectTaskCounter].FootagePieces;
                            }

                            ProjectTaskTotalsDataSet.projecttasktotalsRow NewTaskRow = TheProjectTaskTotalsDataSet.projecttasktotals.NewprojecttasktotalsRow();

                            NewTaskRow.WorkTaskID    = intWorkTaskID;
                            NewTaskRow.WorkTask      = strWorkTask;
                            NewTaskRow.FootagePieces = decTotalFootages;

                            TheProjectTaskTotalsDataSet.projecttasktotals.Rows.Add(NewTaskRow);
                        }
                    }
                }
                else if (gblnAllTasks == false)
                {
                    TheFindProjectTasksForFootageDataSet = TheProjectTaskClass.FindProjectTasksForFootage(MainWindow.gintWorkTaskID, MainWindow.gdatStartDate, MainWindow.gdatEndDate);

                    intProjectTaskNumberOfRecords = TheFindProjectTasksForFootageDataSet.FindProjectTasksForFootage.Rows.Count - 1;

                    if (intProjectTaskNumberOfRecords > -1)
                    {
                        decTotalFootages = 0;

                        for (intProjectTaskCounter = 0; intProjectTaskCounter <= intProjectTaskNumberOfRecords; intProjectTaskCounter++)
                        {
                            decTotalFootages += TheFindProjectTasksForFootageDataSet.FindProjectTasksForFootage[intProjectTaskCounter].FootagePieces;
                        }

                        ProjectTaskTotalsDataSet.projecttasktotalsRow NewTaskRow = TheProjectTaskTotalsDataSet.projecttasktotals.NewprojecttasktotalsRow();

                        NewTaskRow.WorkTaskID    = MainWindow.gintWorkTaskID;
                        NewTaskRow.WorkTask      = MainWindow.gstrWorkTask;
                        NewTaskRow.FootagePieces = decTotalFootages;

                        TheProjectTaskTotalsDataSet.projecttasktotals.Rows.Add(NewTaskRow);
                    }
                }


                dgrResults.ItemsSource = TheProjectTaskTotalsDataSet.projecttasktotals;

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // View Work Task Footages // Generate Report Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            string strValueForValidation;
            bool   blnFatalError      = false;
            bool   blnThereIsAProblem = false;
            string strErrorMessage    = "";
            int    intRecordsReturned;
            int    intCounter;
            int    intNumberOfRecords;
            int    intTaskCounter;
            int    intTaskNumberOfRecords;
            int    intEmployeeID;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                intRecordsReturned = TheMultipleEmployeeDataSet.employees.Rows.Count;
                TheEmployeeSummaryDataSet.employeetasks.Rows.Clear();
                gdecTotalHours = 0;

                if (intRecordsReturned < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Employees have not been Selected\n";
                }
                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);
                    gdatEndDate = TheDataSearchClass.AddingDays(gdatEndDate, 1);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                blnFatalError = TheDataValidationClass.verifyDateRange(gdatStartDate, gdatEndDate);
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("The Start Date is after the End Date");
                    return;
                }

                //first loop
                intNumberOfRecords = TheMultipleEmployeeDataSet.employees.Rows.Count - 1;

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

                    TheFindEmployeeTaskStatsDataSet = TheEmployeeProductivityStatsClass.FindEmployeeTaskStats(intEmployeeID, gdatStartDate, gdatEndDate);

                    TheFindEmployeeByEmployeeIDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intEmployeeID);

                    intTaskNumberOfRecords = TheFindEmployeeTaskStatsDataSet.FindEmployeeTaskStats.Rows.Count - 1;

                    for (intTaskCounter = 0; intTaskCounter <= intTaskNumberOfRecords; intTaskCounter++)
                    {
                        EmployeesSummaryDataSet.employeetasksRow NewTaskRow = TheEmployeeSummaryDataSet.employeetasks.NewemployeetasksRow();

                        NewTaskRow.EmployeeID         = intEmployeeID;
                        NewTaskRow.FirstName          = TheFindEmployeeByEmployeeIDataSet.FindEmployeeByEmployeeID[0].FirstName;
                        NewTaskRow.HomeOffice         = TheFindEmployeeByEmployeeIDataSet.FindEmployeeByEmployeeID[0].HomeOffice;
                        NewTaskRow.LastName           = TheFindEmployeeByEmployeeIDataSet.FindEmployeeByEmployeeID[0].LastName;
                        NewTaskRow.TotalFootagePieces = TheFindEmployeeTaskStatsDataSet.FindEmployeeTaskStats[intTaskCounter].TotalFootage;
                        NewTaskRow.TotalHours         = TheFindEmployeeTaskStatsDataSet.FindEmployeeTaskStats[intTaskCounter].TaskTotalHours;
                        NewTaskRow.WorkTask           = TheFindEmployeeTaskStatsDataSet.FindEmployeeTaskStats[intTaskCounter].WorkTask;

                        gdecTotalHours += TheFindEmployeeTaskStatsDataSet.FindEmployeeTaskStats[intTaskCounter].TaskTotalHours;

                        TheEmployeeSummaryDataSet.employeetasks.Rows.Add(NewTaskRow);
                    }
                }

                dgrResults.ItemsSource = TheEmployeeSummaryDataSet.employeetasks;
                txtTotalHours.Text     = Convert.ToString(gdecTotalHours);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Find Multiple Employee Production // Generate Report Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }
Esempio n. 21
0
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            //setting local viarables
            string  strValueForValidation;
            string  strErrorMessage    = "";
            bool    blnThereIsAProblem = false;
            bool    blnFatalError      = false;
            int     intLaborCounter;
            int     intLaborNumberOfRecords;
            int     intEmployeeCounter;
            int     intEmployeeNumberOfRecords;
            int     intEmployeeID;
            decimal decHours;
            bool    blnItemFound;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                TheTotalHoursDataSet.totalhours.Rows.Clear();

                strValueForValidation = txtEnterStartDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Start Date is not a Date\n";
                }
                else
                {
                    MainWindow.gdatStartDate = Convert.ToDateTime(strValueForValidation);
                }
                strValueForValidation = txtEnterEndDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The End Date is not a Date\n";
                }
                else
                {
                    MainWindow.gdatEndDate = Convert.ToDateTime(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    PleaseWait.Close();
                    return;
                }
                else
                {
                    blnFatalError = TheDataValidationClass.verifyDateRange(MainWindow.gdatStartDate, MainWindow.gdatEndDate);
                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage("The Start Date is after the End Date");
                        PleaseWait.Close();
                        return;
                    }
                }

                TheFindLaborHoursByDateRangeDataSet = TheEmployeeProjectAssignmentClass.FindLaborHoursByDateRange(MainWindow.gdatStartDate, MainWindow.gdatEndDate);

                intLaborNumberOfRecords    = TheFindLaborHoursByDateRangeDataSet.FindLaborHoursByDateRange.Rows.Count - 1;
                intEmployeeNumberOfRecords = 0;

                for (intLaborCounter = 0; intLaborCounter <= intLaborNumberOfRecords; intLaborCounter++)
                {
                    intEmployeeID = TheFindLaborHoursByDateRangeDataSet.FindLaborHoursByDateRange[intLaborCounter].EmployeeID;
                    decHours      = TheFindLaborHoursByDateRangeDataSet.FindLaborHoursByDateRange[intLaborCounter].TotalHours;
                    blnItemFound  = false;

                    if (intEmployeeNumberOfRecords > 0)
                    {
                        for (intEmployeeCounter = 0; intEmployeeCounter < intEmployeeNumberOfRecords; intEmployeeCounter++)
                        {
                            if (intEmployeeID == TheTotalHoursDataSet.totalhours[intEmployeeCounter].EmployeeID)
                            {
                                blnItemFound = true;
                                TheTotalHoursDataSet.totalhours[intEmployeeCounter].TotalHours += decHours;
                            }
                        }
                    }

                    if (blnItemFound == false)
                    {
                        TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intEmployeeID);

                        TotalHoursDataSet.totalhoursRow NewEmployeeRow = TheTotalHoursDataSet.totalhours.NewtotalhoursRow();

                        NewEmployeeRow.EmployeeID   = intEmployeeID;
                        NewEmployeeRow.EmployeeType = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].EmployeeType;
                        NewEmployeeRow.FirstName    = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName;
                        NewEmployeeRow.HomeOffice   = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].HomeOffice;
                        NewEmployeeRow.LastName     = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].LastName;
                        NewEmployeeRow.TotalHours   = decHours;

                        TheTotalHoursDataSet.totalhours.Rows.Add(NewEmployeeRow);
                        intEmployeeNumberOfRecords++;
                    }
                }

                TheTotalHoursDataSet.totalhours.DefaultView.Sort = "TotalHours DESC";


                dgrResults.ItemsSource = TheTotalHoursDataSet.totalhours;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Find Labor Hours // Generate Report Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }
Esempio n. 22
0
        private void mitFindCrews_Click(object sender, RoutedEventArgs e)
        {
            string strValueForValidation;
            string strErrorMessage    = "";
            bool   blnFatalError      = false;
            bool   blnThereIsAProblem = false;
            int    intCounter;
            int    intNumberOfRecords;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                strValueForValidation = txtEnterStartDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                txtTotalHours.Text    = "";
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Start Date is not a Date\n";
                }
                else
                {
                    gdatStartDate = Convert.ToDateTime(strValueForValidation);
                }
                strValueForValidation = txtEnterEndDate.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;
                    }
                }

                cboSelectCrew.Items.Clear();
                cboSelectCrew.Items.Add("Select Crew ID");

                TheFindEmployeeCrewAssignmentComboBoxDataSet = TheEmployeeCrewAssignmentClass.FindEmployeeCrewAssignmentComboBox(gdatStartDate, gdatEndDate);

                intNumberOfRecords = TheFindEmployeeCrewAssignmentComboBoxDataSet.FindEmployeeCrewAssignmentComboBox.Rows.Count - 1;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        cboSelectCrew.Items.Add(TheFindEmployeeCrewAssignmentComboBoxDataSet.FindEmployeeCrewAssignmentComboBox[intCounter].CrewID);
                    }
                }

                cboSelectCrew.SelectedIndex = 0;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Find Employee Crew Assignments // Find Crews Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string strValueForValidation;
            string strErrorMessage    = "";
            bool   blnThereIsAProblem = false;
            bool   blnFatalError      = false;
            int    intCounter;
            int    intNumberOfRecords;
            string strVehicleNumber;
            int    intRecordsReturned;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                TheVehicleHistoryReportDataSet.historyreport.Rows.Clear();

                strValueForValidation = txtStartDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Starting 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 Ending 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 Starting Date is After the Ending Date");
                        return;
                    }
                }


                if (gstrReportType == "DATE RANGE")
                {
                    TheFindVehicleHistoryByDateRangeDataSet = TheVehicleHistoryClass.FindVehicleHistoryByDateRange(gdatStartDate, gdatEndDate);

                    intNumberOfRecords = TheFindVehicleHistoryByDateRangeDataSet.FindVehicleHistoryByDateRange.Rows.Count - 1;

                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        VehicleHistoryReportDataSet.historyreportRow NewHistoryRow = TheVehicleHistoryReportDataSet.historyreport.NewhistoryreportRow();

                        NewHistoryRow.VehicleNumber   = TheFindVehicleHistoryByDateRangeDataSet.FindVehicleHistoryByDateRange[intCounter].VehicleNumber;
                        NewHistoryRow.FirstName       = TheFindVehicleHistoryByDateRangeDataSet.FindVehicleHistoryByDateRange[intCounter].FirstName;
                        NewHistoryRow.LastName        = TheFindVehicleHistoryByDateRangeDataSet.FindVehicleHistoryByDateRange[intCounter].LastName;
                        NewHistoryRow.TransactionDate = TheFindVehicleHistoryByDateRangeDataSet.FindVehicleHistoryByDateRange[intCounter].TransactionDate;

                        TheVehicleHistoryReportDataSet.historyreport.Rows.Add(NewHistoryRow);
                    }
                }
                if (gstrReportType == "VEHICLE NUMBER")
                {
                    strVehicleNumber = txtSearchInfo.Text;
                    if (strVehicleNumber == "")
                    {
                        TheMessagesClass.ErrorMessage("Vehicle Number Not Entered");
                        return;
                    }
                    else
                    {
                        TheFindActiveVehicleMainByVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainByVehicleNumber(strVehicleNumber);

                        intRecordsReturned = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber.Rows.Count;

                        if (intRecordsReturned == 0)
                        {
                            TheMessagesClass.ErrorMessage("Vehicle Not Found");
                            return;
                        }
                        else
                        {
                            gintVehicleID = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VehicleID;
                        }
                    }

                    TheFindVehicleHistoryByVehicleIDAndDateRangeDataSet = TheVehicleHistoryClass.FindVehicleHistoryByVehicleIDAndDateRange(gintVehicleID, gdatStartDate, gdatEndDate);

                    intNumberOfRecords = TheFindVehicleHistoryByVehicleIDAndDateRangeDataSet.FindVehicleHistoryByVehicleIDAndDateRange.Rows.Count - 1;

                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        VehicleHistoryReportDataSet.historyreportRow NewHistoryRow = TheVehicleHistoryReportDataSet.historyreport.NewhistoryreportRow();

                        NewHistoryRow.VehicleNumber   = TheFindVehicleHistoryByVehicleIDAndDateRangeDataSet.FindVehicleHistoryByVehicleIDAndDateRange[intCounter].VehicleNumber;
                        NewHistoryRow.FirstName       = TheFindVehicleHistoryByVehicleIDAndDateRangeDataSet.FindVehicleHistoryByVehicleIDAndDateRange[intCounter].FirstName;
                        NewHistoryRow.LastName        = TheFindVehicleHistoryByVehicleIDAndDateRangeDataSet.FindVehicleHistoryByVehicleIDAndDateRange[intCounter].LastName;
                        NewHistoryRow.TransactionDate = TheFindVehicleHistoryByVehicleIDAndDateRangeDataSet.FindVehicleHistoryByVehicleIDAndDateRange[intCounter].TransactionDate;

                        TheVehicleHistoryReportDataSet.historyreport.Rows.Add(NewHistoryRow);
                    }
                }
                if (gstrReportType == "EMPLOYEE")
                {
                    TheFindVehicleHistoryByEmployeeIDAndDateRangeDataSet = TheVehicleHistoryClass.FindVehicleHistoryByEmployeeIDAndDateRange(gintEmployeeID, gdatStartDate, gdatEndDate);

                    intNumberOfRecords = TheFindVehicleHistoryByEmployeeIDAndDateRangeDataSet.FindVehicleHistoryByEmployeeIDAndDateRange.Rows.Count - 1;

                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        VehicleHistoryReportDataSet.historyreportRow NewHistoryRow = TheVehicleHistoryReportDataSet.historyreport.NewhistoryreportRow();

                        NewHistoryRow.VehicleNumber   = TheFindVehicleHistoryByEmployeeIDAndDateRangeDataSet.FindVehicleHistoryByEmployeeIDAndDateRange[intCounter].VehicleNumber;
                        NewHistoryRow.FirstName       = TheFindVehicleHistoryByEmployeeIDAndDateRangeDataSet.FindVehicleHistoryByEmployeeIDAndDateRange[intCounter].FirstName;
                        NewHistoryRow.LastName        = TheFindVehicleHistoryByEmployeeIDAndDateRangeDataSet.FindVehicleHistoryByEmployeeIDAndDateRange[intCounter].LastName;
                        NewHistoryRow.TransactionDate = TheFindVehicleHistoryByEmployeeIDAndDateRangeDataSet.FindVehicleHistoryByEmployeeIDAndDateRange[intCounter].TransactionDate;

                        TheVehicleHistoryReportDataSet.historyreport.Rows.Add(NewHistoryRow);
                    }
                }

                dgrResults.ItemsSource = TheVehicleHistoryReportDataSet.historyreport;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Vehicle History Report // Search Button " + Ex.Message);

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

            PleaseWait.Close();
        }
Esempio n. 24
0
        private void MitImportExcel_Click(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            string strItem;
            string strManufacturer;
            string strModel;
            string strSerialNumber;
            int    intQuantity;

            try
            {
                TheAssetsForImportDataSet.assets.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

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

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strItem         = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2);
                    strManufacturer = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2);
                    strModel        = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2);
                    strSerialNumber = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2);
                    intQuantity     = Convert.ToInt32(Convert.ToString((range.Cells[intCounter, 5] as Excel.Range).Value2));

                    if (strSerialNumber == null)
                    {
                        strSerialNumber = "";
                    }
                    if (strModel == null)
                    {
                        strModel = "";
                    }
                    if (strManufacturer == null)
                    {
                        strManufacturer = "";
                    }

                    strItem         = strItem.ToUpper();
                    strManufacturer = strManufacturer.ToUpper();
                    strModel        = strModel.ToUpper();
                    strSerialNumber = strSerialNumber.ToUpper();

                    AssetsForImportDataSet.assetsRow NewAssetRow = TheAssetsForImportDataSet.assets.NewassetsRow();

                    NewAssetRow.Item         = strItem;
                    NewAssetRow.ItemValue    = 0;
                    NewAssetRow.Manufacturer = strManufacturer;
                    NewAssetRow.Model        = strModel;
                    NewAssetRow.Quantity     = intQuantity;
                    NewAssetRow.SerialNumber = strSerialNumber;
                    NewAssetRow.Updates      = "";
                    NewAssetRow.WarehouseID  = MainWindow.gintWarehouseID;

                    TheAssetsForImportDataSet.assets.Rows.Add(NewAssetRow);
                }

                PleaseWait.Close();
                dgrResults.ItemsSource = TheAssetsForImportDataSet.assets;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Import IT Assets // Import Excel 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;
            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());
            }
        }
Esempio n. 26
0
        private void mitImportExcel_Click(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int intColumnRange = 0;
            int intCounter;
            int intNumberOfRecords;
            int intRecordsReturned;


            try
            {
                TheNewTrailerDataSet.newtrailers.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

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

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    gstrTrailerNumber = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2);

                    gstrTrailerNumber = gstrTrailerNumber.Substring(4);

                    TheFindActiveTrailerByTrailerNumberDataSet = TheTrailersClass.FindActiveTrailerByTrailerNumber(gstrTrailerNumber);

                    intRecordsReturned = TheFindActiveTrailerByTrailerNumberDataSet.FindActiveTrailerByTrailerNumber.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        gstrAssignedOffice     = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                        gstrTrailerDescription = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();
                        gstrTrailerCategory    = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2).ToUpper();
                        gstrLicensePlate       = Convert.ToString((range.Cells[intCounter, 5] as Excel.Range).Value2).ToUpper();
                        gstrVINNumber          = Convert.ToString((range.Cells[intCounter, 6] as Excel.Range).Value2).ToUpper();

                        gintLocationID = FindLocationID(gstrAssignedOffice);

                        TheFindTrailerCategoryByCategoryDataSet = TheTrailerCategoryClass.FindTrailerCategoryByCategory(gstrTrailerCategory);

                        gintCategoryID = TheFindTrailerCategoryByCategoryDataSet.FindTrailerCategoryByCategory[0].CategoryID;

                        NewTrailerDataSet.newtrailersRow NewTrailerRow = TheNewTrailerDataSet.newtrailers.NewnewtrailersRow();

                        NewTrailerRow.CategoryID         = gintCategoryID;
                        NewTrailerRow.LicensePlate       = gstrLicensePlate;
                        NewTrailerRow.Location           = gstrAssignedOffice;
                        NewTrailerRow.LocationID         = gintLocationID;
                        NewTrailerRow.TrailerCategory    = gstrTrailerCategory;
                        NewTrailerRow.TrailerDescription = gstrTrailerDescription;
                        NewTrailerRow.TrailerNumber      = gstrTrailerNumber;
                        NewTrailerRow.VINNumber          = gstrVINNumber;

                        TheNewTrailerDataSet.newtrailers.Rows.Add(NewTrailerRow);
                    }
                }

                PleaseWait.Close();
                dgrTrailers.ItemsSource = TheNewTrailerDataSet.newtrailers;
                mitSave.IsEnabled       = true;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Import Trailers // Import Excel Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void cboSelectCrew_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int intSelectedIndex;
            int intCounter;
            int intNumberOfRecords;
            int intEmployeeID;
            int intProjectID;


            if (gblnLoadComplete == true)
            {
                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                try
                {
                    intSelectedIndex = cboSelectCrew.SelectedIndex;
                    gdecTotalHours   = 0;
                    TheCrewHoursDataSet.crewhours.Rows.Clear();

                    if (gblnLoadComplete == true)
                    {
                        gstrCrewID = cboSelectCrew.SelectedItem.ToString();

                        TheFindEmployeeCrewByCrewIDDataSet = TheEmployeeCrewAssignmentClass.FindEmployeeCrewByCrewID(gstrCrewID, gdatStartDate, gdatEndDate);

                        intNumberOfRecords = TheFindEmployeeCrewByCrewIDDataSet.FindEmployeeCrewByCrewID.Rows.Count - 1;

                        if (intNumberOfRecords == -1)
                        {
                            TheMessagesClass.ErrorMessage("There is a Problem with Crew Assignments");
                            PleaseWait.Close();
                            return;
                        }

                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            intEmployeeID = TheFindEmployeeCrewByCrewIDDataSet.FindEmployeeCrewByCrewID[intCounter].EmployeeID;
                            intProjectID  = TheFindEmployeeCrewByCrewIDDataSet.FindEmployeeCrewByCrewID[intCounter].ProjectID;

                            TheFindEmployeeProjectHourDateRangeSummaryDataSet = TheEmployeeProductiivityStatsClass.FindEmployeeProjectHourDateRangeSummary(intEmployeeID, intProjectID, gdatStartDate, gdatEndDate);

                            CrewHoursDataSet.crewhoursRow NewHoursRow = TheCrewHoursDataSet.crewhours.NewcrewhoursRow();

                            NewHoursRow.AssignedProjectID = TheFindEmployeeProjectHourDateRangeSummaryDataSet.FindEmployeeProjectHourDateRangeSummary[0].AssignedProjectID;
                            NewHoursRow.FirstName         = TheFindEmployeeProjectHourDateRangeSummaryDataSet.FindEmployeeProjectHourDateRangeSummary[0].FirstName;
                            NewHoursRow.LastName          = TheFindEmployeeProjectHourDateRangeSummaryDataSet.FindEmployeeProjectHourDateRangeSummary[0].LastName;
                            NewHoursRow.ProjectName       = TheFindEmployeeProjectHourDateRangeSummaryDataSet.FindEmployeeProjectHourDateRangeSummary[0].ProjectName;
                            NewHoursRow.Hours             = TheFindEmployeeProjectHourDateRangeSummaryDataSet.FindEmployeeProjectHourDateRangeSummary[0].TotalHours;
                            gdecTotalHours        += TheFindEmployeeProjectHourDateRangeSummaryDataSet.FindEmployeeProjectHourDateRangeSummary[0].TotalHours;
                            NewHoursRow.HomeOffice = TheFindEmployeeProjectHourDateRangeSummaryDataSet.FindEmployeeProjectHourDateRangeSummary[0].HomeOffice;

                            TheCrewHoursDataSet.crewhours.Rows.Add(NewHoursRow);
                        }



                        dgrResults.ItemsSource = TheCrewHoursDataSet.crewhours;

                        txtTotalHours.Text = Convert.ToString(gdecTotalHours);
                    }
                }
                catch (Exception Ex)
                {
                    TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Find Employee Crew Assignments // Combo Box Change Event " + Ex.Message);

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

                PleaseWait.Close();
            }
        }
Esempio n. 28
0
        private void mitImportExcel_Click(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            string strWorkTask;
            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            int    intRecordsReturned;

            try
            {
                TheImportWorkTaskDataSet.worktask.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

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

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 1; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strWorkTask = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2);

                    TheFindWorkTaskByWorkTaskDataSet = TheWorkTaskClass.FindWorkTaskByWorkTask(strWorkTask);

                    intRecordsReturned = TheFindWorkTaskByWorkTaskDataSet.FindWorkTaskByWorkTask.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        ImportWorkTaskDataSet.worktaskRow NewTaskRow = TheImportWorkTaskDataSet.worktask.NewworktaskRow();

                        NewTaskRow.WorkTask = strWorkTask.ToUpper();
                        NewTaskRow.TaskCost = 1;

                        TheImportWorkTaskDataSet.worktask.Rows.Add(NewTaskRow);
                    }
                }

                PleaseWait.Close();
                dgrResults.ItemsSource = TheImportWorkTaskDataSet.worktask;
                mitProcess.IsEnabled   = true;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Import Work Task // Import Excel Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Esempio n. 29
0
        private void mitSave_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string strPartNumber;
            int    intPartID;
            string strDescription;
            string strJDEPartNumber;
            double douPrice = 0;
            string strValueForValidation;
            bool   blnFatalError      = false;
            bool   blnThereIsAProblem = false;
            string strErrorMessage    = "";
            int    intRecordsReturned;
            int    intRecordCounter;
            bool   blnRecordMatch;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                //data validation
                strPartNumber = txtPartNumber.Text;
                intPartID     = Convert.ToInt32(txtPartID.Text);
                if (strPartNumber == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "Part Number Was Not Entered\n";
                }
                strJDEPartNumber = txtJDEPartNumber.Text;
                if (strJDEPartNumber == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "JDE Part Number Was Not Entered\n";
                }
                strDescription = txtDescription.Text;
                if (strDescription == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Description Was Not Entered\n";
                }
                strValueForValidation = txtPrice.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDoubleData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Price Entered in not Numeric\n";
                }
                else
                {
                    douPrice = Convert.ToDouble(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    PleaseWait.Close();
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                //validation to see if the part number is used with another row
                TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    blnRecordMatch = false;

                    for (intRecordCounter = 0; intRecordCounter <= intRecordsReturned - 1; intRecordCounter++)
                    {
                        if (strPartNumber == TheFindPartByPartNumberDataSet.FindPartByPartNumber[intRecordCounter].PartNumber)
                        {
                            if (intPartID != TheFindPartByPartNumberDataSet.FindPartByPartNumber[intRecordCounter].PartID)
                            {
                                blnRecordMatch = true;
                            }
                        }
                    }

                    if (blnRecordMatch == true)
                    {
                        TheMessagesClass.ErrorMessage("Part Number Exists with a Different Part ID");
                        return;
                    }
                }


                if ((strJDEPartNumber != "NOT REQUIRED") && (strJDEPartNumber != "NOT PROVIDED"))
                {
                    TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber);

                    intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnRecordMatch = false;

                        for (intRecordCounter = 0; intRecordCounter <= intRecordsReturned - 1; intRecordCounter++)
                        {
                            if (strJDEPartNumber == TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[intRecordCounter].JDEPartNumber)
                            {
                                if (intPartID != TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[intRecordCounter].PartID)
                                {
                                    blnRecordMatch = true;
                                }
                            }
                        }

                        if (blnRecordMatch == true)
                        {
                            TheMessagesClass.ErrorMessage("JDE Part Number Exists with a Different Part ID");
                            return;
                        }
                    }
                }

                //doing the loop
                blnFatalError = ThePartNumberClass.UpdatePartInformation(intPartID, strJDEPartNumber, strDescription, true, float.Parse(txtPrice.Text));

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

                TheMessagesClass.InformationMessage("The Part Has Been Updated");

                ClearControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Parts // Save Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }