Inkomm/Invoicing/SettlementInvoiceCreation.cs - Umstellung auf Fehlkontakte Standard
SupportOID=168968
This commit is contained in:
@@ -56,29 +56,44 @@ namespace Inkomm.Invoicing
|
||||
|
||||
public override void CalculateInvoiceItemAmounts(Settlement2DC si)
|
||||
{
|
||||
decimal maxApprovedFls = si.ApprovedFLS ?? 0;
|
||||
decimal flsAufgebraucht = 0;
|
||||
decimal flsBudgetGesamt = si.ApprovedFLS ?? 0;
|
||||
|
||||
foreach (var ii in si.InvoiceItems)
|
||||
{
|
||||
if (ii.UnitCount.HasValue)
|
||||
{
|
||||
var uc = Math.Round(ii.UnitCount ?? 0, 2, MidpointRounding.AwayFromZero);
|
||||
if (maxApprovedFls < uc)
|
||||
uc = maxApprovedFls;
|
||||
|
||||
maxApprovedFls -= uc;
|
||||
|
||||
ii.UnitCount = uc;
|
||||
if (ii.UnitCount > 0)
|
||||
{
|
||||
// dieser Abschnitt prueft und kappt ggf. Stunden bei Ueberschreitung Budget - unter Beruecksichtigung ProzentBudget in Leistung(skategorien)
|
||||
var unitCountBudget = Math.Round(ii.UnitCountBudget ?? ii.UnitCount ?? 0, 2, MidpointRounding.AwayFromZero);
|
||||
ii.UnitCount = Math.Round(ii.UnitCount.Value, 2, MidpointRounding.AwayFromZero);
|
||||
var relation = unitCountBudget / ii.UnitCount.Value;
|
||||
var gewichteteStunden = ii.UnitCount * relation;
|
||||
if (gewichteteStunden > flsBudgetGesamt - flsAufgebraucht)
|
||||
{
|
||||
gewichteteStunden = flsBudgetGesamt - flsAufgebraucht;
|
||||
ii.UnitCount = gewichteteStunden / relation;
|
||||
}
|
||||
flsAufgebraucht += ii.UnitCount.Value * relation;
|
||||
}
|
||||
|
||||
if (ii.AmountPerUnit.HasValue)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(ii.ItemDescription) && ii.ItemDescription.ToLower().Contains("fehlkontakt") && ii.ProzentAbrechenbar.HasValue)
|
||||
{
|
||||
ii.AmountPerUnit = ii.AmountPerUnit * ii.ProzentAbrechenbar / 100;
|
||||
}
|
||||
ii.AmountTotal = ii.UnitCount.Value * ii.AmountPerUnit.Value;
|
||||
if (ii.RateFactor.HasValue && ii.RateFactor.Value != 0 && ii.ItemDescription != null && !ii.ItemDescription.Contains("Assistenz"))
|
||||
{
|
||||
ii.GrossAmountTotal = Math.Round(ii.AmountTotal.Value * ((100m + ii.RateFactor.Value) / 100m), 2,
|
||||
MidpointRounding.AwayFromZero);
|
||||
}
|
||||
else
|
||||
{
|
||||
ii.GrossAmountTotal = ii.AmountTotal;
|
||||
|
||||
}
|
||||
}
|
||||
if (ii.MaxApprovedUnitCount < ii.UnitCount)
|
||||
{
|
||||
@@ -95,15 +110,5 @@ namespace Inkomm.Invoicing
|
||||
item.RateFactor = 0;
|
||||
return item;
|
||||
}
|
||||
|
||||
//public override bool IsServiceRecordBillable(ServiceRecord iRecord)
|
||||
// {
|
||||
// if (iRecord.ServiceDescription.ServiceCategory.Name.Contains("Fachleistung") || iRecord.ServiceDescription.ServiceCategory.Name.Contains("Assistenz"))
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user