From c0eaaae6c451a2082aedad2fc2379f84fb6f8a10 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Mon, 12 Aug 2024 14:26:48 +0200 Subject: [PATCH] =?UTF-8?q?PsychosozialeProjekteSaarpfalz/CustomReportCrea?= =?UTF-8?q?tor=20-=20Druck=20f=C3=BCr=20spezielle=20QueryRos=20sichergeste?= =?UTF-8?q?llt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomReportCreator.cs | 87 +++++++++++++++++++ .../PsychosozialeProjekteSaarpfalz.csproj | 1 + 2 files changed, 88 insertions(+) create mode 100644 ReportImp/PsychosozialeProjekteSaarpfalz/CustomReportCreator.cs diff --git a/ReportImp/PsychosozialeProjekteSaarpfalz/CustomReportCreator.cs b/ReportImp/PsychosozialeProjekteSaarpfalz/CustomReportCreator.cs new file mode 100644 index 000000000..467f707c2 --- /dev/null +++ b/ReportImp/PsychosozialeProjekteSaarpfalz/CustomReportCreator.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using BeWo.Data.Access; +using BeWo.Data.Entities; +using BeWo.Report; +using BeWo.Report.ReportObjects; +using BeWo.Service.DCEntityMapper; +using BS.Shared.Core; +using BS.Shared.DataContracts; +using DevExpress.XtraReports.Design; +using DevExpress.XtraReports.UI; + +namespace PsychosozialeProjekteSaarpfalz +{ + public class CustomReportCreator : DefaultReportCreator + { + public override XtraReport CreateInvoiceOverviewReport(List oids) + { + var queryReport = new BeWo.Report.DefaultReports.Bericht(); + var invoices = MapperFactory.InvoiceBaseDC_InvoiceBase.MapToNewDCs(DAOFactory.GenericDAO.LoadByIDs(oids)); + DataTable table = new DataTable(); + string[] spalten = new string[] { "Art der Rechnung", "Klient/in", "Zeitraum", "Nummer", "Datum", "Empfänger", "Betrag", "Bemerkung", + "Geprüft", "Versendet", "Exportiert", "Bezahlt", "Teilzahlung"}; + + for (int i = 0; i < spalten.Length; i++) + table.Columns.Add(spalten[i], typeof(string)); + + for (int i = 0; i < invoices.Count; i++) + { + DataRow row = table.NewRow(); + InvoiceBaseDC invoice = invoices[i]; + row[0] = invoice.InvoiceTypeText; + row[1] = invoice.CustomerLastName + ", " + invoice.CustomerFirstName; + row[2] = invoice.PeriodString; + row[3] = invoice.InvoiceNumber; + row[4] = string.Format("{0:dd.MM.yyyy}", invoice.InvoiceDate); + string recipient = invoice.RecipientOrganisation; + if (!string.IsNullOrEmpty(recipient) && (!string.IsNullOrEmpty(invoice.RecipientPersonFirstName) || !string.IsNullOrEmpty(invoice.RecipientPersonLastName))) + { + recipient += " - "; + } + recipient += invoice.RecipientPersonFirstName + " " + invoice.RecipientPersonLastName; + + row[5] = recipient; + row[6] = string.Format("{0:0.00}", invoice.TotalAmount); + row[7] = invoice.Notice; + row[8] = invoice.IsReviewed ? "Ja" : ""; + row[9] = invoice.IsSent ? "Ja" : ""; + row[10] = invoice.IsExported ? "Ja" : ""; + row[11] = invoice.IsPaid ? "Ja" : ""; + row[12] = invoice.PartialPayment; + table.Rows.Add(row); + } + + var queryReportObject = QueryRO.Create(new Query() { Title = "Rechnungen" }, table); + queryReportObject.Name = "Rechnungen"; + queryReport.SetReportDataSource(queryReportObject); + + return queryReport as XtraReport; + } + + public override XtraReport CreateQueryReport(long queryOid, String queryReportId) + { + var query = DAOFactory.GenericDAO.LoadByID(queryOid); + + if (query is null) + { + return new XtraReport(); + } + + var path = Utils.CreateSavePath(TempPath, queryReportId + ".xml"); + var table = Utils.XMLDeserialize(path); + var queryReport = new BeWo.Report.DefaultReports.Bericht(); + if (queryOid == 101) + { + queryReport = (BeWo.Report.DefaultReports.Bericht)FindReportImp(null, query.ReportTypeName); + } + var queryReportObject = QueryRO.Create(query, table); + queryReport.SetReportDataSource(queryReportObject); + + return queryReport as XtraReport; + } + } +} diff --git a/ReportImp/PsychosozialeProjekteSaarpfalz/PsychosozialeProjekteSaarpfalz.csproj b/ReportImp/PsychosozialeProjekteSaarpfalz/PsychosozialeProjekteSaarpfalz.csproj index ab2beeef9..73f6bff61 100644 --- a/ReportImp/PsychosozialeProjekteSaarpfalz/PsychosozialeProjekteSaarpfalz.csproj +++ b/ReportImp/PsychosozialeProjekteSaarpfalz/PsychosozialeProjekteSaarpfalz.csproj @@ -55,6 +55,7 @@ + Component