using System; using System.Collections.Generic; using BeWo.Data.Access; using BeWo.Data.Entities; using BeWo.Report; using BeWo.Report.ReportObjects; using BS.Shared; using BS.Shared.DataContracts; namespace ProIntegra.Neu { public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport { public Spitzabrechnung() { InitializeComponent(); } public void SetReportDataSource(Settlement2RO pRO) // RecipientContactPerson Trim wenn != null { SetzeAnsprechpartner(pRO); if (!String.IsNullOrEmpty(pRO.RecipientContactPerson)) { pRO.RecipientContactPerson = pRO.RecipientContactPerson.Trim(); } bool isDefaultSpitzabrechnung = false; if (String.IsNullOrEmpty(pRO.Notice)) { lblNotice.Visible = false; } bool hasRatefactor = false; if (!String.IsNullOrWhiteSpace(pRO.RateFactorText2)) { hasRatefactor = true; if (pRO.RateFactorText2 == "1,2") { pRO.RateFactorText2 = "1,20"; } } if (pRO.InvoiceItems != null) { foreach (var ii in pRO.InvoiceItems) { ii.ItemDescription = String.Format("{0:dd.MM.yyyy} bis {1:dd.MM.yyyy}: {2:0.##} FLS {3}x {4:c}", ii.PeriodStartDate, ii.PeriodEndDate, ii.UnitCount, !hasRatefactor ? "" : "x " + pRO.RateFactorText2 + " ", ii.AmountPerUnit); } } if (pRO.RecipientContactPerson != null) pRO.RecipientContactPerson = pRO.RecipientContactPerson.Trim(); this.bindingSource1.DataSource = pRO; } private void SetzeAnsprechpartner(Settlement2RO pRo) { if (pRo.InvoiceBaseOid.HasValue) { var ib = DAOFactory.GenericDAO.LoadByID(pRo.InvoiceBaseOid.Value); if (ib.CostBearer2SupportConcept != null) { var cb2sc = ib.CostBearer2SupportConcept; if (cb2sc.CostBearerContactPerson != null && cb2sc.CostBearerContactPerson.Sex.HasValue) { String anrede = "Frau"; if (cb2sc.CostBearerContactPerson.Sex.Value == Sex.Male) { anrede = "Herr"; } pRo.RecipientContactPerson = String.Format("{0} {1}", anrede, cb2sc.CostBearerContactPerson.LastName); } } } } } }