/// <summary>
        /// function to delete voucher
        /// </summary>
        /// <param name="decDebitNoteMasterId"></param>
        public void DeleteFunction(decimal decDebitNoteMasterId)
        {
            try
            {
                //DebitNoteMasterSP spDebitNoteMaster = new DebitNoteMasterSP();
                DebitNoteBll bllDebitNote = new DebitNoteBll();
                PartyBalanceBll BllPartyBalance = new PartyBalanceBll();
                if (!BllPartyBalance.PartyBalanceCheckReference(decDebitNoteVoucherTypeId, strVoucherNo))
                {
                    bllDebitNote.DebitNoteVoucherDelete(decDebitNoteMasterId, decDebitNoteVoucherTypeId, strVoucherNo);

                    Messages.DeletedMessage();
                    if (frmDebitNoteRegisterObj != null)
                    {
                        this.Close();
                        frmDebitNoteRegisterObj.Enabled = true;
                    }
                    else if (frmDebitNoteReportObj != null)
                    {
                        this.Close();
                        frmDebitNoteReportObj.Enabled = true;
                    }
                    else if (objVoucherSearch != null)
                    {
                        this.Close();
                        objVoucherSearch.GridFill();
                    }
                    else if (frmLedgerDetailsObj != null)
                    {
                        this.Close();
                    }
                    else
                    {
                        Clear();
                    }
                }
                else
                {
                    Messages.InformationMessage("Reference exist. Cannot delete");
                    txtDate.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("DRNT25:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }