コード例 #1
0
 /// <summary>
 /// Saves disposal info
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDisposalSave_Click(object sender, EventArgs e)
 {
     if (txtReasons.Text != "")
     {
         DisposalReasons reason = new DisposalReasons();
         if (_disposalReasonId != 0)
         {
             reason.LoadByPrimaryKey(_disposalReasonId);
         }
         else
         {
             reason.AddNew();
         }
         reason.Reason      = txtReasons.Text.Trim();
         reason.Description = txtDisposalDescription.Text;
         reason.Save();
         reason.LoadAll();
         PopulateDisposalReason(reason);
         ResetDisposalForm();
     }
     else
     {
         txtReasons.BackColor = Color.FromArgb(251, 214, 214);
     }
 }
コード例 #2
0
        /// <summary>
        /// Handles the gridViewReason focused node changed and updates the form accordingly
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridViewReason_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            DataRow dr = gridViewReason.GetFocusedDataRow();

            if (dr != null)
            {
                DisposalReasons reason   = new DisposalReasons();
                int             reasonId = Convert.ToInt32(dr["ID"]);
                reason.LoadByPrimaryKey(reasonId);
                txtReasons.Text             = reason.Reason;
                txtDisposalDescription.Text = reason.Description;
                _disposalReasonId           = reason.ID;
                btnDisposalSave.Text        = "Update";
            }
        }
コード例 #3
0
        /// <summary>
        /// Load the lookups and the tree
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LossesAdjustment_Load(object sender, EventArgs e)
        {
            var UnitColumn  = ((GridView)AdjustmentGrid.MainView).Columns[10];
            var UnitColumn1 = ((GridView)gridItemsChoice.MainView).Columns[4];

            switch (VisibilitySetting.HandleUnits)
            {
            case 2:
                UnitColumn.Visible  = true;
                UnitColumn1.Visible = false;
                break;

            case 1:
                UnitColumn.Visible  = false;
                UnitColumn1.Visible = true;
                break;

            case 3:
                UnitColumn.Visible  = true;
                UnitColumn1.Visible = false;
                break;
            }

            var stor = new Stores();

            stor.GetActiveStores();

            cboStores.Properties.DataSource    = stor.DefaultView;
            lkCategories.Properties.DataSource = BLL.Type.GetAllTypes();

            var unit     = new ItemUnit();
            var allunits = unit.GetAllUnits();

            unitsbindingSource.DataSource = allunits.DefaultView;

            var disRes     = new DisposalReasons();
            var allreasons = disRes.GetAllReasons();

            reasonBindingSource.DataSource = allreasons.DefaultView;

            lkCategories.ItemIndex = 0;
            cboStores.ItemIndex    = 0;
            dtAdjustDate.Value     = DateTime.Now;
            if (ckExpired.Checked)
            {
                gridItemChoiceView.ActiveFilterString = String.Format("[ExpiryDate] < #{0}# and [TypeID]={1} and [QuantityLeft] > 0", DateTime.Now, (int)lkCategories.EditValue);
            }
        }
コード例 #4
0
        /// <summary>
        /// Loads the lookups and the category tree
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ManageItems_Load(object sender, EventArgs e)
        {
            PopulateCatTree(_selectedType);

            var rec   = new DisposalReasons();
            var dtDis = rec.GetAvailableReasons();

            //object[] objRec = { 0, "All Reasons", "" };
            //dtDis.Rows.Add(objRec);
            cboReasons.Properties.DataSource    = dtDis;
            cboReasons.Properties.DisplayMember = "Reason";
            cboReasons.Properties.ValueMember   = "ID";
            //  cboReasons.ItemIndex = 0;

            //cboStores.ItemIndex = 0;

            dtDate.Value        = DateTime.Now;
            dtDate.CustomFormat = "MM/dd/yyyy";
            DateTime dtCur = ConvertDate.DateConverter(dtDate.Text);
            int      month = dtCur.Month;
            int      year;

            if (month < 11)
            {
                year = dtCur.Year;
            }
            else
            {
                year = dtCur.Year + 1;
            }

            DataTable dtyears = Items.AllYears();

            cmbYear.Properties.DataSource = dtyears;
            cmbYear.EditValue             = year;
            if (cmbYear.Properties.Columns.Count > 0)
            {
                cmbYear.Properties.Columns[0].Alignment = DevExpress.Utils.HorzAlignment.Near;
            }
            //cmbYear.EditValue
            var stor = new Stores();

            stor.GetActiveStores();
            cboStores.Properties.DataSource        = stor.DefaultView;
            cboStores.ItemIndex                    = 0;
            lkCommodityTypes.Properties.DataSource = BLL.Type.GetAllTypes();
            lkCommodityTypes.ItemIndex             = 0;
        }
