From 6daa9979586338fe74af38cad3ffd908cd4b0795 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Fri, 10 Oct 2025 13:57:26 +0200 Subject: [PATCH] SBBMainzReports/Invoicing/CustomInvoiceCreation - Ausweis Bruttostunden (inkl. Faktor) in Rechnung --- .../Invoicing/CustomInvoiceCreation.cs | 42 +++++++++++++++++++ .../ServiceInvoiceReport.Designer.cs | 12 +++--- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/ReportImp/SBBMainzReports/Invoicing/CustomInvoiceCreation.cs b/ReportImp/SBBMainzReports/Invoicing/CustomInvoiceCreation.cs index ffccf0728..6089e0d75 100644 --- a/ReportImp/SBBMainzReports/Invoicing/CustomInvoiceCreation.cs +++ b/ReportImp/SBBMainzReports/Invoicing/CustomInvoiceCreation.cs @@ -64,5 +64,47 @@ namespace SbbMainzReports.Invoicing { // do nothing } + + public override IList CreateSummaryInvoiceItems(IList itemList, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap, + Calculations calc, bool summaryPerMonth, bool addRateFactorToUnitCount) + { + return base.CreateSummaryInvoiceItems(itemList, invoicePeriod, scap, calc, false, true); + } + + public override void BerechneSummaryItemsSummen(List newlist, bool addRateFactorToUnitCount) + { + foreach (InvoiceItem invoiceItem in newlist) + { + if (!invoiceItem.AmountPerUnit.HasValue) + { + invoiceItem.AmountPerUnit = 0; + } + invoiceItem.AmountPerUnit = Math.Round(invoiceItem.AmountPerUnit.Value, 2, MidpointRounding.AwayFromZero); + + if (!invoiceItem.UnitCount.HasValue) + { + invoiceItem.UnitCount = 0; + } + + if (addRateFactorToUnitCount && invoiceItem.RateFactor.HasValue) + { + invoiceItem.UnitCount = (invoiceItem.UnitCount ?? 0) * ((invoiceItem.RateFactor + 100) / 100); + } + + invoiceItem.UnitCount = Math.Round(invoiceItem.UnitCount.Value, 3, MidpointRounding.AwayFromZero); + + + invoiceItem.AmountTotal = invoiceItem.AmountPerUnit * invoiceItem.UnitCount; + invoiceItem.AmountTotal = Math.Round(invoiceItem.AmountTotal.Value, 2, MidpointRounding.AwayFromZero); + + invoiceItem.GrossAmountTotal = invoiceItem.AmountTotal; + + + if (!addRateFactorToUnitCount && invoiceItem.RateFactor.HasValue) + { + invoiceItem.GrossAmountTotal *= ((invoiceItem.RateFactor + 100) / 100); + } + } + } } } diff --git a/ReportImp/SBBMainzReports/ServiceInvoiceReport.Designer.cs b/ReportImp/SBBMainzReports/ServiceInvoiceReport.Designer.cs index b95f6b9c3..55a770cb0 100644 --- a/ReportImp/SBBMainzReports/ServiceInvoiceReport.Designer.cs +++ b/ReportImp/SBBMainzReports/ServiceInvoiceReport.Designer.cs @@ -89,7 +89,6 @@ namespace SBBMainzReports this.xrTableCell44 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell9 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell47 = new DevExpress.XtraReports.UI.XRTableCell(); - this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); this.ReportFooter = new DevExpress.XtraReports.UI.ReportFooterBand(); this.xrLabel13 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel18 = new DevExpress.XtraReports.UI.XRLabel(); @@ -97,6 +96,7 @@ namespace SBBMainzReports this.PageFooter = new DevExpress.XtraReports.UI.PageFooterBand(); this.xrLabel15 = new DevExpress.XtraReports.UI.XRLabel(); this.xrPictureBox2 = new DevExpress.XtraReports.UI.XRPictureBox(); + this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable6)).BeginInit(); @@ -749,7 +749,7 @@ namespace SBBMainzReports this.xrTableCell44.StylePriority.UseTextAlignment = false; this.xrTableCell44.Text = "xrTableCell44"; this.xrTableCell44.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; - this.xrTableCell44.TextFormatString = "{0:0.00}"; + this.xrTableCell44.TextFormatString = "{0:0.000}"; this.xrTableCell44.Weight = 0.14933396933294971D; // // xrTableCell9 @@ -787,10 +787,6 @@ namespace SBBMainzReports this.xrTableCell47.TextFormatString = "{0} Euro"; this.xrTableCell47.Weight = 0.53064018869841689D; // - // bindingSource1 - // - this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO); - // // ReportFooter // this.ReportFooter.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { @@ -875,6 +871,10 @@ namespace SBBMainzReports this.xrPictureBox2.SizeF = new System.Drawing.SizeF(159.7919F, 111F); this.xrPictureBox2.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage; // + // bindingSource1 + // + this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO); + // // ServiceInvoiceReport // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] {