MH: Fehlbesuche auf QB für PsychosozialeHilfenBochum

This commit is contained in:
2022-12-30 10:45:46 +01:00
parent 0eb72d5e55
commit 94e12adef5
5 changed files with 174 additions and 60 deletions

View File

@@ -569,6 +569,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BehindertNaUnd", "ReportImp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HausDuelken", "ReportImp\HausDuelken\HausDuelken.csproj", "{ED3DBD24-B774-41E5-A856-99FF78D828A8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PsychosozialeHilfenBochum", "ReportImp\PsychosozialeHilfenBochum\PsychosozialeHilfenBochum.csproj", "{8CC19D28-E0C0-473F-A465-D2E5990C7789}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET
@@ -4508,6 +4510,22 @@ Global
{ED3DBD24-B774-41E5-A856-99FF78D828A8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{ED3DBD24-B774-41E5-A856-99FF78D828A8}.Release|x86.ActiveCfg = Release|Any CPU
{ED3DBD24-B774-41E5-A856-99FF78D828A8}.Release|x86.Build.0 = Release|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Debug|.NET.ActiveCfg = Debug|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Debug|.NET.Build.0 = Debug|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Debug|x86.ActiveCfg = Debug|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Debug|x86.Build.0 = Debug|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Release|.NET.ActiveCfg = Release|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Release|.NET.Build.0 = Release|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Release|Any CPU.Build.0 = Release|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Release|x86.ActiveCfg = Release|Any CPU
{8CC19D28-E0C0-473F-A465-D2E5990C7789}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -4788,6 +4806,7 @@ Global
{DEC65E83-5B19-42EC-A75E-C0A6AE700567} = {D8A691C5-146D-4613-86CC-438F02FE9106}
{13735B44-C4A2-467A-85C3-BDFD9939EE77} = {D8A691C5-146D-4613-86CC-438F02FE9106}
{ED3DBD24-B774-41E5-A856-99FF78D828A8} = {D8A691C5-146D-4613-86CC-438F02FE9106}
{8CC19D28-E0C0-473F-A465-D2E5990C7789} = {D8A691C5-146D-4613-86CC-438F02FE9106}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FBE985BB-9F0F-4DBB-8F94-ABC37A803FF9}

View File

@@ -65,9 +65,6 @@ namespace LebenshilfeCoburg.Invoicing
SetRecipientInformation(invoice, costBearer);
serviceRecords = MapperFactory.ServiceRecordDC_ServiceRecord.MapToNewDCs(DAOFactory.SearchDAO.FindServiceRecordsInSpan(invoicePeriod, null))
.Where(s => s.ServiceDescription.CategoryName == "Arbeitszeitstunden" || s.ServiceDescription.CategoryName == "Nachtdienst" || s.ServiceDescription.CategoryName == "individuelle Begleitung Hilfskraft").ToList();
SetServiceInvoicePeriods(invoice, invoice.InvoiceBase.CostBearer2SupportConcept, invoicePeriod,
serviceRecords);
@@ -87,89 +84,176 @@ namespace LebenshilfeCoburg.Invoicing
return null;
}
// Ein Mal pro Hilfeplan aufgerufen.
public override void SetServiceInvoicePeriods(ServiceInvoice invoice, CostBearer2SupportConcept costBearer2SupportConcept, DateTimeSpan invoicePeriod, List<ServiceRecordDC> serviceRecords)
{
{
var alleBookings = DAOFactory.SearchDAO.GetAdditionalServiceBookings(null, invoicePeriod.StartDate, invoicePeriod.EndDate);
var alleWohnheime = MapperFactory.WohnheimDC_Wohnheim.MapToNewDCs(DAOFactory.GenericDAO.GetAllActive<Wohnheim>());
var supportConcept = costBearer2SupportConcept.SupportConcept;
// Wohnheim, in dem der aktuelle Klient drin ist
WohnheimDC wohnheim = null;
// Alle An-/Abwesenheitseinträge für das entsprechende Wohnheim
List<AdditionalServiceBooking> bookings = new List<AdditionalServiceBooking>();
foreach (var wh in alleWohnheime)
{
var customersInWohnheim = new List<CompactCustomerDC>();
foreach (var rel in wh.RelatedCustomers)
customersInWohnheim.Add(rel.Customer);
if (customersInWohnheim.Any(c => c.CustomerOid == supportConcept.Customer.Oid))
{
wohnheim = wh;
break;
}
}
foreach (var b in alleBookings)
if (b.AdditionalServiceRegion.Name == wohnheim.WohnheimName)
bookings.Add(b);
Console.WriteLine();
var invoiceAccountingPeriodSpan = new DateTimeSpan
{
StartDateTime = invoice.InvoiceBase.AccountingPeriodStart.Value,
EndDateTime = invoice.InvoiceBase.AccountingPeriodEnd.Value
};
ServiceInvoicePeriodDC period = new ServiceInvoicePeriodDC()
{
Start = invoiceAccountingPeriodSpan.StartDate,
End = invoiceAccountingPeriodSpan.EndDate,
InvoiceItems = new List<InvoiceItemDC>()
};
#region ServiceInvoicePeriod-Variablen setzen (optional für diese Rechnung? Stellt sich am Ende raus
ServiceInvoicePeriod serviceInvoicePeriod = CreateServiceInvoicePeriod(MapperFactory.SupportConceptApprovalPeriodDC_SupportConceptApprovalPeriod.MapToNewDC(costBearer2SupportConcept.ApprovalPeriodList[0]), invoiceAccountingPeriodSpan);
serviceInvoicePeriod.SupportConceptApprovalPeriod = costBearer2SupportConcept.ApprovalPeriodList[0];
serviceInvoicePeriod.Customer = supportConcept.Customer;
SupportConceptApprovalPeriodDC approvalPeriodDC = MapperFactory.SupportConceptApprovalPeriodDC_SupportConceptApprovalPeriod.MapToNewDC(costBearer2SupportConcept.ApprovalPeriodList[0]);
CostBearer costBearer = costBearer2SupportConcept.CostBearer;
List<CostRatePeriodDC> costRates = MapperFactory.CostRatePeriodDC_CostRatePeriod.MapToNewDCs(costBearer.CostRatePeriods);
CostRatePeriodDC serviceUnit = costRates.GetCostRatePeriodForDate(CostRatePeriodType.MinutesPerServiceUnit, DateTime.Now);
serviceInvoicePeriod.ServiceUnitName = serviceUnit.UnitName;
#endregion
SetInvoiceItems(invoice, serviceInvoicePeriod, approvalPeriodDC, costBearer2SupportConcept, invoicePeriod, serviceRecords);
//foreach (SupportConceptApprovalPeriod iPeriod in costBearer2SupportConcept.ApprovalPeriodList)
//{
// SupportConceptApprovalPeriodDC approvalPeriodDC = MapperFactory.SupportConceptApprovalPeriodDC_SupportConceptApprovalPeriod.MapToNewDC(iPeriod);
foreach (SupportConceptApprovalPeriod iPeriod in costBearer2SupportConcept.ApprovalPeriodList)
{
#region auskommentierer Standardkram
//SupportConceptApprovalPeriodDC approvalPeriodDC = MapperFactory.SupportConceptApprovalPeriodDC_SupportConceptApprovalPeriod.MapToNewDC(iPeriod);
//if (approvalPeriodDC.Span.EndDateTime < invoiceAccountingPeriodSpan.StartDateTime || approvalPeriodDC.Span.StartDateTime > invoiceAccountingPeriodSpan.EndDate)
//{
// continue;
//}
//if (approvalPeriodDC.Span.EndDateTime < invoiceAccountingPeriodSpan.StartDateTime || approvalPeriodDC.Span.StartDateTime > invoiceAccountingPeriodSpan.EndDate)
//{
// continue;
//}
//ServiceInvoicePeriod serviceInvoicePeriod = CreateServiceInvoicePeriod(approvalPeriodDC, invoiceAccountingPeriodSpan);
//serviceInvoicePeriod.SupportConceptApprovalPeriod = iPeriod;
//serviceInvoicePeriod.Customer = costBearer2SupportConcept.SupportConcept.Customer;
//ServiceInvoicePeriod serviceInvoicePeriod = CreateServiceInvoicePeriod(approvalPeriodDC, invoiceAccountingPeriodSpan);
//serviceInvoicePeriod.SupportConceptApprovalPeriod = iPeriod;
//serviceInvoicePeriod.Customer = costBearer2SupportConcept.SupportConcept.Customer;
//CostBearer costBearer = costBearer2SupportConcept.CostBearer;
//List<CostRatePeriodDC> costRates = MapperFactory.CostRatePeriodDC_CostRatePeriod.MapToNewDCs(costBearer.CostRatePeriods);
//CostBearer costBearer = costBearer2SupportConcept.CostBearer;
//List<CostRatePeriodDC> costRates = MapperFactory.CostRatePeriodDC_CostRatePeriod.MapToNewDCs(costBearer.CostRatePeriods);
//CostRatePeriodDC serviceUnit = costRates.GetCostRatePeriodForDate(CostRatePeriodType.MinutesPerServiceUnit, DateTime.Now);
//serviceInvoicePeriod.ServiceUnitName = serviceUnit.UnitName;
//CostRatePeriodDC serviceUnit = costRates.GetCostRatePeriodForDate(CostRatePeriodType.MinutesPerServiceUnit, DateTime.Now);
//serviceInvoicePeriod.ServiceUnitName = serviceUnit.UnitName;
//Calculations calc = PluginLoader.FindClass<Calculations>(_SpecificID) ?? Calculations.GetInstance(_SpecificID);
//Calculations calc = PluginLoader.FindClass<Calculations>(_SpecificID) ?? Calculations.GetInstance(_SpecificID);
//decimal amountPerUnit;
//decimal unitCount;
//decimal amountPerUnit;
//decimal unitCount;
//serviceInvoicePeriod.ApprovedFixedAmount = calc.GetApprovedFixedAmountForPeriod(approvalPeriodDC, serviceInvoicePeriod.Start.Value, serviceInvoicePeriod.End.Value, out amountPerUnit, out unitCount);
//serviceInvoicePeriod.ApprovedFixedAmount = calc.GetApprovedFixedAmountForPeriod(approvalPeriodDC, serviceInvoicePeriod.Start.Value, serviceInvoicePeriod.End.Value, out amountPerUnit, out unitCount);
//if (!serviceInvoicePeriod.ApprovedFixedAmount.HasValue)
//{
// serviceInvoicePeriod.ApprovedHours = calc.GetApprovedHoursForPeriod(approvalPeriodDC,
// costRates,
// serviceInvoicePeriod.Start.Value,
// serviceInvoicePeriod.End.Value);
// if (serviceInvoicePeriod.ApprovedHours.HasValue)
// serviceInvoicePeriod.ApprovedBE = serviceUnit.GetHoursInBE(serviceInvoicePeriod.ApprovedHours.Value);
//if (!serviceInvoicePeriod.ApprovedFixedAmount.HasValue)
//{
// serviceInvoicePeriod.ApprovedHours = calc.GetApprovedHoursForPeriod(approvalPeriodDC,
// costRates,
// serviceInvoicePeriod.Start.Value,
// serviceInvoicePeriod.End.Value);
// if (serviceInvoicePeriod.ApprovedHours.HasValue)
// serviceInvoicePeriod.ApprovedBE = serviceUnit.GetHoursInBE(serviceInvoicePeriod.ApprovedHours.Value);
// serviceInvoicePeriod.ApprovedAmountDefaultHourlyRate = calc.GetApprovedAmountDefaultHourlyRateForPeriod(approvalPeriodDC,
// costRates,
// serviceInvoicePeriod.Start,
// serviceInvoicePeriod.End);
//}
//SetInvoiceItems(invoice, serviceInvoicePeriod, approvalPeriodDC, costBearer2SupportConcept, invoicePeriod, serviceRecords);
// serviceInvoicePeriod.ApprovedAmountDefaultHourlyRate = calc.GetApprovedAmountDefaultHourlyRateForPeriod(approvalPeriodDC,
// costRates,
// serviceInvoicePeriod.Start,
// serviceInvoicePeriod.End);
//}
//SetInvoiceItems(invoice, serviceInvoicePeriod, approvalPeriodDC, costBearer2SupportConcept, invoicePeriod, serviceRecords);
#endregion
//CheckMaxApprovedAmount(invoice, serviceInvoicePeriod, approvalPeriodDC, costBearer2SupportConcept, invoicePeriod, serviceRecords);
CheckMaxApprovedAmount(invoice, serviceInvoicePeriod, approvalPeriodDC, costBearer2SupportConcept, invoicePeriod, serviceRecords);
//if (serviceInvoicePeriod.InvoiceItemList.Count > 0)
// invoice.ServiceInvoicePeriodList.Add(serviceInvoicePeriod);
}
}
if (serviceInvoicePeriod.InvoiceItemList.Count > 0)
invoice.ServiceInvoicePeriodList.Add(serviceInvoicePeriod);
}
}
public override void CreateFixedAmounts(ServiceInvoicePeriod serviceInvoicePeriod, SupportConceptApprovalPeriodDC supportConceptApprovalPeriod, CostBearer2SupportConcept cb2sc)
{
var calc = PluginLoader.FindClass<Calculations>(_SpecificID) ?? Calculations.GetInstance(_SpecificID);
// HIER DIE DATEN AUS SetServiceInvoicePeriods HOLEN UND DANN DIE ITEMS ERSTELLEN & BERECHNEN
var alleBookings = DAOFactory.SearchDAO.GetAdditionalServiceBookings(null, serviceInvoicePeriod.Start.Value, serviceInvoicePeriod.End.Value);
var alleWohnheime = MapperFactory.WohnheimDC_Wohnheim.MapToNewDCs(DAOFactory.GenericDAO.GetAllActive<Wohnheim>());
var supportConcept = cb2sc.SupportConcept;
var serviceRecords = MapperFactory.ServiceRecordDC_ServiceRecord.MapToNewDCs(DAOFactory.SearchDAO.FindServiceRecords(null, null, null, serviceInvoicePeriod.Start.Value, serviceInvoicePeriod.End.Value))
.Where(s => s.ServiceDescription.CategoryName == "Arbeitszeitstunden" || s.ServiceDescription.CategoryName == "Nachtdienst" || s.ServiceDescription.CategoryName == "individuelle Begleitung Hilfskraft").ToList();
var bewilligteLeistungen = new List<SupportConceptApprovalPeriodDC>();
foreach (SupportConceptApprovalPeriod iPeriod in cb2sc.ApprovalPeriodList)
bewilligteLeistungen.Add(MapperFactory.SupportConceptApprovalPeriodDC_SupportConceptApprovalPeriod.MapToNewDC(iPeriod));
// Wohnheim, in dem der aktuelle Klient drin ist
WohnheimDC wohnheim = null;
// Alle An-/Abwesenheitseinträge für das entsprechende Wohnheim
List<AdditionalServiceBooking> bookings = new List<AdditionalServiceBooking>();
#region richtiges Wohnheim und dazugehörige ergänzende Dienste setzen
foreach (var wh in alleWohnheime)
{
var customersInWohnheim = new List<CompactCustomerDC>();
foreach (var rel in wh.RelatedCustomers)
customersInWohnheim.Add(rel.Customer);
if (customersInWohnheim.Any(c => c.CustomerOid == supportConcept.Customer.Oid))
{
wohnheim = wh;
break;
}
}
foreach (var b in alleBookings)
if (b.AdditionalServiceRegion.Name == wohnheim.WohnheimName)
bookings.Add(b);
#endregion
// Für jede der bewilligten Leistungen die entsprechende Regel zur Berechnung des Betrags anwenden.
foreach (var leistung in bewilligteLeistungen)
{
}
//var data = calc.GetFixedBillingData(supportConceptApprovalPeriod, serviceInvoicePeriod.Start, serviceInvoicePeriod.End);
#region auskommentierter Standardkram
//var data = calc.GetFixedBillingData(supportConceptApprovalPeriod, serviceInvoicePeriod.Start, serviceInvoicePeriod.End);
//foreach (var billingData in data)
//{
// serviceInvoicePeriod.InvoiceItemList.Add(new InvoiceItem
// {
// AmountTotal = billingData.AmountTotal,
// GrossAmountTotal = billingData.GrossAmountTotal,
// ItemPeriodStart = billingData.BillingPeriodStart,
// ItemPeriodEnd = billingData.BillingPeriodEnd,
// AccountingInterval = billingData.AccountingInterval,
// AmountPerUnit = billingData.AmountPerUnit,
// UnitCount = billingData.UnitCount
// });
//}
}
}
//foreach (var billingData in data)
//{
// serviceInvoicePeriod.InvoiceItemList.Add(new InvoiceItem
// {
// AmountTotal = billingData.AmountTotal,
// GrossAmountTotal = billingData.GrossAmountTotal,
// ItemPeriodStart = billingData.BillingPeriodStart,
// ItemPeriodEnd = billingData.BillingPeriodEnd,
// AccountingInterval = billingData.AccountingInterval,
// AmountPerUnit = billingData.AmountPerUnit,
// UnitCount = billingData.UnitCount
// });
//}
#endregion
}
}
}