コード例 #5
0
        /// <summary>
        /// Populates lookups and tables
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SystemSetting_Load(object sender, EventArgs e)
        {
            PopulatePrograms();
            // TAb IIN
            BLL.INN innInfo = new INN();
            innInfo.LoadAll();
            innInfo.Sort = "IIN";
            PopulateINN(innInfo);

            // TAb Category

            BLL.Type type = new BLL.Type();
            type.LoadAll();
            lkCategory.DataSource = type.DefaultView;

            PopulateCategoryTree();
            //unit section
            BLL.Unit uni = new Unit();
            uni.LoadAll();
            lstUnits.DataSource = uni.DefaultView;

            // dosage form section
            DosageForm doForm = new DosageForm();

            doForm.LoadAll();
            doForm.Sort = "Form";
            PopulateDosageForm(doForm);
            //receiving status section
            // PopulateManufacturer();
            //disposal reasons
            DisposalReasons reason = new DisposalReasons();

            reason.LoadAll();
            reason.Sort = "Reason";
            PopulateDisposalReason(reason);
            //location regions zones and woredas
            PopulateLocationTree();
            PopulateSupplyCatTree();

            PopulateBalance();
        }
コード例 #6
0
 /// <summary>
 /// Loads the reason grid
 /// </summary>
 /// <param name="reason"></param>
 private void PopulateDisposalReason(DisposalReasons reason)
 {
     gridReasons.DataSource = reason.DefaultView;
 }
コード例 #7
0
ファイル: ExpiredProductsReport.cs プロジェクト: HCMISFE/FE
        /// <summary>
        /// Loads the lookups and the category tree
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ManageItems_Load(object sender, EventArgs e)
        {
            PopulateCatTree(_selectedType);

            var rec   = new DisposalReasons();
            var dtDis = rec.GetAvailableReasons();

            //object[] objRec = { 0, "All Reasons", "" };
            //dtDis.Rows.Add(objRec);
            cboReasons.Properties.DataSource    = dtDis;
            cboReasons.Properties.DisplayMember = "Reason";
            cboReasons.Properties.ValueMember   = "ID";
            //  cboReasons.ItemIndex = 0;

            //cboStores.ItemIndex = 0;

            dtDate.Value        = DateTime.Now;
            dtDate.CustomFormat = "MM/dd/yyyy";
            DateTime dtCur = ConvertDate.DateConverter(dtDate.Text);
            int      month = dtCur.Month;
            int      year;

            if (month < 11)
            {
                year = dtCur.Year;
            }
            else
            {
                year = dtCur.Year + 1;
            }

            //DataTable dtyears = Items.AllYears();
            //cmbYear.Properties.DataSource = dtyears;
            //cmbYear.EditValue = year;
            DataView dv = Items.AllFiscalYears().DefaultView;

            dv.Sort = "year desc";
            DataTable sortedDT = dv.ToTable();

            cmbYear.Properties.DataSource = sortedDT;
            //  cboYear.EditValue = curYear;
            cmbYear.ItemIndex = 0;
            if (cmbYear.Properties.Columns.Count > 0)
            {
                cmbYear.Properties.Columns[0].Alignment = DevExpress.Utils.HorzAlignment.Near;
            }
            //cmbYear.EditValue

            var stor = new Stores();

            stor.GetActiveStores();
            cboStores.Properties.DataSource = stor.DefaultView;
            cboStores.ItemIndex             = 0;
            DataTable table = BLL.Type.GetAllTypes();
            DataRow   row   = table.NewRow();

            row["ID"]   = "0";
            row["Name"] = "All";
            table.Rows.InsertAt(row, 0);

            lkCommodityTypes.Properties.DataSource = table;
            lkCommodityTypes.ItemIndex             = 0;

            gridItemListView.Columns["InternalDrugCode"].Visible = Convert.ToBoolean(chkIntDrugCode.EditValue);
        }
