MH: Praunheimer Werkstätte QB Fix

This commit is contained in:
2023-11-07 17:21:39 +01:00
parent c4fc90976f
commit ccb0495608

View File

@@ -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)