View File

@@ -35,6 +35,7 @@ namespace LebenshilfeCoburg
var invoice = DAOFactory.GenericDAO.LoadByID<ServiceInvoice>(serviceInvoice.Oid.Value);
var dc = MapperFactory.ServiceInvoiceDC_ServiceInvoice.MapToNewDC(invoice);
var report = new LebenshilfeCoburg.Sammelrechnung();
report.SetReportDataSource(ServiceInvoiceRO.Create(dc));
report.CreateDocument();

View File

@@ -100,6 +100,12 @@
<Compile Include="QueryListReport.Designer.cs">
<DependentUpon>QueryListReport.cs</DependentUpon>
</Compile>
<Compile Include="Wohnheimrechnung.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Wohnheimrechnung.Designer.cs">
<DependentUpon>Wohnheimrechnung.cs</DependentUpon>
</Compile>
<Compile Include="ServicesOverviewReport.cs">
<SubType>Component</SubType>
</Compile>
@@ -129,6 +135,10 @@
<EmbeddedResource Include="QueryListReport.resx">
<DependentUpon>QueryListReport.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Wohnheimrechnung.resx">
<DependentUpon>Wohnheimrechnung.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="ServicesOverviewReport.resx">
<DependentUpon>ServicesOverviewReport.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -30,7 +30,7 @@ namespace PsychosozialeHilfenBochum
foreach (var sd in pRO.Services)
{
if (sd.IsBillable)
if (sd.IsBillable || sd.ServiceCategory == "Fehlbesuch")
{
ServicesOverviewRO.CreateSignatureString(sd);
if (sd.IsGroup)