diff --git a/ReportImp/AlzeyTeilhabe/CustomReportCreator.cs b/ReportImp/AlzeyTeilhabe/CustomReportCreator.cs index 2d2f9230a..3341bef17 100644 --- a/ReportImp/AlzeyTeilhabe/CustomReportCreator.cs +++ b/ReportImp/AlzeyTeilhabe/CustomReportCreator.cs @@ -108,7 +108,7 @@ namespace AlzeyTeilhabe } } - if (kt == "Kreisverwaltung Mainz-Bingen" && ro.StartDate.Date <= new DateTime(2025, 07, 31)) + if (kt == "Kreisverwaltung Mainz-Bingen" && ro.StartDate.Date <= new DateTime(2025, 06, 30)) report = new AlzeyTeilhabe.StundenzettelBi2(); if (report == null && function == "Kostenträger Soziotherapie") diff --git a/ReportImp/ChristopherusHausFamilienhilfe/Einsatzzeiten.cs b/ReportImp/ChristopherusHausFamilienhilfe/Einsatzzeiten.cs index 8bd5938da..97b614857 100644 --- a/ReportImp/ChristopherusHausFamilienhilfe/Einsatzzeiten.cs +++ b/ReportImp/ChristopherusHausFamilienhilfe/Einsatzzeiten.cs @@ -95,8 +95,12 @@ namespace ChristopherusHausFamilienhilfe int row = start.Day +1; string secEmp = null; - while (start <= end) - { + //while (start <= end) + //{ + if (start.Day == 29) + { + + } bool cont = true; if (cont) SetTableText(table, start, sd.ServiceCategory, sd.ServiceDescription); @@ -134,7 +138,7 @@ namespace ChristopherusHausFamilienhilfe start = start.AddDays(1); - } + //} } private void SetTableText(XRTable table, DateTime dt, String categorie, String serviceDescription) diff --git a/ReportImp/FeidPartnerReports/CollectiveBillingReportTab.Designer.cs b/ReportImp/FeidPartnerReports/CollectiveBillingReportTab.Designer.cs index a0b17af58..40a1ffa85 100644 --- a/ReportImp/FeidPartnerReports/CollectiveBillingReportTab.Designer.cs +++ b/ReportImp/FeidPartnerReports/CollectiveBillingReportTab.Designer.cs @@ -83,7 +83,6 @@ namespace FeidPartnerReports this.xrTableCell29 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell3 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell31 = new DevExpress.XtraReports.UI.XRTableCell(); - this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); this.GroupHeader2 = new DevExpress.XtraReports.UI.GroupHeaderBand(); this.GroupFooter1 = new DevExpress.XtraReports.UI.GroupFooterBand(); this.xrTable5 = new DevExpress.XtraReports.UI.XRTable(); @@ -97,11 +96,15 @@ namespace FeidPartnerReports this.xrPictureBox1 = new DevExpress.XtraReports.UI.XRPictureBox(); this.xrLabel8 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel9 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrTableCell2 = new DevExpress.XtraReports.UI.XRTableCell(); + this.xrTableCell4 = new DevExpress.XtraReports.UI.XRTableCell(); + this.xrTableCell5 = new DevExpress.XtraReports.UI.XRTableCell(); + this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); ((System.ComponentModel.ISupportInitialize)(this.xrTable4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); // // Detail @@ -121,7 +124,7 @@ namespace FeidPartnerReports this.xrTable4.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] { this.xrTableRow4, this.xrTableRow7}); - this.xrTable4.SizeF = new System.Drawing.SizeF(1014.831F, 36F); + this.xrTable4.SizeF = new System.Drawing.SizeF(1078F, 36F); this.xrTable4.StylePriority.UseBackColor = false; this.xrTable4.StylePriority.UseBorders = false; this.xrTable4.StylePriority.UseFont = false; @@ -136,6 +139,7 @@ namespace FeidPartnerReports this.xrTableCell19, this.xrTableCell20, this.xrTableCell21, + this.xrTableCell2, this.xrTableCell30, this.xrTableCell32, this.xrTableCell33, @@ -165,7 +169,7 @@ namespace FeidPartnerReports this.xrTableCell12.StylePriority.UseBorders = false; this.xrTableCell12.StylePriority.UseFont = false; this.xrTableCell12.Text = "Name, Vorname"; - this.xrTableCell12.Weight = 0.45423516621260712D; + this.xrTableCell12.Weight = 0.49276499842675459D; // // xrTableCell19 // @@ -176,7 +180,7 @@ namespace FeidPartnerReports this.xrTableCell19.StylePriority.UseBorders = false; this.xrTableCell19.StylePriority.UseFont = false; this.xrTableCell19.Text = "Aktenzeichen"; - this.xrTableCell19.Weight = 0.2759912937317307D; + this.xrTableCell19.Weight = 0.29404700475458D; // // xrTableCell20 // @@ -186,7 +190,7 @@ namespace FeidPartnerReports this.xrTableCell20.StylePriority.UseBorders = false; this.xrTableCell20.StylePriority.UseFont = false; this.xrTableCell20.Text = "Aktueller"; - this.xrTableCell20.Weight = 0.44044461882401287D; + this.xrTableCell20.Weight = 0.43665532365477167D; // // xrTableCell21 // @@ -196,7 +200,7 @@ namespace FeidPartnerReports this.xrTableCell21.StylePriority.UseBorders = false; this.xrTableCell21.StylePriority.UseFont = false; this.xrTableCell21.Text = "Leistung"; - this.xrTableCell21.Weight = 0.33118949750760451D; + this.xrTableCell21.Weight = 0.32239010134679691D; // // xrTableCell30 // @@ -258,6 +262,7 @@ namespace FeidPartnerReports this.xrTableCell38, this.xrTableCell42, this.xrTableCell45, + this.xrTableCell4, this.xrTableCell51, this.lblEPreis, this.lblAnzahl, @@ -284,7 +289,7 @@ namespace FeidPartnerReports this.xrTableCell37.Name = "xrTableCell37"; this.xrTableCell37.StylePriority.UseBorders = false; this.xrTableCell37.StylePriority.UseFont = false; - this.xrTableCell37.Weight = 0.4542354311971783D; + this.xrTableCell37.Weight = 0.49276542697916609D; // // xrTableCell38 // @@ -294,7 +299,7 @@ namespace FeidPartnerReports this.xrTableCell38.Name = "xrTableCell38"; this.xrTableCell38.StylePriority.UseBorders = false; this.xrTableCell38.StylePriority.UseFont = false; - this.xrTableCell38.Weight = 0.27599102472007131D; + this.xrTableCell38.Weight = 0.29404724609610466D; // // xrTableCell42 // @@ -304,7 +309,7 @@ namespace FeidPartnerReports this.xrTableCell42.StylePriority.UseBorders = false; this.xrTableCell42.StylePriority.UseFont = false; this.xrTableCell42.Text = "Bewilligungszeitraum"; - this.xrTableCell42.Weight = 0.44044461204164687D; + this.xrTableCell42.Weight = 0.43665464749375354D; // // xrTableCell45 // @@ -313,7 +318,7 @@ namespace FeidPartnerReports this.xrTableCell45.Name = "xrTableCell45"; this.xrTableCell45.StylePriority.UseBorders = false; this.xrTableCell45.StylePriority.UseFont = false; - this.xrTableCell45.Weight = 0.33118937124124648D; + this.xrTableCell45.Weight = 0.32239155689460891D; // // xrTableCell51 // @@ -400,7 +405,7 @@ namespace FeidPartnerReports this.xrTable1.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 2, 2, 100F); this.xrTable1.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] { this.xrTableRow2}); - this.xrTable1.SizeF = new System.Drawing.SizeF(1014.83F, 17F); + this.xrTable1.SizeF = new System.Drawing.SizeF(1078F, 17F); this.xrTable1.StylePriority.UseBorders = false; this.xrTable1.StylePriority.UseFont = false; this.xrTable1.StylePriority.UsePadding = false; @@ -426,7 +431,7 @@ namespace FeidPartnerReports this.xrTableCell11.StylePriority.UseTextAlignment = false; this.xrTableCell11.Text = "Rechnungssumme"; this.xrTableCell11.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; - this.xrTableCell11.Weight = 1.8007896864822381D; + this.xrTableCell11.Weight = 1.9303659764751189D; // // xrTableCell14 // @@ -441,7 +446,7 @@ namespace FeidPartnerReports this.xrTableCell14.StylePriority.UseTextAlignment = false; this.xrTableCell14.Text = "xrTableCell9"; this.xrTableCell14.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; - this.xrTableCell14.Weight = 0.21297249777057958D; + this.xrTableCell14.Weight = 0.20874658234501667D; // // ruleNoticeNull // @@ -496,12 +501,12 @@ namespace FeidPartnerReports // this.xrTable2.Font = new DevExpress.Drawing.DXFont("Calibri", 8.25F, DevExpress.Drawing.DXFontStyle.Bold, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] { new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); - this.xrTable2.LocationFloat = new DevExpress.Utils.PointFloat(7.947286E-05F, 0F); + this.xrTable2.LocationFloat = new DevExpress.Utils.PointFloat(0F, 0F); this.xrTable2.Name = "xrTable2"; this.xrTable2.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 2, 2, 100F); this.xrTable2.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] { this.xrTableRow3}); - this.xrTable2.SizeF = new System.Drawing.SizeF(1014.83F, 17F); + this.xrTable2.SizeF = new System.Drawing.SizeF(1078F, 17F); this.xrTable2.StylePriority.UseBorders = false; this.xrTable2.StylePriority.UseFont = false; this.xrTable2.StylePriority.UsePadding = false; @@ -514,6 +519,7 @@ namespace FeidPartnerReports this.xrTableCell24, this.xrTableCell25, this.xrTableCell26, + this.xrTableCell5, this.xrTableCell27, this.xrTableCell28, this.xrTableCell29, @@ -539,7 +545,7 @@ namespace FeidPartnerReports this.xrTableCell22.Summary = xrSummary1; this.xrTableCell22.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; this.xrTableCell22.TextFormatString = "{0}"; - this.xrTableCell22.Weight = 0.10634058531450184D; + this.xrTableCell22.Weight = 0.1074583410926062D; // // xrTableCell23 // @@ -555,7 +561,7 @@ namespace FeidPartnerReports this.xrTableCell23.StylePriority.UseTextAlignment = false; this.xrTableCell23.Text = "[ServiceInvoicePeriods.Customer.LastName]"; this.xrTableCell23.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; - this.xrTableCell23.Weight = 0.45657075705373318D; + this.xrTableCell23.Weight = 0.50050532480320276D; // // xrTableCell24 // @@ -567,7 +573,7 @@ namespace FeidPartnerReports this.xrTableCell24.StylePriority.UseTextAlignment = false; this.xrTableCell24.Text = "[ServiceInvoicePeriods.CostBearer2SupportConcept.CustomerReferenceNumber]"; this.xrTableCell24.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; - this.xrTableCell24.Weight = 0.27741008367627817D; + this.xrTableCell24.Weight = 0.29866588697436142D; // // xrTableCell25 // @@ -580,7 +586,7 @@ namespace FeidPartnerReports this.xrTableCell25.Text = "[ServiceInvoicePeriods.CostBearer2SupportConcept.StartDate!dd.MM.yyyy] - [Service" + "InvoicePeriods.CostBearer2SupportConcept.EndDate!dd.MM.yyyy]"; this.xrTableCell25.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; - this.xrTableCell25.Weight = 0.4427094977716719D; + this.xrTableCell25.Weight = 0.44351433866259071D; // // xrTableCell26 // @@ -593,7 +599,7 @@ namespace FeidPartnerReports this.xrTableCell26.StylePriority.UseFont = false; this.xrTableCell26.StylePriority.UseTextAlignment = false; this.xrTableCell26.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; - this.xrTableCell26.Weight = 0.33289208820280392D; + this.xrTableCell26.Weight = 0.3274541928825217D; // // xrTableCell27 // @@ -610,7 +616,7 @@ namespace FeidPartnerReports this.xrTableCell27.StylePriority.UseTextAlignment = false; this.xrTableCell27.Text = "xrTableCell45"; this.xrTableCell27.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; - this.xrTableCell27.Weight = 0.23579789695281189D; + this.xrTableCell27.Weight = 0.23827695045619599D; // // xrTableCell28 // @@ -625,7 +631,7 @@ namespace FeidPartnerReports this.xrTableCell28.StylePriority.UsePadding = false; this.xrTableCell28.StylePriority.UseTextAlignment = false; this.xrTableCell28.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; - this.xrTableCell28.Weight = 0.22192789741327412D; + this.xrTableCell28.Weight = 0.22426102208157253D; // // xrTableCell29 // @@ -639,7 +645,7 @@ namespace FeidPartnerReports this.xrTableCell29.StylePriority.UseTextAlignment = false; this.xrTableCell29.Text = "xrTableCell17"; this.xrTableCell29.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; - this.xrTableCell29.Weight = 0.22192856135156558D; + this.xrTableCell29.Weight = 0.22426066046576354D; // // xrTableCell3 // @@ -652,7 +658,7 @@ namespace FeidPartnerReports this.xrTableCell3.StylePriority.UseFont = false; this.xrTableCell3.StylePriority.UseTextAlignment = false; this.xrTableCell3.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; - this.xrTableCell3.Weight = 0.22192771476319542D; + this.xrTableCell3.Weight = 0.22426043575594362D; // // xrTableCell31 // @@ -666,11 +672,7 @@ namespace FeidPartnerReports this.xrTableCell31.StylePriority.UseFont = false; this.xrTableCell31.StylePriority.UseTextAlignment = false; this.xrTableCell31.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; - this.xrTableCell31.Weight = 0.29773565063758856D; - // - // bindingSource1 - // - this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO); + this.xrTableCell31.Weight = 0.3008674746572616D; // // GroupHeader2 // @@ -694,7 +696,7 @@ namespace FeidPartnerReports this.xrTable5.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 2, 2, 100F); this.xrTable5.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] { this.xrTableRow6}); - this.xrTable5.SizeF = new System.Drawing.SizeF(1014.831F, 17F); + this.xrTable5.SizeF = new System.Drawing.SizeF(1078F, 17F); this.xrTable5.StylePriority.UseBorders = false; this.xrTable5.StylePriority.UseFont = false; this.xrTable5.StylePriority.UsePadding = false; @@ -721,7 +723,7 @@ namespace FeidPartnerReports this.xrTableCell13.StylePriority.UsePadding = false; this.xrTableCell13.StylePriority.UseTextAlignment = false; this.xrTableCell13.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; - this.xrTableCell13.Weight = 0.076059516538963659D; + this.xrTableCell13.Weight = 0.074556285796255742D; // // xrTableCell17 // @@ -737,7 +739,7 @@ namespace FeidPartnerReports this.xrTableCell17.StylePriority.UseTextAlignment = false; this.xrTableCell17.Text = "Summe [Customer.LastName]"; this.xrTableCell17.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; - this.xrTableCell17.Weight = 1.7247306998513456D; + this.xrTableCell17.Weight = 1.8558093367469213D; // // xrTableCell18 // @@ -754,7 +756,7 @@ namespace FeidPartnerReports xrSummary2.Running = DevExpress.XtraReports.UI.SummaryRunning.Group; this.xrTableCell18.Summary = xrSummary2; this.xrTableCell18.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; - this.xrTableCell18.Weight = 0.212973345569157D; + this.xrTableCell18.Weight = 0.20874634129183786D; // // fieldMonatskontingent // @@ -817,6 +819,48 @@ namespace FeidPartnerReports this.xrLabel9.StylePriority.UseFont = false; this.xrLabel9.Text = "[InvoiceBase.InvoiceNumber]\r\n\r\n"; // + // xrTableCell2 + // + this.xrTableCell2.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Top))); + this.xrTableCell2.Font = new DevExpress.Drawing.DXFont("Calibri", 9F, DevExpress.Drawing.DXFontStyle.Bold); + this.xrTableCell2.Multiline = true; + this.xrTableCell2.Name = "xrTableCell2"; + this.xrTableCell2.StylePriority.UseBorders = false; + this.xrTableCell2.StylePriority.UseFont = false; + this.xrTableCell2.Text = "Monat"; + this.xrTableCell2.Weight = 0.19059462802218469D; + // + // xrTableCell4 + // + this.xrTableCell4.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Bottom))); + this.xrTableCell4.Font = new DevExpress.Drawing.DXFont("Calibri", 9F, DevExpress.Drawing.DXFontStyle.Bold); + this.xrTableCell4.Multiline = true; + this.xrTableCell4.Name = "xrTableCell4"; + this.xrTableCell4.StylePriority.UseBorders = false; + this.xrTableCell4.StylePriority.UseFont = false; + this.xrTableCell4.Weight = 0.19059402207551385D; + // + // xrTableCell5 + // + this.xrTableCell5.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Bottom))); + this.xrTableCell5.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "ServiceInvoicePeriods.ServiceInvoiceItems.UnitDescription")}); + this.xrTableCell5.Font = new DevExpress.Drawing.DXFont("Calibri", 9F); + this.xrTableCell5.Multiline = true; + this.xrTableCell5.Name = "xrTableCell5"; + this.xrTableCell5.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 2, 2, 100F); + this.xrTableCell5.StylePriority.UseBorderColor = false; + this.xrTableCell5.StylePriority.UseBorders = false; + this.xrTableCell5.StylePriority.UseFont = false; + this.xrTableCell5.StylePriority.UsePadding = false; + this.xrTableCell5.StylePriority.UseTextAlignment = false; + this.xrTableCell5.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; + this.xrTableCell5.Weight = 0.19358810322603051D; + // + // bindingSource1 + // + this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO); + // // SammelrechnungTab // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { @@ -835,7 +879,7 @@ namespace FeidPartnerReports this.ruleRateFactorNull, this.ruleNoticeNull}); this.Landscape = true; - this.Margins = new DevExpress.Drawing.DXMargins(60F, 60F, 23F, 7.500458F); + this.Margins = new DevExpress.Drawing.DXMargins(60F, 31F, 23F, 7.500458F); this.PageHeight = 827; this.PageWidth = 1169; this.PaperKind = DevExpress.Drawing.Printing.DXPaperKind.A4; @@ -845,8 +889,8 @@ namespace FeidPartnerReports ((System.ComponentModel.ISupportInitialize)(this.xrTable4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); } @@ -916,5 +960,8 @@ namespace FeidPartnerReports private DevExpress.XtraReports.UI.XRTableCell lblAnzahl; private DevExpress.XtraReports.UI.XRTableCell xrTableCell54; private DevExpress.XtraReports.UI.XRTableCell xrTableCell55; + private DevExpress.XtraReports.UI.XRTableCell xrTableCell2; + private DevExpress.XtraReports.UI.XRTableCell xrTableCell4; + private DevExpress.XtraReports.UI.XRTableCell xrTableCell5; } } diff --git a/ReportImp/FeidPartnerReports/Invoicing/CollectiveInvoiceCreation.cs b/ReportImp/FeidPartnerReports/Invoicing/CollectiveInvoiceCreation.cs index 9fae772c5..2c1aa7559 100644 --- a/ReportImp/FeidPartnerReports/Invoicing/CollectiveInvoiceCreation.cs +++ b/ReportImp/FeidPartnerReports/Invoicing/CollectiveInvoiceCreation.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Data; using System.Linq; using BeWo.Data.Access; using BeWo.Data.Entities; @@ -63,72 +64,129 @@ namespace FeidPartnerReports.Invoicing DateTime start = accountingPeriodStart.Value; DateTime end = accountingPeriodEnd.Value; - bool teilmonat = false; - if (supportConceptApprovalPeriod.StartDate != null && supportConceptApprovalPeriod.StartDate > start) - { - start = supportConceptApprovalPeriod.StartDate.Value; - teilmonat = true; - } - if (supportConceptApprovalPeriod.EndDate != null && supportConceptApprovalPeriod.EndDate < end) - { - end = supportConceptApprovalPeriod.EndDate.Value; - teilmonat = true; - } if (supportConceptApprovalPeriod.ServiceCategory != null && data != null && data.Count > 0) { - var ii = new InvoiceItem + decimal preis = (decimal)Math.Round((double)data[0].AmountTotal, 2, MidpointRounding.AwayFromZero); + decimal days = (decimal)(end - start).TotalDays + 1; + + // im Normalfall monatliche Abrechnung + if (start.Year == end.Year && start.Month == end.Month) { - ItemPeriodStart = serviceInvoicePeriod.Start, - ItemPeriodEnd = serviceInvoicePeriod.End, - SupportConceptApprovalPeriodOid = supportConceptApprovalPeriod.SupportConceptApprovalPeriodOid, - AccountingInterval = AccountingIntervalType.Daily, - UnitCount = (decimal)(end - start).TotalDays + 1, - Notice = "keine Minuten" - }; - if (supportConceptApprovalPeriod.ServiceCategory.Name.Contains("Bedarfsgruppe")) - { - ii.AccountingInterval = AccountingIntervalType.Monthly; - ii.ItemDescription = supportConceptApprovalPeriod.ServiceCategory.Name; - ii.UnitCount = 1; - ii.AmountPerUnit = (decimal)Math.Round((double)data[0].AmountTotal, 2, MidpointRounding.AwayFromZero); - if (teilmonat) - { - var days = (double)(end - start).TotalDays + 1; - ii.AmountPerUnit = (decimal)Math.Round((double)data[0].AmountTotal / 30.42 * days, 2, MidpointRounding.AwayFromZero); - } - ii.AmountTotal = ii.AmountPerUnit; - ii.GrossAmountTotal = ii.AmountTotal; - ii.Notice = ""; - serviceInvoicePeriod.InvoiceItemList.Add(ii); - return; + CreateInvoiceItemsLwv(serviceInvoicePeriod, supportConceptApprovalPeriod, start, end, preis); } - if (supportConceptApprovalPeriod.ApprovedBEPerInterval.HasValue) + // ...aber es können auch Zeiträume für einzelne Klienten nachträglich abgerechnet werden, + // dann monatliche Rechnungsposition + else { - ii.Notice = String.Format("{0:n0}", supportConceptApprovalPeriod.ApprovedBEPerInterval.Value); - if (supportConceptApprovalPeriod.ServiceCategory.Name.Contains("Fahrzeit")) + var monthlyDict = data + .GroupBy(e => new DateTime(e.BillingPeriodStart.Value.Year, e.BillingPeriodStart.Value.Month, 1)) + .ToDictionary( + g => g.Key, + g => g.OrderBy(e => e.BillingPeriodStart).ToList() // Liste der Einträge in diesem Monat + ); + + foreach (var kvp in monthlyDict.OrderBy(k => k.Key)) { - ii.AmountPerUnit = supportConceptApprovalPeriod.ApprovedBEPerInterval * AMOUNT_PER_KMQA; - ii.ItemDescription = "Fahrzeiten QA"; + var month = kvp.Key; // z.?B. 2025-01-01 + var entries = kvp.Value; + preis = (decimal)Math.Round((double)entries[0].AmountTotal, 2, MidpointRounding.AwayFromZero); + //days = (decimal)(end - start).TotalDays + 1; + days = entries.Count; + var lastday = entries.LastOrDefault(); + CreateInvoiceItemsLwv(serviceInvoicePeriod, supportConceptApprovalPeriod, entries[0].BillingPeriodStart.Value, lastday.BillingPeriodStart.Value, preis); + } + } + } + } + + private void CreateInvoiceItemsLwv(ServiceInvoicePeriod serviceInvoicePeriod, SupportConceptApprovalPeriodDC supportConceptApprovalPeriod, DateTime start, DateTime end, decimal preis) + { + var ii = new InvoiceItem + { + ItemPeriodStart = serviceInvoicePeriod.Start, + ItemPeriodEnd = serviceInvoicePeriod.End, + SupportConceptApprovalPeriodOid = supportConceptApprovalPeriod.SupportConceptApprovalPeriodOid, + AccountingInterval = AccountingIntervalType.Daily, + UnitCount = (decimal)(end - start).TotalDays + 1, + UnitDescription = String.Format("{0:MM.yyyy}", start), + Notice = "keine Minuten" + }; + if (supportConceptApprovalPeriod.ServiceCategory.Name.Contains("Bedarfsgruppe")) + { + bool teilmonat = false; + if (supportConceptApprovalPeriod.StartDate != null && supportConceptApprovalPeriod.StartDate > start) + { + start = supportConceptApprovalPeriod.StartDate.Value; + teilmonat = true; + } + if (supportConceptApprovalPeriod.EndDate != null && supportConceptApprovalPeriod.EndDate < end) + { + end = supportConceptApprovalPeriod.EndDate.Value; + teilmonat = true; + } + + ii.AccountingInterval = AccountingIntervalType.Monthly; + ii.ItemDescription = supportConceptApprovalPeriod.ServiceCategory.Name; + ii.UnitCount = 1; + ii.AmountPerUnit = preis; + if (teilmonat) + { + var days = (double)(end - start).TotalDays + 1; + ii.AmountPerUnit = (decimal)Math.Round((double)preis / 30.42 * days, 2, MidpointRounding.AwayFromZero); + } + ii.AmountTotal = ii.AmountPerUnit; + ii.GrossAmountTotal = ii.AmountTotal; + ii.Notice = ""; + serviceInvoicePeriod.InvoiceItemList.Add(ii); + return; + } + if (supportConceptApprovalPeriod.ApprovedBEPerInterval.HasValue) + { + ii.Notice = String.Format("{0:n0}", supportConceptApprovalPeriod.ApprovedBEPerInterval.Value); + if (supportConceptApprovalPeriod.ServiceCategory.Name.Contains("Fahrzeit")) + { + ii.AmountPerUnit = supportConceptApprovalPeriod.ApprovedBEPerInterval * AMOUNT_PER_KMQA; + ii.ItemDescription = "Fahrzeiten QA"; + } + else + { + if (supportConceptApprovalPeriod.ApprovedFixedAmount != null) + { + ii.AmountPerUnit = supportConceptApprovalPeriod.ApprovedFixedAmount; } else { - if (supportConceptApprovalPeriod.ApprovedFixedAmount != null) - { - ii.AmountPerUnit = supportConceptApprovalPeriod.ApprovedFixedAmount; - } - else - { - ii.AmountPerUnit = supportConceptApprovalPeriod.ApprovedBEPerInterval * (decimal)Math.Round((double)data[0].AmountTotal / 60, 4, MidpointRounding.AwayFromZero); - } - ii.ItemDescription = "Qualifizierte Assistenz"; + ii.AmountPerUnit = supportConceptApprovalPeriod.ApprovedBEPerInterval * (decimal)Math.Round((double)preis / 60, 4, MidpointRounding.AwayFromZero); } - - ii.AmountPerUnit = Math.Round((decimal)ii.AmountPerUnit, 2, MidpointRounding.AwayFromZero); - ii.AmountTotal = ii.UnitCount * ii.AmountPerUnit; - ii.GrossAmountTotal = ii.AmountTotal; + ii.ItemDescription = "Qualifizierte Assistenz"; + } + + ii.AmountPerUnit = Math.Round((decimal)ii.AmountPerUnit, 2, MidpointRounding.AwayFromZero); + ii.AmountTotal = ii.UnitCount * ii.AmountPerUnit; + ii.GrossAmountTotal = ii.AmountTotal; + } + serviceInvoicePeriod.InvoiceItemList.Add(ii); + + if (supportConceptApprovalPeriod.MonthlyPayment.HasValue && supportConceptApprovalPeriod.MonthlyPayment > 0) + { + var equity = supportConceptApprovalPeriod.MonthlyPayment.Value; + if (equity > 0) + { + var iiE = new InvoiceItem(); + iiE.UnitCount = 1; + iiE.AmountPerUnit = equity; + iiE.AmountTotal = -equity; + iiE.GrossAmountTotal = -equity; + iiE.ItemPeriodStart = ii.ItemPeriodStart; + iiE.ItemPeriodEnd = ii.ItemPeriodEnd; + iiE.Notice = ""; + iiE.SupportConceptApprovalPeriodOid = ii.SupportConceptApprovalPeriodOid; + iiE.ItemDescription = "Eigenanteil"; + iiE.UnitDescription = String.Format("{0:MM.yyyy}", start); + + serviceInvoicePeriod.InvoiceItemList.Add(iiE); } - serviceInvoicePeriod.InvoiceItemList.Add(ii); } } diff --git a/ReportImp/SuchtkrankenhilfeOstfriesland/Calculation/CustomCalculations.cs b/ReportImp/SuchtkrankenhilfeOstfriesland/Calculation/CustomCalculations.cs index 0d85497e0..3160478b0 100644 --- a/ReportImp/SuchtkrankenhilfeOstfriesland/Calculation/CustomCalculations.cs +++ b/ReportImp/SuchtkrankenhilfeOstfriesland/Calculation/CustomCalculations.cs @@ -26,18 +26,25 @@ namespace SuchtkrankenhilfeOstfriesland.Calculation // Jetzt müssen die Zeiterfassungseinträge für den abgerechneten Zeitraum geholt werden. Die dienen denen als Anwesenheitsliste. // Ist die Person weniger als die Hälfte der abgerechneten Tage anwesend gewesen, wird der Betrag halbiert. var serviceRecords = DAOFactory.SearchDAO.FindServiceRecordsDetailsForLastDaysWithStartEndDate(CustomTagesstrukturInvoiceCreation.CostBearer2SupportConcept.Oid.Value, start.Value, end.Value); - List anwesenheitstage = new List(); - foreach (var sr in serviceRecords) + if (serviceRecords != null && serviceRecords.Count > 0) { - if (!anwesenheitstage.Contains(sr.Start.Value.Date)) - anwesenheitstage.Add(sr.Start.Value.Date); - } + var anwesenheiten = serviceRecords.Where(s => s.ServiceDescription.Name.Trim().ToLower().Contains("anwesend ts")).OrderBy(s => s.Start).ToList(); - if ((end.Value - start.Value).TotalDays / 2 > anwesenheitstage.Count) - { - data.AmountTotal /= 2; - data.GrossAmountTotal /= 2; + List anwesenheitstage = new List(); + foreach (var sr in anwesenheiten) + { + if (!anwesenheitstage.Contains(sr.Start.Value.Date)) + anwesenheitstage.Add(sr.Start.Value.Date); + } + + // Wenn die erste Anwesenheit erst ab dem 15. ist, wird die Pauschale für den Monat halbiert + if (anwesenheitstage[0].Day <= 15) + { + data.AmountTotal /= 2; + data.GrossAmountTotal /= 2; + } } + } return billingData;