private void PopulateFields()
        {
            // Bind the lookups first
            ABC abc = new ABC();
            abc.LoadAll();

            radioGroupABC.Properties.Items.Clear();
            while(!abc.EOF){
                radioGroupABC.Properties.Items.Add(new RadioGroupItem(abc.ID, abc.Description));
                abc.MoveNext();
            }

            radioGroupVEN.Properties.Items.Clear();
            VEN ven = new VEN();
            ven.LoadAll();
            while (!ven.EOF)
            {
                radioGroupVEN.Properties.Items.Add(new RadioGroupItem(ven.ID, ven.Description));
                ven.MoveNext();
            }

            if(itemId != 0)
            {
                Item itm = new Item();

                //itm.LoadByPrimaryKey(itemId);
                DataTable dtItem = itm.GetItemById(itemId);
                txtItemName.Text = itm.FullItemName;//String.Format("{0} - {1} - {2}", dtItem.Rows[0]["ItemName"], dtItem.Rows[0]["DosageForm"], dtItem.Rows[0]["Strength"]);
                ckExculed.Checked = (!itm.IsColumnNull("IsInHospitalList"))?itm.IsInHospitalList:false;

                chkProcessDecimal.Checked = (!itm.IsColumnNull("ProcessInDecimal")) ? itm.ProcessInDecimal : false;

                if (!itm.IsColumnNull("ABCID"))
                {
                    radioGroupABC.EditValue = itm.GetColumn("ABCID");
                }
                if (!itm.IsColumnNull("VENID"))
                {
                    radioGroupVEN.EditValue = itm.GetColumn("VENID");
                }

                Supplier sup = new Supplier();
                sup.LoadAll();
                ItemSupplier itmSup = new ItemSupplier();
                itmSup.GetSuppliersAndMarkThoseUsed(itemId);

                while(!itmSup.EOF)
                {
                    lstSuppliers.Items.Add(itmSup.GetColumn("CompanyName"),Convert.ToBoolean(itmSup.GetColumn("IsUsed")));
                    itmSup.MoveNext();
                }

                BLL.Program prog = new BLL.Program();
                prog.GetSubPrograms();
                ItemProgram progItem = new ItemProgram();
                lstPrograms.Items.Clear();
                foreach (DataRowView dv in prog.DefaultView)
                {
                    bool check = false;
                    check = progItem.CheckIfExists(itemId,Convert.ToInt32(dv["ID"]));
                    lstPrograms.Items.Add(dv["Name"],check);
                }
            }
        }
        private void BtnPrintClicked(object sender, EventArgs e)
        {
            if (transactionGrid.DataSource == null)
            {
                XtraMessageBox.Show("Select the BinCard to Print", "Select Bincard", MessageBoxButtons.OK,
                                    MessageBoxIcon.Asterisk);
                return;
            }
            if (tabControl1.SelectedTabPage == tbSOHLocation)
            {
                PrintableComponentLink pcl = new PrintableComponentLink(new PrintingSystem());
                pcl.Component = gridLocations;
                pcl.Landscape = true;

                Item itm = new Item();
                itm.GetItemById(_ItemID);

                pcl.RtfReportHeader = "Locations For: " + itm.FullItemName + "\n";
                pcl.RtfReportFooter = DateTimeHelper.ServerDateTime.ToShortDateString();
                pcl.PrintDlg();

            }
            else if (tabControl1.SelectedTabPage == tbSOHPriceSummary)
            {
                PrintableComponentLink pcl = new PrintableComponentLink(new PrintingSystem());
                pcl.Component = gridSOHSummary;
                pcl.Landscape = true;

                Item itm = new Item();
                itm.GetItemById(_ItemID);

                pcl.RtfReportHeader = "Price Summary For: " + itm.FullItemName + "\n";
                pcl.RtfReportFooter = DateTimeHelper.ServerDateTime.ToShortDateString();
                pcl.PrintDlg();
            }
            else
            {
                PrintableComponentLink pcl = new PrintableComponentLink(new PrintingSystem());
                pcl.Component = transactionGrid;
                pcl.Landscape = true;

                Item itm = new Item();
                itm.GetItemById(_ItemID);

                pcl.RtfReportHeader = "Transactions For: " + itm.FullItemName + "\n";
                pcl.RtfReportFooter = DateTimeHelper.ServerDateTime.ToShortDateString();
                pcl.PrintDlg();
            }
        }
        private void bgWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            // get the results of the pick list from the other thread that calculated it,
            List<DataView> list = (List<DataView>)e.Result;
            _dvPickListMakeup = list[0];
            DataView replenismentView = list[1];
            int i = 1;
            foreach (DataRowView drv in _dvPickListMakeup)
            {
                drv["LineNum"] = i++;
            }
            if (replenismentView.Count > 0)
            {
                string str = "";
                Item itm = new Item();
                Activity stor = new Activity();
                foreach (DataRowView dr in replenismentView)
                {
                    itm.GetItemById(Convert.ToInt32(dr["ItemID"]));
                    stor.LoadByPrimaryKey(Convert.ToInt32(dr["StoreID"]));
                    str += string.Format("\n{0} in {1}", itm.FullItemName, stor.Name);
                }

                XtraMessageBox.Show(
                    String.Format(
                        "Please replenish the corresponding pick faces for the following Items before processing this pick list. \n{0}",
                        str), "Replenish Pick Face", MessageBoxButtons.OK, MessageBoxIcon.Error);
                btnPrintAndSavePickList.Enabled = false;

                // Adjust the columns that had to change to show old Items

            }
            else
            {
                btnPrintAndSavePickList.Enabled = true;
            }
            colPrice.FieldName = "CalculatedCost";
            colSKU.FieldName = "QtyInSKU";

            btnCancelPickList.Enabled = true;
            btnPrintAndSavePickList.Text = @"Print Save";
            gridPickListDetail.DataSource = _dvPickListMakeup;

            progressBarControl.Visible = false;
            this.Enabled = true;
        }