private void LoadMainGrid()
        {
            fGrid.BeginUpdate();
            iGRow _row = null;

            _row            = fGrid.Rows.Add();
            _row.Height     = 4;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            int    group_index = 1;
            string group_name  = "New Account Information";
            //
            var _date = new fnn.DropDownCalenderX();

            _date.start_date    = new DateTime(2015, 1, 1);
            _date.end_date      = sdata.CURR_DATE;
            _date.selected_date = sdata.CURR_DATE;
            _row = CreateNewRow("Date", "start_date", typeof(string), group_index, group_name);
            //
            _row.Cells["desc"].TypeFlags       = iGCellTypeFlags.ComboPreferValue | iGCellTypeFlags.NoTextEdit | iGCellTypeFlags.HasEllipsisButton;
            _row.Cells["desc"].FormatString    = "{0:D}";// {0:d} for short date string
            _row.Cells["desc"].DropDownControl = _date;
            _row.Cells["desc"].Value           = null;
            //
            _row            = CreateNewRow("Bank Name", "bank", typeof(string), group_index, group_name);
            _row            = fGrid.Rows.Add();
            _row.Height     = 4;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;

            _row = CreateNewRow("(+F1)  Account Name", "exp_account", typeof(string), group_index, group_name);
            _row = CreateNewRow("Account Type", "category", typeof(string), group_index, group_name);
            _row.Cells[1].Enabled = iGBool.False;
            //

            //
            _row            = fGrid.Rows.Add();
            _row.Height     = 3;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            //
            _row = CreateNewRow("Amount", "amount", typeof(decimal), group_index, group_name);
            _row.Cells[1].FormatString = "{0:N0}";
            //
            _row            = fGrid.Rows.Add();
            _row.Height     = 3;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;

            _row        = CreateNewRow("Enter \n Particulars", "desc", typeof(string), group_index, group_name);
            _row.Height = 60;
            _row.Cells["desc"].TextFormatFlags = iGStringFormatFlags.WordWrap;
            _row.Cells["name"].TextAlign       = iGContentAlignment.MiddleRight;
            //


            _row            = fGrid.Rows.Add();
            _row.Height     = 5;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;

            fGrid.EndUpdate();
        }
