private void lstTree_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx
            {
                CustomFormat = "MM/dd/yyyy",
                Value        = DateTime.Now
            };
            DateTime dtCurrent = ConvertDate.DateConverter(dtDate.Text);

            DataRowView dr = (DataRowView)lstTree.GetDataRecordByNode(lstTree.FocusedNode);

            if (dr == null)
            {
                return;
            }

            //lstTransactions.Items.Clear();
            IssueDoc  iss = new IssueDoc();
            DataTable dtRec;

            if (dr["ParentID"] == DBNull.Value)
            {
                EthiopianDate.EthiopianDate ethiopianDate = new EthiopianDate.EthiopianDate(Convert.ToInt32(dr["ID"]), 1, 1);
                dtRec = iss.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), ethiopianDate.StartOfFiscalYear.ToGregorianDate(), ethiopianDate.EndOfFiscalYear.ToGregorianDate());
                string dateString = dr["RefNo"].ToString();
                lblIssDate.Text = dateString;
            }
            else
            {
                //dtRec = iss.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(cboStores.EditValue), dr["Date"].ToString());
                dtRec           = iss.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToDateTime(dr["Date"]));
                lblIssDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy");
            }
            gridIssues.DataSource = dtRec;
        }
Beispiel #2
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var us     = new User();
            var userID = MainWindow.LoggedinId;

            us.LoadByPrimaryKey(userID);
            var dr = (DataRowView)lstTree.GetDataRecordByNode(lstTree.FocusedNode);

            if (dr == null)
            {
                return;
            }
            if (us.UserName != "admin")
            {
                XtraMessageBox.Show("You don't have the privilege to update reference number!", "Caution");
                return;
            }
            if (XtraMessageBox.Show("Are You Sure, You want to delete this?", "Confirmation", MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.Yes)
            {
                var       dis  = new IssueDoc();
                DataTable dtbl = dis.GetTransactionByRefNo((string)dr["RefNo"]);
                foreach (DataRow dataRow in dtbl.Rows)
                {
                    AddIssueDocDeleted(dataRow);
                    DeletedRelatedModel(dataRow);
                    dataRow.Delete();
                }

                dis.MarkAsDeleted();
                dis.Save();
                XtraMessageBox.Show("Item successfully deleted.", "Success");
            }
        }
Beispiel #3
0
 private void EditIssueDocRefrenceNo_Load(object sender, EventArgs e)
 {
     dtRecDate.Value        = DateTime.Now;
     dtRecDate.CustomFormat = "MM/dd/yyyy";
     if (_refno != null)
     {
         var iss = new IssueDoc();
         iss.GetTransactionByRefNo(_refno);
         DateTime dtDate = Convert.ToDateTime(iss.Date.ToString("MM/dd/yyyy"));
         txtDate.Text  = dtDate.ToShortDateString();
         txtRefNo.Text = iss.RefNo;
     }
 }
Beispiel #4
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            var       isd  = new IssueDoc();
            DataTable dtbl = isd.GetTransactionByRefNo(_refno);

            if (isd.RowCount > 0)
            {
                foreach (DataRow datarow in dtbl.Rows)
                {
                    datarow["RefNo"] = txtRefNo.Text;
                    datarow["Date"]  = txtDate.Text;
                }
                isd.Save();
                Close();
                XtraMessageBox.Show("Refrence No and Date is successfully updated", "Success");
            }

            else
            {
                XtraMessageBox.Show("There is no refrence no to edit");
                return;
            }
            this.Close();
        }
