private void BindDetails(DataRow dr)
        {
            // txtAdditionalCost.EditValue = 0;
            //txtMargin.EditValue = 100;
            try
            {
                Convert.ToInt16(dr["ItemID"]);
            }
            catch
            {
                ResetForm();
                return;
            }

            if (dr != null)
            {
                costElement = new CostElement(Convert.ToInt32(dr["ItemID"]), Convert.ToInt32(lkAccount.EditValue), Convert.ToInt32(dr["ManufacturerID"]), Convert.ToInt32(dr["UnitID"]));

                //ToDo Remove ReceivedSummary ItemId and Stuff with CostElement
                rs = new ReceivedSummary();
                ReceiveDoc rd = new ReceiveDoc();
                rs.ItemID         = Convert.ToInt32(dr["ItemID"]);
                rs.SupplierID     = Convert.ToInt32(dr["SupplierID"]);
                rs.ManufacturerID = Convert.ToInt32(dr["ManufacturerID"]);
                rs.UnitID         = null;
                if (dr["UnitID"] != DBNull.Value)
                {
                    rs.UnitID = Convert.ToInt32(dr["UnitID"]);
                }
                rs.StoreID = Convert.ToInt32(lkAccount.EditValue);

                // TODO: fix this ( Remove ) try cache
                try
                {
                    txtUnit.Text = dr["Unit"].ToString();
                }
                catch
                {
                }

                txtItemName.Text     = dr["FullItemName"].ToString();
                txtManufacturer.Text = dr["Manufacturer"].ToString();

                rd.LoadForPricing(rs.ItemID, rs.SupplierID, rs.StoreID, rs.ManufacturerID, rs.UnitID);
                gridAllSimilarItems.DataSource = rd.DefaultView;



                LoadDecimalFormatings();

                rs.MovingAverageTable(rs.ItemID, rs.StoreID, rs.SupplierID, rs.ManufacturerID, rs.UnitID);
                txtAverageCost.EditValue  = rs.NewUnitCost;
                txtMargin.EditValue       = rs.Margin;
                txtSellingPrice.EditValue = rs.NewSellingPrice;
            }
        }
        private void LoadDetail()
        {
            LoadDecimalFormatings();
            rs = new ReceivedSummary();

            gridCostSheet.DataSource  = rs.MovingAverageTable(ItemID, StoreID, SupplierID, ManufacturerID, UnitID);
            txtAverageCost.EditValue  = rs.NewUnitCost;
            txtMargin.EditValue       = rs.Margin;
            txtSellingPrice.EditValue = rs.NewSellingPrice;
            //   .EditValue = rs.NewSellingPrice;
        }