コード例 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            ThongKe rpt = new ThongKe();

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #2
0
        //su kien click vao button In
        private void btn_In_Click(object sender, EventArgs e)
        {
            crThongKe hoadon = new crThongKe(); // tao form chua report
            DataSet   ds     = new DataSet();   // tao data cho report

            try
            {
                ds.Tables.Add(dttk.Copy());
            }
            catch (Exception)
            {
                Alert.Show("CHƯA CÓ DỮ LIỆU THỐNG KÊ", Alert.AlertType.error);
                return;
            }
            if (dtgvThongKe.Rows.Count == 0)
            {
                Alert.Show("CHƯA CÓ DỮ LIỆU THỐNG KÊ", Alert.AlertType.error);
                return;
            }

            // gan cac gia tri cho report
            ds.WriteXmlSchema("tk.xml");
            ThongKe rp = new ThongKe();

            rp.SetDataSource(ds);
            crThongKe cr = new crThongKe();

            cr.cr_ThongKe.ReportSource = rp;
            rp.SetParameterValue("tbKieuTK", kieutk);
            rp.SetParameterValue("tbNgaybd", dtlNL.Text); //tên textbox rồi giá trị gán phái sau
            rp.SetParameterValue("tbNgaykt", "");
            rp.SetParameterValue("tbTongTienNhap", lbTongTienNhap.Text);
            rp.SetParameterValue("tbTongTienBan", lbTongTienBan.Text);
            cr.ShowDialog();
        }