From f146c925ef4092522df945f07e6334cc6444ea73 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 3 Sep 2024 10:56:05 +0200 Subject: [PATCH] =?UTF-8?q?EvVereinF=C3=BCrWohnraumhilfe/Invoicing/Collect?= =?UTF-8?q?iveInvoiceCreation=20-=20Bugfix=20u=20Aufhebung=20Bewilligung?= =?UTF-8?q?=20HP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CollectiveBillingReport.cs | 18 ++++-- .../CollectiveBillingReportTab.cs | 23 ++++--- .../Invoicing/CollectiveInvoiceCreation.cs | 64 +------------------ 3 files changed, 29 insertions(+), 76 deletions(-) diff --git a/ReportImp/EvVereinFürWohnraumhilfe/CollectiveBillingReport.cs b/ReportImp/EvVereinFürWohnraumhilfe/CollectiveBillingReport.cs index 98b9a6969..0139ebdba 100644 --- a/ReportImp/EvVereinFürWohnraumhilfe/CollectiveBillingReport.cs +++ b/ReportImp/EvVereinFürWohnraumhilfe/CollectiveBillingReport.cs @@ -23,17 +23,21 @@ namespace BeWo.Report.DefaultReports foreach (var sip in pRO.ServiceInvoicePeriods) { - if (sip.SupportConceptApprovalPeriod.ServiceCategory == null || sip.SupportConceptApprovalPeriod.ServiceCategory != null && sip.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("Monat")) - sip.ApprovedHours = 1; - else + if (sip.SupportConceptApprovalPeriod != null) { - DateTime end = sip.SupportConceptApprovalPeriod.EndDate ?? pRO.AccountingPeriodEnd; - DateTime start = sip.SupportConceptApprovalPeriod.StartDate ?? pRO.AccountingPeriodStart; - sip.ApprovedHours = (decimal)(end - start).TotalDays; + if (sip.SupportConceptApprovalPeriod.ServiceCategory == null || sip.SupportConceptApprovalPeriod.ServiceCategory != null && sip.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("Monat")) + sip.ApprovedHours = 1; + else + { + DateTime end = sip.SupportConceptApprovalPeriod.EndDate ?? pRO.AccountingPeriodEnd; + DateTime start = sip.SupportConceptApprovalPeriod.StartDate ?? pRO.AccountingPeriodStart; + + sip.ApprovedHours = (decimal)(end - start).TotalDays; + } } - if (sip.CostBearer2SupportConcept.CustomerReferenceNumber == null) + if (sip.CostBearer2SupportConcept != null && sip.CostBearer2SupportConcept.CustomerReferenceNumber == null) sip.CostBearer2SupportConcept.CustomerReferenceNumber = "LVG"; if (sip.Notice != null) { diff --git a/ReportImp/EvVereinFürWohnraumhilfe/CollectiveBillingReportTab.cs b/ReportImp/EvVereinFürWohnraumhilfe/CollectiveBillingReportTab.cs index cba1d14e7..7be9b2d0d 100644 --- a/ReportImp/EvVereinFürWohnraumhilfe/CollectiveBillingReportTab.cs +++ b/ReportImp/EvVereinFürWohnraumhilfe/CollectiveBillingReportTab.cs @@ -21,22 +21,29 @@ namespace EvVereinF foreach (var sip in pRO.ServiceInvoicePeriods) { + if (sip.Customer.LastNameFirstName.Contains("Prell")) + { + int test = 1; + } if (sip.Notice != null) { 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")) - sip.ApprovedHours = 1; - else + if (sip.SupportConceptApprovalPeriod != null) { - DateTime end = sip.SupportConceptApprovalPeriod.EndDate ?? pRO.AccountingPeriodEnd; - DateTime start = sip.SupportConceptApprovalPeriod.StartDate ?? pRO.AccountingPeriodStart; + if (sip.SupportConceptApprovalPeriod.ServiceCategory == null || sip.SupportConceptApprovalPeriod.ServiceCategory != null && sip.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("Monat")) + sip.ApprovedHours = 1; + else + { + DateTime end = sip.SupportConceptApprovalPeriod.EndDate ?? pRO.AccountingPeriodEnd; + DateTime start = sip.SupportConceptApprovalPeriod.StartDate ?? pRO.AccountingPeriodStart; - sip.ApprovedHours = (decimal)(end - start).TotalDays + 1; + sip.ApprovedHours = (decimal)(end - start).TotalDays + 1; + } + if (sip.CostBearer2SupportConcept != null && sip.CostBearer2SupportConcept.CustomerReferenceNumber == null) + sip.CostBearer2SupportConcept.CustomerReferenceNumber = "LVG"; } - if (sip.CostBearer2SupportConcept.CustomerReferenceNumber == null) - sip.CostBearer2SupportConcept.CustomerReferenceNumber = "LVG"; } //var anhang = new SammelrechnungAnhang(); diff --git a/ReportImp/EvVereinFürWohnraumhilfe/Invoicing/CollectiveInvoiceCreation.cs b/ReportImp/EvVereinFürWohnraumhilfe/Invoicing/CollectiveInvoiceCreation.cs index f9e342146..479b9e43d 100644 --- a/ReportImp/EvVereinFürWohnraumhilfe/Invoicing/CollectiveInvoiceCreation.cs +++ b/ReportImp/EvVereinFürWohnraumhilfe/Invoicing/CollectiveInvoiceCreation.cs @@ -18,8 +18,6 @@ namespace EvVereinF { public class CollectiveInvoiceCreation : InvoiceCreation { - private DateTime? accountingPeriodStart = null; - private DateTime? accountingPeriodEnd = null; public override void SetInvoiceId(ServiceInvoice invoice) { @@ -29,7 +27,8 @@ namespace EvVereinF public override ServiceInvoice CreateCollectiveBilling(CostBearer costBearer, DateTimeSpan invoicePeriod, Dictionary> supportConcepts2ServiceRecords) { - FuegeAbgelaufeneHilfeplaeneMitAktuellenBewilligungenHinzu(costBearer, invoicePeriod, supportConcepts2ServiceRecords); + // 02.09.2024: ist nicht mehr nötig + // FuegeAbgelaufeneHilfeplaeneMitAktuellenBewilligungenHinzu(costBearer, invoicePeriod, supportConcepts2ServiceRecords); var invoice = new ServiceInvoice(); var newDict = new Dictionary>(); @@ -59,33 +58,6 @@ namespace EvVereinF return invoice; } - private void FuegeAbgelaufeneHilfeplaeneMitAktuellenBewilligungenHinzu(CostBearer costBearer, DateTimeSpan invoicePeriod, Dictionary> supportConcepts2ServiceRecords) - { - var alleHilfeplaene = DAOFactory.GenericDAO.GetAllActiveAndArchived(); - var cs = new CustomerService(); - - foreach (var sc in alleHilfeplaene) - { - foreach (var c2s in sc.CostBearer2SupportConceptList) - { - if (c2s.EndDate < invoicePeriod.StartDate) - { - if (c2s.CostBearer.Oid == costBearer.Oid) - { - foreach (var ap in c2s.ApprovalPeriodList) - { - if (ap.EndDate >= invoicePeriod.StartDate && ap.StartDate <= invoicePeriod.EndDate) - { - var scDc = cs.CreateFlatSupportConcept(sc, c2s); - supportConcepts2ServiceRecords.Add(scDc, new List()); - } - } - } - } - } - } - } - public override void SetServiceInvoicePeriods(ServiceInvoice invoice, CostBearer2SupportConcept costBearer2SupportConcept, DateTimeSpan invoicePeriod, List serviceRecords) { var invoiceAccountingPeriodSpan = new DateTimeSpan @@ -144,37 +116,7 @@ namespace EvVereinF invoice.ServiceInvoicePeriodList.Add(serviceInvoicePeriod); } } - //if (invoice.ServiceInvoicePeriodList.Count > 0) - //{ - // decimal cor = 0; - - // for (int i = invoice.ServiceInvoicePeriodList.Count - 1; i >= 0; i--) - // { - // var sip = invoice.ServiceInvoicePeriodList[i]; - // if (sip.SupportConceptApprovalPeriod.ServiceCategory == null) - // { - // cor = sip.InvoiceItemList[0].AmountTotal.Value; - // var cb2scOid = sip.SupportConceptApprovalPeriod.CostBearer2SupportConcept.Oid; - // var sipOther = invoice.ServiceInvoicePeriodList.Where(s => s.SupportConceptApprovalPeriod.CostBearer2SupportConcept.Oid == cb2scOid); - // var sipCor = sipOther.FirstOrDefault(s => s.SupportConceptApprovalPeriod.ServiceCategory != null); - - // if (sipCor != null && cor != 0) - // { - // sipCor.InvoiceItemList[0].AmountTotal += cor; - // sipCor.InvoiceItemList[0].GrossAmountTotal += cor; - // sipCor.Notice = String.Format("{0:0.00}", cor); - // invoice.ServiceInvoicePeriodList.Remove(sip); - // } - // if (costBearer2SupportConcept.ApprovedEndDate < invoicePeriod.StartDate) - // { - // //sip.InvoiceItemList[0].AmountTotal += cor; - // //sip.InvoiceItemList[0].GrossAmountTotal += cor; - // sip.Notice = String.Format("{0:0.00}", cor); - // //invoice.ServiceInvoicePeriodList.Remove(sip); - // } - // } - // } - + if (invoice.ServiceInvoicePeriodList.Count > 0) { foreach (var sip in invoice.ServiceInvoicePeriodList)