Exemple #1
0
        private void ResetControls()
        {
            int    intCounter;
            int    intNumberOfRecords;
            int    intPartID;
            int    intRecordsReturned;
            string strOldPartNumber;
            bool   blnFatalError = false;

            try
            {
                blnFatalError = TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Parts List");

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

                ThePartsListReportDataSet.partlistreport.Rows.Clear();

                TheFindPartsListReportDataSet = TheInventoryClass.FindPartsListReport();

                intNumberOfRecords = TheFindPartsListReportDataSet.FindPartsListReport.Rows.Count;

                for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                {
                    intPartID = TheFindPartsListReportDataSet.FindPartsListReport[intCounter].PartID;

                    strOldPartNumber = "NONE FOUND";

                    TheFindMasterPartListByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                    intRecordsReturned = TheFindMasterPartListByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        strOldPartNumber = TheFindMasterPartListByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                    }

                    PartsListReportDataSet.partlistreportRow NewPartRow = ThePartsListReportDataSet.partlistreport.NewpartlistreportRow();

                    NewPartRow.JDEPartNumber   = TheFindPartsListReportDataSet.FindPartsListReport[intCounter].JDEPartNumber;
                    NewPartRow.OldPartNumber   = strOldPartNumber;
                    NewPartRow.PartDescription = TheFindPartsListReportDataSet.FindPartsListReport[intCounter].PartDescription;
                    NewPartRow.PartID          = intPartID;
                    NewPartRow.PartNumber      = TheFindPartsListReportDataSet.FindPartsListReport[intCounter].PartNumber;

                    ThePartsListReportDataSet.partlistreport.Rows.Add(NewPartRow);
                }

                dgrResult.ItemsSource = ThePartsListReportDataSet.partlistreport;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Parts List // Reset Controls " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemple #2
0
        private void btnFindPart_Click(object sender, RoutedEventArgs e)
        {
            string strPartNumber;
            int    intNumberOfRecords;
            int    intCounter;
            int    intPartID;
            bool   blnFatalError = false;
            string strJDEPartNumber;
            string strPartDescription;
            int    intRecordsReturned;
            string strOldPartNumber;

            try
            {
                blnFatalError = TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Part Lookup");

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

                ThePartLookupDataSet.partlookup.Rows.Clear();

                strPartNumber = txtEnterPartInformation.Text;

                if (strPartNumber.Length < 1)
                {
                    TheMessagesClass.ErrorMessage("The Part Information Was Not Entered");
                    return;
                }

                //part number search
                TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                intNumberOfRecords = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    intPartID          = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                    strJDEPartNumber   = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber;
                    strPartDescription = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription;

                    TheFindMasterPartListPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                    strOldPartNumber = "NONE FOUND";

                    intRecordsReturned = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        strOldPartNumber = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                    }

                    PartLookupDataSet.partlookupRow NewPartRow = ThePartLookupDataSet.partlookup.NewpartlookupRow();

                    NewPartRow.JDEPartNumber   = strJDEPartNumber;
                    NewPartRow.OldPartNumber   = strOldPartNumber;
                    NewPartRow.PartDescription = strPartDescription;
                    NewPartRow.PartID          = intPartID;
                    NewPartRow.PartNumber      = strPartNumber;

                    ThePartLookupDataSet.partlookup.Rows.Add(NewPartRow);
                }
                else if (intNumberOfRecords < 1)
                {
                    strJDEPartNumber = strPartNumber;

                    TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber);

                    intNumberOfRecords = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                    if (intNumberOfRecords > 0)
                    {
                        strPartNumber      = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartNumber;
                        intPartID          = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID;
                        strPartDescription = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription;

                        TheFindMasterPartListPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                        strOldPartNumber = "NONE FOUND";

                        intRecordsReturned = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            strOldPartNumber = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                        }

                        PartLookupDataSet.partlookupRow NewPartRow = ThePartLookupDataSet.partlookup.NewpartlookupRow();

                        NewPartRow.JDEPartNumber   = strJDEPartNumber;
                        NewPartRow.OldPartNumber   = strOldPartNumber;
                        NewPartRow.PartDescription = strPartDescription;
                        NewPartRow.PartID          = intPartID;
                        NewPartRow.PartNumber      = strPartNumber;

                        ThePartLookupDataSet.partlookup.Rows.Add(NewPartRow);
                    }
                    else if (intNumberOfRecords < 1)
                    {
                        strPartDescription = strPartNumber;

                        TheFindPartByDescriptionKeyWordDataSet = ThePartNumberClass.FindPartByDescriptionKeyWord(strPartDescription);

                        intNumberOfRecords = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord.Rows.Count;

                        if (intNumberOfRecords < 1)
                        {
                            TheMessagesClass.ErrorMessage("The Part Was Not Found");
                            return;
                        }
                        else if (intNumberOfRecords > 1)
                        {
                            for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                            {
                                intPartID          = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord[intCounter].PartID;
                                strPartNumber      = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord[intCounter].PartNumber;
                                strJDEPartNumber   = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord[intCounter].JDEPartNumber;
                                strPartDescription = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord[intCounter].PartDescription;

                                TheFindMasterPartListPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                                strOldPartNumber = "NONE FOUND";

                                intRecordsReturned = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    strOldPartNumber = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                                }

                                PartLookupDataSet.partlookupRow NewPartRow = ThePartLookupDataSet.partlookup.NewpartlookupRow();

                                NewPartRow.JDEPartNumber   = strJDEPartNumber;
                                NewPartRow.OldPartNumber   = strOldPartNumber;
                                NewPartRow.PartDescription = strPartDescription;
                                NewPartRow.PartID          = intPartID;
                                NewPartRow.PartNumber      = strPartNumber;

                                ThePartLookupDataSet.partlookup.Rows.Add(NewPartRow);
                            }
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Part Lookup // Find Part Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            string strPartNumber;
            string strPartLocation;
            string strJDEPartNumber;
            int    intPartID;
            string strOldPartNumber;
            string strPartDescription;
            int    intRecordsReturned;

            try
            {
                TheImportInventoryLocationdDataSet.importinventorylocations.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++)
                {
                    strPartNumber   = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strPartLocation = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();

                    TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        intPartID          = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                        strJDEPartNumber   = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber;
                        strPartDescription = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription;

                        TheFindMasterPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                        intRecordsReturned = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                        strOldPartNumber = "NONE FOUND";

                        if (intRecordsReturned > 0)
                        {
                            strOldPartNumber = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                        }

                        ImportInventoryLocationsDataSet.importinventorylocationsRow NewPartRow = TheImportInventoryLocationdDataSet.importinventorylocations.NewimportinventorylocationsRow();

                        NewPartRow.JDEPartNumber   = strJDEPartNumber;
                        NewPartRow.Location        = strPartLocation;
                        NewPartRow.OldPartNumber   = strOldPartNumber;
                        NewPartRow.PartDescription = strPartDescription;
                        NewPartRow.PartID          = intPartID;
                        NewPartRow.PartNumber      = strPartNumber;
                        NewPartRow.ToBeImported    = true;

                        TheImportInventoryLocationdDataSet.importinventorylocations.Rows.Add(NewPartRow);
                    }
                    else if (intRecordsReturned < 1)
                    {
                        strJDEPartNumber = strPartNumber;

                        TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber);

                        intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            intPartID          = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID;
                            strPartNumber      = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartNumber;
                            strPartDescription = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription;

                            TheFindMasterPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                            intRecordsReturned = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                            strOldPartNumber = "NONE FOUND";

                            if (intRecordsReturned > 0)
                            {
                                strOldPartNumber = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                            }

                            ImportInventoryLocationsDataSet.importinventorylocationsRow NewPartRow = TheImportInventoryLocationdDataSet.importinventorylocations.NewimportinventorylocationsRow();

                            NewPartRow.JDEPartNumber   = strJDEPartNumber;
                            NewPartRow.Location        = strPartLocation;
                            NewPartRow.OldPartNumber   = strOldPartNumber;
                            NewPartRow.PartDescription = strPartDescription;
                            NewPartRow.PartID          = intPartID;
                            NewPartRow.PartNumber      = strPartNumber;
                            NewPartRow.ToBeImported    = true;

                            TheImportInventoryLocationdDataSet.importinventorylocations.Rows.Add(NewPartRow);
                        }
                    }
                }

                PleaseWait.Close();

                dgrImportedInformation.ItemsSource = TheImportInventoryLocationdDataSet.importinventorylocations;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Inventory Locations // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void cboSelectWarehouse_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int     intCounter;
            int     intNumberOfRecords;
            int     intWarehouseID;
            int     intPartID;
            string  strPartNumber;
            string  strOldPartNumber = "";
            string  strJDEPartNumber;
            string  strPartDescription;
            int     intQuantity;
            int     intSelectedIndex;
            int     intRecordsReturned;
            string  strCurrentCount = "";
            decimal decPartCost;
            decimal decTotalCost;

            try
            {
                intSelectedIndex = cboSelectWarehouse.SelectedIndex - 1;
                TheWarehouseCountDataSet.warehousecount.Rows.Clear();

                if (intSelectedIndex > -1)
                {
                    intWarehouseID = TheFindPartsWarehouseDataSet.FindPartsWarehouses[intSelectedIndex].EmployeeID;

                    TheFindWarehouseInventoryDataSet = TheInventoryClass.FindWarehouseInventory(intWarehouseID);

                    intNumberOfRecords = TheFindWarehouseInventoryDataSet.FindWarehouseInventory.Rows.Count;

                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        intPartID          = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intCounter].PartID;
                        strPartNumber      = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intCounter].PartNumber;
                        strJDEPartNumber   = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intCounter].JDEPartNumber;
                        strPartDescription = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intCounter].PartDescription;
                        intQuantity        = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intCounter].Quantity;

                        TheFindPartByPartIDDataSet = ThePartNumberClass.FindPartByPartID(intPartID);

                        decPartCost = Convert.ToDecimal(TheFindPartByPartIDDataSet.FindPartByPartID[0].Price);

                        decPartCost = Math.Round(decPartCost, 2);

                        decTotalCost = decPartCost * intQuantity;

                        decTotalCost = Math.Round(decTotalCost, 2);

                        TheFindMasterPartListPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                        intRecordsReturned = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            strOldPartNumber = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                        }
                        else if (intRecordsReturned < 1)
                        {
                            strOldPartNumber = "NO PART FOUND";
                        }

                        WarehouseCountDataSet.warehousecountRow NewPartRow = TheWarehouseCountDataSet.warehousecount.NewwarehousecountRow();

                        NewPartRow.Quantity        = intQuantity;
                        NewPartRow.JDEPartNumber   = strJDEPartNumber;
                        NewPartRow.OldPartNumber   = strOldPartNumber;
                        NewPartRow.PartDescription = strPartDescription;
                        NewPartRow.PartID          = intPartID;
                        NewPartRow.PartNumber      = strPartNumber;
                        NewPartRow.CurrentQuantity = strCurrentCount;
                        NewPartRow.PartCost        = decPartCost;
                        NewPartRow.TotalValue      = decTotalCost;

                        TheWarehouseCountDataSet.warehousecount.Rows.Add(NewPartRow);
                    }

                    dgrResult.ItemsSource = TheWarehouseCountDataSet.warehousecount;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Warehouse Inventory Report // Select Warehouse Combo Box " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemple #5
