VereinBeratungTherapie/CollectiveBillingReportTabIntern - Rundung QA kombiniert
This commit is contained in:
@@ -38,7 +38,7 @@ namespace VereinBeratungTherapie
|
||||
if (sip.ServiceInvoiceItems.Count > 0)
|
||||
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;
|
||||
else
|
||||
{
|
||||
@@ -47,7 +47,7 @@ namespace VereinBeratungTherapie
|
||||
|
||||
sip.ApprovedHours = (decimal)(end - start).TotalDays;
|
||||
}
|
||||
if (sip.CostBearer2SupportConcept.CustomerReferenceNumber == null)
|
||||
if (sip.CostBearer2SupportConcept != null && sip.CostBearer2SupportConcept.CustomerReferenceNumber == null)
|
||||
{
|
||||
sip.CostBearer2SupportConcept.CustomerReferenceNumber = "";
|
||||
}
|
||||
|
||||
@@ -196,6 +196,7 @@ namespace VereinBeratungTherapie.Invoicing
|
||||
if (supportConceptApprovalPeriod.ApprovedBEInterval != null)
|
||||
{
|
||||
decimal preis = 0;
|
||||
decimal preisLG = 0;
|
||||
if (supportConceptApprovalPeriod.ApprovedBEPerInterval != null)
|
||||
{
|
||||
LG = supportConceptApprovalPeriod.ApprovedBEPerInterval.Value;
|
||||
@@ -204,20 +205,22 @@ namespace VereinBeratungTherapie.Invoicing
|
||||
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
|
||||
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))
|
||||
{
|
||||
LG = Math.Round(LG / 60, 2, MidpointRounding.AwayFromZero);
|
||||
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.AmountTotal = ii.UnitCount * ii.AmountPerUnit;
|
||||
}
|
||||
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.AmountTotal = ii.UnitCount * ii.AmountPerUnit;
|
||||
}
|
||||
@@ -227,7 +230,7 @@ namespace VereinBeratungTherapie.Invoicing
|
||||
if (cat.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)
|
||||
{
|
||||
// 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();
|
||||
foreach (var ap in scapBws)
|
||||
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();
|
||||
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);
|
||||
decimal? minPreis;
|
||||
decimal? minGes;
|
||||
decimal preisGes;
|
||||
decimal preisBw;
|
||||
decimal lgBw = 0;
|
||||
if (ap.ApprovedBEPerInterval != null)
|
||||
if (scapTS.StartDate == ap.StartDate && scapTS.EndDate == ap.EndDate || ap.StartDate < period.End && ap.EndDate > period.Start)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user