protected override void OnLoad(EventArgs e) { var settings = services.GetSettings(); if (!IsMultipleSource) { ReportDataSource dataSource = new ReportDataSource("Reports", Source); dataSource.Name = "dsSource"; mReportViewer.LocalReport.DataSources.Add(dataSource); } else { foreach (var item in ReportSources) { ReportDataSource dataSource = new ReportDataSource("Reports", item); dataSource.Name = item.TableName; mReportViewer.LocalReport.DataSources.Add(dataSource); } } switch (ReportType) { case ReportType.History: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.HistoryReport.rdlc"; this.Text = "History Report"; break; case ReportType.Sales: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.SalesReport.rdlc"; this.Text = "Sales Report"; break; case ReportType.BIR: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.BIRReport.rdlc"; this.Text = "BIR Report"; break; case ReportType.DetailedTransactionSummaryReport: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.DetailedTransactionSummaryReport.rdlc"; this.Text = "Detailed Transaction Summary Report"; break; case ReportType.LengthOfStay: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.LengthOfStayReport.rdlc"; this.Text = "Length Of Stay Report"; break; case ReportType.RemainingCars: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.RemainingCarsReport.rdlc"; this.Text = "Remaining Cars Report"; break; case ReportType.PeakLoad: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.PeakLoadReport.rdlc"; this.Text = "Peak Load Report"; break; case ReportType.HourlyAccountability: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.HourlyAccountabilityReport.rdlc"; this.Text = "Hourly Accountability Report"; break; case ReportType.OperationOccupancy: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.OperationOccupancyReport.rdlc"; this.Text = "Operation Occupancy Report"; break; case ReportType.Shift: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.ShiftReport.rdlc"; this.Text = "Shift Report"; break; case ReportType.CashierAccountability: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.CashierAccountabilityReport.rdlc"; this.Text = "Cashier Accountability Report"; break; case ReportType.OperationHourlyAccountability: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.OperationHourlyAccountabilityReport.rdlc"; this.Text = "Operation Hourly Accountability Report"; break; case ReportType.AuditPerCashier: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.AuditPerCashierReport.rdlc"; this.Text = "Audit Per Cashier Report"; break; case ReportType.AuditPerTerminal: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.AuditPerTerminalReport.rdlc"; this.Text = "Audit Per Terminal Report"; break; case ReportType.SummaryReportPerTerminal: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.SummaryReportPerTerminalReport.rdlc"; this.Text = "Summary Report Per Terminal"; break; case ReportType.ZReading: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.ZReadingReport.rdlc"; this.Text = "ZReading Report"; break; case ReportType.UserAccessMatrix: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.UserAccessMatrixReport.rdlc"; this.Text = "User Access Matrix Report"; break; case ReportType.CardClearing: mReportViewer.LocalReport.ReportEmbeddedResource = "Reports.Reports.CardClearingReport.rdlc"; this.Text = "Card Clearing Report"; break; } ReportParameterCollection parameters = new ReportParameterCollection(); parameters.Add(new ReportParameter("Company", settings.Company)); parameters.Add(new ReportParameter("TIN", settings.TIN)); parameters.Add(new ReportParameter("Address", settings.Address)); if (ReportType == ReportType.AuditPerCashier) { parameters.Add(new ReportParameter("PrintDate", this.PrintDate)); } parameters.Add(new ReportParameter("ProgramAndVersion", Properties.Settings.Default.ProgramVersion)); parameters.Add(new ReportParameter("Serial", Properties.Settings.Default.SN)); parameters.Add(new ReportParameter("Min", Properties.Settings.Default.MIN)); parameters.Add(new ReportParameter("DateCovered", this.DateCovered)); parameters.Add(new ReportParameter("Username", Properties.Settings.Default.Username)); mReportViewer.LocalReport.SetParameters(parameters); this.mReportViewer.RefreshReport(); base.OnLoad(e); }
private void ShowReport() { var settings = services.GetSettings(); switch (ReportType) { case ReportType.History: HistoryCrystalReport report = new HistoryCrystalReport(); report.SetDataSource(DataSource); viewer.ReportSource = report; report.DataDefinition.FormulaFields["Company"].Text = FormulaFieldBuilder(settings.Company); report.DataDefinition.FormulaFields["Address"].Text = FormulaFieldBuilder(settings.Address); report.DataDefinition.FormulaFields["TIN"].Text = FormulaFieldBuilder(settings.TIN); report.DataDefinition.FormulaFields["ProgramAndVersion"].Text = FormulaFieldBuilder(Properties.Settings.Default.ProgramVersion); report.DataDefinition.FormulaFields["Serial"].Text = FormulaFieldBuilder(Properties.Settings.Default.SN); report.DataDefinition.FormulaFields["Min"].Text = FormulaFieldBuilder(Properties.Settings.Default.MIN); report.DataDefinition.FormulaFields["DateCovered"].Text = FormulaFieldBuilder(this.DateCovered); report.DataDefinition.FormulaFields["Username"].Text = FormulaFieldBuilder(Properties.Settings.Default.Username); ReportDocument = report; this.Text = "History Report"; break; case ReportType.DetailedTransactionSummaryReport: DetailedTransactionCrystalReport detailedreport = new DetailedTransactionCrystalReport(); detailedreport.SetDataSource(DataSource); viewer.ReportSource = detailedreport; detailedreport.DataDefinition.FormulaFields["Company"].Text = FormulaFieldBuilder(settings.Company); detailedreport.DataDefinition.FormulaFields["Address"].Text = FormulaFieldBuilder(settings.Address); detailedreport.DataDefinition.FormulaFields["TIN"].Text = FormulaFieldBuilder(settings.TIN); detailedreport.DataDefinition.FormulaFields["ProgramAndVersion"].Text = FormulaFieldBuilder(Properties.Settings.Default.ProgramVersion); detailedreport.DataDefinition.FormulaFields["Serial"].Text = FormulaFieldBuilder(Properties.Settings.Default.SN); detailedreport.DataDefinition.FormulaFields["Min"].Text = FormulaFieldBuilder(Properties.Settings.Default.MIN); detailedreport.DataDefinition.FormulaFields["DateCovered"].Text = FormulaFieldBuilder(this.DateCovered); detailedreport.DataDefinition.FormulaFields["Username"].Text = FormulaFieldBuilder(Properties.Settings.Default.Username); ReportDocument = detailedreport; break; case ReportType.Sales: SalesCrystalReport salesreport = new SalesCrystalReport(); salesreport.SetDataSource(DataSource); viewer.ReportSource = salesreport; salesreport.DataDefinition.FormulaFields["Company"].Text = FormulaFieldBuilder(settings.Company); salesreport.DataDefinition.FormulaFields["Address"].Text = FormulaFieldBuilder(settings.Address); salesreport.DataDefinition.FormulaFields["TIN"].Text = FormulaFieldBuilder(settings.TIN); salesreport.DataDefinition.FormulaFields["ProgramAndVersion"].Text = FormulaFieldBuilder(Properties.Settings.Default.ProgramVersion); salesreport.DataDefinition.FormulaFields["Serial"].Text = FormulaFieldBuilder(Properties.Settings.Default.SN); salesreport.DataDefinition.FormulaFields["Min"].Text = FormulaFieldBuilder(Properties.Settings.Default.MIN); salesreport.DataDefinition.FormulaFields["DateCovered"].Text = FormulaFieldBuilder(this.DateCovered); salesreport.DataDefinition.FormulaFields["Username"].Text = FormulaFieldBuilder(Properties.Settings.Default.Username); ReportDocument = salesreport; break; case ReportType.CashlessReport: CashlessCrystalReport cashless = new CashlessCrystalReport(); cashless.SetDataSource(DataSource); viewer.ReportSource = cashless; cashless.DataDefinition.FormulaFields["Company"].Text = FormulaFieldBuilder(settings.Company); cashless.DataDefinition.FormulaFields["Address"].Text = FormulaFieldBuilder(settings.Address); cashless.DataDefinition.FormulaFields["TIN"].Text = FormulaFieldBuilder(settings.TIN); cashless.DataDefinition.FormulaFields["ProgramAndVersion"].Text = FormulaFieldBuilder(Properties.Settings.Default.ProgramVersion); cashless.DataDefinition.FormulaFields["Serial"].Text = FormulaFieldBuilder(Properties.Settings.Default.SN); cashless.DataDefinition.FormulaFields["Min"].Text = FormulaFieldBuilder(Properties.Settings.Default.MIN); cashless.DataDefinition.FormulaFields["DateCovered"].Text = FormulaFieldBuilder(this.DateCovered); cashless.DataDefinition.FormulaFields["Username"].Text = FormulaFieldBuilder(Properties.Settings.Default.Username); ReportDocument = cashless; break; case ReportType.RegularParker: RegularParkerReport regular = new RegularParkerReport(); regular.SetDataSource(DataSource); viewer.ReportSource = regular; regular.DataDefinition.FormulaFields["Company"].Text = FormulaFieldBuilder(settings.Company); regular.DataDefinition.FormulaFields["Address"].Text = FormulaFieldBuilder(settings.Address); regular.DataDefinition.FormulaFields["TIN"].Text = FormulaFieldBuilder(settings.TIN); regular.DataDefinition.FormulaFields["ProgramAndVersion"].Text = FormulaFieldBuilder(Properties.Settings.Default.ProgramVersion); regular.DataDefinition.FormulaFields["Serial"].Text = FormulaFieldBuilder(Properties.Settings.Default.SN); regular.DataDefinition.FormulaFields["Min"].Text = FormulaFieldBuilder(Properties.Settings.Default.MIN); regular.DataDefinition.FormulaFields["DateCovered"].Text = FormulaFieldBuilder(this.DateCovered); regular.DataDefinition.FormulaFields["Username"].Text = FormulaFieldBuilder(Properties.Settings.Default.Username); ReportDocument = regular; break; case ReportType.AuditTrail: AuditTrailReport audit = new AuditTrailReport(); audit.SetDataSource(DataSource); viewer.ReportSource = audit; audit.DataDefinition.FormulaFields["Company"].Text = FormulaFieldBuilder(settings.Company); audit.DataDefinition.FormulaFields["Address"].Text = FormulaFieldBuilder(settings.Address); audit.DataDefinition.FormulaFields["TIN"].Text = FormulaFieldBuilder(settings.TIN); audit.DataDefinition.FormulaFields["ProgramAndVersion"].Text = FormulaFieldBuilder(Properties.Settings.Default.ProgramVersion); audit.DataDefinition.FormulaFields["Serial"].Text = FormulaFieldBuilder(Properties.Settings.Default.SN); audit.DataDefinition.FormulaFields["Min"].Text = FormulaFieldBuilder(Properties.Settings.Default.MIN); audit.DataDefinition.FormulaFields["DateCovered"].Text = FormulaFieldBuilder(this.DateCovered); audit.DataDefinition.FormulaFields["Username"].Text = FormulaFieldBuilder(Properties.Settings.Default.Username); ReportDocument = audit; break; } viewer.Show(); viewer.RefreshReport(); }