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

54 lines
1.6 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 DomizielAnsbach.Invoicing
{
public class CustomInvoiceFactory : InvoiceFactory
{
public override InvoiceCreation CreateInvoiceCreator(string specificId, string tenant, Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>> supportConcepts2ServiceRecords)
{
foreach (var sc in supportConcepts2ServiceRecords.Keys)
{
if (sc.CostBearerRelOids != null && sc.CostBearerRelOids.Count > 0)
{
var c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(sc.CostBearerRelOids[0]);
foreach (var ap in c2s.ApprovalPeriodList)
{
if (ap.ServiceCategory != null && ap.ServiceCategory.Name.Contains("Ambulant Betreutes Einzelwohnen"))
{
return new AbwInvoiceCreation();
}
if (ap.ServiceCategory != null && (ap.ServiceCategory.Name.Contains("Persönliches Budget") || ap.ServiceCategory.Name.Contains("Selbstzahler")))
{
return new PBInvoiceCreation();
}
if (ap.ServiceCategory != null && ap.ServiceCategory.Name.Contains("Zuverdienst - Arbeitszeit"))
{
return new ZVInvoiceCreation();
}
}
}
}
foreach (var list in supportConcepts2ServiceRecords.Values)
{
foreach (var sr in list)
{
if (sr.CostBearer != null)
if (sr.CostBearer.Name.Contains("Bezirk Mittelfranken (stationär)"))
return new StationaerInvoiceCreation();
}
}
return new CollectiveInvoiceCreation();
}
}
}