74 lines
2.1 KiB
C#
74 lines
2.1 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 InputFamilienhilfe.Invoicing
|
|
{
|
|
public class CustomInvoiceFactory : InvoiceFactory
|
|
{
|
|
|
|
public override InvoiceCreation CreateInvoiceCreator(string specificId, string tenant, Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>> supportConcepts2ServiceRecords)
|
|
{
|
|
foreach (var item in supportConcepts2ServiceRecords)
|
|
{
|
|
var csc = item.Key;
|
|
var cb2sc = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(csc.CostBearerRelOids[0]);
|
|
if (cb2sc.SupportConcept.Customer.CustomerAlias != null && cb2sc.SupportConcept.Customer.CustomerAlias.ToLower() == "bjw")
|
|
{
|
|
return new UnterbringungInvoiceCreation();
|
|
}
|
|
|
|
foreach (var scap in cb2sc.ApprovalPeriodList)
|
|
{
|
|
if (scap.ServiceCategory != null)
|
|
{
|
|
var sd = scap.ServiceCategory;
|
|
String name = "";
|
|
if (!String.IsNullOrEmpty(sd.Name))
|
|
{
|
|
name = sd.Name.ToLower().Trim();
|
|
}
|
|
|
|
if (name.Contains("verfahrensbeistand"))
|
|
{
|
|
return new VerfahrensbeistandInvoiceCreation();
|
|
}
|
|
|
|
if (name.Contains("1:"))
|
|
{
|
|
return new UnterbringungInvoiceCreation();
|
|
}
|
|
|
|
if (name.Contains("inobhutnahme"))
|
|
{
|
|
return new IonInvoiceCreation();
|
|
}
|
|
|
|
if (name.Contains("aws") || name.Contains("abw"))
|
|
{
|
|
return new AwsInvoiceCreation();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach (var list in supportConcepts2ServiceRecords.Values)
|
|
{
|
|
|
|
foreach (var sr in list)
|
|
{
|
|
if (sr.ServiceDescription.Category.Name.Contains("(SGA)"))
|
|
{
|
|
return new SgaInvoiceCreation();
|
|
}
|
|
}
|
|
}
|
|
return new DefaultInvoiceCreation();
|
|
}
|
|
}
|
|
}
|