Files
BeWoPlaner/ReportImp/SPZRatingen/Invoicing/CustomInvoiceFactory.cs
2023-06-13 17:17:30 +02:00

35 lines
973 B
C#

using System;
using System.Collections.Generic;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.Invoicing;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
namespace SpzRatingen.Invoicing
{
public class CustomInvoiceFactory : InvoiceFactory
{
public override InvoiceCreation CreateInvoiceCreator(string specificId, string tenant, Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>> supportConcepts2ServiceRecords)
{
foreach (var item in supportConcepts2ServiceRecords)
{
var csc = item.Key;
var cb2sc = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(csc.CostBearerRelOids[0]);
var org = cb2sc.CostBearer.Organisation;
if (org.Function != null && org.Function.Value.Contains("Krankenkasse"))
{
return new SoziotherapieInvoiceCreation();
}
else
{
return new SpzRatingenInvoiceCreation();
}
}
return new SpzRatingenInvoiceCreation();
}
}
}