/// <summary>
        /// Function for Edit
        /// </summary>
        public void EditFunction()
        {
            try
            {
                DailySalaryVoucherMasterInfo infoMaster = new DailySalaryVoucherMasterInfo();
                DailySalaryVoucherBll BllDailySalaryVoucherMaster = new DailySalaryVoucherBll();
                DailySalaryVoucherDetailsInfo infoDetails = new DailySalaryVoucherDetailsInfo();
                DailySalaryVoucherBll BllDailySalaryVoucher = new DailySalaryVoucherBll();

                LedgerPostingBll BllLedgerPosting = new LedgerPostingBll();

                infoMaster.DailySalaryVoucehrMasterId = decMasterIdforEdit;
                infoMaster.Date = Convert.ToDateTime(dtpDate.Value.ToString());
                infoMaster.LedgerId = Convert.ToDecimal(cmbCashorBankAccount.SelectedValue.ToString());
                infoMaster.Narration = txtNarration.Text;
                infoMaster.TotalAmount = Convert.ToDecimal(lblShowTotelamount.Text.ToString());
                if (isAutomatic)
                {
                    infoMaster.VoucherNo = strVoucherNo;
                }
                else
                {
                    infoMaster.VoucherNo = txtVoucherNo.Text.Trim();
                }

                if (isAutomatic)
                {
                    infoMaster.InvoiceNo = strInvoiceNo;
                }
                else
                {
                    infoMaster.InvoiceNo = txtVoucherNo.Text.Trim();
                }
                infoMaster.Extra1 = string.Empty;
                infoMaster.Extra2 = string.Empty;
                infoMaster.SuffixPrefixId = decDailySuffixPrefixId;
                infoMaster.VoucherTypeId = decDailyVoucherTypeId;
                infoMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                infoMaster.SalaryDate = Convert.ToDateTime(dtpSalaryDate.Text.ToString());
                infoDetails.Extra1 = string.Empty;// Fields not in design//
                infoDetails.Extra2 = string.Empty;// Fields not in design//
                BllDailySalaryVoucherMaster.DailySalaryVoucherMasterEdit(infoMaster);
                int inRowCount = dgvDailySalaryVoucher.RowCount;
                for (int i = 0; i < inRowCount; i++)
                {
                    if (dgvDailySalaryVoucher.Rows[i].Cells["txtEmployeeId"].Value != null && dgvDailySalaryVoucher.Rows[i].Cells["txtEmployeeId"].Value.ToString() != string.Empty)
                    {
                        infoDetails.EmployeeId = Convert.ToDecimal(dgvDailySalaryVoucher.Rows[i].Cells["txtEmployeeId"].Value.ToString());
                    }
                    if (dgvDailySalaryVoucher.Rows[i].Cells["txtWage"].Value != null && dgvDailySalaryVoucher.Rows[i].Cells["txtWage"].Value.ToString() != string.Empty)
                    {
                        infoDetails.Wage = Convert.ToDecimal(dgvDailySalaryVoucher.Rows[i].Cells["txtWage"].Value.ToString());
                    }
                    if (dgvDailySalaryVoucher.Rows[i].Cells["cmbStatus"].Value != null && dgvDailySalaryVoucher.Rows[i].Cells["cmbStatus"].Value.ToString() != string.Empty)
                    {
                        infoDetails.Status = dgvDailySalaryVoucher.Rows[i].Cells["cmbStatus"].Value.ToString();
                    }

                    if (dgvDailySalaryVoucher.Rows[i].Cells["cmbStatus"].Value.ToString() == string.Empty && dgvDailySalaryVoucher.Rows[i].Cells["dgvtxtDailySalaryVocherMasterId"].Value.ToString() != string.Empty)
                    {
                        decimal DailySalaryVoucherDetailsId = Convert.ToDecimal(dgvDailySalaryVoucher.Rows[i].Cells["dgvtxtdailySalaryVoucherDetailsId"].Value.ToString());
                        BllDailySalaryVoucher.DailySalaryVoucherDetailsDelete(DailySalaryVoucherDetailsId);

                        LedgerUpdate();

                    }
                    if (dgvDailySalaryVoucher.Rows[i].Cells["cmbStatus"].Value.ToString() == "paid" && dgvDailySalaryVoucher.Rows[i].Cells["dgvtxtDailySalaryVocherMasterId"].Value.ToString() == string.Empty)
                    {
                        infoDetails.DailySalaryVocherMasterId = decMasterIdforEdit;
                        BllDailySalaryVoucher.DailySalaryVoucherDetailsAdd(infoDetails);
                        //spMaster.DailySalaryVoucherMasterEdit(infoMaster);
                        LedgerUpdate();

                    }
                    if (dgvDailySalaryVoucher.Rows[i].Cells["cmbStatus"].Value.ToString() == string.Empty && dgvDailySalaryVoucher.Rows[i].Cells["dgvtxtDailySalaryVocherMasterId"].Value.ToString() == string.Empty)
                    {
                        BllDailySalaryVoucherMaster.DailySalaryVoucherMasterEdit(infoMaster);
                        LedgerUpdate();

                    }
                }
                if (BllDailySalaryVoucher.DailySalaryVoucherDetailsCount(decMasterIdforEdit) == 0)
                {
                    BllDailySalaryVoucherMaster.DailySalaryVoucherMasterDelete(decMasterIdforEdit);
                }
                Messages.UpdatedMessage();
                Clear();
                if (frmDailySalaryRegisterobj != null)
                {

                    this.Close();
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("DSV12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Function for Delete
        /// </summary>
        public void DeleteFunction()
        {
            try
            {
                DailySalaryVoucherBll BllDailySalaryVoucherMaster = new DailySalaryVoucherBll();
                DailySalaryVoucherBll BllDailySalaryVoucher = new DailySalaryVoucherBll();

                LedgerPostingBll BllLedgerPosting = new LedgerPostingBll();

                if (PublicVariables.isMessageDelete)
                {
                    if (Messages.DeleteMessage())
                    {
                        BllDailySalaryVoucherMaster.DailySalaryVoucherMasterDelete(decMasterIdforEdit);
                        BllDailySalaryVoucher.DailySalaryVoucherDetailsDeleteUsingMasterId(decMasterIdforEdit);
                        BllLedgerPosting.LedgerPostDelete(txtVoucherNo.Text, decDailyVoucherTypeId);
                        Messages.DeletedMessage();
                        Clear();
                        DailySalaryVoucherDetailsGridfill(isEditmode);
                    }
                }
                else
                {
                    BllDailySalaryVoucherMaster.DailySalaryVoucherMasterDelete(decMasterIdforEdit);
                    BllDailySalaryVoucher.DailySalaryVoucherDetailsDeleteUsingMasterId(decMasterIdforEdit);
                    BllLedgerPosting.LedgerPostDelete(txtVoucherNo.Text, decDailyVoucherTypeId);
                    Messages.DeletedMessage();
                    Clear();
                    DailySalaryVoucherDetailsGridfill(isEditmode);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("DSV13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }