From 3feec559d800957f54351d3f31de0db3bafa5b9e Mon Sep 17 00:00:00 2001 From: Alexandra Date: Wed, 24 Jul 2024 16:24:09 +0200 Subject: [PATCH] VereinBeratungTherapie/Invoicing/CollectiveInvoiceCreation - Rundung LWV --- .../Invoicing/CollectiveInvoiceCreation.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ReportImp/VereinBeratungTherapie/Invoicing/CollectiveInvoiceCreation.cs b/ReportImp/VereinBeratungTherapie/Invoicing/CollectiveInvoiceCreation.cs index 6fa414eb7..47e964a94 100644 --- a/ReportImp/VereinBeratungTherapie/Invoicing/CollectiveInvoiceCreation.cs +++ b/ReportImp/VereinBeratungTherapie/Invoicing/CollectiveInvoiceCreation.cs @@ -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 { 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;