/// <summary>
 /// Function to delete
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
         if (bllAccountLedger.AccountLedgerCheckReferences(decLedgerIdForEdit) == -1)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             bllAccountLedger.PartyBalanceDeleteByVoucherTypeVoucherNoAndReferenceType(decLedgerIdForEdit.ToString(), 1);
             bllAccountLedger.LedgerPostingDeleteByVoucherTypeAndVoucherNo(decLedgerIdForEdit.ToString(), 1);
             Messages.DeletedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Cus9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to delete account ledger
 /// </summary>
 public void Delete()
 {
     try
     {
         if (!isDefault)
         {
             if (Messages.DeleteConfirmation())
             {
                 AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
                 bllAccountLedger.PartyBalanceDeleteByVoucherTypeVoucherNoAndReferenceType(decAccountLedgerId.ToString(), 1);
                 bllAccountLedger.LedgerPostingDeleteByVoucherTypeAndVoucherNo(decAccountLedgerId.ToString(), 1);
                 if (bllAccountLedger.AccountLedgerCheckReferences(decAccountLedgerId) == -1)
                 {
                     Messages.ReferenceExistsMessage();
                 }
                 else
                 {
                     Messages.DeletedMessage();
                     Clear();
                 }
             }
         }
         else
         {
             Messages.InformationMessage("Can't delete build in account ledger");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AL25:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }