using System; using System.Collections.Generic; using System.Linq; using System.Text; using BeWo.Report; using BeWo.Report.DefaultReports; using BeWo.Report.ReportObjects; using DevExpress.XtraReports.UI; namespace KcmGmbH { public class CustomReportCreator : DefaultReportCreator { public override XtraReport CreateServiceOverviewAllCustomersReport(int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay) { List lROs = ServicesOverviewRO.Create(month, year, orgaOid, empOid, startDay, endDay, serviceCategoryOid); if (lROs.Count > 0) { var rootReport = CreateServicesOverviewReportForRo(lROs[0], serviceCategoryOid); rootReport.CreateDocument(); for (int i = 1; i < lROs.Count; i++) { var lNext = CreateServicesOverviewReportForRo(lROs[i], serviceCategoryOid); if (lNext.Pages.Count == 0) { lNext.CreateDocument(); } rootReport.Pages.AddRange(lNext.Pages); } return rootReport; } return new XtraReport(); } public override XtraReport CreateServiceOverviewSingleCustomerReport(long customerOid, int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay) { var ro = ServicesOverviewRO.Create(customerOid, month, year, false, orgaOid, empOid, startDay, endDay, serviceCategoryOid); return CreateServicesOverviewReportForRo(ro, serviceCategoryOid); } public override XtraReport CreateReportForServicesOverviewRo(ServicesOverviewRO ro, string reportId) { return CreateServicesOverviewReportForRo(ro, null); } private XtraReport CreateServicesOverviewReportForRo(ServicesOverviewRO ro, long? serviceCategoryOid) { XtraReport report = null; ServicesOverviewRO flsRo = ServicesOverviewRO.CopyFromRO(ro); ServicesOverviewRO alsRo = ServicesOverviewRO.CopyFromRO(ro); if (ro.Services != null) { foreach (ServicesOverviewRO.ServiceDetail s in ro.Services) { if (s.ServiceCategory.Contains("Assistenz")) { alsRo.Services.Add(s); } else { flsRo.Services.Add(s); } } } report = AddSubServicesOverviewReportToReport(report, new Quittierungsbeleg(), flsRo); report = AddSubServicesOverviewReportToReport(report, new QuittierungsbelegAssistenz(), alsRo); if (report == null) report = new XtraReport(); return report; } } }