Files
BeWoPlaner/ReportImp/AlzeyTeilhabe/Invoicing/CustomInvoiceFactory.cs

36 lines
1.2 KiB
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 AlzeyTeilhabe.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 == "Kostenträger Soziotherapie")
{
return new SozioInvoiceCreation();
}
else if (org.Function != null && org.Function.Value == "Kostenträger Eingliederungshilfe")
return new CustomInvoiceCreation();
}
return new InvoiceCreation();
}
}
}