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

            rpt.Site = this.Site;
            return(rpt);
        }
        private void frmRoomUtiliationReport_Load(object sender, EventArgs e)
        {
            //Declare a report object for use at runtime
            RoonUtiliation aCustomerInvoicesReport;

            //Intantiate the report
            aCustomerInvoicesReport = new RoonUtiliation();
            try
            {
                //Instantiate the dataset and table adapters
                roomInvoicesDataSet   = new MVCH_group3DataSet();
                admitanceTableAdapter = new MVCH_group3DataSetTableAdapters.tblAdmittanceTableAdapter();
                patientTableAdapter   = new MVCH_group3DataSetTableAdapters.tblPatientsTableAdapter();
                roomTableAdapter      = new MVCH_group3DataSetTableAdapters.tblRoomTableAdapter();
                //Fill the dataset using via the two table adapters
                //Fill with customers
                admitanceTableAdapter.Fill(roomInvoicesDataSet.tblAdmittance);
                //Fill with invoices
                patientTableAdapter.Fill(roomInvoicesDataSet.tblPatients);
                roomTableAdapter.Fill(roomInvoicesDataSet.tblRoom);
                //Assign the filled dataset as the datasource for the report
                aCustomerInvoicesReport.SetDataSource(roomInvoicesDataSet);
                //Set up the report viewer object on the form to
                //show the runtime report object
                crystalReportViewer1.ReportSource = aCustomerInvoicesReport;
            }
            catch (Exception dataException)
            {
                //Catch any exception thrown during data object instantiation
                //or report generation and display based on the dataset
                MessageBox.Show("Data Error Encountered: " + dataException.Message);
            }
        }