private void btnPrintReport_Click(object sender, RoutedEventArgs e)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Id", typeof(Int32));
            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("Qty", typeof(Int32));
            dt.Columns.Add("Rate", typeof(decimal));
            dt.Columns.Add("Total", typeof(decimal));

            for (int i = 0; i < 200; i++)
            {
                int    id   = 1;
                string name = "lahore madical store 10 Tab 10/5";
                int    qty  = 10;
                float  rate = float.Parse(102.25.ToString());
                float  tot  = float.Parse(1022.5.ToString());

                dt.Rows.Add(id, name, qty, rate, tot);
            }

            SampleReport sr = new SampleReport();

            sr.Database.Tables["DTSample"].SetDataSource(dt);

            sampleCRV.ViewerCore.ReportSource = null;
            sampleCRV.ViewerCore.ReportSource = sr;
        }
Exemplo n.º 2
0
        private void btnPrintReport_Click(object sender, RoutedEventArgs e)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Id", typeof(Int32));
            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("Age", typeof(Int32));
            dt.Columns.Add("Salary", typeof(decimal));

            for (int i = 0; i < 6; i++)
            {
                int     id   = 1;
                string  name = "Rana Abbas";
                int     age  = 22;
                decimal sal  = 2000;

                dt.Rows.Add(id, name, age, sal);
            }

            SampleReport sr = new SampleReport();

            sr.Database.Tables["DTSample"].SetDataSource(dt);

            sampleCRV.ViewerCore.ReportSource = sr;
        }
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            SampleReport rpt = new SampleReport();

            rpt.Site = this.Site;
            return(rpt);
        }