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

49 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using BeWo.Service.Invoicing;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
namespace FeidPartnerReports.Invoicing
{
public class CustomInvoiceFactory : InvoiceFactory
{
public override InvoiceCreation CreateInvoiceCreator(string specificId, string tenant, Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>> supportConcepts2ServiceRecords)
{
foreach (var key in supportConcepts2ServiceRecords.Keys)
{
if (key.CostBearer.ToLower().Contains("§67") || key.CostBearer.ToLower().Contains("§ 67"))
{
return new CollectiveInvoiceBeWo67Creation();
}
else
{
return new CollectiveInvoiceCreation();
}
}
foreach (var list in supportConcepts2ServiceRecords.Values)
{
if (list != null && list.Count > 0)
{
foreach (var sr in list)
{
if (sr.CostBearer != null)
{
if (sr.CostBearer.Name.ToLower().Contains("§67") || sr.CostBearer.Name.ToLower().Contains("§ 67"))
{
return new CollectiveInvoiceBeWo67Creation();
}
else
{
return new CollectiveInvoiceCreation();
}
}
}
}
}
return new CollectiveInvoiceCreation();
}
}
}