private void ManageItems_Load(object sender, EventArgs e)
        {
            var stor = new Stores();
            stor.GetActiveStores();
            cboStores.Properties.DataSource = stor.DefaultView;
            cboStores.ItemIndex = 0;

            var sup = new Supplier();
            var dtSup = sup.GetSuppliersWithTransaction();
            cboSupplier.Properties.DataSource = dtSup;
            cboSupplier.ItemIndex = -1;
            cboSupplier.Text = "Select Supplier";

            var itemunit = new ItemUnit();
            var units = itemunit.GetAllUnits();
            unitsbindingSource.DataSource = units.DefaultView;

            // bind the supplier lookup for the grid.
            lkEditSupplier.DataSource = dtSup;
            var unitcolumn = ((GridView)gridReceives.MainView).Columns[14];
            switch (VisibilitySetting.HandleUnits)
            {
                case 1:
                    unitcolumn.Visible = false;
                    break;
                case 2:
                    unitcolumn.Visible = true;
                    break;
                default:
                    unitcolumn.Visible = true;
                    break;
            }

            // bind the current dates

               try
            {
                var dr = (DataRowView) lstTree.GetDataRecordByNode(lstTree.Nodes[0].FirstNode);
                if (dr == null) return;
                var rec = new ReceiveDoc();
                if (dr["ParentID"] == DBNull.Value)
                {
                   // int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1);
                    var dt1 = new DateTime(Convert.ToInt32(dr["ID"]) - 1, 11, 1);
                    var dt2 = new DateTime(Convert.ToInt32(dr["ID"]), 11, 1);
                    dtRec = rec.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2);
                    lblRecDate.Text =  dr["RefNo"].ToString();
                }
                else
                {
                    dtRec = rec.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(cboStores.EditValue),dr["Date"].ToString());
                    lblRecDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy");
                }
                gridReceives.DataSource = dtRec;
            }
            catch (Exception ex)
            {

            }
        }
        private void ManageItems_Load(object sender, EventArgs e)
        {
            SetPermission();
            // Bind the supplier combo
            Supplier sup = new Supplier();
            DataTable dtSup = sup.GetSuppliersWithTransaction();
            cboSuppliers.Properties.DataSource = dtSup;
            cboSuppliers.ItemIndex = -1;
            cboSuppliers.Text = @"Select Supplier";

            cboStores.SetupActivityEditor().SetDefaultActivity();
            // Set the default dates on the filter as the current date
            // TODO: the from date should be fixed.
            dtFrom.Value = DateTimeHelper.ServerDateTime;
            dtTo.Value = DateTimeHelper.ServerDateTime;
            _isReady = true;
        }