diff --git a/ReportImp/PraunheimerWerkstaettenGmbh/ServicesOverviewReport.cs b/ReportImp/PraunheimerWerkstaettenGmbh/ServicesOverviewReport.cs index 5ed8f8127..0e4ab215a 100644 --- a/ReportImp/PraunheimerWerkstaettenGmbh/ServicesOverviewReport.cs +++ b/ReportImp/PraunheimerWerkstaettenGmbh/ServicesOverviewReport.cs @@ -12,6 +12,8 @@ using BS.Shared; using BS.Shared.Core; using BS.Shared.Services; using BS.Shared.DataContracts; +using BeWo.Service.DCEntityMapper; +using System.Linq; namespace PraunheimerWerkstaettenGmbh { @@ -72,6 +74,21 @@ namespace PraunheimerWerkstaettenGmbh private void BerechneSollIst(ServicesOverviewRO ro) { + if (ro.SupportConceptCostBearer == null) + { + if (ro.CostBearer2SupportConceptList != null && ro.CostBearer2SupportConceptList.Count > 0) + { + if (ro.CostBearer2SupportConceptList.Count == 1) + ro.SupportConceptCostBearer = MapperFactory.SupportConceptCostBearerRelDC_CostBearer2SupportConcept.MapToNewDC(ro.CostBearer2SupportConceptList[0]); + else if (ro.CostBearer2SupportConceptList.Count > 1) + { + var cb2sc = ro.CostBearer2SupportConceptList.FirstOrDefault(cs => ro.StartDate >= cs.StartDate.Value && ro.StartDate <= cs.EndDate.Value); + if (cb2sc != null) + ro.SupportConceptCostBearer = MapperFactory.SupportConceptCostBearerRelDC_CostBearer2SupportConcept.MapToNewDC(cb2sc); + } + } + } + if (ro.SupportConceptCostBearer != null && ro.SupportConceptCostBearer.CostBearer2SupportConceptOid != null) { if (ro.SupportConceptCostBearer.StartDate != null)