SoziotherapieInvoiceCreation default
This commit is contained in:
@@ -67,6 +67,8 @@ namespace DakotaSender
|
||||
|
||||
PrintSeperator();
|
||||
}
|
||||
|
||||
PrintLine();
|
||||
}
|
||||
|
||||
internal static void PrintTitle()
|
||||
|
||||
@@ -126,7 +126,6 @@
|
||||
</Compile>
|
||||
<Compile Include="Invoicing\DiakoneKKKleveBeWo67InvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\DiakoneKKKleveMitEigenanteilInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\DiakoneKKKleveSoziotherapieInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\DiakoneKKKleveSelbstzahlerInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\DiakoneKKKleveDefaultInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\DiakoneKKKleveInvoiceFactory.cs" />
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace DiakonieKKKleve.Invoicing
|
||||
}
|
||||
if (!String.IsNullOrEmpty(sd.Name) && sd.Name.Contains("Therapie"))
|
||||
{
|
||||
var ic = new DiakoneKKKleveSoziotherapieInvoiceCreation();
|
||||
var ic = new SoziotherapieInvoiceCreation();
|
||||
if (specificId == "FinanzauswertungOhnePauschale")
|
||||
{
|
||||
ic.ErstelleHausbesuchspauschale = false;
|
||||
|
||||
@@ -1,336 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.Invoicing;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
using BS.Shared.Services;
|
||||
|
||||
namespace DiakonieKKKleve.Invoicing
|
||||
{
|
||||
public class DiakoneKKKleveSoziotherapieInvoiceCreation : InvoiceCreation
|
||||
{
|
||||
public DiakoneKKKleveSoziotherapieInvoiceCreation() : base()
|
||||
{
|
||||
//Wichtig für Finanzauswertung. Hier sollen entweder nur die normalen Therapieeinheiten oder nur die Hausbesuchspauschale berechnet werden
|
||||
ErstelleTherapieeinheiten = true;
|
||||
ErstelleHausbesuchspauschale = true;
|
||||
}
|
||||
|
||||
|
||||
public bool ErstelleTherapieeinheiten { get; set; }
|
||||
|
||||
public bool ErstelleHausbesuchspauschale { get; set; }
|
||||
|
||||
public override void SetInvoiceId(ServiceInvoice invoice)
|
||||
{
|
||||
invoice.InvoiceBase.InvoiceId = "RechnungSoziotherapie";
|
||||
invoice.InvoiceBase.InvoiceTypeText = "Soziotherapie";
|
||||
}
|
||||
|
||||
public override ServiceInvoice CreateSingleInvoice(int invoiceCounter, CostBearer costBearer, DateTimeSpan invoicePeriod, CompactSupportConceptDC supportConcept, List<ServiceRecordDC> serviceRecords)
|
||||
{
|
||||
var invoice = base.CreateSingleInvoice(invoiceCounter, costBearer, invoicePeriod, supportConcept, serviceRecords);
|
||||
|
||||
if (invoicePeriod != null)
|
||||
{
|
||||
SetAmountEquityContribution(invoice);
|
||||
}
|
||||
|
||||
return invoice;
|
||||
}
|
||||
|
||||
public override void SetAmountEquityContribution(ServiceInvoice invoice)
|
||||
{
|
||||
decimal equity = 0;
|
||||
|
||||
IList<InvoiceBase> EquityInvoiceList = DAOFactory.SearchDAO.GetInvoiceBaseByTypeAndSupportConceptOid(InvoiceType.CustomerEquity, invoice.InvoiceBase.SupportConceptOid.Value);
|
||||
|
||||
EquityInvoiceList = EquityInvoiceList.Where(i =>
|
||||
{
|
||||
if (i.AccountingPeriodEnd >= invoice.InvoiceBase.AccountingPeriodStart && i.AccountingPeriodStart <= invoice.InvoiceBase.AccountingPeriodEnd)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}).ToList();
|
||||
|
||||
foreach (InvoiceBase iEquityInvoice in EquityInvoiceList)
|
||||
{
|
||||
foreach (InvoiceItem item in iEquityInvoice.InvoiceItems)
|
||||
{
|
||||
if (item.AmountTotal != null)
|
||||
{
|
||||
equity += item.AmountTotal.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
invoice.AmountEquityContribution = equity;
|
||||
}
|
||||
|
||||
public override InvoiceItem CreateInvoiceItem(ServiceRecordDC iServiceRecord, SupportConceptApprovalPeriod scap, BS.Shared.Services.Calculations calc)
|
||||
{
|
||||
var ii = base.CreateInvoiceItem(iServiceRecord, scap, calc);
|
||||
|
||||
|
||||
|
||||
|
||||
//if (iServiceRecord.CostBearer.Name.Contains("Techniker Krankenkasse"))
|
||||
// {
|
||||
// ii.RateFactor = null;
|
||||
// ii.AmountTotal = ii.AmountPerUnit * ii.UnitCount;
|
||||
// ii.GrossAmountTotal = ii.AmountTotal;
|
||||
//}
|
||||
|
||||
if (ii.ItemDescription.ToLower().Contains("probe"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001607";
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("gruppentherapie") || (iServiceRecord != null && iServiceRecord.GroupPersonCount.HasValue && iServiceRecord.GroupPersonCount.Value > 1))
|
||||
{
|
||||
//Setze Pauschale für Gruppentherapie
|
||||
var preisGruppe = GetGruppenPreis(scap.CostBearer2SupportConcept, iServiceRecord.Start.Value);
|
||||
ii.AmountPerUnit = preisGruppe;
|
||||
ii.AmountTotal = preisGruppe;
|
||||
ii.UnitCount = 1;
|
||||
ii.UnitDescription = "GPos: 2002672";
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("video"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30 || ii.ItemDescription.ToLower().Contains("30"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001616";
|
||||
}
|
||||
else if (iServiceRecord.RoundedDuration > 30 || ii.ItemDescription.ToLower().Contains("60"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001615";
|
||||
}
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("telefon"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001618";
|
||||
}
|
||||
else if (iServiceRecord.RoundedDuration > 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001617";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001612";
|
||||
}
|
||||
else if (iServiceRecord.RoundedDuration > 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001610";
|
||||
}
|
||||
}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
public virtual InvoiceItem CreateInvoiceItemFactor(ServiceRecordDC iServiceRecord, SupportConceptApprovalPeriod scap, BS.Shared.Services.Calculations calc)
|
||||
{
|
||||
var ii = base.CreateInvoiceItem(iServiceRecord, scap, calc);
|
||||
|
||||
//if (iServiceRecord.CostBearer.Name.Contains("Techniker Krankenkasse"))
|
||||
// {
|
||||
// ii.UnitCount = ii.UnitCount * ii.RateFactor / 100;
|
||||
// ii.AmountTotal = ii.AmountPerUnit * ii.UnitCount;
|
||||
// ii.GrossAmountTotal = ii.AmountTotal;
|
||||
// ii.RateFactor = null;
|
||||
// ii.UnitDescription = "Mittelbare Leistung (Verwaltung)";
|
||||
//}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
public override IList<InvoiceItem> CreateInvoiceItems(List<ServiceRecordDC> serviceRecordsInPeriod, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap,
|
||||
BS.Shared.Services.Calculations calc)
|
||||
{
|
||||
var list = new List<InvoiceItem>();
|
||||
//if (scap.CostBearer2SupportConcept.CostBearer.Organisation.Name.Contains("Techniker Krankenkasse"))
|
||||
//{
|
||||
// list = (List<InvoiceItem>)CreateInvoiceItemsTKK(serviceRecordsInPeriod, invoicePeriod, scap, calc);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
if (ErstelleTherapieeinheiten)
|
||||
{
|
||||
list = (List<InvoiceItem>)base.CreateInvoiceItems(serviceRecordsInPeriod, invoicePeriod, scap, calc);
|
||||
}
|
||||
|
||||
if (ErstelleHausbesuchspauschale)
|
||||
{
|
||||
var ii = CreateHausbesuchspauschale(serviceRecordsInPeriod, invoicePeriod, scap);
|
||||
list.AddRange(ii);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
//public virtual IList<InvoiceItem> CreateInvoiceItemsTKK(List<ServiceRecordDC> serviceRecordsInPeriod, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap, Calculations calc)
|
||||
//{
|
||||
// var list = new List<InvoiceItem>();
|
||||
// foreach (ServiceRecordDC iServiceRecord in serviceRecordsInPeriod)
|
||||
// {
|
||||
// if (iServiceRecord.ServiceDescription.Category.IsBillable)
|
||||
// {
|
||||
// if (!iServiceRecord.AlreadyAccounted)
|
||||
// {
|
||||
// InvoiceItem invoiceItem = CreateInvoiceItem(iServiceRecord, scap, calc);
|
||||
// if (invoiceItem != null)
|
||||
// {
|
||||
// list.Add(invoiceItem);
|
||||
// }
|
||||
// InvoiceItem invoiceItemFactor = CreateInvoiceItemFactor(iServiceRecord, scap, calc);
|
||||
// if (invoiceItemFactor != null)
|
||||
// {
|
||||
// list.Add(invoiceItemFactor);
|
||||
// }
|
||||
// }
|
||||
// iServiceRecord.AlreadyAccounted = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return CreateSummaryInvoiceItems(list, invoicePeriod, scap, calc);
|
||||
//}
|
||||
|
||||
public virtual IList<InvoiceItem> CreateHausbesuchspauschale(List<ServiceRecordDC> serviceRecordsInPeriod, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap)
|
||||
{
|
||||
//Dictionary<String, int> differentDays = new Dictionary<string, int>();
|
||||
IList<InvoiceItem> items = new List<InvoiceItem>();
|
||||
decimal hausbesuchspauschale = GetHausbesuchspauschale(scap.CostBearer2SupportConcept, invoicePeriod.StartDate);
|
||||
|
||||
//if (invoicePeriod.StartDateTime >= new DateTime(2022, 4, 1))
|
||||
//{
|
||||
// hausbesuchspauschale = 8.02m;
|
||||
//}
|
||||
|
||||
int countHausbesuch = 0;
|
||||
|
||||
foreach (var sr in serviceRecordsInPeriod)
|
||||
{
|
||||
if (!sr.ServiceDescription.Name.ToLower().Contains("telefon") && !sr.ServiceDescription.Name.ToLower().Contains("gruppe") && !sr.ServiceDescription.Name.ToLower().Contains("praxis"))
|
||||
{
|
||||
countHausbesuch++;
|
||||
}
|
||||
}
|
||||
|
||||
if (countHausbesuch > 0)
|
||||
{
|
||||
var desc = DAOFactory.GenericDAO.GetAllActive<ServiceDescription>();
|
||||
CostRatePeriodDC crp = null;
|
||||
List<CostRatePeriodDC> crpDcs;
|
||||
|
||||
// foreach (var ServiceDescription in desc)
|
||||
// {
|
||||
//if (scap.CostBearer2SupportConcept.CostBearer.Organisation.Name.Contains("Barmer"))
|
||||
//{
|
||||
// if (ServiceDescription.Name.Contains("Hausbesuchpauschale") && ServiceDescription.Name.Contains("Barmer"))
|
||||
// {
|
||||
// crpDcs = MapperFactory.CostRatePeriodDC_CostRatePeriod.MapToNewDCs(ServiceDescription.CostRatePeriods);
|
||||
// crp = crpDcs.GetCostRatePeriodForDate(CostRatePeriodType.AmountOfMoney, invoicePeriod.StartDate);
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// if (ServiceDescription.Name.Contains("Hausbesuchpauschale") && !ServiceDescription.Name.Contains("Barmer"))
|
||||
// {
|
||||
// crpDcs = MapperFactory.CostRatePeriodDC_CostRatePeriod.MapToNewDCs(ServiceDescription.CostRatePeriods);
|
||||
// crp = crpDcs.GetCostRatePeriodForDate(CostRatePeriodType.AmountOfMoney, invoicePeriod.StartDate);
|
||||
// }
|
||||
//}
|
||||
|
||||
// if (crp != null && crp.CostRateValue.HasValue)
|
||||
// {
|
||||
// hausbesuchspauschale = crp.CostRateValue ?? 0;
|
||||
// }
|
||||
|
||||
// foreach (var oscap in scap.CostBearer2SupportConcept.ApprovalPeriodList)
|
||||
// {
|
||||
// if (!String.IsNullOrEmpty(oscap.ServiceCategory.Name) && oscap.ServiceCategory.Name.Contains("Hausbesuchspauschale"))
|
||||
// hausbesuchspauschale = oscap.ApprovedFixedAmount ?? hausbesuchspauschale;
|
||||
//}
|
||||
// }
|
||||
var invoiceItem = new InvoiceItem();
|
||||
|
||||
//decimal anzahlHausbesuche = differentDays.Count;
|
||||
decimal anzahlHausbesuche = countHausbesuch;
|
||||
|
||||
|
||||
invoiceItem.AmountPerUnit = hausbesuchspauschale;
|
||||
invoiceItem.UnitCount = anzahlHausbesuche;
|
||||
invoiceItem.AmountTotal = anzahlHausbesuche * hausbesuchspauschale;
|
||||
invoiceItem.ItemPeriodStart = invoicePeriod.StartDate;
|
||||
invoiceItem.ItemPeriodEnd = invoicePeriod.EndDate;
|
||||
invoiceItem.RateFactor = null;
|
||||
invoiceItem.GrossAmountTotal = invoiceItem.AmountTotal;
|
||||
invoiceItem.ItemDescription = "Hausbesuchspauschale";
|
||||
invoiceItem.UnitDescription = "GPos: 2009690";
|
||||
if (scap != null)
|
||||
invoiceItem.SupportConceptApprovalPeriodOid = scap.Oid;
|
||||
|
||||
items.Add(invoiceItem);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
private decimal GetHausbesuchspauschale(CostBearer2SupportConcept c2s, DateTime dt)
|
||||
{
|
||||
String preisName = "Hausbesuchspauschale Primärkassen";
|
||||
|
||||
if (c2s.CostBearer.Organisation.Function != null)
|
||||
{
|
||||
if (c2s.CostBearer.Organisation.Function.Value.Contains("Ersatzkasse"))
|
||||
{
|
||||
preisName = "Hausbesuchspauschale Ersatzkassen";
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetPreis(preisName, dt);
|
||||
}
|
||||
|
||||
private decimal GetGruppenPreis(CostBearer2SupportConcept c2s, DateTime dt)
|
||||
{
|
||||
String preisName = "Gruppentherapie Primärkassen";
|
||||
|
||||
if (c2s.CostBearer.Organisation.Function != null)
|
||||
{
|
||||
if (c2s.CostBearer.Organisation.Function.Value.Contains("Ersatzkasse"))
|
||||
{
|
||||
preisName = "Gruppentherapie Ersatzkassen";
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetPreis(preisName, dt);
|
||||
}
|
||||
|
||||
public override IList<InvoiceItem> CreateSummaryInvoiceItems(IList<InvoiceItem> itemList, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap, BS.Shared.Services.Calculations calc, bool summaryPerMonth, bool addRateFactorToUnitCount)
|
||||
{
|
||||
return base.CreateSummaryInvoiceItems(itemList, invoicePeriod, scap, calc, true, true);
|
||||
}
|
||||
|
||||
public override string GetSummaryItemKey(SupportConceptApprovalPeriod scap, InvoiceItem iitem, bool summaryPerMonth)
|
||||
{
|
||||
String key = String.Format("{0}_{1}_{2}", iitem.AmountPerUnit, iitem.RateFactor, iitem.UnitDescription);
|
||||
if (summaryPerMonth)
|
||||
{
|
||||
key = String.Format("{0}_{1}_{2:yyyyMM}_{3}", iitem.AmountPerUnit, iitem.RateFactor, iitem.ItemPeriodStart, iitem.UnitDescription);
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,256 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.Invoicing;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
using BS.Shared.Services;
|
||||
|
||||
namespace OwnSoftTest5Mrd.Invoicing
|
||||
{
|
||||
public class SoziotherapieInvoiceCreation : InvoiceCreation
|
||||
{
|
||||
public override void SetInvoiceId(ServiceInvoice invoice)
|
||||
{
|
||||
invoice.InvoiceBase.InvoiceId = "RechnungSoziotherapie";
|
||||
invoice.InvoiceBase.InvoiceTypeText = "Soziotherapie";
|
||||
}
|
||||
|
||||
public override ServiceInvoice CreateSingleInvoice(int invoiceCounter, CostBearer costBearer, DateTimeSpan invoicePeriod, CompactSupportConceptDC supportConcept, List<ServiceRecordDC> serviceRecords)
|
||||
{
|
||||
var invoice = new ServiceInvoice();
|
||||
|
||||
var supportConceptList = new List<CompactSupportConceptDC> { supportConcept };
|
||||
|
||||
SetSenderInformation(invoice);
|
||||
SetInvoiceBaseData(invoiceCounter, invoice, costBearer, invoicePeriod, supportConceptList);
|
||||
SetSingleInvoiceBaseData(invoiceCounter, invoice, costBearer, invoicePeriod, supportConcept);
|
||||
|
||||
SetRecipientInformation(invoice, costBearer);
|
||||
|
||||
SetServiceInvoicePeriods(invoice, invoice.InvoiceBase.CostBearer2SupportConcept, invoicePeriod, serviceRecords);
|
||||
|
||||
SetServiceInvoicePeriodAmounts(invoice);
|
||||
|
||||
if (invoicePeriod == null)
|
||||
{
|
||||
SetAmountAdvancePayments(invoice);
|
||||
SetAmountEquityContribution(invoice);
|
||||
}
|
||||
|
||||
base.CreateSingleInvoice(invoiceCounter, costBearer, invoicePeriod, supportConcept, serviceRecords);
|
||||
return invoice;
|
||||
}
|
||||
|
||||
public override IList<InvoiceItem> CreateInvoiceItems(List<ServiceRecordDC> serviceRecordsInPeriod, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap, Calculations calc)
|
||||
{
|
||||
var list = base.CreateInvoiceItems(serviceRecordsInPeriod, invoicePeriod, scap, calc);
|
||||
var ii = CreateHausbesuchspauschale(serviceRecordsInPeriod, invoicePeriod, scap);
|
||||
list.AddRange(ii);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override InvoiceItem CreateInvoiceItem(ServiceRecordDC iServiceRecord, SupportConceptApprovalPeriod scap, Calculations calc)
|
||||
{
|
||||
var ii = base.CreateInvoiceItem(iServiceRecord, scap, calc);
|
||||
ii.ItemDescription = iServiceRecord.ServiceDescription.Name;
|
||||
|
||||
if (ii.ItemDescription.ToLower().Contains("gruppe"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 45)
|
||||
ii.UnitDescription = "GPos: 2002678";
|
||||
else if (iServiceRecord.RoundedDuration <= 60)
|
||||
ii.UnitDescription = "GPos: 2002677";
|
||||
else
|
||||
ii.UnitDescription = "GPos: 2002672"; // 90 min, 2-5 Personen
|
||||
ii.AmountPerUnit = GetGruppenPreis(scap.CostBearer2SupportConcept, iServiceRecord.Start.Value);
|
||||
ii.AmountTotal = ii.AmountPerUnit * ii.UnitCount;
|
||||
ii.GrossAmountTotal = ii.AmountTotal;
|
||||
}
|
||||
else
|
||||
{
|
||||
ii.AmountPerUnit = GetEinzelPreis(scap.CostBearer2SupportConcept, iServiceRecord.Start.Value);
|
||||
ii.AmountTotal = ii.AmountPerUnit * ii.UnitCount;
|
||||
ii.GrossAmountTotal = ii.AmountTotal;
|
||||
|
||||
if (ii.ItemDescription.ToLower().Contains("video"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001616";
|
||||
}
|
||||
else
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001615";
|
||||
}
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("telefonat"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001618";
|
||||
}
|
||||
else
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001617";
|
||||
}
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("aufsuchende einheit"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 10)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001613 / 2009690";
|
||||
}
|
||||
else if (iServiceRecord.RoundedDuration <= 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001612 / 2009690";
|
||||
}
|
||||
else if (iServiceRecord.RoundedDuration <= 45)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001611 / 2009690";
|
||||
}
|
||||
else
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001610 / 2009690";
|
||||
}
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("aufsuchende probatorik"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001607 / 2009690";
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("büroprobatorik"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001607";
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("büroeinheit"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 10)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001613";
|
||||
}
|
||||
else if (iServiceRecord.RoundedDuration <= 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001612";
|
||||
}
|
||||
else if (iServiceRecord.RoundedDuration <= 45)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001611";
|
||||
}
|
||||
else
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001610";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
public virtual IList<InvoiceItem> CreateHausbesuchspauschale(List<ServiceRecordDC> serviceRecordsInPeriod, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap)
|
||||
{
|
||||
IList<InvoiceItem> items = new List<InvoiceItem>();
|
||||
decimal hausbesuchspauschale = 8.53m;
|
||||
if (scap != null && invoicePeriod != null)
|
||||
{
|
||||
hausbesuchspauschale = GetHausbesuchspauschale(scap.CostBearer2SupportConcept, invoicePeriod.StartDate);
|
||||
}
|
||||
int countHausbesuch = 0;
|
||||
foreach (var sr in serviceRecordsInPeriod)
|
||||
{
|
||||
if (sr.ServiceDescription != null && sr.ServiceDescription.Name != null && sr.ServiceDescription.Name.ToLower().Contains("aufsuchend"))
|
||||
{
|
||||
countHausbesuch++;
|
||||
}
|
||||
}
|
||||
|
||||
if (countHausbesuch > 0)
|
||||
{
|
||||
var invoiceItem = new InvoiceItem();
|
||||
|
||||
decimal anzahlHausbesuche = countHausbesuch;
|
||||
|
||||
invoiceItem.AmountPerUnit = hausbesuchspauschale;
|
||||
invoiceItem.UnitCount = anzahlHausbesuche;
|
||||
invoiceItem.AmountTotal = anzahlHausbesuche * hausbesuchspauschale;
|
||||
if (invoicePeriod != null)
|
||||
{
|
||||
invoiceItem.ItemPeriodStart = invoicePeriod.StartDate;
|
||||
invoiceItem.ItemPeriodEnd = invoicePeriod.EndDate;
|
||||
}
|
||||
invoiceItem.RateFactor = null;
|
||||
invoiceItem.GrossAmountTotal = invoiceItem.AmountTotal;
|
||||
invoiceItem.ItemDescription = "Hausbesuchspauschale";
|
||||
invoiceItem.UnitDescription = "GPos: 2009690";
|
||||
if (scap != null)
|
||||
invoiceItem.SupportConceptApprovalPeriodOid = scap.Oid;
|
||||
|
||||
items.Add(invoiceItem);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private decimal GetHausbesuchspauschale(CostBearer2SupportConcept c2s, DateTime dt)
|
||||
{
|
||||
String preisName = "Hausbesuchspauschale Primärkasse";
|
||||
|
||||
if (c2s.CostBearer.Organisation.Function != null)
|
||||
{
|
||||
if (c2s.CostBearer.Organisation.Function.Value.Contains("Ersatzkasse"))
|
||||
{
|
||||
preisName = "Hausbesuchspauschale Ersatzkasse";
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetPreis(preisName, dt);
|
||||
}
|
||||
|
||||
private decimal GetGruppenPreis(CostBearer2SupportConcept c2s, DateTime dt)
|
||||
{
|
||||
String preisName = "Gruppenstunde Primärkasse";
|
||||
|
||||
if (c2s.CostBearer.Organisation.Function != null)
|
||||
{
|
||||
if (c2s.CostBearer.Organisation.Function.Value.Contains("Ersatzkasse"))
|
||||
{
|
||||
preisName = "Gruppenstunde Ersatzkasse";
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetPreis(preisName, dt);
|
||||
}
|
||||
|
||||
private decimal GetEinzelPreis(CostBearer2SupportConcept c2s, DateTime dt)
|
||||
{
|
||||
String preisName = "Einzelstunde Primärkasse";
|
||||
|
||||
if (c2s.CostBearer.Organisation.Function != null)
|
||||
{
|
||||
if (c2s.CostBearer.Organisation.Function.Value.Contains("Ersatzkasse"))
|
||||
{
|
||||
preisName = "Einzelstunde Ersatzkasse";
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetPreis(preisName, dt);
|
||||
}
|
||||
|
||||
public override IList<InvoiceItem> CreateSummaryInvoiceItems(IList<InvoiceItem> itemList, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap, Calculations calc, bool summaryPerMonth, bool addRateFactorToUnitCount)
|
||||
{
|
||||
return base.CreateSummaryInvoiceItems(itemList, invoicePeriod, scap, calc, true, true);
|
||||
}
|
||||
|
||||
public override string GetSummaryItemKey(SupportConceptApprovalPeriod scap, InvoiceItem iitem, bool summaryPerMonth)
|
||||
{
|
||||
String key = String.Format("{0}_{1}_{2}", iitem.AmountPerUnit, iitem.RateFactor, iitem.ItemDescription);
|
||||
if (summaryPerMonth)
|
||||
{
|
||||
key = String.Format("{0}_{1}_{2:yyyyMM}_{3}", iitem.AmountPerUnit, iitem.RateFactor, iitem.ItemPeriodStart, iitem.ItemDescription);
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,6 @@
|
||||
<Compile Include="CustomReportCreator.cs" />
|
||||
<Compile Include="Invoicing\CustomInvoiceFactory.cs" />
|
||||
<Compile Include="Invoicing\SettlementInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\SoziotherapieInvoiceCreation.cs" />
|
||||
<Compile Include="LeistungsnachweisSoziotherapie.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace BeWo.Service.Invoicing
|
||||
return new SbdDefaultInvoiceCreation();
|
||||
}
|
||||
|
||||
return InvoiceCreation.GetInstance(specificId, tenant);
|
||||
return InvoiceCreation.GetInstance(specificId, tenant);
|
||||
}
|
||||
|
||||
public virtual SettlementInvoiceCreation CreateSettlementInvoiceCreator(string costbearerId, string tenant, CostBearer2SupportConcept lCb2Sc)
|
||||
|
||||
273
Service/Invoicing/SoziotherapieInvoiceCreation.cs
Normal file
273
Service/Invoicing/SoziotherapieInvoiceCreation.cs
Normal file
@@ -0,0 +1,273 @@
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
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 BeWo.Service.Invoicing
|
||||
{
|
||||
public class SoziotherapieInvoiceCreation : InvoiceCreation
|
||||
{
|
||||
public SoziotherapieInvoiceCreation() : base()
|
||||
{
|
||||
//Wichtig für Finanzauswertung. Hier sollen entweder nur die normalen Therapieeinheiten oder nur die Hausbesuchspauschale berechnet werden
|
||||
ErstelleTherapieeinheiten = true;
|
||||
ErstelleHausbesuchspauschale = true;
|
||||
}
|
||||
|
||||
public bool ErstelleTherapieeinheiten { get; set; }
|
||||
public bool ErstelleHausbesuchspauschale { get; set; }
|
||||
|
||||
public override void SetInvoiceId(ServiceInvoice invoice)
|
||||
{
|
||||
invoice.InvoiceBase.InvoiceId = "RechnungSoziotherapie";
|
||||
invoice.InvoiceBase.InvoiceTypeText = "Soziotherapie";
|
||||
}
|
||||
|
||||
public override ServiceInvoice CreateSingleInvoice(int invoiceCounter, CostBearer costBearer, DateTimeSpan invoicePeriod, CompactSupportConceptDC supportConcept, List<ServiceRecordDC> serviceRecords)
|
||||
{
|
||||
var invoice = base.CreateSingleInvoice(invoiceCounter, costBearer, invoicePeriod, supportConcept, serviceRecords);
|
||||
|
||||
if (invoicePeriod != null)
|
||||
{
|
||||
SetAmountEquityContribution(invoice);
|
||||
}
|
||||
|
||||
return invoice;
|
||||
}
|
||||
|
||||
public override void SetAmountEquityContribution(ServiceInvoice invoice)
|
||||
{
|
||||
decimal equity = 0;
|
||||
|
||||
IList<InvoiceBase> EquityInvoiceList = DAOFactory.SearchDAO.GetInvoiceBaseByTypeAndSupportConceptOid(InvoiceType.CustomerEquity, invoice.InvoiceBase.SupportConceptOid.Value);
|
||||
|
||||
EquityInvoiceList = EquityInvoiceList.Where(i =>
|
||||
{
|
||||
if (i.AccountingPeriodEnd >= invoice.InvoiceBase.AccountingPeriodStart && i.AccountingPeriodStart <= invoice.InvoiceBase.AccountingPeriodEnd)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}).ToList();
|
||||
|
||||
foreach (InvoiceBase iEquityInvoice in EquityInvoiceList)
|
||||
{
|
||||
foreach (InvoiceItem item in iEquityInvoice.InvoiceItems)
|
||||
{
|
||||
if (item.AmountTotal != null)
|
||||
{
|
||||
equity += item.AmountTotal.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
invoice.AmountEquityContribution = equity;
|
||||
}
|
||||
|
||||
public override InvoiceItem CreateInvoiceItem(ServiceRecordDC iServiceRecord, SupportConceptApprovalPeriod scap, BS.Shared.Services.Calculations calc)
|
||||
{
|
||||
var ii = base.CreateInvoiceItem(iServiceRecord, scap, calc);
|
||||
|
||||
if (ii.ItemDescription.ToLower().Contains("probe"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001607";
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("gruppentherapie") || (iServiceRecord != null && iServiceRecord.GroupPersonCount.HasValue && iServiceRecord.GroupPersonCount.Value > 1))
|
||||
{
|
||||
//Setze Pauschale für Gruppentherapie
|
||||
var preisGruppe = GetGruppenPreis(scap.CostBearer2SupportConcept, iServiceRecord.Start.Value);
|
||||
ii.AmountPerUnit = preisGruppe;
|
||||
ii.AmountTotal = preisGruppe;
|
||||
ii.UnitCount = 1;
|
||||
ii.UnitDescription = "GPos: 2002672";
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("video"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30 || ii.ItemDescription.ToLower().Contains("30"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001616";
|
||||
}
|
||||
else if (iServiceRecord.RoundedDuration > 30 || ii.ItemDescription.ToLower().Contains("60"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001615";
|
||||
}
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("telefon"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001618";
|
||||
}
|
||||
else if (iServiceRecord.RoundedDuration > 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001617";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001612";
|
||||
}
|
||||
else if (iServiceRecord.RoundedDuration > 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001610";
|
||||
}
|
||||
}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
public virtual InvoiceItem CreateInvoiceItemFactor(ServiceRecordDC iServiceRecord, SupportConceptApprovalPeriod scap, BS.Shared.Services.Calculations calc)
|
||||
{
|
||||
return CreateInvoiceItem(iServiceRecord, scap, calc);
|
||||
}
|
||||
|
||||
public override IList<InvoiceItem> CreateInvoiceItems(List<ServiceRecordDC> serviceRecordsInPeriod, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap,
|
||||
BS.Shared.Services.Calculations calc)
|
||||
{
|
||||
var list = new List<InvoiceItem>();
|
||||
|
||||
if (ErstelleTherapieeinheiten)
|
||||
{
|
||||
list = (List<InvoiceItem>)base.CreateInvoiceItems(serviceRecordsInPeriod, invoicePeriod, scap, calc);
|
||||
}
|
||||
|
||||
if (ErstelleHausbesuchspauschale)
|
||||
{
|
||||
var ii = CreateHausbesuchspauschale(serviceRecordsInPeriod, invoicePeriod, scap);
|
||||
list.AddRange(ii);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public virtual IList<InvoiceItem> CreateHausbesuchspauschale(List<ServiceRecordDC> serviceRecordsInPeriod, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap)
|
||||
{
|
||||
IList<InvoiceItem> items = new List<InvoiceItem>();
|
||||
decimal hausbesuchspauschale = GetHausbesuchspauschale(scap.CostBearer2SupportConcept, invoicePeriod.StartDate);
|
||||
|
||||
int countHausbesuch = 0;
|
||||
|
||||
foreach (var sr in serviceRecordsInPeriod)
|
||||
{
|
||||
if (!sr.ServiceDescription.Name.ToLower().Contains("telefon") && !sr.ServiceDescription.Name.ToLower().Contains("gruppe") && !sr.ServiceDescription.Name.ToLower().Contains("praxis"))
|
||||
{
|
||||
countHausbesuch++;
|
||||
}
|
||||
}
|
||||
|
||||
if (countHausbesuch > 0)
|
||||
{
|
||||
var desc = DAOFactory.GenericDAO.GetAllActive<ServiceDescription>();
|
||||
CostRatePeriodDC crp = null;
|
||||
List<CostRatePeriodDC> crpDcs;
|
||||
|
||||
var invoiceItem = new InvoiceItem();
|
||||
|
||||
decimal anzahlHausbesuche = countHausbesuch;
|
||||
|
||||
invoiceItem.AmountPerUnit = hausbesuchspauschale;
|
||||
invoiceItem.UnitCount = anzahlHausbesuche;
|
||||
invoiceItem.AmountTotal = anzahlHausbesuche * hausbesuchspauschale;
|
||||
invoiceItem.ItemPeriodStart = invoicePeriod.StartDate;
|
||||
invoiceItem.ItemPeriodEnd = invoicePeriod.EndDate;
|
||||
invoiceItem.RateFactor = null;
|
||||
invoiceItem.GrossAmountTotal = invoiceItem.AmountTotal;
|
||||
invoiceItem.ItemDescription = "Hausbesuchspauschale";
|
||||
invoiceItem.UnitDescription = "GPos: 2009690";
|
||||
if (scap != null)
|
||||
invoiceItem.SupportConceptApprovalPeriodOid = scap.Oid;
|
||||
|
||||
items.Add(invoiceItem);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
private decimal GetHausbesuchspauschale(CostBearer2SupportConcept c2s, DateTime dt)
|
||||
{
|
||||
String preisName = "Hausbesuchspauschale Primärkassen";
|
||||
|
||||
if (c2s.CostBearer.Organisation.Function != null)
|
||||
{
|
||||
if (c2s.CostBearer.Organisation.Function.Value.Contains("Ersatzkasse"))
|
||||
{
|
||||
preisName = "Hausbesuchspauschale Ersatzkassen";
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetPreis(preisName, dt);
|
||||
}
|
||||
|
||||
private decimal GetGruppenPreis(CostBearer2SupportConcept c2s, DateTime dt)
|
||||
{
|
||||
String preisName = "Gruppentherapie Primärkassen";
|
||||
|
||||
if (c2s.CostBearer.Organisation.Function != null)
|
||||
{
|
||||
if (c2s.CostBearer.Organisation.Function.Value.Contains("Ersatzkasse"))
|
||||
{
|
||||
preisName = "Gruppentherapie Ersatzkassen";
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetPreis(preisName, dt);
|
||||
}
|
||||
|
||||
public override IList<InvoiceItem> CreateSummaryInvoiceItems(IList<InvoiceItem> itemList, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap, BS.Shared.Services.Calculations calc, bool summaryPerMonth, bool addRateFactorToUnitCount)
|
||||
{
|
||||
var newlist = new List<InvoiceItem>();
|
||||
|
||||
var rateToItem = new Dictionary<String, InvoiceItem>();
|
||||
foreach (InvoiceItem iitem in itemList)
|
||||
{
|
||||
InvoiceItem item;
|
||||
|
||||
var key = String.Format("{0}_{1}_{2:yyyyMMdd}_{3}", iitem.AmountPerUnit, iitem.RateFactor, iitem.ItemPeriodStart, iitem.UnitDescription);
|
||||
|
||||
if (rateToItem.ContainsKey(key))
|
||||
{
|
||||
item = rateToItem[key];
|
||||
}
|
||||
else
|
||||
{
|
||||
item = new InvoiceItem();
|
||||
newlist.Add(item);
|
||||
|
||||
item.AmountPerUnit = iitem.AmountPerUnit;
|
||||
item.ItemPeriodStart = iitem.ItemPeriodStart.Value.Date;
|
||||
item.ItemPeriodEnd = iitem.ItemPeriodEnd.Value.Date;
|
||||
|
||||
item.RateFactor = iitem.RateFactor;
|
||||
|
||||
item.AccountingInterval = iitem.AccountingInterval;
|
||||
item.ItemDescription = iitem.ItemDescription;
|
||||
item.UnitDescription = iitem.UnitDescription;
|
||||
item.SupportConceptApprovalPeriodOid = scap.Oid;
|
||||
item.ServiceRecord = iitem.ServiceRecord;
|
||||
|
||||
rateToItem[key] = item;
|
||||
}
|
||||
|
||||
|
||||
if (!item.UnitCount.HasValue)
|
||||
{
|
||||
item.UnitCount = 0;
|
||||
}
|
||||
item.UnitCount += iitem.UnitCount ?? 0;
|
||||
}
|
||||
|
||||
BerechneSummaryItemsSummen(newlist, addRateFactorToUnitCount);
|
||||
|
||||
return newlist;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -420,6 +420,7 @@
|
||||
<Compile Include="Invoicing\LWLInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\LWLSettlementInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\SettlementInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\SoziotherapieInvoiceCreation.cs" />
|
||||
<Compile Include="MessageContracts\UploadChatPackage.cs" />
|
||||
<Compile Include="MessageContracts\UploadPersehDocumentResult.cs" />
|
||||
<Compile Include="MessageContracts\UploadChatResult.cs" />
|
||||
|
||||
Reference in New Issue
Block a user