/// <summary>
        /// Calculates the current volume of a pallet, 
        /// this assumes that the box levels have all the dimentions set.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public double CalculateCurrentVolume( int id)
        {
            Pallet p = new Pallet();
            p.GetAllItemsInPallet(id);
            ReceiveDoc rd = new ReceiveDoc();
            ItemManufacturer im = new ItemManufacturer();
            double volume = 0;

            foreach (DataRowView drv in p.DefaultView)
            {
                //Get the recieving box size and manufacturer
                rd.LoadByPrimaryKey(Convert.ToInt32(drv["ReceiveID"]));
                //Handle if the box size was not specified for some reason.
                // this shouldn't happen on a non error condition
                if (drv["BoxSize"].ToString() == "")
                {
                    drv["BoxSize"] = 0;
                }
                im.LoadIMbyLevel(rd.ItemID, rd.ManufacturerId, Convert.ToInt32(drv["BoxSize"]));
                if (im.RowCount == 0)
                {
                    im.LoadIMbyLevel(rd.ItemID, rd.ManufacturerId, 0);
                }
                double quantity = Convert.ToInt32(drv["Balance"])/im.QuantityInBasicUnit;
                volume += quantity * im.Volume;
                // find the volume of the items in the current pallet.

            }
            return volume;
        }
        /// <summary>
        /// Calculates the current volume of a pallet,
        /// this assumes that the box levels have all the dimentions set.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public double CalculateCurrentVolume(int id)
        {
            Pallet p = new Pallet();

            p.GetAllItemsInPallet(id);
            ReceiveDoc       rd     = new ReceiveDoc();
            ItemManufacturer im     = new ItemManufacturer();
            double           volume = 0;

            foreach (DataRowView drv in p.DefaultView)
            {
                //Get the recieving box size and manufacturer
                rd.LoadByPrimaryKey(Convert.ToInt32(drv["ReceiveID"]));
                //Handle if the box size was not specified for some reason.
                // this shouldn't happen on a non error condition
                if (drv["BoxSize"].ToString() == "")
                {
                    drv["BoxSize"] = 0;
                }
                im.LoadIMbyLevel(rd.ItemID, rd.ManufacturerId, Convert.ToInt32(drv["BoxSize"]));
                if (im.RowCount == 0)
                {
                    im.LoadIMbyLevel(rd.ItemID, rd.ManufacturerId, 0);
                }
                double quantity = Convert.ToInt32(drv["Balance"]) / im.QuantityInBasicUnit;
                volume += quantity * im.Volume;
                // find the volume of the items in the current pallet.
            }
            return(volume);
        }
        private void repositoryItemButtonEdit1_DoubleClick(object sender, EventArgs e)
        {
            Pallet pallet = new Pallet();
            PalletLocation pl = new PalletLocation();
            if (gridItemMovementView.FocusedValue != null )
            {
                prev = gridItemMovementView.FocusedValue;
                pl.LoadByPrimaryKey(Convert.ToInt32(gridItemMovementView.FocusedValue));
                if (!pl.IsColumnNull("PalletID"))
                {
                    pallet.GetAllItemsInPallet(pl.PalletID);
                    gridControl2.DataSource = pallet.DefaultView;
                    pallet.GetAllItemsInPalletSKUTotal(pl.PalletID);
                    Label l = new Label();
                    l.Dock = DockStyle.Bottom;

                    XtraForm f = new XtraForm();
                    //gridControl2.Parent = null;
                    f.ShowInTaskbar = false;
                    f.Width = gridControl2.Width;
                    if (pallet.RowCount > 0 && !pallet.IsColumnNull("Total"))
                    {

                        l.Text = string.Format("Total SKU: {0}", pallet.GetColumn("Total").ToString());
                    }
                    else
                    {
                        l.Text = "Total SKU: 0";
                    }
                    f.Controls.Add(l);

                    pallet.LoadByPrimaryKey(pl.PalletID);
                    if (!pallet.IsColumnNull("PalletNo"))
                    {
                        f.Text = String.Format("Pallet Number: {0}", pallet.PalletNo);

                    }
                    f.Controls.Add(gridControl2);

                    f.StartPosition = FormStartPosition.CenterScreen;
                    f.ShowDialog();
                }
            }
        }