Beispiel #5
0
        /// <summary>
        /// Populate the lookups
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ManageItems_Load(object sender, EventArgs e)
        {
            var usr    = new User();
            var userID = MainWindow.LoggedinId;

            usr.LoadByPrimaryKey(userID);
            if (usr.UserType == 1)
            {
                contextMenuStrip1.Enabled = false;
            }
            GeneralInfo gn = new GeneralInfo();

            gn.LoadAll();
            _priceRate = gn.IsColumnNull("PriceRate") ? 0 : Convert.ToDouble(gn.PriceRate);
            _usesModel = gn.IsColumnNull("UsesModel") ? false : gn.UsesModel;
            _printedby = usr.FullName;
            layoutPrintModel.Visibility = _usesModel ? DevExpress.XtraLayout.Utils.LayoutVisibility.Always : DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            var       rec   = new ReceivingUnits();
            DataTable drRec = rec.GetAllApplicableDU();
            //cboIssuedTo.Properties.DataSource = drRec;
            //cboIssuedTo.ItemIndex = -1;//.SelectedIndex = -1;
            //cboIssuedTo.Text = @"Select Issue Location";


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

            unitbindingSource.DataSource = units.DefaultView;

            // populate the receiving unit's lookup edit
            var rus = new ReceivingUnits();

            rus.GetActiveDispensaries();
            lkEditReceivingUnis.DataSource = rus.DefaultView;

            //var stor = new Stores();
            //stor.GetActiveStores();
            UserStore ucs = new UserStore();
            DataTable dt  = ucs.GetUserStore(MainWindow.LoggedinId);

            //cboStores.Properties.DataSource = stor.DefaultView;
            cboStores.Properties.DataSource = dt;
            cboStores.ItemIndex             = 0;
            var unitcolumn = ((GridView)gridIssues.MainView).Columns[12];

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

            case 2:
                unitcolumn.Visible = true;
                break;

            default:
                unitcolumn.Visible = true;
                break;
            }

            try
            {
                DataRowView dr = (DataRowView)lstTree.GetDataRecordByNode(lstTree.Nodes[0].FirstNode);

                if (dr == null)
                {
                    return;
                }

                //lstTransactions.Items.Clear();
                IssueDoc  iss = new IssueDoc();
                DataTable dtRec;
                if (dr["ParentID"] == DBNull.Value)
                {
                    EthiopianDate.EthiopianDate ethiopianDate = new EthiopianDate.EthiopianDate(Convert.ToInt32(dr["ID"]), 1, 1);
                    dtRec = iss.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), ethiopianDate.StartOfFiscalYear.ToGregorianDate(), ethiopianDate.EndOfFiscalYear.ToGregorianDate());
                    string dateString = dr["RefNo"].ToString();
                    lblIssDate.Text = dateString;
                }
                else
                {
                    //dtRec = iss.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(cboStores.EditValue), dr["Date"].ToString());
                    dtRec           = iss.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToDateTime(dr["Date"]));
                    lblIssDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy");
                }
                gridIssues.DataSource          = dtRec;
                grdLogIssue.ActiveFilterString = String.Format("Quantity<>0");
            }

            catch (Exception ex)
            {
                // do nothing
            }
            grdLogIssue.Columns["InternalDrugCode"].Visible = Convert.ToBoolean(chkIntDrugCode.EditValue);
        }
        /// <summary>
        /// Populate the lookups
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ManageItems_Load(object sender, EventArgs e)
        {
            var       rec   = new ReceivingUnits();
            DataTable drRec = rec.GetAllApplicableDU();

            cboIssuedTo.Properties.DataSource = drRec;
            cboIssuedTo.ItemIndex             = -1;//.SelectedIndex = -1;
            cboIssuedTo.Text = @"Select Issue Location";


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

            unitbindingSource.DataSource = units.DefaultView;

            // populate the receiving unit's lookup edit
            var rus = new ReceivingUnits();

            rus.GetActiveDispensaries();
            lkEditReceivingUnis.DataSource = rus.DefaultView;

            var stor = new Stores();

            stor.GetActiveStores();
            cboStores.Properties.DataSource = stor.DefaultView;
            cboStores.ItemIndex             = 0;
            var unitcolumn = ((GridView)gridIssues.MainView).Columns[12];

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

            case 2:
                unitcolumn.Visible = true;
                break;

            default:
                unitcolumn.Visible = true;
                break;
            }

            try
            {
                DataRowView dr = (DataRowView)lstTree.GetDataRecordByNode(lstTree.Nodes[0].FirstNode);

                if (dr == null)
                {
                    return;
                }

                //lstTransactions.Items.Clear();
                IssueDoc  iss = new IssueDoc();
                DataTable dtRec;
                if (dr["ParentID"] == DBNull.Value)
                {
                    EthiopianDate.EthiopianDate ethiopianDate = new EthiopianDate.EthiopianDate(Convert.ToInt32(dr["ID"]), 1, 1);
                    dtRec = iss.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), ethiopianDate.StartOfFiscalYear.ToGregorianDate(), ethiopianDate.EndOfFiscalYear.ToGregorianDate());
                    string dateString = dr["RefNo"].ToString();
                    lblIssDate.Text = dateString;
                }
                else
                {
                    //dtRec = iss.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(cboStores.EditValue), dr["Date"].ToString());
                    dtRec           = iss.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToDateTime(dr["Date"]));
                    lblIssDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy");
                }
                gridIssues.DataSource = dtRec;
            }

            catch (Exception ex)
            {
                // do nothing
            }
        }