Exemple #2
0
        private void fGrid_AfterCommitEdit(object sender, iGAfterCommitEditEventArgs e)
        {
            var _key = fGrid.Rows[e.RowIndex].Key;

            switch (_key)
            {
            case "date":
            {
                DateTime?_date = System.Convert.ToDateTime(fGrid.Rows[e.RowIndex].Cells[1].Value);
                fGrid.Rows["curr_amount"].Cells[1].Value    = null;
                fGrid.Rows["curr_exch_rate"].Cells[1].Value = null;
                using (var xd = new xing())
                {
                    int   _acc_id    = (fGrid.Rows["currency"].Cells[1].AuxValue as fnn.iGComboItemEX).Tag.ToInt32();
                    float _exch_rate = accn.GetFS_ConversionRate(xd, fn.GetFSID(_date.Value), _acc_id);
                    int   _acc_bal   = accn.GetFS_ForeignCurrencyBalance(xd, fn.GetFSID(_date.Value), _acc_id);
                    fGrid.Rows["curr_exch_rate"].Cells[1].Value = _exch_rate;
                    if (_acc_bal > 0)
                    {
                        fGrid.Rows["curr_amount"].Cells[1].Value = _acc_bal;
                    }
                    xd.CommitTransaction();
                }
                break;
            }

            case "currency":
            {
                if (fGrid.Rows[e.RowIndex].Cells[1].Value == null)
                {
                    fGrid.Rows["curr_amount"].Cells[1].Value    = null;
                    fGrid.Rows["curr_exch_rate"].Cells[1].Value = null;
                    //
                    fGrid.Rows["exch_amount"].Cells[1].Value = null;
                    fGrid.Rows["exch_rate"].Cells[1].Value   = null;
                    fGrid.Rows["ug_amount"].Cells[1].Value   = null;
                    fGrid.Rows["gain"].Cells[1].Value        = null;
                    fGrid.Rows["loss"].Cells[1].Value        = null;
                    fGrid.Rows["date"].Cells[1].Value        = null;
                    fGrid.Rows["date"].Cells[1].AuxValue     = null;
                    fGrid.Rows["date"].Cells[1].Enabled      = iGBool.False;
                    fGrid.Rows["exch_amount"].Cells[0].Value = "Amount Exchanged";
                }
                else
                {
                    fGrid.Rows["curr_amount"].Cells[1].Value    = null;
                    fGrid.Rows["curr_exch_rate"].Cells[1].Value = null;
                    //
                    fGrid.Rows["exch_amount"].Cells[1].Value = null;
                    fGrid.Rows["exch_rate"].Cells[1].Value   = null;
                    fGrid.Rows["ug_amount"].Cells[1].Value   = null;
                    fGrid.Rows["gain"].Cells[1].Value        = null;
                    fGrid.Rows["loss"].Cells[1].Value        = null;
                    fGrid.Rows["date"].Cells[1].Value        = null;
                    fGrid.Rows["date"].Cells[1].AuxValue     = null;
                    fGrid.Rows["date"].Cells[1].Enabled      = iGBool.True;
                    fGrid.Rows["exch_amount"].Cells[0].Value = string.Format("{0} Exchanged", fGrid.Rows["currency"].Cells[1].Text);
                    //
                    using (var xd = new xing())
                    {
                        int    _acc_id = (fGrid.Rows["currency"].Cells[1].AuxValue as fnn.iGComboItemEX).Tag.ToInt32();
                        object _obj    = xd.ExecuteScalarObject(string.Format("select last_exchange_date from acc_foreign_currency_tb where sys_account_id={0}", _acc_id));
                        if (_obj == null)
                        {
                            _obj = xd.ExecuteScalarObject(string.Format("select TOP 1 fs_date from acc_foreign_currency_mvt_tb where sys_account_id={0} order by fs_id", _acc_id));
                        }
                        DateTime?_start_date = System.Convert.ToDateTime(_obj);
                        var      _date       = new fnn.DropDownCalenderX();
                        if (_start_date != null)
                        {
                            _date.start_date    = _start_date.Value;
                            _date.end_date      = sdata.CURR_DATE;
                            _date.selected_date = sdata.CURR_DATE;
                        }
                        else
                        {
                            _date.start_date    = sdata.CURR_DATE;
                            _date.end_date      = sdata.CURR_DATE;
                            _date.selected_date = sdata.CURR_DATE;
                        }
                        fGrid.Rows["date"].Cells["desc"].DropDownControl = _date;
                    }
                }
                break;
            }

            case "exch_amount":
            case "exch_rate":
            {
                fGrid.Rows["gain"].Cells[1].Value      = null;
                fGrid.Rows["loss"].Cells[1].Value      = null;
                fGrid.Rows["ug_amount"].Cells[1].Value = null;
                if (_key == "exch_amount")
                {
                    if ((fGrid.Rows["exch_amount"].Cells[1].Value.ToInt32() > fGrid.Rows["curr_amount"].Cells[1].Value.ToInt32()) | (fGrid.Rows["exch_amount"].Cells[1].Value.ToInt32() <= 0))
                    {
                        MessageBox.Show("The Amount You Have Entered INVALID", "Invalid Value Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        fGrid.Focus();
                        fGrid.Rows[e.RowIndex].Cells[1].Value    = null;
                        fGrid.Rows[e.RowIndex].Cells[1].Selected = true;
                        fGrid.Rows["exch_rate"].Cells[1].Value   = null;
                        return;
                    }
                }
                if (_key == "exch_rate")
                {
                    int _c = (fGrid.Rows["exch_rate"].Cells[1].Value.ToFloat() - fGrid.Rows["curr_exch_rate"].Cells[1].Value.ToFloat()).ToInt32();
                    if (Math.Abs(_c) > (fGrid.Rows["curr_exch_rate"].Cells[1].Value.ToFloat() * 0.75).ToInt32())
                    {
                        MessageBox.Show("The Exchange Rate You Entered Is Probably Wrong", "Wrong Exchange Rate Error");
                        fGrid.Focus();
                        fGrid.Rows[e.RowIndex].Cells[1].Value    = null;
                        fGrid.Rows[e.RowIndex].Cells[1].Selected = true;
                        return;
                    }
                }

                if (fGrid.Rows["exch_amount"].Cells[1].Value != null & fGrid.Rows["exch_rate"].Cells[1].Value != null)
                {
                    fGrid.Rows["ug_amount"].Cells[1].Value = (fGrid.Rows["exch_amount"].Cells[1].Value.ToInt32() * fGrid.Rows["exch_rate"].Cells[1].Value.ToFloat()).ToInt32();
                    var _diff = (fGrid.Rows["ug_amount"].Cells[1].Value.ToInt32() - ((fGrid.Rows["exch_amount"].Cells[1].Value.ToInt32() * fGrid.Rows["curr_exch_rate"].Cells[1].Value.ToFloat()).ToInt32()));
                    if (_diff > 0)
                    {
                        fGrid.Rows["gain"].Cells[1].Value = _diff;
                    }
                    else
                    {
                        if (_diff != 0)
                        {
                            fGrid.Rows["loss"].Cells[1].Value = Math.Abs(_diff);
                        }
                    }
                }

                break;
            }
            }
            if (e.RowIndex != fGrid.Rows.Count - 1)
            {
                if (fGrid.Rows[e.RowIndex].Cells["desc"].Value == null)
                {
                    return;
                }
                for (int k = e.RowIndex + 1; k < fGrid.Rows.Count; k++)
                {
                    if (fGrid.Rows[k].Type == iGRowType.AutoGroupRow)
                    {
                        fGrid.Rows[k].Expanded = true;
                        continue;
                    }
                    if (!fGrid.Rows[k].Visible)
                    {
                        continue;
                    }
                    if (fGrid.Rows[k].Cells[1].Enabled == iGBool.False)
                    {
                        continue;
                    }
                    if (fGrid.Rows[k].Cells[1].ReadOnly == iGBool.True)
                    {
                        continue;
                    }
                    if (string.IsNullOrEmpty(fGrid.Rows[k].Key))
                    {
                        continue;
                    }
                    if ((e.RowIndex + 3) < fGrid.Rows.Count)
                    {
                        fGrid.Rows[(e.RowIndex + 3)].EnsureVisible();
                    }
                    fGrid.SetCurCell(k, e.ColIndex);
                    break;
                }
            }
        }
Exemple #3
0
        private void LoadMainGrid()
        {
            fGrid.BeginUpdate();
            iGRow _row = null;

            _row            = fGrid.Rows.Add();
            _row.Height     = 7;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;

            int    group_index = 1;
            string group_name  = "New Account Information";

            _row = CreateNewRow("Pledge Account", "pledge_acc", typeof(string), group_index, group_name);
            _row.Cells[0].TextAlign = iGContentAlignment.MiddleRight;
            _row.Cells[1].Font      = new Font("verdana", 15, FontStyle.Regular);
            _row.Cells[1].Value     = string.IsNullOrEmpty(m_pledge_settings.pledge_name) ? datam.DATA_ACCOUNTS[m_pledge_settings.account_id].account_name : m_pledge_settings.pledge_name;
            _row.Cells[1].Enabled   = iGBool.False;
            _row.Height            += 4;
            _row            = fGrid.Rows.Add();
            _row.Height     = 3;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;


            //
            _row = CreateNewRow("(+ F1)  Member Name", "owner", typeof(string), group_index, group_name);
            _row.Cells[0].TextAlign = iGContentAlignment.MiddleRight;
            _row.Cells[1].Font      = new Font("verdana", 15, FontStyle.Regular);
            _row.Height            += 4;
            //
            _row = CreateNewRow("(+ F2) Pledge Account", "account", typeof(string), group_index, group_name);
            _row.Cells[0].TextAlign = iGContentAlignment.MiddleRight;
            _row.Cells[1].Font      = new Font("verdana", 15, FontStyle.Regular);

            _row.Height += 4;
            _row.Visible = false;
            //

            //
            _row = CreateNewRow("Name", "other_name", typeof(string), group_index, group_name);
            _row.Cells[0].TextAlign = iGContentAlignment.MiddleRight;
            _row.Cells[1].Font      = new Font("verdana", 15, FontStyle.Regular);
            _row.Height            += 3;
            _row.Visible            = false;
            //
            _row = CreateNewRow("Phone", "other_phone", typeof(string), group_index, group_name);
            _row.Cells[0].TextAlign = iGContentAlignment.MiddleRight;
            _row.Cells[1].Font      = new Font("verdana", 15, FontStyle.Regular);
            _row.Height            += 3;
            _row.Visible            = false;
            //
            _row            = fGrid.Rows.Add();
            _row.Height     = 7;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            //
            _row = CreateNewRow("Pledged Amount", "pl_amount", typeof(decimal), group_index, group_name);
            _row.Cells[0].TextAlign    = iGContentAlignment.MiddleRight;
            _row.Cells[1].Font         = new Font("verdana", 15, FontStyle.Regular);
            _row.Cells[1].FormatString = "{0:N0}";
            _row.Height   += 4;
            _row.ForeColor = Color.Maroon;
            //
            _row            = fGrid.Rows.Add();
            _row.Height     = 7;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            //
            _row = CreateNewRow("Church Group", "churh_group", typeof(string), group_index, group_name);
            _row.Cells[0].TextAlign = iGContentAlignment.MiddleRight;
            _row.Cells[1].Font      = new Font("verdana", 15, FontStyle.Regular);
            _row.Height            += 4;
            _row.Cells[1].Enabled   = iGBool.False;
            _row.Visible            = false;
            _row            = fGrid.Rows.Add();
            _row.Height     = 7;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            _row.Visible    = false;
            //
            var _dropdown = new fnn.DropDownCalenderX();

            _dropdown.start_date    = m_pledge_settings.start_date;
            _dropdown.selected_date = sdata.CURR_DATE;
            _dropdown.end_date      = sdata.CURR_DATE;
            _row = CreateNewRow("Add To Pledge Date", "start_date", typeof(string), group_index, group_name);
            _row.Cells["desc"].TypeFlags       = iGCellTypeFlags.ComboPreferValue | iGCellTypeFlags.NoTextEdit | iGCellTypeFlags.HasEllipsisButton;
            _row.Cells["desc"].FormatString    = "{0:D}";// {0:d} for short date string
            _row.Cells["desc"].DropDownControl = _dropdown;
            _row.Cells["desc"].Value           = null;
            //
            _row      = CreateNewRow("Collect Date (Optional)", "collect_date", typeof(string), group_index, group_name);
            _row.Font = new Font("georgia", 13, FontStyle.Regular);
            _row.Cells["desc"].TypeFlags       = iGCellTypeFlags.ComboPreferValue | iGCellTypeFlags.NoTextEdit | iGCellTypeFlags.HasEllipsisButton;
            _row.Cells["desc"].FormatString    = "{0:D}";// {0:d} for short date string
            _row.Cells["desc"].Value           = sdata.CURR_DATE;
            _row.Cells["desc"].DropDownControl = new fnn.DropDownCalendar();
            _row.Cells["name"].TypeFlags       = iGCellTypeFlags.NoTextEdit | iGCellTypeFlags.HasEllipsisButton;
            _row.Cells["name"].ReadOnly        = iGBool.False;
            _row.Cells["name"].ForeColor       = Color.DarkSlateGray;
            _row.Cells["name"].Selectable      = iGBool.False;
            _row.Cells["name"].TextAlign       = iGContentAlignment.MiddleRight;
            _row.Cells[1].Enabled = iGBool.False;
            _row.Visible          = false;

            fGrid.EndUpdate();
        }
Exemple #4
0
        private void LoadMainGrid()
        {
            fGrid.BeginUpdate();
            iGRow _row = null;

            _row            = fGrid.Rows.Add();
            _row.Height     = 5;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            int    group_index = 1;
            string group_name  = "New Account Information";

            //
            _row = CreateNewRow("Select Currency", "currency", typeof(string), group_index, group_name);
            _row.Cells[0].ForeColor = Color.Maroon;
            var _nlist = accn.GetChildAccounts("UNBANKED_FOREIGN", em.account_typeS.ActualAccount);
            var icombo = fnn.CreateCombo();

            foreach (var k in _nlist)
            {
                icombo.Items.Add(new fnn.iGComboItemEX()
                {
                    Value = k.account_name,
                    Tag   = k.account_id
                });
            }
            _row.Cells[1].DropDownControl = icombo;
            _row.Cells[1].Value           = null;
            //
            var _date = new fnn.DropDownCalenderX();

            _date.start_date    = sdata.CURR_DATE;
            _date.end_date      = sdata.CURR_DATE;
            _date.selected_date = sdata.CURR_DATE;
            _row = CreateNewRow("Exchange Date", "date", typeof(string), group_index, group_name);
            _row.Cells["desc"].TypeFlags       = iGCellTypeFlags.ComboPreferValue | iGCellTypeFlags.NoTextEdit | iGCellTypeFlags.HasEllipsisButton;
            _row.Cells["desc"].FormatString    = "{0:D}";// {0:d} for short date string
            _row.Cells["desc"].DropDownControl = _date;
            _row.Cells["desc"].Value           = null;
            _row.Cells["desc"].Enabled         = iGBool.False;
            //
            _row            = fGrid.Rows.Add();
            _row.Height     = 5;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            //
            _row = CreateNewRow("Current Amount", "curr_amount", typeof(string), group_index, group_name);
            _row.Cells[1].FormatString = "{0:N0}";
            _row.Cells[1].Enabled      = iGBool.False;
            _row = CreateNewRow("Current Exch Rate", "curr_exch_rate", typeof(float), group_index, group_name);
            _row.Cells[1].Enabled = iGBool.False;
            //
            _row                    = fGrid.Rows.Add();
            _row.Height             = 5;
            _row.BackColor          = Color.Lavender;
            _row.Selectable         = false;
            _row                    = CreateNewRow("Amount Exchanged", "exch_amount", typeof(int), group_index, group_name);
            _row.Cells[0].ForeColor = Color.Maroon;
            _row                    = CreateNewRow("Exchange Rate", "exch_rate", typeof(float), group_index, group_name);
            _row.Cells[0].ForeColor = Color.Maroon;
            //
            _row            = fGrid.Rows.Add();
            _row.Height     = 3;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;

            _row = CreateNewRow("Ugx Amount", "ug_amount", typeof(float), group_index, group_name);
            _row.Cells[1].FormatString = "{0:N0}";
            _row.Cells[1].ReadOnly     = iGBool.True;
            _row.Cells[1].ForeColor    = Color.DarkBlue;
            //
            _row            = fGrid.Rows.Add();
            _row.Height     = 3;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            //
            _row = CreateNewRow("Exchange Gain", "gain", typeof(int), group_index, group_name);
            _row.Cells[1].FormatString = "{0:N0}";
            _row.Cells[1].Enabled      = iGBool.False;
            _row.Cells[0].ForeColor    = Color.DarkGreen;
            _row = CreateNewRow("Exchange Loss", "loss", typeof(int), group_index, group_name);
            _row.Cells[1].FormatString = "{0:N0}";
            _row.Cells[1].Enabled      = iGBool.False;
            _row.Cells[0].ForeColor    = Color.Red;
            //

            _row            = fGrid.Rows.Add();
            _row.Height     = 4;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            //



            fGrid.EndUpdate();
        }
        private void LoadMainGrid()
        {
            fGrid.BeginUpdate();
            iGRow _row = null;

            _row            = fGrid.Rows.Add();
            _row.Height     = 4;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            int    group_index = 1;
            string group_name  = "New Account Information";
            //
            var _date = new fnn.DropDownCalenderX();

            _date.start_date = new DateTime(2015, 1, 1);
            // _date.start_date = sdata.CURR_DATE;
            _date.end_date      = sdata.CURR_DATE;
            _date.selected_date = sdata.CURR_DATE;
            //
            _row = CreateNewRow("Transfer Date", "transfer_date", typeof(string), group_index, group_name);
            _row.Cells["desc"].TypeFlags       = iGCellTypeFlags.ComboPreferValue | iGCellTypeFlags.NoTextEdit | iGCellTypeFlags.HasEllipsisButton;
            _row.Cells["desc"].FormatString    = "{0:D}";// {0:d} for short date string
            _row.Cells["desc"].DropDownControl = _date;
            _row.Cells["desc"].Value           = null;
            //


            //
            _row            = fGrid.Rows.Add();
            _row.Height     = 4;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            //
            _row = CreateNewRow("From Account", "account_from", typeof(string), group_index, group_name);
            _row.Cells[1].ForeColor             = Color.DarkBlue;
            _row.Cells[0].ForeColor             = Color.Maroon;
            m_SourceAccounts                    = fnn.CreateCombo();
            m_SourceAccounts.MaxVisibleRowCount = 6;
            _row.Cells[1].DropDownControl       = m_SourceAccounts;
            _row.Cells[1].Value                 = null;
            _row.Cells[1].Enabled               = iGBool.False;
            //
            _row = CreateNewRow("Account Balance", "account_balance", typeof(decimal), group_index, group_name);
            _row.Cells[1].Enabled      = iGBool.False;
            _row.Cells[0].ForeColor    = Color.Gray;
            _row.Cells[1].FormatString = "{0:N0}";
            //
            _row            = fGrid.Rows.Add();
            _row.Height     = 4;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            _row.Height    += 2;
            //
            _row = CreateNewRow("To Account", "account_to", typeof(string), group_index, group_name);
            _row.Cells[1].ForeColor = Color.DarkBlue;
            _row.Cells[0].ForeColor = Color.Green;
            m_DestinationAccounts   = fnn.CreateCombo();
            m_DestinationAccounts.MaxVisibleRowCount = 6;
            _row.Cells[1].DropDownControl            = m_DestinationAccounts;
            _row.Cells[1].Value   = null;
            _row.Cells[1].Enabled = iGBool.False;
            //
            _row = CreateNewRow("Transfered Amount", "transfer_amount", typeof(decimal), group_index, group_name);
            _row.Cells[1].Enabled      = iGBool.False;
            _row.Cells[1].FormatString = "{0:N0}";
            //
            _row            = fGrid.Rows.Add();
            _row.Height     = 4;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            _row.Height    += 2;
            //
            _row        = CreateNewRow("Transfer \n Reason", "reason", typeof(string), group_index, group_name);
            _row.Height = 60;
            _row.Cells["desc"].TextFormatFlags = iGStringFormatFlags.WordWrap;
            _row.Cells["name"].TextAlign       = iGContentAlignment.MiddleRight;
            //
            _row            = fGrid.Rows.Add();
            _row.Height     = 3;
            _row.BackColor  = Color.Lavender;
            _row.Selectable = false;
            //


            fGrid.EndUpdate();
        }