Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        private void cboStores_EditValueChanged(object sender, EventArgs e)
        {
            if (cboStores.EditValue == null)
            {
                return;
            }
            var iss = new IssueDoc();
            //  var dtRec = iss.GetDistinctIssueDocments(Convert.ToInt32(cboStores.EditValue));
            UserCommodityType ucs = new UserCommodityType();
            DataTable         dt  = ucs.GetUserCommodityType(MainWindow.LoggedinId);

            int[] typeid = new int[dt.Rows.Count];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                typeid[i] = Convert.ToInt32(dt.Rows[i]["ID"]);
            }
            var typeids = string.Join(",", typeid);
            var dtRec   = iss.GetDistinctIssueDocmentsUsers(Convert.ToInt32(cboStores.EditValue), typeids);

            lstTree.DataSource = dtRec;

            DateTime dt1 = EthiopianDate.EthiopianDate.Now.StartOfFiscalYear.ToGregorianDate();
            DateTime dt2 = DateTime.Now;

            dtRec                 = iss.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2);
            lblIssDate.Text       = @"Current Year";
            gridIssues.DataSource = dtRec;
        }
Ejemplo n.º 3
0
        private void RefreshFilter()
        {
            int supID = 0;
            int lkid  = 0;

            if (lkSupplierT.EditValue != null)
            {
                supID = (int)lkSupplierT.EditValue;
            }
            if (lklocationT.EditValue != null)
            {
                lkid = (int)lklocationT.EditValue;
            }
            if ((cboStores.Text == "All Stores") || (cboStores.EditValue == null))
            {
                dtRec = rec.GetAllReceiveByDateRange(dtFrom.Value, dtTo.Value);
                dtiss = iss.GetIssuedByDateRange(dtFrom.Value, dtTo.Value);

                grdTotalReceived.DataSource = rec.GetTotalReceiveByDateRange(dtFrom.Value, dtTo.Value, supID);
                grdTotalIssued.DataSource   = iss.GetTotalIssuedByDateRange(dtFrom.Value, dtTo.Value, lkid);
            }
            else
            {
                dtRec = rec.GetAllReceiveByStoreDateRange(Convert.ToInt32(cboStores.EditValue), dtFrom.Value, dtTo.Value);
                dtiss = iss.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dtFrom.Value, dtTo.Value);

                grdTotalReceived.DataSource = rec.GetTotalReceiveByStoreDateRange(Convert.ToInt32(cboStores.EditValue), dtFrom.Value, dtTo.Value);
                grdTotalIssued.DataSource   = iss.GetTotalTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dtFrom.Value, dtTo.Value);
            }

            gridReceives.DataSource = dtRec;
            gridIssues.DataSource   = dtiss;
        }
Ejemplo n.º 4
0
        private void dtTo_ValueChanged(object sender, EventArgs e)
        {
            //CALENDAR:
            IssueDoc iss = new IssueDoc();
            //dtFrom.CustomFormat = "MM/dd/yyyy";
            //dtTo.CustomFormat = "MM/dd/yyyy";

            //DateTime dteFrom = ConvertDate.DateConverter(dtFrom.Text);
            //DateTime dteTo = ConvertDate.DateConverter(dtTo.Text);

            DataTable dtRec = dtFrom.Value < dtTo.Value ? iss.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dtFrom.Value, dtTo.Value) : iss.GetAllTransaction(Convert.ToInt32(cboStores.EditValue));

            gridIssues.DataSource = dtRec;
        }
Ejemplo n.º 5
0
        private void RefreshFilter()
        {
            if ((cboStores.Text == "All Stores") || (cboStores.EditValue == null))
            {
                dtRec = rec.GetAllReceiveByDateRange(dtFrom.Value, dtTo.Value);
                dtiss = iss.GetIssuedByDateRange(dtFrom.Value, dtTo.Value);
            }
            else
            {
                dtRec = rec.GetAllReceiveByStoreDateRange(Convert.ToInt32(cboStores.EditValue), dtFrom.Value, dtTo.Value);
                dtiss = iss.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dtFrom.Value, dtTo.Value);
            }

            gridReceives.DataSource = dtRec;
            gridIssues.DataSource   = dtiss;
        }
Ejemplo n.º 6
0
        private void cboStores_EditValueChanged(object sender, EventArgs e)
        {
            if (cboStores.EditValue == null)
            {
                return;
            }
            var iss   = new IssueDoc();
            var dtRec = iss.GetDistinctIssueDocments(Convert.ToInt32(cboStores.EditValue));

            lstTree.DataSource = dtRec;

            DateTime dt1 = EthiopianDate.EthiopianDate.Now.StartOfFiscalYear.ToGregorianDate();
            DateTime dt2 = DateTime.Now;

            dtRec                 = iss.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2);
            lblIssDate.Text       = @"Current Year";
            gridIssues.DataSource = dtRec;
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        /// <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
            }
        }