From 2fb79c1b30c27da643508fdc889d7466335c3eb6 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Mon, 3 Nov 2025 15:56:09 +0100 Subject: [PATCH] =?UTF-8?q?FenixSozialeDienste/CustomReportCreator.cs=20-?= =?UTF-8?q?=20Anh=C3=A4ngen=20der=20Leistungsnachweise=20an=20Rechnung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomReportCreator.cs | 93 +++++++++++++++++++ .../FenixSozialeDienste.csproj | 1 + 2 files changed, 94 insertions(+) create mode 100644 ReportImp/FenixSozialeDienste/CustomReportCreator.cs diff --git a/ReportImp/FenixSozialeDienste/CustomReportCreator.cs b/ReportImp/FenixSozialeDienste/CustomReportCreator.cs new file mode 100644 index 000000000..cceb076ae --- /dev/null +++ b/ReportImp/FenixSozialeDienste/CustomReportCreator.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using BeWo.Data.Access; +using BeWo.Data.Entities; +using BeWo.Report; +using BeWo.Report.ReportObjects; +using BeWo.Service.DCEntityMapper; +using BS.Shared.DataContracts; +using DevExpress.XtraReports.UI; + +namespace FenixSozialeDienste +{ + public class CustomReportCreator : DefaultReportCreator + { + + public override XtraReport CreateServiceInvoiceReport(string dcIds, long? invoiceBaseOid) + { + if (String.IsNullOrEmpty(dcIds) && invoiceBaseOid.HasValue) + { + var serviceInvoice = DAOFactory.SearchDAO.GetServiceInvoiceByInvoiceBaseOid(invoiceBaseOid.Value); + dcIds = String.Format("{0}", serviceInvoice.Oid); + } + + if (!string.IsNullOrEmpty(dcIds)) + { + var dcList = new List(); + var dcidStrs = dcIds.Split(';'); + + foreach (var oidStr in dcidStrs) + { + var oid = long.Parse(oidStr); + var invoice = DAOFactory.GenericDAO.LoadByID(oid); + var dc = MapperFactory.ServiceInvoiceDC_ServiceInvoice.MapToNewDC(invoice); + dcList.Add(dc); + } + + return CreateInvoiceReport(dcList); + } + return new XtraReport(); + } + + private XtraReport CreateInvoiceReport(List invoices) + { + XtraReport allReports = null; + + foreach (var iDC in invoices) + { + XtraReport invoiceReport = null; + IBeWoReport seite1 = FindReportImp(iDC.InvoiceBase.InvoiceId); + + if (iDC.ServiceInvoicePeriods.Count > 0 && iDC.ServiceInvoicePeriods[0].SupportConceptApprovalPeriod.ServiceCategory != null) + { + var ro = ServiceInvoiceRO.Create(iDC); + seite1.SetReportDataSource(ro); + ((XtraReport)seite1).CreateDocument(); + invoiceReport = seite1 as XtraReport; + + int month = iDC.InvoiceBase.AccountingPeriodStart.Value.Month; + int year = iDC.InvoiceBase.AccountingPeriodStart.Value.Year; + long cOid = iDC.InvoiceBase.SupportConceptCostBearerRelDc.SupportConcept.Customer.CustomerOid; + long oOid = iDC.InvoiceBase.RecipientOrganisationOid ?? 0; + + while (month <= iDC.InvoiceBase.AccountingPeriodEnd.Value.Month) + { + var qb = CreateServiceOverviewSingleCustomerReport(cOid, month, year, oOid, 0, null, 1, DateTime.DaysInMonth(year, month)); + qb.CreateDocument(); + + invoiceReport.Pages.AddRange(qb.Pages); + month++; + } + } + if (invoiceReport == null) + { + var ro = ServiceInvoiceRO.Create(iDC); + seite1.SetReportDataSource(ro); + ((XtraReport)seite1).CreateDocument(); + invoiceReport = seite1 as XtraReport; + } + if (allReports == null) + { + allReports = invoiceReport; + } + else + { + ((XtraReport)allReports).Pages.AddRange(invoiceReport.Pages); + } + } + + return allReports as XtraReport; + } + } +} + diff --git a/ReportImp/FenixSozialeDienste/FenixSozialeDienste.csproj b/ReportImp/FenixSozialeDienste/FenixSozialeDienste.csproj index 13000ddef..81ab8e06c 100644 --- a/ReportImp/FenixSozialeDienste/FenixSozialeDienste.csproj +++ b/ReportImp/FenixSozialeDienste/FenixSozialeDienste.csproj @@ -57,6 +57,7 @@ + Component