Ejemplo n.º 1
0
 /// <summary>
 /// on combobox account group text changing
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmbAccountGroup_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (isLoad)
         {
             int            index          = cmbAccountGroup.SelectedIndex;
             string         strinr         = cmbAccountGroup.Text.ToString();
             int            dec            = cmbAccountGroup.SelectedIndex;
             int            inRowcount     = dgvMultipleAccountLedger.RowCount;
             AccountGroupSP spAccountGroup = new AccountGroupSP();
             string         strNature;
             strNature = spAccountGroup.MultipleAccountLedgerCrOrDr(cmbAccountGroup.Text);
             for (int i = 0; i < inRowcount; i++)
             {
                 if (strNature == "Assets" || strNature == "Income")
                 {
                     dgvMultipleAccountLedger.Rows[i].Cells["dgvcmbDebitOrCredit"].Value = "Cr";
                 }
                 else if (strNature == "Expenses" || strNature == "Liabilities")
                 {
                     dgvMultipleAccountLedger.Rows[i].Cells["dgvcmbDebitOrCredit"].Value = "Dr";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "MAL12:" + ex.Message;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// on grid opening balance textbox keypress
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvtxtOpeningBalance_KeyPress(object sender, KeyPressEventArgs e)
        {
            AccountGroupSP spAccountGroup = new AccountGroupSP();

            try
            {
                if (dgvMultipleAccountLedger.CurrentCell != null)
                {
                    if (dgvMultipleAccountLedger.Columns[dgvMultipleAccountLedger.CurrentCell.ColumnIndex].Name == "dgvtxtOpeningBalance")
                    {
                        Common.DecimalValidation(sender, e, false);
                    }

                    if (dgvMultipleAccountLedger.Columns[dgvMultipleAccountLedger.CurrentCell.ColumnIndex].Name == "dgvtxtLedgerName")
                    {
                        if (dgvMultipleAccountLedger.Columns["dgvtxtLedgerName"].Index == 1)
                        {
                            string strNature;
                            strNature = spAccountGroup.MultipleAccountLedgerCrOrDr(cmbAccountGroup.Text);
                            if (strNature == "Assets" || strNature == "Income")
                            {
                                dgvMultipleAccountLedger.Rows[dgvMultipleAccountLedger.CurrentRow.Index].Cells["dgvcmbDebitOrCredit"].Value = "Cr";
                            }
                            else if (strNature == "Expenses" || strNature == "Liabilities")
                            {
                                dgvMultipleAccountLedger.Rows[dgvMultipleAccountLedger.CurrentRow.Index].Cells["dgvcmbDebitOrCredit"].Value = "Dr";
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "MAL17:" + ex.Message;
            }
        }