/// <summary>
 ///Function to fill data in to controls when click on datagridview
 /// </summary>        
 public void FillControls()
 {
     try
     {
         AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
         AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
         infoAccountLedger = bllAccountLedger.AccountLedgerViewForEdit(decAccountLedgerId);
         txtAccountNo.Text = infoAccountLedger.BankAccountNumber;
         txtAcNo.Text = infoAccountLedger.BankAccountNumber;
         txtAddress.Text = infoAccountLedger.Address;
         txtBranchName.Text = infoAccountLedger.BranchName;
         txtBranchCode.Text = infoAccountLedger.BranchCode;
         txtCst.Text = infoAccountLedger.Cst;
         txtEmail.Text = infoAccountLedger.Email;
         txtLedgerName.Text = infoAccountLedger.LedgerName;
         txtMailingName.Text = infoAccountLedger.MailingName;
         txtMobile.Text = infoAccountLedger.Mobile;
         txtNarration.Text = infoAccountLedger.Narration;
         txtPan.Text = infoAccountLedger.Pan;
         txtPhone.Text = infoAccountLedger.Phone;
         txtTin.Text = infoAccountLedger.Tin;
         txtCreditLimit.Text = infoAccountLedger.CreditLimit.ToString();
         txtCreditPeriod.Text = infoAccountLedger.CreditPeriod.ToString();
         AreaComboFill();
         cmbArea.SelectedValue = infoAccountLedger.AreaId.ToString();
         if (infoAccountLedger.BillByBill)
         {
             cmbBillByBill.Text = "Yes";
         }
         else
         {
             cmbBillByBill.Text = "No";
         }
         cmbGroup.SelectedValue = infoAccountLedger.AccountGroupId.ToString();
         PrlicingLevelComboFill();
         cmbPricingLevel.SelectedValue = infoAccountLedger.PricinglevelId;
         cmbRoute.SelectedValue = infoAccountLedger.RouteId.ToString();
         decimal decBalance = infoAccountLedger.OpeningBalance;
         txtOpeningBalance.Text = decBalance.ToString();
         cmbOpeningBalanceCrOrDr.Text = infoAccountLedger.CrOrDr.ToString();
         if (infoAccountLedger.IsDefault == true)
         {
             cmbGroup.Enabled = false;
             txtLedgerName.ReadOnly = true;
             btnAccountGroupAdd.Enabled = false;
             txtLedgerName.BackColor = Color.WhiteSmoke;
         }
         else if (infoAccountLedger.IsDefault == false && decBalance > 0)
         {
             cmbGroup.Enabled = false;
             btnAccountGroupAdd.Enabled = false;
             txtLedgerName.ReadOnly = false;
             txtLedgerName.BackColor = Color.White;
         }
         else
         {
             cmbGroup.Enabled = true;
             txtLedgerName.ReadOnly = false;
             txtLedgerName.BackColor = Color.White;
             btnAccountGroupAdd.Enabled = true;
         }
         if (bllAccountLedger.PartyBalanceAgainstReferenceCheck(decAccountLedgerId.ToString(), 1))
         {
             cmbGroup.Enabled = false;
             txtLedgerName.ReadOnly = false;
             txtOpeningBalance.Enabled = false;
             cmbOpeningBalanceCrOrDr.Enabled = false;
             cmbBillByBill.Enabled = false;
             txtLedgerName.BackColor = Color.White;
         }
         decLedger = infoAccountLedger.LedgerId;
         isDefault = infoAccountLedger.IsDefault;
         tbctrlLedger.SelectedTab = tbMainDetails;
     }
     catch (Exception ex)
     {
         MessageBox.Show("AL26:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }