From f5b8a8db096ff9ca4fa8803ec119f9b62ca1c69d Mon Sep 17 00:00:00 2001 From: Marcel Hirschle Date: Wed, 5 Oct 2022 11:28:04 +0200 Subject: [PATCH] =?UTF-8?q?MH:=20HPH=20=C3=84nderungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HphBersenbrueckAtz/CustomReportCreator.cs | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/ReportImp/HphBersenbrueckAtz/CustomReportCreator.cs b/ReportImp/HphBersenbrueckAtz/CustomReportCreator.cs index da6b6b9af..3b7dd8713 100644 --- a/ReportImp/HphBersenbrueckAtz/CustomReportCreator.cs +++ b/ReportImp/HphBersenbrueckAtz/CustomReportCreator.cs @@ -165,6 +165,78 @@ namespace BeWo.HphBersenbrueckAtz } + public override XtraReport CreateServiceOverviewReportForCustomers(IList customerOids, int month, int year, long? orgaOid, long? empOid, long? serviceCategoryOid, int startDay, int endDay, bool nurFehlende) + { + DateTime startDate = new DateTime(year, month, 1); + + if (startDay == 1 && endDay == DateTime.DaysInMonth(year, month)) + { + var endDate = startDate.AddMonths(3).AddDays(-1); + + month = startDate.Month; + year = startDate.Year; + startDay = startDate.Day; + + endDay = (int)endDate.Subtract(startDate).TotalDays; + + endDay += startDay; + } + + + + + + + + + var roList = new List(); + + foreach (var coid in customerOids) + { + var ro = ServicesOverviewRO.Create(coid, month, year, true, orgaOid ?? 0, empOid ?? 0, startDay, endDay, serviceCategoryOid); + + if (ro != null) + { + roList.Add(ro); + } + } + + var sortedList = roList.OrderBy(r => r.CustomerLastName + ", " + r.CustomerFirstName).ToList(); + + if (sortedList.Count > 0) + { + String reportId = null; + if (orgaOid.HasValue && orgaOid > 0) + { + var organisation = DAOFactory.GenericDAO.LoadByID(orgaOid.Value); + if (organisation != null) + reportId = organisation.Name; + } + + var rootReport = CreateReportForServicesOverviewRo(sortedList[0], reportId); + if (rootReport.Pages.Count == 0) + { + rootReport.CreateDocument(); + } + + + for (int i = 1; i < sortedList.Count; i++) + { + var lNext = CreateReportForServicesOverviewRo(sortedList[i], reportId); + if (lNext.Pages.Count == 0) + { + lNext.CreateDocument(); + } + + rootReport.Pages.AddRange(lNext.Pages); + } + + return rootReport; + } + return new XtraReport(); + } + + private XtraReport CreateServicesOverviewReportForRo(ServicesOverviewRO ro, String reportId) { NachweisTherapieeinheiten report = new NachweisTherapieeinheiten();