From d7be5332f345554f80d11565c35cb91cc4408e07 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Mon, 15 Jul 2024 16:58:47 +0200 Subject: [PATCH] PerspektivenEV/CollectiveBillingReportTabBthg - Einbau Spitzabrechnung --- .../CollectiveBillingReportTabBthg.cs | 11 +++- ...CollectiveBillingReportTabBthg.designer.cs | 45 +++++++------- .../PerspektivenEV/CustomReportCreator.cs | 58 +++++++++++++++++-- .../CollectiveInvoiceCreationBthg.cs | 42 ++++++++------ 4 files changed, 107 insertions(+), 49 deletions(-) diff --git a/ReportImp/PerspektivenEV/CollectiveBillingReportTabBthg.cs b/ReportImp/PerspektivenEV/CollectiveBillingReportTabBthg.cs index ff29d9aa2..6574ad03b 100644 --- a/ReportImp/PerspektivenEV/CollectiveBillingReportTabBthg.cs +++ b/ReportImp/PerspektivenEV/CollectiveBillingReportTabBthg.cs @@ -125,14 +125,19 @@ namespace PerspektivenEV pRO.ServiceInvoicePeriods.Sort((a, b) => a.Customer.LastNameFirstName.CompareTo(b.Customer.LastNameFirstName)); var count = pRO.ServiceInvoicePeriods.Count; + var pos = 0; for (int i = 0; i < count; i++) { var sip = pRO.ServiceInvoicePeriods[i]; - sip.NotBillableString = i.ToString(); + sip.NotBillableString = pos++.ToString(); if (sip.ServiceInvoiceItems.Count > 0) { - sip.ServiceInvoiceItems[0].CustomerFirstname = i.ToString(); - sip.ServiceInvoiceItems[0].CustomerLastname = sip.Customer.CustomerOid.ToString(); + foreach (var ii in sip.ServiceInvoiceItems) + { + ii.CustomerFirstname = pos++.ToString(); + pos++; + ii.CustomerLastname = sip.Customer.CustomerOid.ToString(); + } } //if (sip.Notice != null) //{ diff --git a/ReportImp/PerspektivenEV/CollectiveBillingReportTabBthg.designer.cs b/ReportImp/PerspektivenEV/CollectiveBillingReportTabBthg.designer.cs index f933614a7..06b63f267 100644 --- a/ReportImp/PerspektivenEV/CollectiveBillingReportTabBthg.designer.cs +++ b/ReportImp/PerspektivenEV/CollectiveBillingReportTabBthg.designer.cs @@ -29,11 +29,11 @@ namespace PerspektivenEV private void InitializeComponent() { this.components = new System.ComponentModel.Container(); + DevExpress.XtraReports.UI.XRSummary xrSummary1 = new DevExpress.XtraReports.UI.XRSummary(); DevExpress.XtraReports.UI.XRSummary xrSummary2 = new DevExpress.XtraReports.UI.XRSummary(); DevExpress.XtraReports.UI.XRGroupSortingSummary xrGroupSortingSummary1 = new DevExpress.XtraReports.UI.XRGroupSortingSummary(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SammelrechnungTabBthg)); DevExpress.XtraReports.UI.XRSummary xrSummary3 = new DevExpress.XtraReports.UI.XRSummary(); - DevExpress.XtraReports.UI.XRSummary xrSummary1 = new DevExpress.XtraReports.UI.XRSummary(); DevExpress.XtraReports.UI.XRWatermark xrWatermark1 = new DevExpress.XtraReports.UI.XRWatermark(); this.Detail = new DevExpress.XtraReports.UI.DetailBand(); this.ReportHeader = new DevExpress.XtraReports.UI.ReportHeaderBand(); @@ -44,6 +44,7 @@ namespace PerspektivenEV this.xrTable1 = new DevExpress.XtraReports.UI.XRTable(); this.xrTableRow2 = new DevExpress.XtraReports.UI.XRTableRow(); this.xrTableCell11 = new DevExpress.XtraReports.UI.XRTableCell(); + this.xrTableCell1 = new DevExpress.XtraReports.UI.XRTableCell(); this.ruleNoticeNull = new DevExpress.XtraReports.UI.FormattingRule(); this.DetailReport = new DevExpress.XtraReports.UI.DetailReportBand(); this.Detail1 = new DevExpress.XtraReports.UI.DetailBand(); @@ -96,7 +97,6 @@ namespace PerspektivenEV this.fieldMonatskontingent = new DevExpress.XtraReports.UI.CalculatedField(); this.PageFooter = new DevExpress.XtraReports.UI.PageFooterBand(); this.xrPageInfo2 = new DevExpress.XtraReports.UI.XRPageInfo(); - this.xrTableCell1 = new DevExpress.XtraReports.UI.XRTableCell(); this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable2)).BeginInit(); @@ -182,6 +182,25 @@ namespace PerspektivenEV this.xrTableCell11.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; this.xrTableCell11.Weight = 1.9128650948316184D; // + // xrTableCell1 + // + this.xrTableCell1.Borders = ((DevExpress.XtraPrinting.BorderSide)(((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Right) + | DevExpress.XtraPrinting.BorderSide.Bottom))); + this.xrTableCell1.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "ServiceInvoicePeriods.ServiceInvoiceItems.NetAmount")}); + this.xrTableCell1.Font = new DevExpress.Drawing.DXFont("Arial", 8.25F, DevExpress.Drawing.DXFontStyle.Bold, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] { + new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrTableCell1.Multiline = true; + this.xrTableCell1.Name = "xrTableCell1"; + this.xrTableCell1.StylePriority.UseBorders = false; + this.xrTableCell1.StylePriority.UseFont = false; + this.xrTableCell1.StylePriority.UseTextAlignment = false; + xrSummary1.FormatString = "{0:C2}"; + xrSummary1.Running = DevExpress.XtraReports.UI.SummaryRunning.Report; + this.xrTableCell1.Summary = xrSummary1; + this.xrTableCell1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; + this.xrTableCell1.Weight = 0.23525351325611044D; + // // ruleNoticeNull // this.ruleNoticeNull.Condition = "[Notice] == ?"; @@ -372,7 +391,7 @@ namespace PerspektivenEV // this.xrTableCell29.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Bottom))); this.xrTableCell29.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { - new DevExpress.XtraReports.UI.XRBinding("Text", null, "ServiceInvoicePeriods.ServiceInvoiceItems.Hours", "{0:n0}")}); + new DevExpress.XtraReports.UI.XRBinding("Text", null, "ServiceInvoicePeriods.ServiceInvoiceItems.Hours")}); this.xrTableCell29.Font = new DevExpress.Drawing.DXFont("Arial", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] { new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); this.xrTableCell29.Name = "xrTableCell29"; @@ -381,6 +400,7 @@ namespace PerspektivenEV this.xrTableCell29.StylePriority.UseTextAlignment = false; this.xrTableCell29.Text = "xrTableCell17"; this.xrTableCell29.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; + this.xrTableCell29.TextFormatString = "{0:0.##}"; this.xrTableCell29.Weight = 0.22192813805721787D; // // xrTableCell3 @@ -810,25 +830,6 @@ namespace PerspektivenEV this.xrPageInfo2.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopRight; this.xrPageInfo2.TextFormatString = "Seite {0} von {1}"; // - // xrTableCell1 - // - this.xrTableCell1.Borders = ((DevExpress.XtraPrinting.BorderSide)(((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Right) - | DevExpress.XtraPrinting.BorderSide.Bottom))); - this.xrTableCell1.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { - new DevExpress.XtraReports.UI.XRBinding("Text", null, "ServiceInvoicePeriods.ServiceInvoiceItems.NetAmount")}); - this.xrTableCell1.Font = new DevExpress.Drawing.DXFont("Arial", 8.25F, DevExpress.Drawing.DXFontStyle.Bold, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] { - new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); - this.xrTableCell1.Multiline = true; - this.xrTableCell1.Name = "xrTableCell1"; - this.xrTableCell1.StylePriority.UseBorders = false; - this.xrTableCell1.StylePriority.UseFont = false; - this.xrTableCell1.StylePriority.UseTextAlignment = false; - xrSummary1.FormatString = "{0:C2}"; - xrSummary1.Running = DevExpress.XtraReports.UI.SummaryRunning.Report; - this.xrTableCell1.Summary = xrSummary1; - this.xrTableCell1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; - this.xrTableCell1.Weight = 0.23525351325611044D; - // // bindingSource1 // this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO); diff --git a/ReportImp/PerspektivenEV/CustomReportCreator.cs b/ReportImp/PerspektivenEV/CustomReportCreator.cs index e9e466fc5..7badaeeb4 100644 --- a/ReportImp/PerspektivenEV/CustomReportCreator.cs +++ b/ReportImp/PerspektivenEV/CustomReportCreator.cs @@ -47,8 +47,8 @@ namespace PerspektivenEV if (qro != null && qro.Rows.Count > 0) { long c2sOid = Int64.Parse(qro.Rows[0].Field1.ToString()); - - var ro = LwvKASpitzabrechnungRO.Create(c2sOid); + long? cat = Int64.Parse(qro.Rows[0].Field2.ToString()); + var ro = LwvKASpitzabrechnungRO.Create(c2sOid, null, cat); var report = new LwvKASpitzabrechnung(); report.SetReportDataSource(ro); @@ -100,8 +100,23 @@ namespace PerspektivenEV ServiceInvoiceRO ro = ServiceInvoiceRO.Create(firstInv[0]); anhang.SetReportDataSource(ro); anhang.CreateDocument(); + if (ro.ServiceInvoicePeriods != null && ro.ServiceInvoicePeriods.Count > 0) + { + foreach (var sip in ro.ServiceInvoicePeriods) + { + if (sip.ServiceInvoiceItems != null && sip.ServiceInvoiceItems.Count > 1 + && sip.SupportConceptApprovalPeriod.ServiceCategory.Abbreviation.Substring(sip.SupportConceptApprovalPeriod.ServiceCategory.Abbreviation.Length - 2) == "KA") + { + var anhang2 = new LwvKASpitzabrechnung(); + var kaRo = LwvKASpitzabrechnungRO.Create(sip.CostBearer2SupportConcept.Oid.Value, sip.SupportConceptApprovalPeriod.Oid.Value, null); + anhang2.SetReportDataSource(kaRo); + anhang2.CreateDocument(); + ((XtraReport)anhang).Pages.AddRange(((XtraReport)anhang2).Pages); + } + } + } + return (XtraReport)anhang; } - return (XtraReport)anhang; } return new XtraReport(); } @@ -200,13 +215,30 @@ namespace PerspektivenEV var invoice = DAOFactory.GenericDAO.LoadByID(oid); var idc = MapperFactory.ServiceInvoiceDC_ServiceInvoice.MapToNewDC(invoice); + XtraReport invoiceReport = null; var anhang = new SammelrechnungTabBthgIntern(); var ro = ServiceInvoiceRO.Create(idc); anhang.SetReportDataSource(ro); anhang.CreateDocument(); - //invoiceReport = anhang; - return anhang; + if (ro.ServiceInvoicePeriods != null && ro.ServiceInvoicePeriods.Count > 0) + { + foreach (var sip in ro.ServiceInvoicePeriods) + { + if (sip.ServiceInvoiceItems != null && sip.ServiceInvoiceItems.Count > 1 + && sip.SupportConceptApprovalPeriod.ServiceCategory.Abbreviation.Substring(sip.SupportConceptApprovalPeriod.ServiceCategory.Abbreviation.Length - 2) == "KA") + { + var anhang2 = new LwvKASpitzabrechnung(); + var kaRo = LwvKASpitzabrechnungRO.Create(sip.CostBearer2SupportConcept.Oid.Value, sip.SupportConceptApprovalPeriod.Oid.Value, null); + anhang2.SetReportDataSource(kaRo); + anhang2.CreateDocument(); + ((XtraReport)anhang).Pages.AddRange(((XtraReport)anhang2).Pages); + } + } + } + invoiceReport = anhang as XtraReport; + + return invoiceReport; } public override XtraReport CreateServiceInvoiceReport(string dcIds, long? invoiceBaseOid) @@ -266,6 +298,22 @@ namespace PerspektivenEV anhang.SetReportDataSource(ro); anhang.CreateDocument(); ((XtraReport)singleReport).Pages.AddRange(((XtraReport)anhang).Pages); + + if (ro.ServiceInvoicePeriods != null && ro.ServiceInvoicePeriods.Count > 0) + { + foreach (var sip in ro.ServiceInvoicePeriods) + { + if (sip.ServiceInvoiceItems != null && sip.ServiceInvoiceItems.Count > 1 + && sip.SupportConceptApprovalPeriod.ServiceCategory.Abbreviation.Substring(sip.SupportConceptApprovalPeriod.ServiceCategory.Abbreviation.Length - 2) == "KA") + { + var anhang2 = new LwvKASpitzabrechnung(); + var kaRo = LwvKASpitzabrechnungRO.Create(sip.CostBearer2SupportConcept.Oid.Value, sip.SupportConceptApprovalPeriod.Oid.Value, null); + anhang2.SetReportDataSource(kaRo); + anhang2.CreateDocument(); + ((XtraReport)singleReport).Pages.AddRange(((XtraReport)anhang2).Pages); + } + } + } invoiceReport = singleReport as XtraReport; } } diff --git a/ReportImp/PerspektivenEV/Invoicing/CollectiveInvoiceCreationBthg.cs b/ReportImp/PerspektivenEV/Invoicing/CollectiveInvoiceCreationBthg.cs index 479e6f251..9bfaf6ea1 100644 --- a/ReportImp/PerspektivenEV/Invoicing/CollectiveInvoiceCreationBthg.cs +++ b/ReportImp/PerspektivenEV/Invoicing/CollectiveInvoiceCreationBthg.cs @@ -331,27 +331,31 @@ namespace PerspektivenEV.Invoicing } ii.GrossAmountTotal = ii.AmountTotal; + serviceInvoicePeriod.InvoiceItemList.Add(ii); // ToDo!!! letzter Monat wird bei Kompensatorischer Assistenz spitzabgerechnet!!! - // siehe Übersicht Umstellung Vergütung...xlsx -> hier kommt die normale Monatszeile plus je eine Zeile pro Jahr mit zu wenig erbrachten Stunden! - //if (cat.Abbreviation.Substring(cat.Abbreviation.Length - 4) == "KAFZ" || cat.Abbreviation.Substring(cat.Abbreviation.Length - 5) == "KAAlt" || cat.Abbreviation.Substring(cat.Abbreviation.Length - 2) == "KA") - //{ - // if (supportConceptApprovalPeriod.EndDate.Value <= accountingPeriodEnd.Value.AddMonths(1)) - // { - // if (cat.Abbreviation.Substring(cat.Abbreviation.Length - 5) == "KAAlt" || cat.Abbreviation.Substring(cat.Abbreviation.Length - 2) == "KA") - // { - // serviceInvoicePeriod.InvoiceItemList.Add(ii); - // } - // } - // else - // { - // serviceInvoicePeriod.InvoiceItemList.Add(ii); - //} - //} - //else - //{ - serviceInvoicePeriod.InvoiceItemList.Add(ii); - //} + if (cat.Abbreviation.Substring(cat.Abbreviation.Length - 2) == "KA" && supportConceptApprovalPeriod.EndDate.Value <= accountingPeriodEnd.Value.AddMonths(1) + && supportConceptApprovalPeriod.EndDate.Value >= accountingPeriodStart.Value) + { + var ro = LwvKASpitzabrechnungRO.Create(cb2sc.Oid.Value, supportConceptApprovalPeriod.SupportConceptApprovalPeriodOid, null); + foreach (var pz in ro.Preiszeitraeume) + { + var iiKa = new InvoiceItem + { + ItemPeriodStart = serviceInvoicePeriod.Start, + ItemPeriodEnd = serviceInvoicePeriod.End, + SupportConceptApprovalPeriodOid = supportConceptApprovalPeriod.SupportConceptApprovalPeriodOid, + AccountingInterval = AccountingIntervalType.Daily, + UnitCount = pz.SummeStundenDifferenz.Value, + AmountPerUnit = pz.Stundensatz.Value, + AmountTotal = Math.Round(pz.SummeBetragDifferenz.Value, 2, MidpointRounding.AwayFromZero), + GrossAmountTotal = Math.Round(pz.SummeBetragDifferenz.Value, 2, MidpointRounding.AwayFromZero), + ItemDescription = "Differenz erbrachter Stunden KA", + UnitDescription = "0,00 €" + }; + serviceInvoicePeriod.InvoiceItemList.Add(iiKa); + } + } } }