48 lines
1.6 KiB
C#
48 lines
1.6 KiB
C#
using BeWo.Data.Entities;
|
|
using BeWo.Service.Invoicing;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Intego.Invoicing
|
|
{
|
|
public class CustomInvoiceFactory : InvoiceFactory
|
|
{
|
|
public override SettlementInvoiceCreation CreateSettlementInvoiceCreator(string costbearerId, string tenant, CostBearer2SupportConcept lCb2Sc)
|
|
{
|
|
return new CustomSettlementInvoiceCreation();
|
|
}
|
|
public override InvoiceCreation CreateInvoiceCreator(string specificId, string tenant, Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>> supportConcepts2ServiceRecords)
|
|
{
|
|
foreach (var list in supportConcepts2ServiceRecords.Values)
|
|
{
|
|
foreach (var sr in list)
|
|
{
|
|
var sd = sr.ServiceDescription.Category;
|
|
var ic = GetInvoiceCreatorForCategory(sd);
|
|
if (ic != null)
|
|
return ic;
|
|
}
|
|
}
|
|
return base.CreateInvoiceCreator(specificId, tenant, supportConcepts2ServiceRecords);
|
|
}
|
|
|
|
private InvoiceCreation GetInvoiceCreatorForCategory(ServiceCategoryDC sd)
|
|
{
|
|
if (sd != null && !String.IsNullOrEmpty(sd.Name))
|
|
{
|
|
String cat = sd.Name.ToLower().Trim();
|
|
if (cat.IndexOf("assistenz") >= 0)
|
|
{
|
|
return new CustomAssistenzInvoiceCreation();
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
}
|