diff --git a/BeWo/View/Navigation/OrganisationNavigationView.xaml b/BeWo/View/Navigation/OrganisationNavigationView.xaml index 381e5e3ff..4c4f7eace 100644 --- a/BeWo/View/Navigation/OrganisationNavigationView.xaml +++ b/BeWo/View/Navigation/OrganisationNavigationView.xaml @@ -7,8 +7,9 @@ CreateNewObject="mainNavigationView_CreateNewObject" OpenObject="mainNavigationView_OpenObject" DeleteObject="mainNavigationView_DeleteObject" - ArchiveObject="mainNavigationView_ArchiveObject" + ArchiveObject="mainNavigationView_ArchiveObject" ExcelExport="mainNavigationView_ExcelExport" + Print="mainNavigationView_Print" DeleteDemands="DeleteAll, OrganisationView_Delete" CreateDemands="CreateAll, OrganisationView_Create" ContentGroupStyle="{StaticResource OrganisationNavigationStyle}" diff --git a/BeWo/View/Navigation/OrganisationNavigationView.xaml.cs b/BeWo/View/Navigation/OrganisationNavigationView.xaml.cs index 1847a21d0..fc4aa08ad 100644 --- a/BeWo/View/Navigation/OrganisationNavigationView.xaml.cs +++ b/BeWo/View/Navigation/OrganisationNavigationView.xaml.cs @@ -95,6 +95,19 @@ namespace BeWo.View.Navigation ServiceFacade.DoDownloadServiceSync(s => BeWoUtils.WriteExcelFile(s.PrepareExcelFileOrganisationExport(mainNavigationView.DownloadLinkEngine.ExcelFileId, e.Data.Cast().Select(c => c.OrganisationOid).ToList()), sf.FileName)); } + private void mainNavigationView_Print(object sender, EventArgs> e) + { + var oids = e.Data.Cast().Select(c => c.OrganisationOid).ToList(); + + ServiceFacade.DoReportServiceAsync(s => s.CreateOrganisationListReport(oids), r => + { + this.Dispatch(() => + { + BeWoUtils.ShowReportWindow(r, "Organisationen"); + }); + }); + } + private void mainNavigationView_OpenObject(IFilterableDC obj) { CompactOrganisationDC dc = obj as CompactOrganisationDC; diff --git a/Report/AbstractReportCreator.cs b/Report/AbstractReportCreator.cs index 52bb65b18..b676991dd 100644 --- a/Report/AbstractReportCreator.cs +++ b/Report/AbstractReportCreator.cs @@ -107,6 +107,8 @@ namespace BeWo.Report public abstract XtraReport CreateSupportConceptListReport(List oids); + public abstract XtraReport CreateOrganisationListReport(List oids); + public abstract XtraReport CreatePersonListReport(List oids); public abstract XtraReport CreateEmployeeListReport(List oids); diff --git a/Report/DefaultReportCreator.cs b/Report/DefaultReportCreator.cs index d15583a1c..bc6813d7b 100644 --- a/Report/DefaultReportCreator.cs +++ b/Report/DefaultReportCreator.cs @@ -1276,6 +1276,46 @@ namespace BeWo.Report return queryReport as XtraReport; } + public override XtraReport CreateOrganisationListReport(List oids) + { + var queryReport = FindReportImp(null, "Organisationen"); + var organisations = DAOFactory.GenericDAO.LoadByIDs(oids); + + DataTable table = new DataTable(); + string[] spalten = new string[] { "Organisation", "Straße", "PLZ", "Ort", "Telefon", "Fax", "Mail", "Ansprechpartner" }; + for (int i = 0; i < spalten.Length; i++) + table.Columns.Add(spalten[i], typeof(string)); + + for (int i = 0; i < organisations.Count; i++) + { + DataRow row = table.NewRow(); + Organisation organisation = organisations[i]; + row[0] = organisation.Name; + var address = organisation.Address; + if (address != null) + { + row[1] = address.Street; + row[2] = address.PostalCode; + row[3] = address.Town; + } + var contacts = organisation.Contacts; + if (contacts != null) + { + row[4] = contacts.FirstOrDefault(c => c.Type == BS.Shared.ContactType.business_Phone)?.Value; + row[5] = contacts.FirstOrDefault(c => c.Type == BS.Shared.ContactType.business_Fax)?.Value; + row[6] = contacts.FirstOrDefault(c => c.Type == BS.Shared.ContactType.business_Mail)?.Value; + row[7] = contacts.FirstOrDefault(c => c.Type == BS.Shared.ContactType.ContactPerson)?.Value; + } + table.Rows.Add(row); + } + + var queryReportObject = QueryRO.Create(new Query() { Title = "Organisationen" }, table); + queryReportObject.Name = "Organisationen"; + queryReport.SetReportDataSource(queryReportObject); + + return queryReport as XtraReport; + } + public override XtraReport CreatePersonListReport(List oids) { var ro = PersonListRO.Create(oids); @@ -1351,6 +1391,7 @@ namespace BeWo.Report return queryReport as XtraReport; } + public override XtraReport CreateEmployeeListReport(List oids) { var ro = EmployeeListRO.Create(oids); diff --git a/ReportService/ServiceImplementations/ReportServiceImp.cs b/ReportService/ServiceImplementations/ReportServiceImp.cs index 7c10c1f5a..51ac6eac9 100644 --- a/ReportService/ServiceImplementations/ReportServiceImp.cs +++ b/ReportService/ServiceImplementations/ReportServiceImp.cs @@ -285,12 +285,14 @@ namespace ReportingService.ServiceImplementations public MemoryStream CreateEmployeeListReport(List oids) { - return null; + var reportCreator = GetReportCreator(); + return CreateReportStream(reportCreator.CreateEmployeeListReport(oids)); } public MemoryStream CreateOrganisationListReport(List oids) { - return null; + var reportCreator = GetReportCreator(); + return CreateReportStream(reportCreator.CreateOrganisationListReport(oids)); } public MemoryStream CreateTeamListReport(List oids)