Ejemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            viewSaleReport rpt = new viewSaleReport();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void report_Click(object sender, EventArgs e)
        {
            printSaleForm        printForm = new printSaleForm();
            medicalStoreDataSet7 dataSet   = new medicalStoreDataSet7();

            dataSet.EnforceConstraints = false;

            viewSaleReport report = new viewSaleReport();


            try
            {
                DataTable dt = new DataTable();
                foreach (DataGridViewRow row in this.dataGridView1.Rows)
                {
                    DataRow dr = dt.NewRow();

                    if (row.DataBoundItem != null)
                    {
                        dr = (DataRow)((DataRowView)row.DataBoundItem).Row;

                        dataSet.masterSale.ImportRow(dr);
                    }
                }



                report.SetDataSource(dataSet);


                printForm.crystalReportViewer1.ReportSource = report;
                printForm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }