public void LoadReport(LoadReportType ReportType) { if (ParamDate.Count == 0) { MessageBox.Show("No date parameter selected.", "Parameter Required", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { reportType = ReportType; switch (ReportType) { case LoadReportType.NetSalesByServiceType: if (Rpt1 == null) { Rpt1 = CreateReport1(); } DV.DocumentSource = Rpt1; Rpt1.CreateDocument(); break; case LoadReportType.GrossSalesSummarybyHours: if (Rpt2 == null) { Rpt2 = CreateReport2(); } DV.DocumentSource = Rpt2; Rpt2.CreateDocument(); break; case LoadReportType.NetSalesByCategory: if (Rpt3 == null) { Rpt3 = CreateReport3(); } DV.DocumentSource = Rpt3; Rpt3.CreateDocument(); break; case LoadReportType.DiscountSummary: if (Rpt4 == null) { Rpt4 = CreateReport4(); } DV.DocumentSource = Rpt4; Rpt4.CreateDocument(); break; } } }
private rpt4 CreateReport4() { // Create a new report instance. rpt4 report = new rpt4(); try { // Assign the data source to the report. report.DataSource = DataSourceToBind(); //report.DataMember = "customQuery"; report.TotalQty = DTotalQty; // RptSalesTotals.TotalQty; report.TotalAmt = DTotalAmt; //RptSalesTotals.TotalAmt; report.StoreName = StoreName; report.ParamDate = ParamDate; report.TotalPercent = DTotalPercent; } catch (Exception ex) { MessageBox.Show(ex.Message); } return(report); }