using System; using System.Text; using BeWo.Report; using BeWo.Report.ReportObjects; using BS.Shared.Extensions; using DevExpress.XtraReports.UI; namespace IBAHS { public partial class ServiceInvoiceReport : XtraReport, IBeWoReport { public ServiceInvoiceReport() { this.InitializeComponent(); } public void SetReportDataSource(ServiceInvoiceRO pRO) { DateTime start = pRO.AccountingPeriodStart; DateTime end = pRO.AccountingPeriodEnd; decimal summeFlS = 0; if (pRO.ServiceInvoicePeriods != null) { foreach (var period in pRO.ServiceInvoicePeriods) { if (period.ServiceInvoiceItems != null) { foreach (var iitem in period.ServiceInvoiceItems) { if (iitem.ServiceDescription != null && !lblAktuellerStundensatz.Text.Contains("€") && (iitem.ServiceDescription.ToLower().Contains("fls") || iitem.ServiceDescription.ToLower().Contains("fachleistung"))) { lblAktuellerStundensatz.Text += string.Format("{0:c}.", iitem.AmountPerUnit); } if (iitem.NetAmount.HasValue && iitem.NetAmount.Value > 0) summeFlS += iitem.UnitCount.Value; } } } } lblSummeFLS.Text += string.Format("{0:0.00} FLS.", summeFlS); 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)) //{ // 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(); } } }