0
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            string strPartNumber;
            string strJDEPartNumber;
            int    intPartID = 0;
            string strPartDescription;
            int    intQuantity = 0;
            int    intRecordsReturned;
            bool   blnItemFound;
            bool   blnItemInTable;
            bool   blnFatalError = false;
            int    intSecondCounter;
            string strOldPartNumber = "";

            try
            {
                expImportExcel.IsExpanded = false;

                blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Create Spectrum Report // Import Spectrum Count");

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

                if (cboSelectWarehouse.SelectedIndex < 1)
                {
                    TheMessagesClass.ErrorMessage("The Warehouse Was Not Selected");
                    return;
                }

                TheSpectrumCountDataSet.spectrumcount.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;
                gintCounter         = 0;
                gintNumberOfRecords = 0;

                for (intCounter = 1; intCounter <= intNumberOfRecords; intCounter++)
                {
                    blnItemFound       = false;
                    strPartNumber      = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strJDEPartNumber   = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strPartDescription = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();

                    TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        intPartID        = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                        strJDEPartNumber = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber;
                        blnItemFound     = true;
                    }
                    else if (intRecordsReturned < 1)
                    {
                        TheFindPartByJDEPartNUmberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber);

                        intRecordsReturned = TheFindPartByJDEPartNUmberDataSet.FindPartByJDEPartNumber.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            strPartNumber = TheFindPartByJDEPartNUmberDataSet.FindPartByJDEPartNumber[0].PartNumber;
                            intPartID     = TheFindPartByJDEPartNUmberDataSet.FindPartByJDEPartNumber[0].PartID;
                            blnItemFound  = true;
                        }
                        else if (intRecordsReturned < 1)
                        {
                            if (strPartNumber == "NONE")
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intCounter * -1;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = "UNKNOWN";

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                        }
                    }


                    if (blnItemFound == true)
                    {
                        TheFindWarehouseInventoryByPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(intPartID, MainWindow.gintWarehouseID);

                        intRecordsReturned = TheFindWarehouseInventoryByPartDataSet.FindWarehouseInventoryPart.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            blnItemInTable = false;

                            if (gintCounter > 0)
                            {
                                for (intSecondCounter = 0; intSecondCounter <= gintNumberOfRecords; intSecondCounter++)
                                {
                                    if (intPartID == TheSpectrumCountDataSet.spectrumcount[intSecondCounter].PartID)
                                    {
                                        blnItemInTable = true;
                                    }
                                }
                            }

                            if (blnItemInTable == false)
                            {
                                intQuantity = TheFindWarehouseInventoryByPartDataSet.FindWarehouseInventoryPart[0].Quantity;

                                TheFindMasterPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                                intRecordsReturned = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    strOldPartNumber = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                                }
                                else
                                {
                                    strOldPartNumber = "NOT FOUND";
                                }

                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = intQuantity;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                        }
                        else if (intRecordsReturned < 1)
                        {
                            if (strPartDescription.Contains("CABLE RG6") == true)
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                            else if (strPartDescription.Contains("CABLE RG11") == true)
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                            else if (strPartDescription.Contains("CABLE 875") == true)
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                            else if (strPartDescription.Contains("CABLE 625") == true)
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                        }
                    }
                }

                dgrResult.ItemsSource = TheSpectrumCountDataSet.spectrumcount;

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create Spectrum Report // Import Excel Expander " + Ex.Message);

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