/// <summary>
        ///Funtion to call save and edit function
        /// </summary>
        public void SaveOrEdit()
        {
            try
            {
                if (txtMailingName.Text.Trim() == string.Empty)
                {
                    txtMailingName.Text = txtLedgerName.Text.Trim();
                }
                if (txtLedgerName.Text.Trim() == string.Empty)
                {
                    Messages.InformationMessage("Enter ledger name");
                    txtLedgerName.Focus();
                    tbctrlLedger.SelectedTab = tbMainDetails;
                }
                else if (cmbGroup.SelectedIndex == -1)
                {
                    Messages.InformationMessage("Select group name");
                    cmbGroup.Focus();
                    tbctrlLedger.SelectedTab = tbMainDetails;
                }
                else
                {
                    if (btnSave.Text == "Save")
                    {
                        if (Messages.SaveConfirmation())
                        {
                            SaveFunction();
                        }
                        decIdForOtherForms = decLedgerId;
                        if (frmServiceVoucherObj != null)
                        {
                            if (decIdForOtherForms != 0)
                            {
                                this.Close();
                            }
                            else
                            {
                                txtLedgerName.Focus();
                            }
                        }
                        //--------Monthly Salary Voucher----------//
                        if (frmMonthlySalaryVoucherObj != null)
                        {
                            if (decIdForOtherForms != 0)
                            {
                                this.Close();
                            }
                            else
                            {
                                txtLedgerName.Focus();
                            }
                        }
                        if (frmAdvancePaymentobj != null)
                        {
                            if (decIdForOtherForms != 0)
                            {
                                this.Close();
                            }
                            else
                            {
                                txtLedgerName.Focus();
                            }
                        }
                        //for frmDeliveryNote
                        if (frmDeliveryNoteObj != null)
                        {
                            if (decIdForOtherForms != 0)
                            {
                                this.Close();
                            }
                            else
                            {
                                txtLedgerName.Focus();
                            }
                        }
                        //for rejectionOut
                        if (frmRejectionOutObj != null)
                        {
                            if (decIdForOtherForms != 0)
                            {
                                this.Close();
                            }
                            else
                            {
                                txtLedgerName.Focus();
                            }
                        }
                        // for Purchase Return
                        if (frmPurchaseReturnObj != null)
                        {
                            if (decIdForOtherForms != 0)
                            {
                                this.Close();
                            }
                            else
                            {
                                txtLedgerName.Focus();
                            }
                        }
                    }
                    else
                    {
                        if (Messages.UpdateConfirmation())
                        {
                            AccountLedgerBll BllAccountLedger = new AccountLedgerBll();
                            if (!BllAccountLedger.AccountLedgerCheckExistenceForTax(strTaxNameForUpdate))
                            {
                                EditFunction();
                            }
                            else
                            {
                                Messages.ReferenceExistsMessageForUpdate();
                            }

                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("AL3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }