SHKService/CollectiveBillingReportTab - Format und Berechnung nachgeschärft

This commit is contained in:
2024-07-31 15:21:16 +02:00
parent 7c82583836
commit acdbbb9e60
4 changed files with 938 additions and 1568 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -23,10 +23,12 @@ namespace SHKService
foreach (var sip in pRO.ServiceInvoicePeriods)
{
if (sip.Customer.LastName.ToLower().Contains("(ka)"))
if (sip.Customer.FirstName.ToLower().Contains("(ka)"))
{
sip.Customer.LastName = sip.Customer.LastName.Replace(" (ka)", "");
sip.Customer.FirstName = sip.Customer.FirstName.Replace("(ka)", "").Trim();
sip.Customer.FirstName = sip.Customer.FirstName.Replace("(KA)", "").Trim();
}
sip.Customer.LastName = sip.Customer.LastName + ", " + sip.Customer.FirstName;
if (sip.Notice != null)
{
if (sip.ServiceInvoiceItems.Count > 0)
@@ -45,9 +47,24 @@ namespace SHKService
sip.CostBearer2SupportConcept.CustomerReferenceNumber = "LVG";
}
//var anhang = new SammelrechnungAnhang();
//xrSubreport1.ReportSource = anhang;
//anhang.SetReportDataSource(pRO);
pRO.ServiceInvoicePeriods.Sort((a, b) => a.Customer.LastNameFirstName.CompareTo(b.Customer.LastNameFirstName));
var count = pRO.ServiceInvoicePeriods.Count;
var pos = 1;
for (int i = 0; i < count; i++)
{
var sip = pRO.ServiceInvoicePeriods[i];
if (sip.ServiceInvoiceItems.Count > 0)
{
foreach (var ii in sip.ServiceInvoiceItems)
{
ii.CustomerFirstname = pos++.ToString();
if(ii.Notice == null && sip.SupportConceptApprovalPeriod != null && sip.SupportConceptApprovalPeriod.ApprovedBEPerInterval.HasValue)
{
ii.Notice = String.Format("{0:n0}", sip.SupportConceptApprovalPeriod.ApprovedBEPerInterval.Value);
}
}
}
}
this.bindingSource1.DataSource = pRO;
}

File diff suppressed because one or more lines are too long

View File

@@ -89,7 +89,8 @@ namespace SHKService.Invoicing
ItemPeriodEnd = serviceInvoicePeriod.End,
SupportConceptApprovalPeriodOid = supportConceptApprovalPeriod.SupportConceptApprovalPeriodOid,
AccountingInterval = AccountingIntervalType.Daily,
UnitCount = (decimal)(end - start).TotalDays + 1
UnitCount = (decimal)(end - start).TotalDays + 1,
Notice = String.Format("{0:n0}", supportConceptApprovalPeriod.ApprovedBEPerInterval.Value)
};
if (supportConceptApprovalPeriod.ServiceCategory.Name == "Fahrzeit")
{
@@ -107,14 +108,21 @@ namespace SHKService.Invoicing
else
{
ii.AmountPerUnit = supportConceptApprovalPeriod.ApprovedBEPerInterval * (decimal)Math.Round((double)data[0].AmountTotal / 60, 4, MidpointRounding.AwayFromZero);
if (!cb2sc.SupportConcept.Customer.Person.LastNameFirstName.Contains("(ka)"))
{
var LG = (decimal)GetLeistungsgruppe(supportConceptApprovalPeriod.ApprovedBEPerInterval);
if (data.Count > 0 && data[0].AmountTotal != null)
{
ii.AmountPerUnit = (decimal)Math.Round((double)data[0].AmountTotal * Math.Round((double)LG / 60, 2, MidpointRounding.AwayFromZero), 2, MidpointRounding.AwayFromZero);
//ii.AmountPerUnit = LG * (decimal)Math.Round((double)data[0].AmountTotal / 60, 4, MidpointRounding.AwayFromZero);
}
ii.ItemDescription = "Qualifizierte Assistenz";
ii.Notice = LG.ToString();
}
if (cb2sc.SupportConcept.Customer.Person.LastNameFirstName.Contains("(ka)"))
{
ii.ItemDescription = "Kompensatorische Assistenz";
}
else
{
ii.ItemDescription = "Qualifizierte Assistenz";
}
}
ii.AmountPerUnit = Math.Round((decimal)ii.AmountPerUnit, 2, MidpointRounding.AwayFromZero);
@@ -141,5 +149,46 @@ namespace SHKService.Invoicing
return 0;
}
private object GetLeistungsgruppe(decimal? approvedBEPerInterval)
{
// alle Leistungen werden in Stufen - sogenannten Leistungsgruppen abgerechnet -
// bei der QA tragen sie die tatsächlich bewilligten Minuten ein, um zu wissen wie viel sie leisten müssen - Abrechnung braucht aber LG
decimal lg = 60;
if (approvedBEPerInterval == null || approvedBEPerInterval.Value < 91)
{
lg = 60;
}
else if (approvedBEPerInterval.Value < 151)
{
lg = 120;
}
else if (approvedBEPerInterval.Value < 211)
{
lg = 180;
}
else if (approvedBEPerInterval.Value < 271)
{
lg = 240;
}
else if (approvedBEPerInterval.Value < 391)
{
lg = 330;
}
else if (approvedBEPerInterval.Value < 511)
{
lg = 450;
}
else if (approvedBEPerInterval.Value < 751)
{
lg = 630;
}
else if (approvedBEPerInterval.Value < 1051)
{
lg = 900;
}
return lg;
}
}
}