using BeWo.Data.Entities; using BeWo.Report; using BeWo.Report.ReportObjects; using BS.Shared; using BS.Shared.Core; using DevExpress.XtraReports.UI; using System; using System.Linq; using System.Text; namespace LebenshilfeBadKreuznachWohnstaette { public partial class Rechnung : XtraReport, IBeWoReport { public Rechnung() { this.InitializeComponent(); } public void SetReportDataSource(ServiceInvoiceRO pRO) { bool selbstzahler = false; if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && pRO.RecipientOrganisation.ToLower().Contains("selbstzahler")) { lblAnschrift.Visible = true; selbstzahler = true; } if (pRO.ServiceInvoicePeriods != null) { if (pRO.ServiceInvoicePeriods.Any(s => (s.SupportConceptApprovalPeriod?.ServiceCategory?.Name.ToLower() ?? "").Contains("tagesstruktur"))) { lblTSA.Visible = true; } if (selbstzahler && pRO.ServiceInvoicePeriods.Any(s => (s.SupportConceptApprovalPeriod?.ServiceCategory?.Name.ToLower() ?? "").Contains("einzelfallhilfe"))) { lblTSA.Visible = true; lblTSA.Text = "Einzelfallhilfe / Mehrbedarf [AccountingPeriodEnd!dd.MM.yyyy]"; } } if (!pRO.CreatorName.Contains("Ruta")) { lblBearbeiter.Text = "Kirmse"; lblTel.Text = "0671/483269-118"; lblMail.Text = "andrea.kirmse@\nlebenshilfe-kreuznach.de"; } SetzeAdresse(pRO); this.bindingSource1.DataSource = pRO; } private void SetzeAdresse(ServiceInvoiceRO pRO) { StringBuilder sb = new StringBuilder(); if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && pRO.RecipientOrganisation.ToLower() != "selbstzahler") { sb.AppendLine(pRO.RecipientOrganisation); } if (!String.IsNullOrEmpty(pRO.RecipientAddressLine1) && pRO.RecipientOrganisation.ToLower() != "selbstzahler") { sb.AppendLine(pRO.RecipientAddressLine1); } if (!String.IsNullOrEmpty(pRO.RecipientContactPerson)) { sb.AppendLine(pRO.RecipientContactPerson); } if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientOrganisation) && pRO.RecipientOrganisation.ToLower() != "selbstzahler") { sb.AppendLine(pRO.RecipientDivision); } if (!String.IsNullOrEmpty(pRO.RecipientPoBox)) { sb.AppendLine(pRO.RecipientPoBox); } else if (!String.IsNullOrEmpty(pRO.RecipientStreet)) { sb.AppendLine(pRO.RecipientStreet); } if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown)) { sb.AppendLine(pRO.RecipientPostCodeAndTown); } lblAdresse.Text = sb.ToString(); } } }