From 94e12adef56d700bbf2e246a44e30e0cbc5e6085 Mon Sep 17 00:00:00 2001 From: Marcel Hirschle Date: Fri, 30 Dec 2022 10:45:46 +0100 Subject: [PATCH] =?UTF-8?q?MH:=20Fehlbesuche=20auf=20QB=20f=C3=BCr=20Psych?= =?UTF-8?q?osozialeHilfenBochum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo.sln | 19 ++ .../LhCoburgWohnheimInvoiceCreation.cs | 202 +++++++++++++----- .../LHCoburgReportCreator.cs | 1 + .../LebenshilfeCoburg.csproj | 10 + .../Quittierungsbeleg.cs | 2 +- 5 files changed, 174 insertions(+), 60 deletions(-) diff --git a/BeWo.sln b/BeWo.sln index 9eea3e3bb..3fa113540 100644 --- a/BeWo.sln +++ b/BeWo.sln @@ -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} diff --git a/ReportImp/LebenshilfeCoburg/Invoicing/LhCoburgWohnheimInvoiceCreation.cs b/ReportImp/LebenshilfeCoburg/Invoicing/LhCoburgWohnheimInvoiceCreation.cs index 2f528201f..836271f78 100644 --- a/ReportImp/LebenshilfeCoburg/Invoicing/LhCoburgWohnheimInvoiceCreation.cs +++ b/ReportImp/LebenshilfeCoburg/Invoicing/LhCoburgWohnheimInvoiceCreation.cs @@ -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 serviceRecords) - { + { + var alleBookings = DAOFactory.SearchDAO.GetAdditionalServiceBookings(null, invoicePeriod.StartDate, invoicePeriod.EndDate); + var alleWohnheime = MapperFactory.WohnheimDC_Wohnheim.MapToNewDCs(DAOFactory.GenericDAO.GetAllActive()); + 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 bookings = new List(); + foreach (var wh in alleWohnheime) + { + var customersInWohnheim = new List(); + 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() + }; + + + #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 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 costRates = MapperFactory.CostRatePeriodDC_CostRatePeriod.MapToNewDCs(costBearer.CostRatePeriods); + //CostBearer costBearer = costBearer2SupportConcept.CostBearer; + //List 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(_SpecificID) ?? Calculations.GetInstance(_SpecificID); + //Calculations calc = PluginLoader.FindClass(_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(_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()); + 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(); + 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 bookings = new List(); + #region richtiges Wohnheim und dazugehörige ergänzende Dienste setzen + foreach (var wh in alleWohnheime) + { + var customersInWohnheim = new List(); + 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 + } + } } diff --git a/ReportImp/LebenshilfeCoburg/LHCoburgReportCreator.cs b/ReportImp/LebenshilfeCoburg/LHCoburgReportCreator.cs index f90908e20..3ea6955e1 100644 --- a/ReportImp/LebenshilfeCoburg/LHCoburgReportCreator.cs +++ b/ReportImp/LebenshilfeCoburg/LHCoburgReportCreator.cs @@ -35,6 +35,7 @@ namespace LebenshilfeCoburg var invoice = DAOFactory.GenericDAO.LoadByID(serviceInvoice.Oid.Value); var dc = MapperFactory.ServiceInvoiceDC_ServiceInvoice.MapToNewDC(invoice); + var report = new LebenshilfeCoburg.Sammelrechnung(); report.SetReportDataSource(ServiceInvoiceRO.Create(dc)); report.CreateDocument(); diff --git a/ReportImp/LebenshilfeCoburg/LebenshilfeCoburg.csproj b/ReportImp/LebenshilfeCoburg/LebenshilfeCoburg.csproj index c89658abe..c3e6ef0f1 100644 --- a/ReportImp/LebenshilfeCoburg/LebenshilfeCoburg.csproj +++ b/ReportImp/LebenshilfeCoburg/LebenshilfeCoburg.csproj @@ -100,6 +100,12 @@ QueryListReport.cs + + Component + + + Wohnheimrechnung.cs + Component @@ -129,6 +135,10 @@ QueryListReport.cs + + Wohnheimrechnung.cs + Designer + ServicesOverviewReport.cs diff --git a/ReportImp/PsychosozialeHilfenBochum/Quittierungsbeleg.cs b/ReportImp/PsychosozialeHilfenBochum/Quittierungsbeleg.cs index 458aca8e0..2ff1fec7b 100644 --- a/ReportImp/PsychosozialeHilfenBochum/Quittierungsbeleg.cs +++ b/ReportImp/PsychosozialeHilfenBochum/Quittierungsbeleg.cs @@ -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)