Exemplo n.º 1
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
     Rp_DC_2 rpt = new Rp_DC_2();
     rpt.Site = this.Site;
     return rpt;
 }
        private void frmShowReport_Load(object sender, EventArgs e)
        {
            try
              {

                if (type == "DC_1")
                {
                    Rp_DC_1 cry = new Rp_DC_1();
                    cry.SetDataSource(dt);
                    cry.SetParameterValue("Ngayin", DateTime.Now.ToShortDateString());
                    cry.SetParameterValue("Gioin", DateTime.Now.ToLongTimeString());
                    cry.SetParameterValue("Thoigian", thoiGian);
                    cry.SetParameterValue("Title", title);
                    crystalReportViewer1.ReportSource = cry;
                }
                else if (type == "DC_2")
                {
                    Rp_DC_2 cry = new Rp_DC_2();
                    cry.SetDataSource(dt);
                    cry.SetParameterValue("Ngayin", DateTime.Now.ToShortDateString());
                    cry.SetParameterValue("Gioin", DateTime.Now.ToLongTimeString());
                    cry.SetParameterValue("Thoigian", thoiGian);
                    cry.SetParameterValue("Title", title);
                    crystalReportViewer1.ReportSource = cry;
                }
                else if (type == "DC_6")
                {
                    Rp_DC_6 cry = new Rp_DC_6();
                    cry.SetDataSource(dt);
                    cry.SetParameterValue("Ngayin", DateTime.Now.ToShortDateString());
                    cry.SetParameterValue("Gioin", DateTime.Now.ToLongTimeString());
                    cry.SetParameterValue("Thoigian", thoiGian);
                    cry.SetParameterValue("Title", title);
                    cry.SetParameterValue("Title2", title2);
                    crystalReportViewer1.ReportSource = cry;
                }
                else if (type == "DC_7")
                {
                    Rp_DC_7 cry = new Rp_DC_7();
                    cry.SetDataSource(dt);
                    cry.SetParameterValue("Ngayin", DateTime.Now.ToShortDateString());
                    cry.SetParameterValue("Gioin", DateTime.Now.ToLongTimeString());
                    cry.SetParameterValue("Thoigian", thoiGian);
                    cry.SetParameterValue("Title", title);
                    crystalReportViewer1.ReportSource = cry;
                }
                else if (type == "DC_10")
                {
                    Rp_DC_10 cry = new Rp_DC_10();
                    cry.SetDataSource(dt);
                    cry.SetParameterValue("Ngayin", DateTime.Now.ToShortDateString());
                    cry.SetParameterValue("Gioin", DateTime.Now.ToLongTimeString());
                    cry.SetParameterValue("Thoigian", thoiGian);
                    cry.SetParameterValue("Title", title);
                    crystalReportViewer1.ReportSource = cry;
                }
                else if (type == "DC_11")
                {
                    Rp_DC_10 cry = new Rp_DC_10();
                    cry.SetDataSource(dt);
                    cry.SetParameterValue("Ngayin", DateTime.Now.ToShortDateString());
                    cry.SetParameterValue("Gioin", DateTime.Now.ToLongTimeString());
                    cry.SetParameterValue("Thoigian", thoiGian);
                    cry.SetParameterValue("Title", title);
                    crystalReportViewer1.ReportSource = cry;
                }
                else if (type == "DC_12")
                {
                    Rp_DC_10 cry = new Rp_DC_10();
                    cry.SetDataSource(dt);
                    cry.SetParameterValue("Ngayin", DateTime.Now.ToShortDateString());
                    cry.SetParameterValue("Gioin", DateTime.Now.ToLongTimeString());
                    cry.SetParameterValue("Thoigian", thoiGian);
                    cry.SetParameterValue("Title", title);
                    crystalReportViewer1.ReportSource = cry;
                }
                else if (type == "DC_13")
                {
                    Rp_DC_13 cry = new Rp_DC_13();
                    cry.SetDataSource(dt);
                    cry.SetParameterValue("Ngayin", DateTime.Now.ToShortDateString());
                    cry.SetParameterValue("Gioin", DateTime.Now.ToLongTimeString());
                    cry.SetParameterValue("Thoigian", thoiGian);
                    cry.SetParameterValue("Title", title);
                    cry.SetParameterValue("Title2", title2);
                    cry.SetParameterValue("Tochuc", tochuc);
                    crystalReportViewer1.ReportSource = cry;
                }
                else if (type == "DC_14")
                {
                    Rp_TaiKhoan_Flexcube cry = new Rp_TaiKhoan_Flexcube();
                    cry.SetDataSource(dt);
                    cry.SetParameterValue("ngayin", DateTime.Now.ToShortDateString());
                    cry.SetParameterValue("trnrefno", trnrefno);
                    crystalReportViewer1.ReportSource = cry;

                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }