private void AddItem_Load(object sender, EventArgs e)
        {
            Shelf slf = new Shelf();
            DataTable dtSlf = slf.GetShelves();

            BLL.Program prog = new BLL.Program();
            prog.GetParentPrograms();
            cboPrograms.DataSource = prog.DefaultView;
            cboPrograms.SelectedIndex = -1;

            PopulateFields();

                ResetForHub();
        }
        private void AddItem_Load(object sender, EventArgs e)
        {
            Shelf     slf   = new Shelf();
            DataTable dtSlf = slf.GetShelves();

            BLL.Program prog = new BLL.Program();
            prog.GetParentPrograms();
            cboPrograms.DataSource    = prog.DefaultView;
            cboPrograms.SelectedIndex = -1;

            PopulateFields();


            ResetForHub();
        }
Beispiel #3
0
        private void BeforeLayout(object sender, LayoutEventArgs e)
        {
            if (this.IsReady)
            {
                return;
            }
            // Do this only the first time, when the page loaded.
            //PopulateCatTree(SelectedType);
            DataTable dtMonths = new DataTable();

            dtMonths.Columns.Add("Value");
            dtMonths.Columns.Add("Month");
            dtDate.Value        = DateTimeHelper.ServerDateTime;
            dtDate.CustomFormat = "MM/dd/yyyy";
            _dtCur = ConvertDate.DateConverter(dtDate.Text);
            int currentMont = _dtCur.Month;

            int year = _dtCur.Year;// ((currentMont < 11) ? _dtCur.Year : _dtCur.Year + 1);

            Item      itm     = new Item();
            DataTable dtyears = itm.AllYears();

            cboYear.Properties.DataSource = dtyears;
            cboYear.EditValue             = year;
            BLL.Program prog = new BLL.Program();
            new DataTable();

            DataTable dtProg = prog.GetSubPrograms();

            object[] objProg = { 0, "All Programs", "", 0, "" };
            dtProg.Rows.Add(objProg);
            lkPrograms.Properties.DataSource = dtProg;
            lkPrograms.EditValue             = 0;


            lkStore.SetupActivityEditor().SetDefaultActivity();

            //lkStore.EditValue = (BLL.Settings.IsRdfMode)? 9: 1;
            this.IsReady = true;
            layoutProgressBar.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
            PopulateGrid();
        }
        private void cboPrograms_SelectedIndexChanged(object sender, EventArgs e)
        {
            lstPrograms.Items.Clear();
            BLL.Program prog     = new BLL.Program();
            ItemProgram progItem = new ItemProgram();

            if (cboPrograms.SelectedValue != null)
            {
                prog.GetSubProgramsByParentId(Convert.ToInt32(cboPrograms.SelectedValue));
            }
            else
            {
                prog.GetSubPrograms();
            }
            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 BeforeLayout(object sender, LayoutEventArgs e)
        {
            if (this.IsReady)
            {
                return;
            }
            // Do this only the first time, when the page loaded.
            //PopulateCatTree(SelectedType);
            DataTable dtMonths = new DataTable();
            dtMonths.Columns.Add("Value");
            dtMonths.Columns.Add("Month");
            dtDate.Value = DateTimeHelper.ServerDateTime;
            dtDate.CustomFormat = "MM/dd/yyyy";
            _dtCur = ConvertDate.DateConverter(dtDate.Text);
            int currentMont = _dtCur.Month;

            int year = _dtCur.Year;// ((currentMont < 11) ? _dtCur.Year : _dtCur.Year + 1);

            Item itm = new Item();
            DataTable dtyears = itm.AllYears();

            cboYear.Properties.DataSource = dtyears;
            cboYear.EditValue = year;
            BLL.Program prog = new BLL.Program();
            new DataTable();

            DataTable dtProg = prog.GetSubPrograms();
            object[] objProg = { 0, "All Programs", "", 0, "" };
            dtProg.Rows.Add(objProg);
            lkPrograms.Properties.DataSource = dtProg;
            lkPrograms.EditValue = 0;

            lkStore.SetupActivityEditor().SetDefaultActivity();

            //lkStore.EditValue = (BLL.Settings.IsRdfMode)? 9: 1;
            this.IsReady = true;
            layoutProgressBar.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
            PopulateGrid();
        }
        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 cboPrograms_SelectedIndexChanged(object sender, EventArgs e)
        {
            lstPrograms.Items.Clear();
                BLL.Program prog = new BLL.Program();
                ItemProgram progItem = new ItemProgram();
            if (cboPrograms.SelectedValue != null)
            {

                prog.GetSubProgramsByParentId(Convert.ToInt32(cboPrograms.SelectedValue));

            }
            else
            {
                prog.GetSubPrograms();
            }
            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 btnSave_Click(object sender, EventArgs e)
        {
            if (!AccountTypeSelectionValid())
            {
                XtraMessageBox.Show("Please choose to which account types this item applies to.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                gridViewStoreItemMatrix.SetColumnError(gridColAcctType, "At least one account type needs to be selected");
                return;
            }
            Item itm = new Item();
            ItemSupplier itmSup = new ItemSupplier();
            if (itemId != 0)
                itm.LoadByPrimaryKey(itemId);
            else
            {
                itm.AddNew();
                ItemCategory prodCate = new ItemCategory();
                prodCate.AddNew();
                prodCate.ItemId = itm.ID;
                prodCate.SubCategoryID = Convert.ToInt32(categoryId);
                prodCate.Save();
            }
            if(radioGroupABC.EditValue != null){
                itm.ABC = Convert.ToInt32(radioGroupABC.EditValue);
            }

            if (radioGroupVEN.EditValue != null)
            {
                itm.VEN = Convert.ToInt32(radioGroupVEN.EditValue);
            }
            itm.IsInHospitalList = ckExculed.Checked;
            itm.ProcessInDecimal = chkProcessDecimal.Checked;
            itm.Save();

            if (itm.IsInHospitalList)
            {
                SaveHubDetails();
            }
            else
            {
                // clear out the prefered locations
                // clear out the pick face locations
                // make sure that this item could be made not in the list

            }

            itmSup.DeleteAllSupForItem(itm.ID);
            Supplier sup = new Supplier();
            for (int i = 0; i < lstSuppliers.CheckedItems.Count;i++ )
            {
                sup.GetSupplierByName(lstSuppliers.CheckedItems[i].ToString());
                itmSup.AddNew();
                itmSup.ItemID = itm.ID;
                itmSup.SupplierID = sup.ID;
                itmSup.Save();
            }

            ItemProgram progItm = new ItemProgram();
            progItm.DeleteAllProgramsForItem(itemId);
            BLL.Program prog = new BLL.Program();
            for (int i = 0; i < lstPrograms.CheckedItems.Count; i++)
            {
                prog.GetProgramByName(lstPrograms.CheckedItems[i].ToString());
                progItm.AddNew();
                progItm.ItemID = itm.ID;
                progItm.ProgramID = prog.ID;
                progItm.Save();
            }

                XtraMessageBox.Show("Item Detail is Saved Successfully!", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
        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 btnSave_Click(object sender, EventArgs e)
        {
            if (!AccountTypeSelectionValid())
            {
                XtraMessageBox.Show("Please choose to which account types this item applies to.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                gridViewStoreItemMatrix.SetColumnError(gridColAcctType, "At least one account type needs to be selected");
                return;
            }
            Item         itm    = new Item();
            ItemSupplier itmSup = new ItemSupplier();

            if (itemId != 0)
            {
                itm.LoadByPrimaryKey(itemId);
            }
            else
            {
                itm.AddNew();
                ItemCategory prodCate = new ItemCategory();
                prodCate.AddNew();
                prodCate.ItemId        = itm.ID;
                prodCate.SubCategoryID = Convert.ToInt32(categoryId);
                prodCate.Save();
            }
            if (radioGroupABC.EditValue != null)
            {
                itm.ABC = Convert.ToInt32(radioGroupABC.EditValue);
            }

            if (radioGroupVEN.EditValue != null)
            {
                itm.VEN = Convert.ToInt32(radioGroupVEN.EditValue);
            }
            itm.IsInHospitalList = ckExculed.Checked;
            itm.ProcessInDecimal = chkProcessDecimal.Checked;
            itm.Save();


            if (itm.IsInHospitalList)
            {
                SaveHubDetails();
            }
            else
            {
                // clear out the prefered locations
                // clear out the pick face locations
                // make sure that this item could be made not in the list
            }

            itmSup.DeleteAllSupForItem(itm.ID);
            Supplier sup = new Supplier();

            for (int i = 0; i < lstSuppliers.CheckedItems.Count; i++)
            {
                sup.GetSupplierByName(lstSuppliers.CheckedItems[i].ToString());
                itmSup.AddNew();
                itmSup.ItemID     = itm.ID;
                itmSup.SupplierID = sup.ID;
                itmSup.Save();
            }

            ItemProgram progItm = new ItemProgram();

            progItm.DeleteAllProgramsForItem(itemId);
            BLL.Program prog = new BLL.Program();
            for (int i = 0; i < lstPrograms.CheckedItems.Count; i++)
            {
                prog.GetProgramByName(lstPrograms.CheckedItems[i].ToString());
                progItm.AddNew();
                progItm.ItemID    = itm.ID;
                progItm.ProgramID = prog.ID;
                progItm.Save();
            }

            XtraMessageBox.Show("Item Detail is Saved Successfully!", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }