/// <summary>
 /// On 'Print' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvContraReport.RowCount > 0)
         {
             DataSet ds = new DataSet();
             //CompanySP spCompany = new CompanySP();
             CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
             frmReport          reportobj          = new frmReport();
             //ContraMasterSP spContraMaster = new ContraMasterSP();
             ContraVoucherDetailsBll bllContraVoucherDetails = new ContraVoucherDetailsBll();
             List <DataTable>        listObjCompany          = bllCompanyCreation.CompanyViewDataTable(1);
             List <DataTable>        listObjCotraReport      = bllContraVoucherDetails.ContraReport(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbVoucherType.Text, cmbCashOrBank.Text, strType);
             ds.Tables.Add(listObjCompany[0]);
             ds.Tables.Add(listObjCotraReport[0]);
             reportobj.MdiParent = formMDI.MDIObj;
             reportobj.ContraVoucherReport(ds);
         }
         else
         {
             MessageBox.Show("No data found", "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CRT:12" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Cash/Bank combobox
 /// </summary>
 public void BankOrCashComboFill()
 {
     try
     {
         //ContraMasterSP spContraMaster = new ContraMasterSP();
         ContraVoucherDetailsBll bllContraVoucherDetails = new ContraVoucherDetailsBll();
         List <DataTable>        listObj = new List <DataTable>();
         listObj = bllContraVoucherDetails.CashOrBankComboFill();
         DataRow dr = listObj[0].NewRow();
         dr[0] = "ALL";
         listObj[0].Rows.InsertAt(dr, 0);
         cmbCashOrBank.DataSource    = listObj[0];
         cmbCashOrBank.ValueMember   = "ledgerId";
         cmbCashOrBank.DisplayMember = "ledgerName";
         cmbCashOrBank.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("CRT:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         //ContraMasterSP spContraMaster = new ContraMasterSP();
         ContraVoucherDetailsBll bllContraVoucherDetails = new ContraVoucherDetailsBll();
         List <DataTable>        listObj = new List <DataTable>();
         if (rbtnDeposit.Checked)
         {
             strType = "Deposit";
         }
         else
         {
             strType = "Withdraw";
         }
         listObj = bllContraVoucherDetails.ContraReport(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbVoucherType.Text, cmbCashOrBank.Text, strType);
         dgvContraReport.DataSource = listObj[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("CRT:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void Gridfill()
 {
     try
     {
         string strType = string.Empty;
         if (rbtnDeposit.Checked)
         {
             strType = "Deposit";
         }
         else
         {
             strType = "Withdraw";
         }
         //ContraMasterSP spContraMaster = new ContraMasterSP();
         ContraVoucherDetailsBll bllContraVoucherDetails = new ContraVoucherDetailsBll();
         List <DataTable>        listObj = new List <DataTable>();
         listObj = bllContraVoucherDetails.ContraVoucherRegisterSearch(Convert.ToDateTime(dtpFromDate.Value), Convert.ToDateTime(dtpToDate.Value), txtVoucherNo.Text.Trim(), cmbBankOrCash.Text, strType);
         dgvContraRegister.DataSource = listObj[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("CR:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }