Example #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            crpt_BAOCAO_XOA_KETQUA_TONGHOP rpt = new crpt_BAOCAO_XOA_KETQUA_TONGHOP();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void btnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                ReportDocument crpt;

                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 ds =
                        SPs.SpBaoCaoXoaKetQua(dtpFromDate.Value.ToString("yyyy/MM/dd"),
                                              dtpToDate.Value.ToString("yyyy/MM/dd"),
                                              Utility.Int32Dbnull(cboTestType.SelectedValue, -1),
                                              Utility.sDbnull(cboUserName.SelectedValue, "")).GetDataSet();
                if (cboReportType.SelectedIndex == 1)
                {
                    crpt = new crpt_BAOCAO_XOA_KETQUA_TONGHOP();
                    dt = ds.Tables[0];
                }
                else
                {
                    crpt = new crpt_BAOCAO_XOA_KETQUA_CHITIET();
                    dt = ds.Tables[1];
                }
                if (dt.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Không có dữ liệu để báo cáo");
                }
                else
                {
                    var oForm = new frmPrintPreview("In báo cáo xóa", 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", dtpDatePrintFrom.Value);
                    oForm.crptViewer.ReportSource = crpt;
                    oForm.ShowDialog();
                    oForm.Dispose();
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     crpt_BAOCAO_XOA_KETQUA_TONGHOP rpt = new crpt_BAOCAO_XOA_KETQUA_TONGHOP();
     rpt.Site = this.Site;
     return rpt;
 }