66 lines
1.5 KiB
C#
66 lines
1.5 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 LebenshilfeWetterau.Invoicing
|
|
{
|
|
public class CustomInvoiceFactory : InvoiceFactory
|
|
{
|
|
|
|
public override InvoiceCreation CreateInvoiceCreator(string specificId, string tenant, Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>> supportConcepts2ServiceRecords)
|
|
{
|
|
if (supportConcepts2ServiceRecords.Count > 1)
|
|
{
|
|
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.Name != null && org.Name == "LWV-Hessen")
|
|
{
|
|
return new CollectiveInvoiceCreation();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
foreach (var list in supportConcepts2ServiceRecords.Values)
|
|
{
|
|
|
|
foreach (var sr in list)
|
|
{
|
|
if (sr.ServiceDescription.CategoryName.Contains("Assistenz"))
|
|
{
|
|
return new AssistenzInvoiceCreation();
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
if (supportConcepts2ServiceRecords.Count == 1)
|
|
{
|
|
foreach (var item in supportConcepts2ServiceRecords)
|
|
{
|
|
var csc = item.Key;
|
|
csc.IsApproved = true;
|
|
return new CustomInvoiceCreation();
|
|
}
|
|
}
|
|
return new CustomInvoiceCreation();
|
|
|
|
|
|
}
|
|
|
|
}
|
|
}
|