/// <summary>
        /// save function
        /// </summary>
        public void SaveFunction()
        {
            try
            {
                VoucherTypeBll BllVoucherType = new VoucherTypeBll();
                VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
                if (BllVoucherType.VoucherTypeCheckExistence(txtVoucherName.Text.Trim(), 0) == false)
                {
                    infoVoucherType.VoucherTypeName = txtVoucherName.Text.Trim();
                    infoVoucherType.TypeOfVoucher = cmbTypeOfVoucher.Text;
                    infoVoucherType.MethodOfVoucherNumbering = cmbMethodOfvoucherNumbering.Text;
                    int inRowCount = dgvApplicableTaxes.RowCount;
                    for (int i = 0; i <= inRowCount - 1; i++)
                    {
                        if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value != null)
                        {

                            if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString() != "False")
                            {
                                isTax = bool.Parse(dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString());
                            }
                        }
                    }
                    infoVoucherType.IsTaxApplicable = isTax;
                    if (cbxActive.Checked)
                    {
                        IsActive = true;
                    }
                    infoVoucherType.IsActive = IsActive;
                    infoVoucherType.IsDefault = false;
                    infoVoucherType.Narration = txtNarration.Text.Trim();
                    infoVoucherType.Extra1 = string.Empty;
                    infoVoucherType.Extra2 = string.Empty;
                    infoVoucherType.MasterId = Convert.ToInt32(cmbDotMatrix.SelectedValue);
                    infoVoucherType.Declarartion = txtDeclaration.Text;
                    infoVoucherType.Heading1 = txtHeading1.Text;
                    infoVoucherType.Heading2 = txtHeading2.Text;
                    infoVoucherType.Heading3 = txtHeading3.Text;
                    infoVoucherType.Heading4 = txtHeading4.Text;

                    decVoucherTypeId = BllVoucherType.VoucherTypeAddWithIdentity(infoVoucherType);
                    if (isTax)
                    {
                        for (int i = 0; i <= inRowCount - 1; i++)
                        {
                            if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value != null)
                            {
                                if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString() != "False")
                                {
                                    VoucherTypeTaxBll BllVoucherTypeTax = new VoucherTypeTaxBll();
                                    VoucherTypeTaxInfo infoVoucherTypeTax = new VoucherTypeTaxInfo();
                                    infoVoucherTypeTax.VoucherTypeId = decVoucherTypeId;
                                    infoVoucherTypeTax.TaxId = Convert.ToDecimal(dgvApplicableTaxes.Rows[i].Cells["dgvtxtTaxId"].Value.ToString());
                                    infoVoucherTypeTax.Extra1 = string.Empty;
                                    infoVoucherTypeTax.Extra2 = string.Empty;

                                    BllVoucherTypeTax.VoucherTypeTaxAdd(infoVoucherTypeTax);
                                }
                            }

                        }

                    }
                    Messages.SavedMessage();
                    Clear();
                }
                else
                {
                    Messages.InformationMessage("Voucher name already exists");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("VT03:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }