VereinBeratungTherapie/CollectiveBillingReportTabIntern - Rundung QA kombiniert

This commit is contained in:
2024-07-22 16:39:53 +02:00
parent 205f7d9589
commit 7d5e084f39
2 changed files with 50 additions and 22 deletions

View File

@@ -38,7 +38,7 @@ namespace VereinBeratungTherapie
if (sip.ServiceInvoiceItems.Count > 0) if (sip.ServiceInvoiceItems.Count > 0)
sip.NotBillableString = sip.ServiceInvoiceItems[0].UnitDescription; sip.NotBillableString = sip.ServiceInvoiceItems[0].UnitDescription;
} }
if (sip.SupportConceptApprovalPeriod.ServiceCategory == null || sip.SupportConceptApprovalPeriod.ServiceCategory != null && sip.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("Monat")) if (sip.SupportConceptApprovalPeriod == null || sip.SupportConceptApprovalPeriod.ServiceCategory == null || sip.SupportConceptApprovalPeriod.ServiceCategory != null && sip.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("Monat"))
sip.ApprovedHours = 1; sip.ApprovedHours = 1;
else else
{ {
@@ -47,7 +47,7 @@ namespace VereinBeratungTherapie
sip.ApprovedHours = (decimal)(end - start).TotalDays; sip.ApprovedHours = (decimal)(end - start).TotalDays;
} }
if (sip.CostBearer2SupportConcept.CustomerReferenceNumber == null) if (sip.CostBearer2SupportConcept != null && sip.CostBearer2SupportConcept.CustomerReferenceNumber == null)
{ {
sip.CostBearer2SupportConcept.CustomerReferenceNumber = ""; sip.CostBearer2SupportConcept.CustomerReferenceNumber = "";
} }

View File

@@ -196,6 +196,7 @@ namespace VereinBeratungTherapie.Invoicing
if (supportConceptApprovalPeriod.ApprovedBEInterval != null) if (supportConceptApprovalPeriod.ApprovedBEInterval != null)
{ {
decimal preis = 0; decimal preis = 0;
decimal preisLG = 0;
if (supportConceptApprovalPeriod.ApprovedBEPerInterval != null) if (supportConceptApprovalPeriod.ApprovedBEPerInterval != null)
{ {
LG = supportConceptApprovalPeriod.ApprovedBEPerInterval.Value; LG = supportConceptApprovalPeriod.ApprovedBEPerInterval.Value;
@@ -204,20 +205,22 @@ namespace VereinBeratungTherapie.Invoicing
if (data != null && supportConceptApprovalPeriod.ApprovedBEPerInterval != null) if (data != null && supportConceptApprovalPeriod.ApprovedBEPerInterval != null)
{ {
// LWV rundet den Prei bei KA und alten Bewilligungen QA auf Minutenwert und bei neuer QA auf Stunden :-P // LWV rundet den Prei bei KA und alten Bewilligungen QA auf Minutenwert und bei neuer QA auf Stunden :-P
if ((cat.Abbreviation.Contains("QA") || supportConceptApprovalPeriod.ServiceCategory.Name.Contains("Qualifizierte")) if ((cat.Abbreviation.Contains("QA") || cat.Name.Contains("Qualifizierte"))
&& new List<decimal> { 60, 120, 180, 240, 330, 450, 630, 900 }.Contains(LG)) && new List<decimal> { 60, 120, 180, 240, 330, 450, 630, 900 }.Contains(LG))
{ {
LG = Math.Round(LG / 60, 2, MidpointRounding.AwayFromZero); LG = Math.Round(LG / 60, 2, MidpointRounding.AwayFromZero);
if (data != null && supportConceptApprovalPeriod.ApprovedBEPerInterval != null) if (data != null && supportConceptApprovalPeriod.ApprovedBEPerInterval != null)
{ {
preis = data[0].AmountTotal.Value; preisLG = data[0].AmountTotal.Value;
preis = preisLG;
} }
ii.AmountPerUnit = Math.Round(preis * LG, 2); ii.AmountPerUnit = Math.Round(preis * LG, 2);
ii.AmountTotal = ii.UnitCount * ii.AmountPerUnit; ii.AmountTotal = ii.UnitCount * ii.AmountPerUnit;
} }
else else
{ {
preis = Math.Round(data[0].AmountTotal.Value / 60, 4, MidpointRounding.AwayFromZero); preisLG = data[0].AmountTotal.Value;
preis = Math.Round(preisLG / 60, 4, MidpointRounding.AwayFromZero);
ii.AmountPerUnit = Math.Round(preis * LG, 2, MidpointRounding.AwayFromZero); ii.AmountPerUnit = Math.Round(preis * LG, 2, MidpointRounding.AwayFromZero);
ii.AmountTotal = ii.UnitCount * ii.AmountPerUnit; ii.AmountTotal = ii.UnitCount * ii.AmountPerUnit;
} }
@@ -227,7 +230,7 @@ namespace VereinBeratungTherapie.Invoicing
if (cat.Abbreviation.Contains("TS") if (cat.Abbreviation.Contains("TS")
&& cb2sc.ApprovalPeriodList.Any(a => a.ServiceCategory.Abbreviation.Contains(cat.Abbreviation.Substring(0, 2)) && !a.ServiceCategory.Abbreviation.Contains("TS"))) && cb2sc.ApprovalPeriodList.Any(a => a.ServiceCategory.Abbreviation.Contains(cat.Abbreviation.Substring(0, 2)) && !a.ServiceCategory.Abbreviation.Contains("TS")))
{ {
GetKombiniertenPreisQA(serviceInvoicePeriod, supportConceptApprovalPeriod, cat, cb2sc, LG, preis, ii); GetKombiniertenPreisQA(serviceInvoicePeriod, supportConceptApprovalPeriod, cat, cb2sc, LG, preisLG, ii);
} }
} }
} }
@@ -244,26 +247,51 @@ namespace VereinBeratungTherapie.Invoicing
private void GetKombiniertenPreisQA(ServiceInvoicePeriod period, SupportConceptApprovalPeriodDC scapTS, ServiceCategoryDC cat, CostBearer2SupportConcept cb2sc, decimal LG, decimal? preis, InvoiceItem ii) private void GetKombiniertenPreisQA(ServiceInvoicePeriod period, SupportConceptApprovalPeriodDC scapTS, ServiceCategoryDC cat, CostBearer2SupportConcept cb2sc, decimal LG, decimal? preis, InvoiceItem ii)
{ {
// Errechnung des summierten Preises und dann Korrektur für TS // Errechnung des summierten Preises und dann Korrektur für TS
var scapBws = cb2sc.ApprovalPeriodList.Where(a => a.ServiceCategory.Abbreviation.Contains(cat.Abbreviation.Substring(0, 2)) && !a.ServiceCategory.Abbreviation.Contains("TS")).ToList(); var scapBws = cb2sc.ApprovalPeriodList.Where(a => a.ServiceCategory != null && a.ServiceCategory.Abbreviation.Contains(cat.Abbreviation.Substring(0, 2)) && a.ServiceCategory.Abbreviation.Substring(2, 2) == "BW").ToList();
foreach (var ap in scapBws) if (scapBws != null)
{ {
if (scapTS.StartDate == ap.StartDate && scapTS.EndDate == ap.EndDate || ap.StartDate < period.End && ap.EndDate > period.Start) foreach (var ap in scapBws)
{ {
var catBW = MapperFactory.ServiceCategoryDC_ServiceCategory.MapToNewDC(ap.ServiceCategory); if (scapTS.StartDate == ap.StartDate && scapTS.EndDate == ap.EndDate || ap.StartDate < period.End && ap.EndDate > period.Start)
decimal? minPreis;
decimal? minGes;
decimal preisGes;
decimal preisBw;
decimal lgBw = 0;
if (ap.ApprovedBEPerInterval != null)
{ {
lgBw = ap.ApprovedBEPerInterval.Value; var catBW = MapperFactory.ServiceCategoryDC_ServiceCategory.MapToNewDC(ap.ServiceCategory);
decimal? minPreis;
decimal? minGes;
decimal preisGes;
decimal preisBw = 0;
decimal lgBw = 0;
decimal lgGes = 0;
if (ap.ApprovedBEPerInterval != null)
{
lgBw = ap.ApprovedBEPerInterval.Value;
}
// LWV rundet den Prei bei KA und alten Bewilligungen QA auf Minutenwert und bei neuer QA auf Stunden :-P
if ((cat.Abbreviation.Contains("QA") || cat.Name.Contains("Qualifizierte")))
{
if (new List<decimal> { 60, 120, 180, 240, 330, 450, 630, 900 }.Contains(lgBw))
{
preisBw = Math.Round(preis.Value * lgBw / 60, 2, MidpointRounding.AwayFromZero);
lgGes = Math.Round((LG + lgBw) / 60, 2, MidpointRounding.AwayFromZero);
}
else
{
preisBw = Math.Round(Math.Round(preis.Value / 60, 4, MidpointRounding.AwayFromZero) * lgBw, 2, MidpointRounding.AwayFromZero);
lgGes = LG + lgBw;
}
preisGes = Math.Round(preis.Value * lgGes / 60, 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);
ii.AmountPerUnit = preisGes - preisBw;
ii.AmountTotal = ii.UnitCount * ii.AmountPerUnit;
break;
}
} }
preisBw = Math.Round(preis.Value * lgBw, 2, MidpointRounding.AwayFromZero);
preisGes = Math.Round(preis.Value * (LG + lgBw), 2, MidpointRounding.AwayFromZero);
ii.AmountPerUnit = preisGes - preisBw;
ii.AmountTotal = ii.UnitCount * ii.AmountPerUnit;
break;
} }
} }
} }