diff --git a/ReportImp/ChristopherusHausFamilienhilfe/ServiceInvoiceReport.cs b/ReportImp/ChristopherusHausFamilienhilfe/ServiceInvoiceReport.cs index 3a8ab8647..75d37cb48 100644 --- a/ReportImp/ChristopherusHausFamilienhilfe/ServiceInvoiceReport.cs +++ b/ReportImp/ChristopherusHausFamilienhilfe/ServiceInvoiceReport.cs @@ -20,7 +20,13 @@ namespace ChristopherusHausFamilienhilfe DateTime start = pRO.AccountingPeriodStart; DateTime end = pRO.AccountingPeriodEnd; - if (!String.IsNullOrEmpty(pRO.RecipientOrganisation)) + // Klientin Maren Völpert wird noch bis Juli 23 betreut und bekommt unabhängig vom KT einen anderen Paragrafen. Daher frage ich jetzt speziell nach ihrem Namen ab und setze dafür dann den Paragrafen + + if (pRO.CustomerLastName.ToLower() == "völpert" && pRO.CustomerFirstName.ToLower() == "maren") + { + lblLeistung.Text = "Nach § 41 i.V.m. § 35 SGB VIII"; + } + else if (!String.IsNullOrEmpty(pRO.RecipientOrganisation)) { if (pRO.RecipientOrganisation == "Stadt Herne") lblLeistung.Text = "Nach § 113 SGB IX in Verbindung mit § 78 SGB IX"; diff --git a/ReportImp/LebenshilfeCoburg/Invoicing/LhCoburgInvoiceFactory.cs b/ReportImp/LebenshilfeCoburg/Invoicing/LhCoburgInvoiceFactory.cs index 1c124d0d0..934019bc3 100644 --- a/ReportImp/LebenshilfeCoburg/Invoicing/LhCoburgInvoiceFactory.cs +++ b/ReportImp/LebenshilfeCoburg/Invoicing/LhCoburgInvoiceFactory.cs @@ -32,6 +32,7 @@ namespace LebenshilfeCoburg.Invoicing { name = sd.Name.ToLower().Trim(); } + if (name == "auw pers. budget") { return new LhCoburgPBInvoiceCreation(); @@ -40,6 +41,10 @@ namespace LebenshilfeCoburg.Invoicing { return new LhCoburgAusbildungsassistenzInvoiceCreation(); } + if (name == "ind. p/b fk" || name == "nw fk" || name == "nw hk" || name == "gem fk" || name == "gem hk" || name == "ind. begl. hk" || name == "hw") + { + return new LhCoburgWohnheimInvoiceCreation(); + } } } } diff --git a/ReportImp/LebenshilfeCoburg/Invoicing/LhCoburgWohnheimInvoiceCreation.cs b/ReportImp/LebenshilfeCoburg/Invoicing/LhCoburgWohnheimInvoiceCreation.cs new file mode 100644 index 000000000..2f528201f --- /dev/null +++ b/ReportImp/LebenshilfeCoburg/Invoicing/LhCoburgWohnheimInvoiceCreation.cs @@ -0,0 +1,175 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using System.Windows.Forms.VisualStyles; +using BeWo.Data.Access; +using BeWo.Data.Entities; +using BeWo.Service.DCEntityMapper; +using BeWo.Service.Invoicing; +using BeWo.Service.Plugins; +using BS.Shared; +using BS.Shared.Core; +using BS.Shared.DataContracts; +using BS.Shared.DataContracts.Compact; +using BS.Shared.Extensions; +using BS.Shared.Services; + +namespace LebenshilfeCoburg.Invoicing +{ + public class LhCoburgWohnheimInvoiceCreation : InvoiceCreation + { + private DateTime? accountingPeriodStart = null; + private DateTime? accountingPeriodEnd = null; + + public override void SetInvoiceId(ServiceInvoice invoice) + { + invoice.InvoiceBase.InvoiceId = "Wohnheim"; + invoice.InvoiceBase.InvoiceTypeText = "Wohnheim"; + } + + public override void SetInvoiceBaseData(int invoiceCounter, ServiceInvoice invoice, CostBearer costBearer, DateTimeSpan invoicePeriod, + IList supportConceptList) + { + if (invoicePeriod != null) + { + accountingPeriodStart = invoicePeriod.StartDate; + accountingPeriodEnd = invoicePeriod.EndDate; + } + base.SetInvoiceBaseData(invoiceCounter, invoice, costBearer, invoicePeriod, supportConceptList); + } + + public override void SetInvoiceItems(ServiceInvoice invoice, + ServiceInvoicePeriod serviceInvoicePeriod, + SupportConceptApprovalPeriodDC supportConceptApprovalPeriod, + CostBearer2SupportConcept cb2sc, + DateTimeSpan invoicePeriod, + List serviceRecords) + { + CreateFixedAmounts(serviceInvoicePeriod, supportConceptApprovalPeriod, cb2sc); + } + + + public override ServiceInvoice CreateSingleInvoice(int invoiceCounter, CostBearer costBearer, DateTimeSpan invoicePeriod, CompactSupportConceptDC supportConcept, List serviceRecords) + { + if (supportConcept.IsApproved) + { + var invoice = new ServiceInvoice(); + + var supportConceptList = new List { supportConcept }; + + + SetSenderInformation(invoice); + SetInvoiceBaseData(invoiceCounter, invoice, costBearer, invoicePeriod, supportConceptList); + SetSingleInvoiceBaseData(invoiceCounter, invoice, costBearer, invoicePeriod, supportConcept); + + 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); + + SetServiceInvoicePeriodAmounts(invoice); + + // Spitzabrechnung + if (invoicePeriod == null) + { + SetAmountAdvancePayments(invoice); + SetAmountEquityContribution(invoice); + } + + return invoice; + } + + return null; + } + + + public override void SetServiceInvoicePeriods(ServiceInvoice invoice, CostBearer2SupportConcept costBearer2SupportConcept, DateTimeSpan invoicePeriod, List serviceRecords) + { + var invoiceAccountingPeriodSpan = new DateTimeSpan + { + StartDateTime = invoice.InvoiceBase.AccountingPeriodStart.Value, + EndDateTime = invoice.InvoiceBase.AccountingPeriodEnd.Value + }; + + + + //foreach (SupportConceptApprovalPeriod iPeriod in costBearer2SupportConcept.ApprovalPeriodList) + //{ + // SupportConceptApprovalPeriodDC approvalPeriodDC = MapperFactory.SupportConceptApprovalPeriodDC_SupportConceptApprovalPeriod.MapToNewDC(iPeriod); + + + //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; + + //CostBearer costBearer = costBearer2SupportConcept.CostBearer; + //List costRates = MapperFactory.CostRatePeriodDC_CostRatePeriod.MapToNewDCs(costBearer.CostRatePeriods); + + //CostRatePeriodDC serviceUnit = costRates.GetCostRatePeriodForDate(CostRatePeriodType.MinutesPerServiceUnit, DateTime.Now); + //serviceInvoicePeriod.ServiceUnitName = serviceUnit.UnitName; + + //Calculations calc = PluginLoader.FindClass(_SpecificID) ?? Calculations.GetInstance(_SpecificID); + + //decimal amountPerUnit; + //decimal 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); + + // serviceInvoicePeriod.ApprovedAmountDefaultHourlyRate = calc.GetApprovedAmountDefaultHourlyRateForPeriod(approvalPeriodDC, + // costRates, + // serviceInvoicePeriod.Start, + // serviceInvoicePeriod.End); + //} + //SetInvoiceItems(invoice, serviceInvoicePeriod, approvalPeriodDC, costBearer2SupportConcept, invoicePeriod, serviceRecords); + + //CheckMaxApprovedAmount(invoice, serviceInvoicePeriod, approvalPeriodDC, costBearer2SupportConcept, invoicePeriod, serviceRecords); + + //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); + + + + //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 + // }); + //} + } + } + +} diff --git a/ReportImp/LebenshilfeCoburg/LebenshilfeCoburg.csproj b/ReportImp/LebenshilfeCoburg/LebenshilfeCoburg.csproj index f5e67b571..c89658abe 100644 --- a/ReportImp/LebenshilfeCoburg/LebenshilfeCoburg.csproj +++ b/ReportImp/LebenshilfeCoburg/LebenshilfeCoburg.csproj @@ -79,6 +79,7 @@ AusbildungsassistenzRechnung.cs + Component