/// <summary>
 /// Function to edit the voucher
 /// </summary>
 public void EditFunction()
 {
     MaterialReceiptMasterInfo infoMaterialReceiptMaster = new MaterialReceiptMasterInfo();
     MaterialReceiptBll bllMaterialReceiptMaster = new MaterialReceiptBll();
     SettingsBll BllSettings = new SettingsBll();
     try
     {
         infoMaterialReceiptMaster.MaterialReceiptMasterId = decMaterialReceiptMasterId;
         infoMaterialReceiptMaster.Date = Convert.ToDateTime(txtDate.Text);
         infoMaterialReceiptMaster.LedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());
         infoMaterialReceiptMaster.SuffixPrefixId = Convert.ToDecimal(decMaterialReceiptSuffixPrefixId);
         infoMaterialReceiptMaster.VoucherNo = strVoucherNo;
         infoMaterialReceiptMaster.VoucherTypeId = decMaterialReceiptVoucherTypeId;
         infoMaterialReceiptMaster.InvoiceNo = txtReceiptNo.Text;
         infoMaterialReceiptMaster.UserId = PublicVariables._decCurrentUserId;
         infoMaterialReceiptMaster.TransportationCompany = txtTransportation.Text.Trim();
         infoMaterialReceiptMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
         infoMaterialReceiptMaster.Narration = txtNarration.Text.Trim();
         infoMaterialReceiptMaster.LrNo = txtLRNo.Text.Trim();
         infoMaterialReceiptMaster.exchangeRateId = Convert.ToDecimal(cmbcurrency.SelectedValue.ToString());
         infoMaterialReceiptMaster.TotalAmount = Convert.ToDecimal(txtTotal.Text);
         infoMaterialReceiptMaster.Extra1 = string.Empty;
         infoMaterialReceiptMaster.Extra2 = string.Empty;
         infoMaterialReceiptMaster.ExtraDate = Convert.ToDateTime(DateTime.Now);
         if (cmbOrderNo.Text == string.Empty || cmbOrderNo.SelectedValue.ToString() == string.Empty)
         {
             infoMaterialReceiptMaster.OrderMasterId = 0;
         }
         else
         {
             infoMaterialReceiptMaster.OrderMasterId = Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString());
         }
         bllMaterialReceiptMaster.MaterialReceiptMasterEdit(infoMaterialReceiptMaster);
         removeMaterialReceiptDetails();
         MaterialReceiptDetailsEditFill();
         if (isEdit)
         {
             Messages.UpdatedMessage();
             if (frmMaterialReceiptRegisterObj != null)
             {
                 if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decMaterialReceiptMasterId);
                 }
                 else
                 {
                     Print(decMaterialReceiptMasterId, infoMaterialReceiptMaster.OrderMasterId);
                 }
                 frmMaterialReceiptRegisterObj.GridFill();
                 frmMaterialReceiptRegisterObj.Enabled = true;
             }
             if (frmMaterialReceiptReportObj != null)
             {
                 if (cbxPrintAfterSave.Checked)
                 {
                     if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                     {
                         PrintForDotMatrix(decMaterialReceiptMasterId);
                     }
                     else
                     {
                         Print(decMaterialReceiptMasterId, infoMaterialReceiptMaster.OrderMasterId);
                     }
                 }
                 frmMaterialReceiptReportObj.GridFill();
                 frmMaterialReceiptReportObj.Enabled = true;
             }
             if (frmDayBookObj != null)
             {
                 if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decMaterialReceiptMasterId);
                 }
                 else
                 {
                     Print(decMaterialReceiptMasterId, infoMaterialReceiptMaster.OrderMasterId);
                 }
             }
             this.Close();
             isEdit = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MR36:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }