using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Text; using BeWo.Data.Access; using BeWo.Data.Entities; using DevExpress.XtraReports.UI; using BeWo.Report.ReportObjects; using BeWo.Report; namespace BeWo.AssistenzaReports { public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport { public Spitzabrechnung() { InitializeComponent(); } public void SetReportDataSource(Settlement2RO pRO) { StringBuilder sb = new StringBuilder(); if (!String.IsNullOrEmpty(pRO.RecipientOrganisation)) { sb.AppendLine(pRO.RecipientOrganisation); } if (!String.IsNullOrEmpty(pRO.RecipientContactPerson)) { sb.AppendLine(pRO.RecipientContactPerson); } if (!String.IsNullOrEmpty(pRO.RecipientDivision)) { sb.AppendLine(pRO.RecipientDivision); } if (!String.IsNullOrEmpty(pRO.RecipientStreet)) { sb.AppendLine(pRO.RecipientStreet); } if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown)) { sb.AppendLine(pRO.RecipientPostCodeAndTown); } lblAdresse.Text = sb.ToString(); decimal rateFactor = 1; foreach (var ii in pRO.InvoiceItems) { if (ii.RateFactor.HasValue) { rateFactor = (100 + ii.RateFactor.Value) / 100; } ii.RateFactor = rateFactor; } pRO.RateFactor = (double) rateFactor; if (String.IsNullOrEmpty(pRO.AbsenceTimes)) { pRO.AbsenceTimes = "Keine Krankenhausaufenthalte bekannt oder abrechnungsrelevant im Abrechnungszeitraum"; } else { pRO.AbsenceTimes = string.Empty; sb = new StringBuilder(); if (pRO.InvoiceBaseOid.HasValue) { var ib = DAOFactory.GenericDAO.LoadByID(pRO.InvoiceBaseOid.Value); var lCustomer = ib.CostBearer2SupportConcept.SupportConcept.Customer; if (lCustomer.AbsenceTimes != null) { foreach (var at in lCustomer.AbsenceTimes) { if (at.AbsenceSpan != null) { bool cont = true; if (at.Start != null && at.Start > pRO.AccountingEndDate) { cont = false; } if (cont && at.End != null && at.End < pRO.AccountingStartDate) { cont = false; } if (cont) { if (sb.Length > 0) { sb.Append(", "); } if (at.Start.HasValue) { sb.Append(String.Format("{0:dd.MM.yyyy}", at.Start)); sb.Append(" - "); if (at.End.HasValue) { sb.Append(String.Format("{0:dd.MM.yyyy}", at.End)); } else { sb.Append("unbekannt"); } } } } } } } pRO.AbsenceTimes = sb.ToString(); } if (String.IsNullOrWhiteSpace(pRO.Notice)) { lblBemerkungHeader.Text = ""; } this.bindingSource1.DataSource = pRO; } } }