VereinBeratungTherapie/Invoicing/CollectiveInvoiceCreation - Rundung LWV

This commit is contained in:
2024-07-24 16:24:09 +02:00
parent b0d33358eb
commit 3feec559d8

View File

@@ -255,8 +255,7 @@ namespace VereinBeratungTherapie.Invoicing
if (scapTS.StartDate == ap.StartDate && scapTS.EndDate == ap.EndDate || ap.StartDate < period.End && ap.EndDate > period.Start)
{
var catBW = MapperFactory.ServiceCategoryDC_ServiceCategory.MapToNewDC(ap.ServiceCategory);
decimal? minPreis;
decimal? minGes;
decimal minPreis = Math.Round(preis.Value / 60, 4, MidpointRounding.AwayFromZero);
decimal preisGes;
decimal preisBw = 0;
decimal lgBw = 0;
@@ -275,18 +274,25 @@ namespace VereinBeratungTherapie.Invoicing
}
else
{
preisBw = Math.Round(Math.Round(preis.Value / 60, 4, MidpointRounding.AwayFromZero) * lgBw, 2, MidpointRounding.AwayFromZero);
preisBw = Math.Round(minPreis * lgBw, 2, MidpointRounding.AwayFromZero);
lgGes = LG + lgBw;
}
preisGes = Math.Round(preis.Value * lgGes / 60, 2, MidpointRounding.AwayFromZero);
if (new List<decimal> { 60, 120, 180, 240, 330, 450, 630, 900 }.Contains(lgGes))
{
preisGes = Math.Round(preis.Value * lgGes / 60, 2, MidpointRounding.AwayFromZero);
}
else
{
preisGes = Math.Round(minPreis * lgGes, 2, MidpointRounding.AwayFromZero);
}
ii.AmountPerUnit = preisGes - preisBw;
ii.AmountTotal = ii.UnitCount * ii.AmountPerUnit;
break;
}
else
{
preisBw = Math.Round(preis.Value * lgBw, 2, MidpointRounding.AwayFromZero);
preisGes = Math.Round(preis.Value * (LG + lgBw), 2, MidpointRounding.AwayFromZero);
preisBw = Math.Round(minPreis * lgBw, 2, MidpointRounding.AwayFromZero);
preisGes = Math.Round(minPreis * (LG + lgBw), 2, MidpointRounding.AwayFromZero);
ii.AmountPerUnit = preisGes - preisBw;
ii.AmountTotal = ii.UnitCount * ii.AmountPerUnit;
break;