private void btnViewReport_Click(object sender, EventArgs e) { try { ProductManager manageProduct = new ProductManager(); if (Convert.ToInt32(cmbWarehouse.SelectedValue) < 0) { MessageBox.Show("Please Select Department Name", "Depart is Required", MessageBoxButtons.OK, MessageBoxIcon.Warning); cmbWarehouse.Focus(); return; } document = new ReportDocument(); int ProductId = -1; if (!string.IsNullOrEmpty(txtPCode.Text)) { ProductId = manageProduct.GetProductIdByCode(txtPCode.Text); } string path = Application.StartupPath + "/rpt/Production/rptWarehouseTransferSummary.rpt"; document.Load(path); DataTable dtReport = new DataTable(); dtReport = manageWarehouse.GetTransferSummaryReport(Convert.ToDateTime(dtpDate.Text), Convert.ToInt32(cmbWarehouse.SelectedValue), txtSONo.Text, ProductId); document.SetDataSource(dtReport); Utility.SetReportDefaultParameter(ref document); CrViewer.ReportSource = document; } catch (Exception ex) { } }