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

54 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;
using BS.Shared.Services;
namespace HPHBersenbrueck.Invoicing
{
public class CustomInvoiceFactory : InvoiceFactory
{
public override InvoiceCreation CreateInvoiceCreator(string specificId, string tenant, Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>> supportConcepts2ServiceRecords)
{
//Prüfe neue Assistenz
foreach (var list in supportConcepts2ServiceRecords.Values)
{
foreach (var sr in list)
{
var sc = sr.ServiceDescription.Category;
if (sc.Name.StartsWith("Neu "))
{
if (sr.CostBearer.Name.ToLower().Contains("selbstzahler"))
{
return new NeueAssistenzSelbstzahlerInvoiceCreation();
}
return new NeueAssistenzInvoiceCreation();
}
}
}
foreach (var list in supportConcepts2ServiceRecords.Values)
{
foreach (var sr in list)
{
if (sr.CostBearer != null)
{
if (sr.CostBearer.Name.ToLower().Contains("selbstzahler"))
{
return new SelbstzahlerInvoiceCreation();
}
}
}
}
return new InvoiceCreation();
}
}
}