diff --git a/ReportImp/KetteReports/Invoicing/CustomInvoiceFactory.cs b/ReportImp/KetteReports/Invoicing/CustomInvoiceFactory.cs index 6d45150f9..4a6cf1340 100644 --- a/ReportImp/KetteReports/Invoicing/CustomInvoiceFactory.cs +++ b/ReportImp/KetteReports/Invoicing/CustomInvoiceFactory.cs @@ -21,13 +21,12 @@ namespace KetteReports.Invoicing var org = cb2sc.CostBearer.Organisation; - if (org.Function != null && (org.Function.Value.Contains("Privat") || org.Function.Value.Contains("Priavat"))) - { - return new SelbstzahlerInvoiceCreation(); - - } - - + if (org.Function != null && (org.Function.Value.Contains("Privat") || org.Function.Value.Contains("Priavat"))) + { + return new SelbstzahlerInvoiceCreation(); + } + else + return new CustomInvoiceCreation(); } return base.CreateInvoiceCreator(specificId, tenant, supportConcepts2ServiceRecords); diff --git a/ReportImp/KetteReports/Invoicing/DefaultInvoiceCreation.cs b/ReportImp/KetteReports/Invoicing/DefaultInvoiceCreation.cs index 307785169..9c2843856 100644 --- a/ReportImp/KetteReports/Invoicing/DefaultInvoiceCreation.cs +++ b/ReportImp/KetteReports/Invoicing/DefaultInvoiceCreation.cs @@ -17,29 +17,29 @@ namespace KetteReports.Invoicing { public class SelbstzahlerInvoiceCreation : InvoiceCreation { - public override void SetRecipientInformation(ServiceInvoice serviceInvoice, CostBearer costBearer) - { - base.SetRecipientInformation(serviceInvoice, costBearer); - - String name = costBearer.Organisation.Name; - - if (costBearer.Organisation.InvoiceAddress != null) - { - if (!String.IsNullOrWhiteSpace(costBearer.Organisation.InvoiceAddress.AddressLine1)) - { - name = costBearer.Organisation.InvoiceAddress.AddressLine1; - } - - } - else if (costBearer.Organisation.Address != null) - { - if (!String.IsNullOrWhiteSpace(costBearer.Organisation.Address.AddressLine1)) - { - name = costBearer.Organisation.Address.AddressLine1; - } - } - - serviceInvoice.InvoiceBase.RecipientOrganisation = name; - } + public override void SetRecipientInformation(ServiceInvoice serviceInvoice, CostBearer costBearer) + { + base.SetRecipientInformation(serviceInvoice, costBearer); + + String name = costBearer.Organisation.Name; + + if (costBearer.Organisation.InvoiceAddress != null) + { + if (!String.IsNullOrWhiteSpace(costBearer.Organisation.InvoiceAddress.AddressLine1)) + { + name = costBearer.Organisation.InvoiceAddress.AddressLine1; + } + + } + else if (costBearer.Organisation.Address != null) + { + if (!String.IsNullOrWhiteSpace(costBearer.Organisation.Address.AddressLine1)) + { + name = costBearer.Organisation.Address.AddressLine1; + } + } + + serviceInvoice.InvoiceBase.RecipientOrganisation = name; + } } } diff --git a/ReportImp/KetteReports/KetteReports.csproj b/ReportImp/KetteReports/KetteReports.csproj index dac98630c..934a4146c 100644 --- a/ReportImp/KetteReports/KetteReports.csproj +++ b/ReportImp/KetteReports/KetteReports.csproj @@ -135,6 +135,7 @@ + Component diff --git a/ReportImp/KetteReports/ServiceInvoiceReport.Designer.cs b/ReportImp/KetteReports/ServiceInvoiceReport.Designer.cs index 18b705eb1..3e6139639 100644 --- a/ReportImp/KetteReports/ServiceInvoiceReport.Designer.cs +++ b/ReportImp/KetteReports/ServiceInvoiceReport.Designer.cs @@ -34,6 +34,7 @@ namespace KetteReports this.ReportHeader = new DevExpress.XtraReports.UI.ReportHeaderBand(); this.ruleRateFactorNull = new DevExpress.XtraReports.UI.FormattingRule(); this.topMarginBand1 = new DevExpress.XtraReports.UI.TopMarginBand(); + this.xrPictureBox2 = new DevExpress.XtraReports.UI.XRPictureBox(); this.bottomMarginBand1 = new DevExpress.XtraReports.UI.BottomMarginBand(); this.xrRichText1 = new DevExpress.XtraReports.UI.XRRichText(); this.xrLabel6 = new DevExpress.XtraReports.UI.XRLabel(); @@ -81,7 +82,6 @@ namespace KetteReports this.xrLabel8 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel1 = new DevExpress.XtraReports.UI.XRLabel(); this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); - this.xrPictureBox2 = new DevExpress.XtraReports.UI.XRPictureBox(); ((System.ComponentModel.ISupportInitialize)(this.xrRichText1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrRichText2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable4)).BeginInit(); @@ -117,6 +117,14 @@ namespace KetteReports this.topMarginBand1.HeightF = 210F; this.topMarginBand1.Name = "topMarginBand1"; // + // xrPictureBox2 + // + this.xrPictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("xrPictureBox2.Image"))); + this.xrPictureBox2.LocationFloat = new DevExpress.Utils.PointFloat(518.2781F, 54.8958F); + this.xrPictureBox2.Name = "xrPictureBox2"; + this.xrPictureBox2.SizeF = new System.Drawing.SizeF(183.7219F, 145.1042F); + this.xrPictureBox2.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage; + // // bottomMarginBand1 // this.bottomMarginBand1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { @@ -702,14 +710,6 @@ namespace KetteReports // this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO); // - // xrPictureBox2 - // - this.xrPictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("xrPictureBox2.Image"))); - this.xrPictureBox2.LocationFloat = new DevExpress.Utils.PointFloat(518.2781F, 54.8958F); - this.xrPictureBox2.Name = "xrPictureBox2"; - this.xrPictureBox2.SizeF = new System.Drawing.SizeF(183.7219F, 145.1042F); - this.xrPictureBox2.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage; - // // ServiceInvoiceReport // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { diff --git a/ReportImp/KetteReports/ServiceInvoiceReport.cs b/ReportImp/KetteReports/ServiceInvoiceReport.cs index 96f5c84c3..28e0d7417 100644 --- a/ReportImp/KetteReports/ServiceInvoiceReport.cs +++ b/ReportImp/KetteReports/ServiceInvoiceReport.cs @@ -32,7 +32,9 @@ namespace KetteReports } //Rechnung an Sozialamt Bergisch Gladbach, Gybowitch und Herrn Schulze. Adresse Abrechnungsbetreuungsleistung für steht kein Name SetzeAdresse(pRO); - + + if (pRO.RecipientOrganisation.ToLower().Contains("jugendamt") && pRO.ServiceInvoicePeriods[0].ServiceInvoiceItems[0].UnitDescription != null) + pRO.CustomerReferenceNumber += " i.V.m. " + pRO.ServiceInvoicePeriods[0].ServiceInvoiceItems[0].UnitDescription; DateTime start = pRO.AccountingPeriodStart; DateTime end = pRO.AccountingPeriodEnd; diff --git a/ReportImp/PraxisPusteblume/QuittierungsbelegIfs.Designer.cs b/ReportImp/PraxisPusteblume/QuittierungsbelegIfs.Designer.cs index 31a4791a6..bc09819ef 100644 --- a/ReportImp/PraxisPusteblume/QuittierungsbelegIfs.Designer.cs +++ b/ReportImp/PraxisPusteblume/QuittierungsbelegIfs.Designer.cs @@ -56,7 +56,6 @@ namespace PraxisPusteblume this.xrTableCell7 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell18 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell6 = new DevExpress.XtraReports.UI.XRTableCell(); - this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); this.GroupFooter1 = new DevExpress.XtraReports.UI.GroupFooterBand(); this.xrLabel14 = new DevExpress.XtraReports.UI.XRLabel(); this.fieldEinzel = new DevExpress.XtraReports.UI.CalculatedField(); @@ -81,13 +80,15 @@ namespace PraxisPusteblume this.xrTableCell12 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell13 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell15 = new DevExpress.XtraReports.UI.XRTableCell(); + this.picSignature = new DevExpress.XtraReports.UI.XRPictureBox(); + this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); ((System.ComponentModel.ISupportInitialize)(this.rtAnschriftNormal)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.rtKopfNormal)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.rtFussNormal)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable3)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); // // Detail @@ -179,7 +180,7 @@ namespace PraxisPusteblume // // lblAdresse // - this.lblAdresse.LocationFloat = new DevExpress.Utils.PointFloat(45.83333F, 32.29173F); + this.lblAdresse.LocationFloat = new DevExpress.Utils.PointFloat(45.83308F, 32.2917F); this.lblAdresse.Multiline = true; this.lblAdresse.Name = "lblAdresse"; this.lblAdresse.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); @@ -338,10 +339,6 @@ namespace PraxisPusteblume this.xrTableCell6.Text = "Unterschrift der\r\nErziehungsberechtigten bzw.\r\nder Erzieher*in der Kita"; this.xrTableCell6.Weight = 0.33846153645799254D; // - // bindingSource1 - // - this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServicesOverviewRO); - // // GroupFooter1 // this.GroupFooter1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { @@ -488,7 +485,10 @@ namespace PraxisPusteblume // // xrTableCell3 // - this.xrTableCell3.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Right))); + this.xrTableCell3.Borders = ((DevExpress.XtraPrinting.BorderSide)(((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Right) + | DevExpress.XtraPrinting.BorderSide.Bottom))); + this.xrTableCell3.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.picSignature}); this.xrTableCell3.FormattingRules.Add(this.ruleBorderUnten); this.xrTableCell3.Name = "xrTableCell3"; this.xrTableCell3.StylePriority.UseBorders = false; @@ -592,7 +592,8 @@ namespace PraxisPusteblume // // xrTableCell15 // - this.xrTableCell15.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Right))); + this.xrTableCell15.Borders = ((DevExpress.XtraPrinting.BorderSide)(((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Right) + | DevExpress.XtraPrinting.BorderSide.Bottom))); this.xrTableCell15.FormattingRules.Add(this.ruleBorderUnten); this.xrTableCell15.Name = "xrTableCell15"; this.xrTableCell15.StylePriority.UseBorders = false; @@ -600,6 +601,22 @@ namespace PraxisPusteblume this.xrTableCell15.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; this.xrTableCell15.Weight = 0.33846153846153831D; // + // 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(30F, 2F); + this.picSignature.Name = "picSignature"; + this.picSignature.SizeF = new System.Drawing.SizeF(160F, 20F); + this.picSignature.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage; + this.picSignature.StylePriority.UseBorders = false; + this.picSignature.BeforePrint += new System.Drawing.Printing.PrintEventHandler(this.picSignature_BeforePrint); + // + // bindingSource1 + // + this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServicesOverviewRO); + // // QuittierungsbelegIfs // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { @@ -628,9 +645,9 @@ namespace PraxisPusteblume ((System.ComponentModel.ISupportInitialize)(this.rtKopfNormal)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.rtFussNormal)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable3)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xrTable1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); } @@ -687,5 +704,6 @@ namespace PraxisPusteblume private DevExpress.XtraReports.UI.XRTableCell xrTableCell12; private DevExpress.XtraReports.UI.XRTableCell xrTableCell13; private DevExpress.XtraReports.UI.XRTableCell xrTableCell15; + private DevExpress.XtraReports.UI.XRPictureBox picSignature; } } diff --git a/ReportImp/PraxisPusteblume/QuittierungsbelegIfs.cs b/ReportImp/PraxisPusteblume/QuittierungsbelegIfs.cs index 85fd5a419..6b2c2b3d5 100644 --- a/ReportImp/PraxisPusteblume/QuittierungsbelegIfs.cs +++ b/ReportImp/PraxisPusteblume/QuittierungsbelegIfs.cs @@ -1,9 +1,12 @@ using System; +using System.IO; using System.Text; +using System.Text.RegularExpressions; using BeWo.Data.Access; -using BeWo.Data.Entities; +//using BeWo.Data.Entities; using BeWo.Report; using BeWo.Report.ReportObjects; +using System.Drawing; using BeWo.Service.ServiceImplementations; using BS.Shared; using BS.Shared.Core; @@ -32,6 +35,7 @@ namespace PraxisPusteblume foreach (var sd in pRO.Services) { pRO.MainAttendant = sd.EmployeeFullname; + ServicesOverviewRO.CreateSignatureString(sd); //sd.Notice = String.Format("{0:0.##}", sd.Minutes / 60); sd.Notice = InvoiceHelper.GetUnitString(((decimal)sd.Minutes * (4m / 3m) / 60m)); @@ -79,7 +83,7 @@ namespace PraxisPusteblume sb.AppendLine(org.Name); - var orgEnt = DAOFactory.GenericDAO.LoadByID(org.OrganisationOid); + //var orgEnt = DAOFactory.GenericDAO.LoadByID(org.OrganisationOid); if (!String.IsNullOrEmpty(org.Name2)) { sb.AppendLine(org.Name2); @@ -118,6 +122,79 @@ namespace PraxisPusteblume } return null; } - + + private void EmployeeSignature_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) + { + return; + + if (sender is XRPictureBox pictureBox) + { + var base64String = pictureBox.Tag as string; + + if (!string.IsNullOrWhiteSpace(base64String)) + { + var base64Data = Regex.Match(base64String, @"data:image/(?.+?),(?.+)").Groups["data"].Value; + var binaryData = Convert.FromBase64String(base64Data); + var image = ByteArrayToImage(binaryData); + + pictureBox.Image = image; + } + else + { + pictureBox.Image = null; + } + } + } + + // TODO: Wie anzeigen? Alle? + // TODO: Visibile der Datumstextboxen auf true setzen! + private void CustomerSignature_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) + { + return; + + if (sender is XRPictureBox pictureBox) + { + var base64String = pictureBox.Tag as string; + + if (!string.IsNullOrWhiteSpace(base64String)) + { + var base64Data = Regex.Match(base64String, @"data:image/(?.+?),(?.+)").Groups["data"].Value; + var binaryData = Convert.FromBase64String(base64Data); + var image = ByteArrayToImage(binaryData); + + pictureBox.Image = image; + } + else + { + pictureBox.Image = 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) + { + using (var memoryStream = new MemoryStream(byteArrayIn)) + { + return Image.FromStream(memoryStream); + } + } } } \ No newline at end of file