Exemplo n.º 1
0
        internal void ShowReport()
        {
            addFirmDetailsToParameters();

            BillPrintoutReport report = new BillPrintoutReport();

            report.SetDataSource(dataset);

            if (Properties.Settings.Default.PrintDirectlyToPrinter)
            {
                passParametersToReport(report);

                PrinterSettings prtSetting = new PrinterSettings();
                report.PrintOptions.PrinterName = prtSetting.PrinterName;
                Cursor.Current = Cursors.Default;
                report.PrintToPrinter(1, false, 0, 0); //print the report
                this.Dispose();
            }
            else //display the report in the ReportViewerControl
            {
                configureReportViewer();
                crystalReportViewer.ReportSource = report;
                passParametersToReport(report);
                crystalReportViewer.Zoom(1); //show to fit page width
                this.Show();
            }
        }
Exemplo n.º 2
0
 private void passParametersToReport(BillPrintoutReport report)
 {
     report.SetParameterValue(0, reportParameters["FirmName"]);
     report.SetParameterValue(1, reportParameters["FirmAddress"]);
     report.SetParameterValue(2, reportParameters["PhoneNumbers"]);
     report.SetParameterValue(3, reportParameters["DiscountAmount"]);
     report.SetParameterValue(4, reportParameters["ExpenseAmount"]);
     report.SetParameterValue(5, reportParameters["ExpenseText"]);
     report.SetParameterValue(6, reportParameters["InvoiceID"]);
     report.SetParameterValue(7, reportParameters["InvoiceDate"]);
     report.SetParameterValue(8, reportParameters["CustomerName"]);
 }