MH: Schubkraft Preise bearbeitet
This commit is contained in:
@@ -33,10 +33,9 @@ namespace ABCBetreuungenReports.Invoicing
|
||||
SupportConceptApprovalPeriod scap, BS.Shared.Services.Calculations calc)
|
||||
{
|
||||
var list = base.CreateInvoiceItems(serviceRecordsInPeriod, invoicePeriod, scap, calc);
|
||||
|
||||
if (!scap.CostBearer2SupportConcept.CostBearer.Organisation.Name.ToLower().Contains("alt"))
|
||||
string kostentraeger = scap.CostBearer2SupportConcept.CostBearer.Organisation.Name.ToLower();
|
||||
if (!kostentraeger.Contains("alt"))
|
||||
{
|
||||
|
||||
var crp = scap.CostBearer2SupportConcept.CostBearer.CostRatePeriods;
|
||||
decimal minsProFLS = 60;
|
||||
if (crp != null && crp.Count > 0)
|
||||
@@ -46,25 +45,33 @@ namespace ABCBetreuungenReports.Invoicing
|
||||
}
|
||||
|
||||
// Klären, welche Kostenträger betroffen sind. (Funktion?)
|
||||
|
||||
decimal counter = 0;
|
||||
|
||||
Dictionary<decimal, decimal> preiseZuAnzahl = new Dictionary<decimal, decimal>();
|
||||
foreach (var sr in serviceRecordsInPeriod)
|
||||
{
|
||||
if (sr.ServiceDescription.Name.ToLower().Contains("behördengang") || sr.ServiceDescription.Name.ToLower().Contains("außentermin") || sr.ServiceDescription.Name.ToLower().Contains("wohnung"))
|
||||
{
|
||||
string preisbezeichnung = kostentraeger.Contains("kompensatorisch") ? "Kontaktpauschale kompensatorisch" : "Kontaktpauschale qualifiziert";
|
||||
var preis = GetPreis(preisbezeichnung, sr.Start.Value);
|
||||
|
||||
decimal unitcount = 1;
|
||||
// Bei Gruppenbuchungen muss die Pauschale durch die Teilnehmerzahl geteilt werden
|
||||
if (sr.GroupPersonCount.HasValue)
|
||||
counter = counter + (1m / Convert.ToDecimal(sr.GroupPersonCount.Value));
|
||||
else
|
||||
counter += 1;
|
||||
unitcount /= Convert.ToDecimal(sr.GroupPersonCount.Value);
|
||||
|
||||
if (preiseZuAnzahl.ContainsKey(preis))
|
||||
preiseZuAnzahl[preis] += unitcount;
|
||||
else
|
||||
preiseZuAnzahl.Add(preis, unitcount);
|
||||
}
|
||||
}
|
||||
|
||||
if (counter > 0)
|
||||
if (preiseZuAnzahl.Count > 0)
|
||||
{
|
||||
List<InvoiceItem> toAdd = new List<InvoiceItem>();
|
||||
toAdd.Add(CreateKontaktpauschalenItem(counter, invoicePeriod.StartDate, invoicePeriod.EndDate));
|
||||
list.AddRange(toAdd);
|
||||
foreach (var item in preiseZuAnzahl)
|
||||
{
|
||||
list.Add(CreateKontaktpauschalenItem(item.Value, item.Key, invoicePeriod.StartDate, invoicePeriod.EndDate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,41 +98,20 @@ namespace ABCBetreuungenReports.Invoicing
|
||||
}
|
||||
}
|
||||
}
|
||||
// Klären, wie die InvoiceItems heißen sollen
|
||||
|
||||
// if (iServiceRecord != null)
|
||||
// {
|
||||
// var cat = iServiceRecord.ServiceDescription.CategoryName;
|
||||
// var desc = iServiceRecord.ServiceDescription.Name;
|
||||
|
||||
// if (cat == "Direkte Leistung")
|
||||
// {
|
||||
// invoiceItem.ItemDescription = "face-to-face";
|
||||
// invoiceItem.UnitDescription = "Fachleistungsstunde (FLS)";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// invoiceItem.ItemDescription = desc;
|
||||
// invoiceItem.UnitDescription = "Stunde";
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
|
||||
return invoiceItem;
|
||||
}
|
||||
|
||||
private InvoiceItem CreateKontaktpauschalenItem(decimal? unitCount, DateTime? itemPeriodStart, DateTime? itemPeriodEnd)
|
||||
private InvoiceItem CreateKontaktpauschalenItem(decimal unitCount, decimal preis, DateTime? itemPeriodStart, DateTime? itemPeriodEnd)
|
||||
{
|
||||
decimal pauschale = PauschalenHelper.GetPreis("Kontaktpauschale", itemPeriodStart.Value);
|
||||
|
||||
var ii = new InvoiceItem()
|
||||
{
|
||||
UnitCount = unitCount,
|
||||
ItemDescription = "Anfahrtspauschale",
|
||||
UnitDescription = "Pauschale pro direktem Kontakt",
|
||||
AmountPerUnit = pauschale,
|
||||
AmountTotal = pauschale * unitCount,
|
||||
GrossAmountTotal = pauschale * unitCount,
|
||||
AmountPerUnit = preis,
|
||||
AmountTotal = unitCount * preis,
|
||||
GrossAmountTotal = unitCount * preis,
|
||||
ItemPeriodStart = itemPeriodStart,
|
||||
ItemPeriodEnd = itemPeriodEnd,
|
||||
RateFactor = 0
|
||||
|
||||
@@ -104,50 +104,65 @@ namespace ABCBetreuungenReports.Invoicing
|
||||
private static InvoiceItemDC CreateKontaktpauschalenItem(AccountingPeriod accountingPeriod, string recipientOrganisation)
|
||||
{
|
||||
InvoiceItemDC invoiceItem = null;
|
||||
decimal unitCount = 0;
|
||||
|
||||
Dictionary<decimal, decimal> preiseZuAnzahl = new Dictionary<decimal, decimal>();
|
||||
|
||||
foreach (var sr in accountingPeriod.ServiceRecordsInPeriod)
|
||||
|
||||
foreach (var sr in accountingPeriod.ServiceRecordsInPeriod)
|
||||
{
|
||||
if (sr.ServiceDescription.Name.ToLower().Contains("behördengang") || sr.ServiceDescription.Name.ToLower().Contains("außentermin") || sr.ServiceDescription.Name.ToLower().Contains("wohnung"))
|
||||
{
|
||||
unitCount++;
|
||||
}
|
||||
string preisbezeichnung = recipientOrganisation.Contains("kompensatorisch") ? "Kontaktpauschale kompensatorisch" : "Kontaktpauschale qualifiziert";
|
||||
var preis = PauschalenHelper.GetPreis(preisbezeichnung, accountingPeriod.PeriodStart);
|
||||
|
||||
decimal unitcount = 1;
|
||||
// Bei Gruppenbuchungen muss die Pauschale durch die Teilnehmerzahl geteilt werden
|
||||
if (sr.GroupPersonCount.HasValue)
|
||||
unitcount /= Convert.ToDecimal(sr.GroupPersonCount.Value);
|
||||
|
||||
if (preiseZuAnzahl.ContainsKey(preis))
|
||||
preiseZuAnzahl[preis] += unitcount;
|
||||
else
|
||||
preiseZuAnzahl.Add(preis, unitcount);
|
||||
}
|
||||
}
|
||||
|
||||
if (unitCount > 0)
|
||||
if (preiseZuAnzahl.Count > 0)
|
||||
{
|
||||
//decimal pauschale = PauschalenHelper._FAHRTKOSTENPAUSCHALE;
|
||||
decimal pauschale = PauschalenHelper.GetPreis("Kontaktpauschale", accountingPeriod.PeriodStart);
|
||||
decimal rateFactor = accountingPeriod.RateFactor == 0 ? 1 : accountingPeriod.RateFactor;
|
||||
|
||||
if (accountingPeriod.RateFactor == 0)
|
||||
invoiceItem = new InvoiceItemDC()
|
||||
{
|
||||
UnitCount = unitCount,
|
||||
ItemDescription = "Kontaktpauschale",
|
||||
UnitDescription = "Pauschale pro direktem Kontakt",
|
||||
AmountPerUnit = pauschale,
|
||||
AmountTotal = pauschale * unitCount,
|
||||
GrossAmountTotal = pauschale * unitCount,
|
||||
ItemPeriodStart = accountingPeriod.PeriodStart,
|
||||
ItemPeriodEnd = accountingPeriod.PeriodEnd,
|
||||
RateFactor = 0,
|
||||
};
|
||||
else
|
||||
//decimal pauschale = PauschalenHelper._FAHRTKOSTENPAUSCHALE;
|
||||
foreach (var item in preiseZuAnzahl)
|
||||
{
|
||||
invoiceItem = new InvoiceItemDC()
|
||||
if (accountingPeriod.RateFactor == 0)
|
||||
{
|
||||
UnitCount = unitCount,
|
||||
ItemDescription = "Kontaktpauschale",
|
||||
UnitDescription = "Pauschale pro direktem Kontakt",
|
||||
AmountPerUnit = pauschale,
|
||||
AmountTotal = pauschale * unitCount * accountingPeriod.RateFactor,
|
||||
GrossAmountTotal = pauschale * unitCount * accountingPeriod.RateFactor,
|
||||
ItemPeriodStart = accountingPeriod.PeriodStart,
|
||||
ItemPeriodEnd = accountingPeriod.PeriodEnd,
|
||||
RateFactor = accountingPeriod.RateFactor
|
||||
};
|
||||
}
|
||||
invoiceItem = new InvoiceItemDC()
|
||||
{
|
||||
UnitCount = item.Value,
|
||||
ItemDescription = "Kontaktpauschale",
|
||||
UnitDescription = "Pauschale pro direktem Kontakt",
|
||||
AmountPerUnit = item.Key,
|
||||
AmountTotal = item.Value * item.Key,
|
||||
GrossAmountTotal = item.Value * item.Key,
|
||||
ItemPeriodStart = accountingPeriod.PeriodStart,
|
||||
ItemPeriodEnd = accountingPeriod.PeriodEnd,
|
||||
RateFactor = 0,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
invoiceItem = new InvoiceItemDC()
|
||||
{
|
||||
UnitCount = item.Value,
|
||||
ItemDescription = "Kontaktpauschale",
|
||||
UnitDescription = "Pauschale pro direktem Kontakt",
|
||||
AmountPerUnit = item.Key,
|
||||
AmountTotal = item.Value * item.Key * accountingPeriod.RateFactor,
|
||||
GrossAmountTotal = item.Value * item.Key * accountingPeriod.RateFactor,
|
||||
ItemPeriodStart = accountingPeriod.PeriodStart,
|
||||
ItemPeriodEnd = accountingPeriod.PeriodEnd,
|
||||
RateFactor = accountingPeriod.RateFactor
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return invoiceItem;
|
||||
|
||||
Reference in New Issue
Block a user