/// <summary>
 /// When doubleclicking on the grid
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvVatreturn_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgvVatreturn.Rows.Count > 1)
         {
             if (dgvVatreturn.CurrentRow.Cells["dgvtxtsalesmasterid"].Value != null)
             {
                 //SalesMasterSP spSale = new SalesMasterSP();
                 SalesInvoiceBll BllSalesInvoice = new SalesInvoiceBll();
                 strVoucherName = dgvVatreturn.CurrentRow.Cells["dgvtxtvoucherName"].Value.ToString();
                 dcSalesId = Convert.ToDecimal(dgvVatreturn.CurrentRow.Cells["dgvtxtsalesmasterid"].Value.ToString());
                 if (dgvVatreturn.CurrentRow.Cells["dgvtxtvoucherName"].Value != null)
                 {
                     string strpos = BllSalesInvoice.SaleMasterGetPos(dcSalesId, strVoucherName);
                     if (strpos == "0")
                     {
                         frmSalesInvoice objfrmsaleInvoice;
                         objfrmsaleInvoice = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice;
                         if (objfrmsaleInvoice == null)
                         {
                             objfrmsaleInvoice = new frmSalesInvoice();
                             objfrmsaleInvoice.MdiParent = formMDI.MDIObj;
                             objfrmsaleInvoice.callFromVatReturnReport(this, dcSalesId);
                         }
                         else
                         {
                             objfrmsaleInvoice.callFromVatReturnReport(this, dcSalesId);
                         }
                     }
                     if (strpos == "1")
                     {
                         frmPOS objfrmpos;
                         objfrmpos = Application.OpenForms["frmPOS"] as frmPOS;
                         if (objfrmpos == null)
                         {
                             objfrmpos = new frmPOS();
                             objfrmpos.MdiParent = formMDI.MDIObj;
                             objfrmpos.callFromVatReturnReport(this, dcSalesId);
                         }
                         else
                         {
                             objfrmpos.callFromVatReturnReport(this, dcSalesId);
                         }
                     }
                     if (strpos == "a")
                     {
                         frmPurchaseInvoice objfrmPurchaseInvoice;
                         objfrmPurchaseInvoice = Application.OpenForms["frmPurchaseInvoice"] as frmPurchaseInvoice;
                         if (objfrmPurchaseInvoice == null)
                         {
                             objfrmPurchaseInvoice = new frmPurchaseInvoice();
                             objfrmPurchaseInvoice.MdiParent = formMDI.MDIObj;
                             objfrmPurchaseInvoice.CallFromVatReturnReport(this, dcSalesId);
                         }
                         else
                         {
                             objfrmPurchaseInvoice.CallFromVatReturnReport(this, dcSalesId);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("VRR:15" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }