From 5beb04bd12d38d7902c4dc3acc799f603e3964c4 Mon Sep 17 00:00:00 2001 From: Marcel Hirschle Date: Thu, 9 Feb 2023 16:48:37 +0100 Subject: [PATCH] MH: BAW Rundung fixen + BetreuWo Unterschriften --- .../ServicesOverviewReportALS.cs | 34 ++++++++++++- .../ServicesOverviewReportALS.designer.cs | 47 +++++++++++++++-- ...etreuungsserviceFuerAlltagUndWohnen.csproj | 2 + .../Invoicing/CustomInvoiceCreation.cs | 50 +++++++++++++++++++ .../Invoicing/CustomInvoiceFactory.cs | 21 ++++++++ .../ServiceInvoiceReport.cs | 2 +- 6 files changed, 150 insertions(+), 6 deletions(-) create mode 100644 ReportImp/BetreuungsserviceFuerAlltagUndWohnen/Invoicing/CustomInvoiceCreation.cs create mode 100644 ReportImp/BetreuungsserviceFuerAlltagUndWohnen/Invoicing/CustomInvoiceFactory.cs diff --git a/ReportImp/BetreuWoReports/ServicesOverviewReportALS.cs b/ReportImp/BetreuWoReports/ServicesOverviewReportALS.cs index 41d079e8f..42ca12b9f 100644 --- a/ReportImp/BetreuWoReports/ServicesOverviewReportALS.cs +++ b/ReportImp/BetreuWoReports/ServicesOverviewReportALS.cs @@ -6,6 +6,10 @@ using BS.Shared.DataContracts; using DevExpress.XtraReports.UI; using BeWo.Report.ReportObjects; using BeWo.Report; +using System.Text.RegularExpressions; +using System.Drawing; +using System.IO; +using BS.Shared.Core; namespace BeWo.BetreuWoReports { @@ -42,7 +46,8 @@ namespace BeWo.BetreuWoReports { foreach (var item in pRO.Services) { - if (item.ServiceCategory.StartsWith("UA ")) + ServicesOverviewRO.CreateSignatureString(item); + if (item.ServiceCategory.StartsWith("UA ")) { minTotal += item.Minutes; @@ -86,5 +91,32 @@ namespace BeWo.BetreuWoReports } return null; } + + private void picSignature_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) + { + XRPictureBox xrBox = sender as XRPictureBox; + //var test = this.GetCurrent + string base64String = xrBox.Tag as string; + if (!String.IsNullOrWhiteSpace(base64String)) + { + var base64Data = Regex.Match(base64String, @"data:image/(?.+?),(?.+)").Groups["data"].Value; + var binData = Convert.FromBase64String(base64Data); + Image img = ByteArrayToImage(binData); + xrBox.Image = Utils.CropImage(img); + } + else + { + xrBox.Image = null; + } + } + + public Image ByteArrayToImage(byte[] byteArrayIn) + { + Image returnImage = null; + MemoryStream ms = new System.IO.MemoryStream(byteArrayIn); + returnImage = Image.FromStream(ms); + + return returnImage; + } } } diff --git a/ReportImp/BetreuWoReports/ServicesOverviewReportALS.designer.cs b/ReportImp/BetreuWoReports/ServicesOverviewReportALS.designer.cs index 35a91a28b..37cf0f076 100644 --- a/ReportImp/BetreuWoReports/ServicesOverviewReportALS.designer.cs +++ b/ReportImp/BetreuWoReports/ServicesOverviewReportALS.designer.cs @@ -79,6 +79,9 @@ namespace BeWo.BetreuWoReports this.xrLabel1 = new DevExpress.XtraReports.UI.XRLabel(); this.GroupFooter3 = new DevExpress.XtraReports.UI.GroupFooterBand(); this.GroupHeader2 = new DevExpress.XtraReports.UI.GroupHeaderBand(); + this.xrTableCell5 = new DevExpress.XtraReports.UI.XRTableCell(); + this.xrTableCell6 = new DevExpress.XtraReports.UI.XRTableCell(); + this.picSignature = new DevExpress.XtraReports.UI.XRPictureBox(); ((System.ComponentModel.ISupportInitialize)(this.xrTableServiceRecords1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); @@ -105,7 +108,7 @@ namespace BeWo.BetreuWoReports this.xrTableServiceRecords1.Padding = new DevExpress.XtraPrinting.PaddingInfo(3, 0, 0, 0, 100F); this.xrTableServiceRecords1.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] { this.xrTableRow2}); - this.xrTableServiceRecords1.SizeF = new System.Drawing.SizeF(480F, 20F); + this.xrTableServiceRecords1.SizeF = new System.Drawing.SizeF(707F, 20F); this.xrTableServiceRecords1.StylePriority.UseBackColor = false; this.xrTableServiceRecords1.StylePriority.UseBorders = false; this.xrTableServiceRecords1.StylePriority.UseFont = false; @@ -120,7 +123,8 @@ namespace BeWo.BetreuWoReports this.xrTableCell4, this.xrTableCell1, this.xrTableCell2, - this.xrTableCell11}); + this.xrTableCell11, + this.xrTableCell5}); this.xrTableRow2.Name = "xrTableRow2"; this.xrTableRow2.StylePriority.UsePadding = false; this.xrTableRow2.StylePriority.UseTextAlignment = false; @@ -198,7 +202,7 @@ namespace BeWo.BetreuWoReports this.xrTable3.Padding = new DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F); this.xrTable3.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] { this.xrTableRow6}); - this.xrTable3.SizeF = new System.Drawing.SizeF(480F, 20F); + this.xrTable3.SizeF = new System.Drawing.SizeF(707F, 20F); this.xrTable3.StylePriority.UseBorders = false; this.xrTable3.StylePriority.UseFont = false; this.xrTable3.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft; @@ -210,7 +214,8 @@ namespace BeWo.BetreuWoReports this.xrTableCell7, this.xrTableCell14, this.xrTableCell15, - this.xrTableCell16}); + this.xrTableCell16, + this.xrTableCell6}); this.xrTableRow6.FormattingRules.Add(this.ruleRowInvisible); this.xrTableRow6.Name = "xrTableRow6"; this.xrTableRow6.Padding = new DevExpress.XtraPrinting.PaddingInfo(3, 0, 0, 0, 100F); @@ -569,6 +574,37 @@ namespace BeWo.BetreuWoReports this.GroupHeader2.Name = "GroupHeader2"; this.GroupHeader2.RepeatEveryPage = true; // + // xrTableCell5 + // + this.xrTableCell5.Name = "xrTableCell5"; + this.xrTableCell5.StylePriority.UseTextAlignment = false; + this.xrTableCell5.Text = "Unterschrift Klient/in"; + this.xrTableCell5.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; + this.xrTableCell5.Weight = 0.55356034248081987D; + // + // xrTableCell6 + // + this.xrTableCell6.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.picSignature}); + this.xrTableCell6.Name = "xrTableCell6"; + this.xrTableCell6.Padding = new DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F); + this.xrTableCell6.StylePriority.UsePadding = false; + this.xrTableCell6.StylePriority.UseTextAlignment = false; + this.xrTableCell6.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; + this.xrTableCell6.Weight = 0.28661621662654468D; + // + // picSignature + // + this.picSignature.Borders = DevExpress.XtraPrinting.BorderSide.None; + this.picSignature.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Tag", null, "Services.Signature")}); + this.picSignature.LocationFloat = new DevExpress.Utils.PointFloat(0F, 0F); + this.picSignature.Name = "picSignature"; + this.picSignature.SizeF = new System.Drawing.SizeF(227.0001F, 20.00001F); + this.picSignature.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage; + this.picSignature.StylePriority.UseBorders = false; + this.picSignature.BeforePrint += new System.Drawing.Printing.PrintEventHandler(this.picSignature_BeforePrint); + // // StundenzettelALS // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { @@ -657,5 +693,8 @@ namespace BeWo.BetreuWoReports private DevExpress.XtraReports.UI.XRLabel xrLabel1; private DevExpress.XtraReports.UI.XRPageInfo xrPageInfo1; private DevExpress.XtraReports.UI.XRLabel xrLabel2; + private DevExpress.XtraReports.UI.XRTableCell xrTableCell5; + private DevExpress.XtraReports.UI.XRTableCell xrTableCell6; + private DevExpress.XtraReports.UI.XRPictureBox picSignature; } } diff --git a/ReportImp/BetreuungsserviceFuerAlltagUndWohnen/BetreuungsserviceFuerAlltagUndWohnen.csproj b/ReportImp/BetreuungsserviceFuerAlltagUndWohnen/BetreuungsserviceFuerAlltagUndWohnen.csproj index 8fa886b8c..9fd672834 100644 --- a/ReportImp/BetreuungsserviceFuerAlltagUndWohnen/BetreuungsserviceFuerAlltagUndWohnen.csproj +++ b/ReportImp/BetreuungsserviceFuerAlltagUndWohnen/BetreuungsserviceFuerAlltagUndWohnen.csproj @@ -51,6 +51,8 @@ + + Component diff --git a/ReportImp/BetreuungsserviceFuerAlltagUndWohnen/Invoicing/CustomInvoiceCreation.cs b/ReportImp/BetreuungsserviceFuerAlltagUndWohnen/Invoicing/CustomInvoiceCreation.cs new file mode 100644 index 000000000..063a735ae --- /dev/null +++ b/ReportImp/BetreuungsserviceFuerAlltagUndWohnen/Invoicing/CustomInvoiceCreation.cs @@ -0,0 +1,50 @@ +using BeWo.Data.Entities; +using BeWo.Service.Invoicing; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BetreuungsserviceFuerAlltagUndWohnen.Invoicing +{ + public class CustomInvoiceCreation : InvoiceCreation + { + public override void BerechneSummaryItemsSummen(List newlist, bool addRateFactorToUnitCount) + { + addRateFactorToUnitCount = true; + 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, 2, 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/BetreuungsserviceFuerAlltagUndWohnen/Invoicing/CustomInvoiceFactory.cs b/ReportImp/BetreuungsserviceFuerAlltagUndWohnen/Invoicing/CustomInvoiceFactory.cs new file mode 100644 index 000000000..e62038c19 --- /dev/null +++ b/ReportImp/BetreuungsserviceFuerAlltagUndWohnen/Invoicing/CustomInvoiceFactory.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using BeWo.Data.Access; +using BeWo.Data.Entities; +using BeWo.Service.Invoicing; +using BS.Shared.DataContracts; +using BS.Shared.DataContracts.Compact; + +namespace BetreuungsserviceFuerAlltagUndWohnen.Invoicing +{ + public class CustomInvoiceFactory : InvoiceFactory + { + + public override InvoiceCreation CreateInvoiceCreator(string specificId, string tenant, Dictionary> supportConcepts2ServiceRecords) + { + return new CustomInvoiceCreation(); + } + + + } +} diff --git a/ReportImp/BetreuungsserviceFuerAlltagUndWohnen/ServiceInvoiceReport.cs b/ReportImp/BetreuungsserviceFuerAlltagUndWohnen/ServiceInvoiceReport.cs index 64a888f79..1580a7d29 100644 --- a/ReportImp/BetreuungsserviceFuerAlltagUndWohnen/ServiceInvoiceReport.cs +++ b/ReportImp/BetreuungsserviceFuerAlltagUndWohnen/ServiceInvoiceReport.cs @@ -25,7 +25,7 @@ namespace BetreuungsserviceFuerAlltagUndWohnen hourlyRate = invoiceItem.HourlyRate.Value; } } - flsGesamt = flsGesamt * (1 + pRO.InvoiceBase.SupportConceptCostBearerRelDc.CostBearer.ActualRateFactor / 100); + //flsGesamt = flsGesamt * (1 + pRO.InvoiceBase.SupportConceptCostBearerRelDc.CostBearer.ActualRateFactor / 100); lblGesamtFLS.Text = string.Format("{0:0.00}", flsGesamt); lblGesamtforderung.Text = string.Format("{0:0.00} Stunden x {1:c}", flsGesamt, hourlyRate);