public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { Crpt_BaoCaoLuu_NoBarcode rpt = new Crpt_BaoCaoLuu_NoBarcode(); rpt.Site = this.Site; return rpt; }
private void btnPrint_Click(object sender, EventArgs e) { PrintData(); try { if(dt.Rows.Count<=0) { Utility.ShowMsg("Không có dữ liệu để báo cáo","Thông Báo",MessageBoxIcon.Information); } else { string s = ""; if(cboTestType.SelectedValue.ToString() =="-1") { s = "TẤT CẢ CÁC LOẠI XÉT NGHIỆM"; } else { s = string.Format("XÉT NGHIỆM {0}", cboTestType.SelectedText.ToUpper()); } var crpt = new Crpt_BaoCaoLuu_NoBarcode(); var oForm = new frmPrintPreview("In Báo cáo lưu", crpt, true, true); crpt.SetDataSource(dt); crpt.DataDefinition.FormulaFields["Formula_1"].Text = ""; crpt.SetParameterValue("TongBenhNhan", dt.Rows.Count); crpt.SetParameterValue("TestType_Name",s ); crpt.SetParameterValue("ParentBranchName", ManagementUnit.gv_sParentBranchName); crpt.SetParameterValue("BranchName", ManagementUnit.gv_sBranchName); crpt.SetParameterValue("sCurrentDate", DateTime.Now.Date); oForm.crptViewer.ReportSource = crpt; oForm.ShowDialog(); oForm.Dispose(); } } catch (Exception ex) { Utility.ShowMsg("Lỗi" + ex,"Thông báo",MessageBoxIcon.Warning); } }