/// <summary>
 /// edit function
 /// </summary>
 private void EditFunction()
 {
     try
     {
         AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
         AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
         infoAccountLedger.LedgerName = txtSupplierName.Text.Trim();
         infoAccountLedger.MailingName = txtMailingName.Text.Trim();
         if (txtOpeningBalance.Text.Trim() != string.Empty)
         {
             infoAccountLedger.OpeningBalance = Convert.ToDecimal(txtOpeningBalance.Text.ToString());
         }
         else
         {
             infoAccountLedger.OpeningBalance = 0;
         }
         infoAccountLedger.CrOrDr = cmbDrOrCr.Text.ToString();
         infoAccountLedger.BankAccountNumber = txtAcNo.Text.Trim();
         infoAccountLedger.BranchName = txtBranchName.Text.Trim();
         infoAccountLedger.BranchCode = txtBranchCode.Text.Trim();
         infoAccountLedger.Mobile = txtMobile.Text.Trim();
         infoAccountLedger.Address = txtAddress.Text.Trim();
         if (cmbBillbyBill.Text == "Yes")
         {
             infoAccountLedger.BillByBill = true;
         }
         else
         {
             infoAccountLedger.BillByBill = false;
         }
         infoAccountLedger.Cst = txtCst.Text.Trim();
         infoAccountLedger.AreaId = Convert.ToDecimal(cmbArea.SelectedValue.ToString());
         infoAccountLedger.RouteId = Convert.ToDecimal(cmbRoute.SelectedValue.ToString());
         infoAccountLedger.MailingName = txtMailingName.Text.Trim();
         infoAccountLedger.Phone = txtPhone.Text.Trim();
         infoAccountLedger.Email = txtEmail.Text.Trim();
         infoAccountLedger.Tin = txtTin.Text.Trim();
         infoAccountLedger.Pan = txtPan.Text.Trim();
         infoAccountLedger.Narration = txtNarration.Text.Trim();
         infoAccountLedger.LedgerId = decLedger;
         infoAccountLedger.ExtraDate = PublicVariables._dtCurrentDate;
         if (bllAccountLedger.AccountLedgerCheckExistenceForSalesman(txtSupplierName.Text.Trim().ToString(), decLedger) == false)
         {
             bllAccountLedger.AccountLedgerEditForSalesman(infoAccountLedger);
             ledgerUpdate();
             if (cmbBillbyBill.Text == "Yes")
             {
                 partyBalanceUpdate();
             }
             else
             {
                 bllAccountLedger.PartyBalanceDeleteByVoucherTypeVoucherNoAndReferenceType(decLedger.ToString(), 1);
             }
             Messages.UpdatedMessage();
             Clear();
         }
         else
         {
             Messages.InformationMessage("Supplier name already exist");
             txtSupplierName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SUP10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }