diff --git a/ReportImp/Hiba/Invoicing/HibaDefaultInvoiceCreation.cs b/ReportImp/Hiba/Invoicing/HibaDefaultInvoiceCreation.cs index ebfda9ae1..7867b0e0f 100644 --- a/ReportImp/Hiba/Invoicing/HibaDefaultInvoiceCreation.cs +++ b/ReportImp/Hiba/Invoicing/HibaDefaultInvoiceCreation.cs @@ -71,7 +71,62 @@ namespace Hiba public override IList CreateInvoiceItems(List serviceRecordsInPeriod, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap, Calculations calc) { - var list = base.CreateInvoiceItems(serviceRecordsInPeriod, invoicePeriod, scap, calc); + var list = new List(); + foreach (ServiceRecordDC iServiceRecord in serviceRecordsInPeriod) + { + if (iServiceRecord.ServiceDescription.Category.IsBillable) + { + if (!iServiceRecord.AlreadyAccounted) + { + InvoiceItem invoiceItem = CreateInvoiceItem(iServiceRecord, scap, calc); + if (invoiceItem != null) + { + list.Add(invoiceItem); + + if (iServiceRecord.Start.HasValue && iServiceRecord.Start.Value.Date >= new DateTime(2023, 10, 01) && // vor Auslieferung auf 01.01.2024 ändern + iServiceRecord.DistanceInMeter.HasValue && iServiceRecord.DistanceInMeter.Value > 0) + { + var amountPerUnit = invoiceItem.AmountPerUnit / 100 * 25; + var unitcount = 0m; + if (iServiceRecord.GroupPersonCount != null && iServiceRecord.GroupPersonCount.HasValue) + { + decimal count = iServiceRecord.GroupPersonCount.Value; + unitcount += 1 / count; + } + else + unitcount += 1; + + iServiceRecord.DistanceInMeter = 0; + + InvoiceItem wegepauschaleInvoiceItem = new InvoiceItem() + { + AccountingInterval = BS.Shared.AccountingIntervalType.FlatRate, + AmountPerUnit = amountPerUnit, + AmountTotal = amountPerUnit * unitcount, + GrossAmountTotal = amountPerUnit * unitcount, + ItemDescription = "Wegepauschale", + ItemPeriodStart = invoiceItem.ItemPeriodStart, + ItemPeriodEnd = invoiceItem.ItemPeriodEnd, + RateFactor = null, + SupportConceptApprovalPeriodOid = invoiceItem.SupportConceptApprovalPeriodOid, + UnitCount = unitcount, + UnitDescription = "Pauschal pro Fahrt" + }; + list.Add(wegepauschaleInvoiceItem); + } + } + iServiceRecord.AlreadyAccounted = true; + } + } + } + + list = CreateSummaryInvoiceItems(list, invoicePeriod, scap, calc).ToList(); + + + + + + //var list = base.CreateInvoiceItems(serviceRecordsInPeriod, invoicePeriod, scap, calc); String serviceName = "geleistete Päd.-Stunden"; if (scap.ServiceCategory != null && !scap.ServiceCategory.Name.Contains("Fachleistung")) { @@ -80,12 +135,24 @@ namespace Hiba foreach (var invoiceItem in list) { - invoiceItem.ItemDescription = serviceName; - invoiceItem.UnitDescription = "Stundensatz"; + if (invoiceItem.ItemDescription != "Wegepauschale") + { + invoiceItem.ItemDescription = serviceName; + invoiceItem.UnitDescription = "Stundensatz"; + } } - InvoiceItem ttii = CreateFahrkostenInvoiceItem(serviceRecordsInPeriod, scap, calc); + + // Fällt ab 01.01.2024 weg + InvoiceItem ttii = CreateFahrkostenZonenInvoiceItem(serviceRecordsInPeriod, scap, calc); if (ttii != null) list.Add(ttii); + + //InvoiceItem fahrtkostenAb2024 = CreateFahrkostenInvoiceItemAb2024(serviceRecordsInPeriod, scap, calc); + //if (fahrtkostenAb2024 != null) + // list.Add(fahrtkostenAb2024); + + list = list.OrderBy(ii => ii.ItemPeriodStart).ToList(); + return list; } @@ -177,7 +244,7 @@ namespace Hiba return newlist; } - private InvoiceItem CreateFahrkostenInvoiceItem(List serviceRecordsInPeriod, SupportConceptApprovalPeriod scap, Calculations calc) + private InvoiceItem CreateFahrkostenZonenInvoiceItem(List serviceRecordsInPeriod, SupportConceptApprovalPeriod scap, Calculations calc) { decimal anzahlFahrtkosten = 0; @@ -193,11 +260,13 @@ namespace Hiba if (sr.GroupPersonCount != null && sr.GroupPersonCount.HasValue) { decimal count = sr.GroupPersonCount.Value; - anzahlFahrtkosten += 1 / count; + if (sr.Start.HasValue && sr.Start.Value.Date < new DateTime(2024, 01, 01)) + anzahlFahrtkosten += 1 / count; } else { - anzahlFahrtkosten += 1; + if (sr.Start.HasValue && sr.Start.Value.Date < new DateTime(2024, 01, 01)) + anzahlFahrtkosten += 1; } sr.DistanceInMeter = 0; } @@ -219,14 +288,63 @@ namespace Hiba if (scap != null) invoiceItem.SupportConceptApprovalPeriodOid = scap.Oid; + return invoiceItem; + } + return null; + } + private InvoiceItem CreateFahrkostenInvoiceItemAb2024(List serviceRecordsInPeriod, SupportConceptApprovalPeriod scap, Calculations calc) + { + decimal anzahlFahrtkostenAb2024 = 0; + + if (!accountingPeriodStart.HasValue) + accountingPeriodStart = scap.StartDate; + if (!accountingPeriodEnd.HasValue) + accountingPeriodEnd = scap.EndDate; + + foreach (var sr in serviceRecordsInPeriod) + { + if (sr.DistanceInMeter.HasValue && sr.DistanceInMeter.Value > 0) + { + if (sr.GroupPersonCount != null && sr.GroupPersonCount.HasValue) + { + decimal count = sr.GroupPersonCount.Value; + if (sr.Start.HasValue && sr.Start.Value.Date >= new DateTime(2024, 01, 01)) + anzahlFahrtkostenAb2024 += 1 / count; + } + else + { + if (sr.Start.HasValue && sr.Start.Value.Date >= new DateTime(2024, 01, 01)) + anzahlFahrtkostenAb2024 += 1; + } + sr.DistanceInMeter = 0; + } + } + + var customer = scap.CostBearer2SupportConcept.SupportConcept.Customer; + if (anzahlFahrtkostenAb2024 > 0) + { + var invoiceItem = new InvoiceItem(); + invoiceItem.AmountPerUnit = GetPauschale(); + invoiceItem.UnitCount = Math.Round(anzahlFahrtkostenAb2024, 2, MidpointRounding.AwayFromZero); + invoiceItem.AmountTotal = invoiceItem.UnitCount * invoiceItem.AmountPerUnit; + invoiceItem.RateFactor = null; + invoiceItem.ItemPeriodStart = accountingPeriodStart; + invoiceItem.ItemPeriodEnd = accountingPeriodEnd; + invoiceItem.GrossAmountTotal = invoiceItem.AmountTotal; + invoiceItem.ItemDescription = String.Format("Wegezeitenpauschale"); + invoiceItem.UnitDescription = String.Format("Pauschalsatz"); + if (scap != null) + invoiceItem.SupportConceptApprovalPeriodOid = scap.Oid; return invoiceItem; } return null; } - private decimal GetFahrtkosten(Customer customer) + + + private decimal GetFahrtkosten(Customer customer) { foreach (var vf in customer.VarFieldValueList) { @@ -253,6 +371,11 @@ namespace Hiba return 0; } - } + + private decimal? GetPauschale() + { + return 0; + } + } } diff --git a/ReportImp/Hiba/Quittierungsbeleg.cs b/ReportImp/Hiba/Quittierungsbeleg.cs index 737823f97..09b999a0f 100644 --- a/ReportImp/Hiba/Quittierungsbeleg.cs +++ b/ReportImp/Hiba/Quittierungsbeleg.cs @@ -67,7 +67,7 @@ namespace Hiba sd.Notice4 = ""; // Felder für Ausfallstunden setzen - if (sd.ServiceCategory.ToLower().Contains("ausfall") || sd.ServiceDescription.ToLower().Contains("fehlkontakt")) + if (sd.ServiceCategory.ToLower().Contains("ausfall") || sd.ServiceDescription.ToLower().Contains("ausfall") || sd.ServiceDescription.ToLower().Contains("fehlkontakt")) { sd.Notice5 = "X"; summeAusfallstunden++; diff --git a/ReportImp/Hiba/ServiceInvoiceReport.Designer.cs b/ReportImp/Hiba/ServiceInvoiceReport.Designer.cs index a8fbfe9b5..d4cb794d0 100644 --- a/ReportImp/Hiba/ServiceInvoiceReport.Designer.cs +++ b/ReportImp/Hiba/ServiceInvoiceReport.Designer.cs @@ -57,10 +57,10 @@ namespace Hiba this.xrLabel13 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel9 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel1 = new DevExpress.XtraReports.UI.XRLabel(); - this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); this.ReportFooter = new DevExpress.XtraReports.UI.ReportFooterBand(); this.xrLabel16 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel15 = new DevExpress.XtraReports.UI.XRLabel(); + this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); ((System.ComponentModel.ISupportInitialize)(this.xrRichText1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrRichText2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); @@ -215,7 +215,7 @@ namespace Hiba // this.xrLabel12.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "ServiceInvoicePeriods.ServiceInvoiceItems.GrossAmount")}); - this.xrLabel12.LocationFloat = new DevExpress.Utils.PointFloat(347.9167F, 40.00003F); + this.xrLabel12.LocationFloat = new DevExpress.Utils.PointFloat(400F, 40.00003F); this.xrLabel12.Name = "xrLabel12"; this.xrLabel12.SizeF = new System.Drawing.SizeF(152.08F, 20F); this.xrLabel12.StylePriority.UsePadding = false; @@ -229,7 +229,7 @@ namespace Hiba new DevExpress.XtraReports.UI.XRBinding("Text", null, "ServiceInvoicePeriods.ServiceInvoiceItems.HourlyRate", "{0:c}")}); this.xrLabel11.LocationFloat = new DevExpress.Utils.PointFloat(200F, 40.00003F); this.xrLabel11.Name = "xrLabel11"; - this.xrLabel11.SizeF = new System.Drawing.SizeF(139.21F, 20F); + this.xrLabel11.SizeF = new System.Drawing.SizeF(185.75F, 20F); this.xrLabel11.StylePriority.UsePadding = false; // // xrLabel10 @@ -249,7 +249,7 @@ namespace Hiba this.xrLabel6.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.xrLabel6.LocationFloat = new DevExpress.Utils.PointFloat(200F, 20.00001F); this.xrLabel6.Name = "xrLabel6"; - this.xrLabel6.SizeF = new System.Drawing.SizeF(139.21F, 20F); + this.xrLabel6.SizeF = new System.Drawing.SizeF(185.75F, 20F); this.xrLabel6.StylePriority.UseFont = false; this.xrLabel6.StylePriority.UsePadding = false; this.xrLabel6.Text = "xrLabel6"; @@ -324,7 +324,7 @@ namespace Hiba this.xrLabel1.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "GrossClaim", "{0}")}); this.xrLabel1.Font = new System.Drawing.Font("Tahoma", 11F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.xrLabel1.LocationFloat = new DevExpress.Utils.PointFloat(366.9998F, 17.00001F); + this.xrLabel1.LocationFloat = new DevExpress.Utils.PointFloat(419.0798F, 17.00001F); this.xrLabel1.Name = "xrLabel1"; this.xrLabel1.SizeF = new System.Drawing.SizeF(133.0002F, 33.33333F); this.xrLabel1.StylePriority.UseFont = false; @@ -332,10 +332,6 @@ namespace Hiba this.xrLabel1.StylePriority.UseTextAlignment = false; this.xrLabel1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; // - // bindingSource1 - // - this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO); - // // ReportFooter // this.ReportFooter.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { @@ -364,6 +360,10 @@ namespace Hiba this.xrLabel15.StylePriority.UsePadding = false; this.xrLabel15.Text = "Finanzamt Hildesheim\r\nSteuer-Nr. 30/212/34331"; // + // bindingSource1 + // + this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO); + // // ServiceInvoiceReport // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { diff --git a/ReportImp/Hiba/ServiceInvoiceReport.cs b/ReportImp/Hiba/ServiceInvoiceReport.cs index b98a8049a..461a838bb 100644 --- a/ReportImp/Hiba/ServiceInvoiceReport.cs +++ b/ReportImp/Hiba/ServiceInvoiceReport.cs @@ -60,7 +60,7 @@ namespace Hiba { foreach (var ii in sip.ServiceInvoiceItems) { - if (ii.ServiceDescription.Contains("Wegezeiten")) + if (ii.ServiceDescription.Contains("Wegezeiten") || ii.ServiceDescription.Contains("Wegepauschale")) { ii.UnitCountString = String.Format("{0:0.##}x", ii.UnitCount); }