コード例 #8
0
        /// <summary>
        /// Prepare all lookups
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ManageItems_Load(object sender, EventArgs e)
        {
            var stor = new Stores();

            stor.GetActiveStores();
            cboStores.Properties.DataSource = stor.DefaultView;
            cboStores.ItemIndex             = 0;

            var rec   = new DisposalReasons();
            var dtDis = rec.GetAvailableReasons();

            cboReasons.Properties.DataSource = dtDis.DefaultView;
            reasonBindingSource.DataSource   = dtDis.DefaultView;
            // cboReasons.ItemIndex = 0;

            var itemunit = new ItemUnit();
            var units    = itemunit.GetAllUnits();

            unitbindingSource.DataSource = units.DefaultView;

            var unitcolumn = ((GridView)gridAdjustments.MainView).Columns[10];

            switch (VisibilitySetting.HandleUnits)
            {
            case 1:
                unitcolumn.Visible = false;
                break;

            case 2:
                unitcolumn.Visible = true;
                break;

            default:
                unitcolumn.Visible = true;
                break;
            }
            try
            {
                //CALENDAR:
                var dtDate = new CalendarLib.DateTimePickerEx
                {
                    CustomFormat = "MM/dd/yyyy",
                    Value        = DateTime.Now
                };
                var dr = (DataRowView)lstTree.GetDataRecordByNode(lstTree.Nodes[0].FirstNode);
                if (dr == null)
                {
                    return;
                }

                var disp = new Disposal();
                if (dr["ParentID"] == DBNull.Value)
                {
                    var dt1 = new DateTime(Convert.ToInt32(dr["ID"]) - 1, 11, 1);
                    var dt2 = new DateTime(Convert.ToInt32(dr["ID"]), 11, 1);
                    dtRec           = disp.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2);
                    lblAdjDate.Text = dr["RefNo"].ToString();
                }
                else
                {
                    dtRec           = disp.GetDocumentByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(cboStores.EditValue), dr["Date"].ToString());
                    lblAdjDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy");
                }
                gridAdjustments.DataSource = dtRec;
            }
            catch (Exception ex)
            {
            }
        }
コード例 #9
0
ファイル: LossesAdjustment.cs プロジェクト: tomanye/facility
        /// <summary>
        /// Load the lookups and the tree
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LossesAdjustment_Load(object sender, EventArgs e)
        {
            var UnitColumn  = ((GridView)AdjustmentGrid.MainView).Columns[10];
            var UnitColumn1 = ((GridView)gridItemsChoice.MainView).Columns[4];

            switch (VisibilitySetting.HandleUnits)
            {
            case 2:
                UnitColumn.Visible  = true;
                UnitColumn1.Visible = false;
                break;

            case 1:
                UnitColumn.Visible  = false;
                UnitColumn1.Visible = true;
                break;

            case 3:
                UnitColumn.Visible  = true;
                UnitColumn1.Visible = false;
                break;
            }

            var stor = new Stores();

            stor.GetActiveStores();
            UserStore ust = new UserStore();
            DataTable dtt = ust.GetUserStore(MainWindow.LoggedinId);

            cboStores.Properties.DataSource = dtt;
            // cboStores.Properties.DataSource = stor.DefaultView;
            //lkCategories.Properties.DataSource = BLL.Type.GetAllTypes();
            UserCommodityType ucs = new UserCommodityType();
            DataTable         dt  = ucs.GetUserCommodityType(MainWindow.LoggedinId);

            lkCategories.Properties.DataSource = dt;

            var unit     = new ItemUnit();
            var allunits = unit.GetAllUnits();

            unitsbindingSource.DataSource = allunits.DefaultView;

            var disRes     = new DisposalReasons();
            var allreasons = disRes.GetAllReasons();

            reasonBindingSource.DataSource = allreasons.DefaultView;
            lkReason.Properties.DataSource = allreasons;


            lkCategories.ItemIndex = 0;
            cboStores.ItemIndex    = 0;
            dtAdjustDate.Value     = DateTime.Now;
            if (ckExpired.Checked)
            {
                gridItemChoiceView.ActiveFilterString = String.Format("[ExpiryDate] < #{0}# and [TypeID]={1} and [QuantityLeft] > 0", DateTime.Now, (int)lkCategories.EditValue);
            }

            if (Common.IsInventoryPeriod())
            {
                btnSave.Enabled = false;
            }
            else
            {
                btnSave.Enabled = true;
            }
            ((GridView)AdjustmentGrid.MainView).Columns[11].Visible = false;
            ((GridView)AdjustmentGrid.MainView).Columns[12].Visible = false;
        }