コード例 #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;
        }
コード例 #2
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;
        }
コード例 #3
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
            }
        }
コード例 #4
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;
        }