BeWoTrio/Invoicing/CustomInvoiceCreation.cs - Selbstzahler u Pers Budget

This commit is contained in:
2025-02-19 16:19:58 +01:00
parent e6e486036f
commit 1f105919a4
7 changed files with 190 additions and 5690 deletions

View File

@@ -67,6 +67,8 @@
<Compile Include="InvoiceCustomerReport.Designer.cs">
<DependentUpon>InvoiceCustomerReport.cs</DependentUpon>
</Compile>
<Compile Include="Invoicing\CustomInvoiceFactory.cs" />
<Compile Include="Invoicing\CustomInvoiceCreation.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServiceInvoiceReport.cs">
<SubType>Component</SubType>

View File

@@ -0,0 +1,86 @@
using BeWo.Data.Entities;
using BeWo.Service.Invoicing;
using System.Linq;
using BeWo.Data.Access;
namespace BeWoTrio.Invoicing
{
public class CustomInvoiceCreation : InvoiceCreation
{
public override void SetRecipientInformation(ServiceInvoice serviceInvoice, CostBearer costBearer)
{
if (costBearer.Organisation.Name.ToLower().Contains("selbstzahler") || costBearer.Organisation.Name.ToLower().Contains("budget"))
{
serviceInvoice.InvoiceBase.RecipientDivision = costBearer.Organisation.Name2;
serviceInvoice.InvoiceBase.RecipientOrganisationOid = costBearer.Organisation.Oid;
serviceInvoice.InvoiceBase.RecipientOrganisation = costBearer.Organisation.Name;
if(costBearer.Organisation.Name.ToLower().Contains("selbstzahler"))
{
serviceInvoice.InvoiceBase.RecipientOrganisation = "Selbstzahler";
}
serviceInvoice.InvoiceBase.RecipientContacts = costBearer.Organisation.Contacts.Select(i => i.CopyToNew()).ToList();
serviceInvoice.InvoiceBase.RecipientCostBearerOid = costBearer.Oid;
if (serviceInvoice.InvoiceBase.CostBearer2SupportConcept != null)
{
var cust = serviceInvoice.InvoiceBase.CostBearer2SupportConcept.SupportConcept.Customer;
if (cust.Person.InvoiceAddress != null)
{
serviceInvoice.InvoiceBase.RecipientAddress = cust.Person.InvoiceAddress.CopyToNew();
}
else if (cust.Person.Address != null)
{
serviceInvoice.InvoiceBase.RecipientAddress = cust.Person.Address.CopyToNew();
}
if (cust.Person.InvoiceAddress != null && cust.Person.InvoiceAddress.AddressLine1 != null) // Anderer Rechnungsempfänger z.B. Vormund
{
serviceInvoice.InvoiceBase.RecipientPersonFirstName = cust.Person.InvoiceAddress.AddressLine1;
serviceInvoice.InvoiceBase.RecipientPersonLastName = "";
}
else
{
serviceInvoice.InvoiceBase.RecipientPersonFirstName = cust.Person.FirstName;
serviceInvoice.InvoiceBase.RecipientPersonLastName = cust.Person.LastName;
}
return;
}
if (costBearer.Organisation.InvoiceAddress != null)
{
serviceInvoice.InvoiceBase.RecipientAddress = costBearer.Organisation.InvoiceAddress.CopyToNew();
}
else if (costBearer.Organisation.Address != null)
{
serviceInvoice.InvoiceBase.RecipientAddress = costBearer.Organisation.Address.CopyToNew();
}
}
else
{
if (costBearer.Organisation.InvoiceAddress != null)
{
serviceInvoice.InvoiceBase.RecipientAddress = costBearer.Organisation.InvoiceAddress.CopyToNew();
}
else if (costBearer.Organisation.Address != null)
{
serviceInvoice.InvoiceBase.RecipientAddress = costBearer.Organisation.Address.CopyToNew();
}
serviceInvoice.InvoiceBase.RecipientDivision = costBearer.Organisation.Name2;
serviceInvoice.InvoiceBase.RecipientOrganisationOid = costBearer.Organisation.Oid;
serviceInvoice.InvoiceBase.RecipientOrganisation = costBearer.Organisation.Name;
serviceInvoice.InvoiceBase.RecipientContacts = costBearer.Organisation.Contacts.Select(i => i.CopyToNew()).ToList();
serviceInvoice.InvoiceBase.RecipientCostBearerOid = costBearer.Oid;
//serviceInvoice.InvoiceBase. = c2s.CostBearer.Organisation.Contacts.FirstOrDefault(f => f.Type.Equals(ContactType.business_POBox)) != null ? c2s.CostBearer.Organisation.Contacts.FirstOrDefault(f => f.Type.Equals(ContactType.business_POBox)).Value : String.Empty;
if (serviceInvoice.InvoiceBase.CostBearer2SupportConcept != null &&
serviceInvoice.InvoiceBase.CostBearer2SupportConcept.CostBearerContactPerson != null)
{
serviceInvoice.InvoiceBase.RecipientPersonFirstName = serviceInvoice.InvoiceBase.CostBearer2SupportConcept.CostBearerContactPerson.FirstName;
serviceInvoice.InvoiceBase.RecipientPersonLastName = serviceInvoice.InvoiceBase.CostBearer2SupportConcept.CostBearerContactPerson.LastName;
}
}
}
}
}

View File

@@ -0,0 +1,19 @@
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;
using BS.Shared.Services;
namespace BeWoTrio.Invoicing
{
public class CustomInvoiceFactory : InvoiceFactory
{
public override InvoiceCreation CreateInvoiceCreator(string specificId, string tenant, Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>> supportConcepts2ServiceRecords)
{
return new CustomInvoiceCreation(); // neben Selbstzahler auch persönliches Budget
}
}
}

View File

@@ -0,0 +1 @@
DevExpress.XtraReports.UI.XtraReport, DevExpress.XtraReports.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@@ -29,13 +29,14 @@ namespace BeWoTrio
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
DevExpress.XtraReports.UI.XRWatermark xrWatermark1 = new DevExpress.XtraReports.UI.XRWatermark();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ServiceInvoiceReport));
this.Detail = new DevExpress.XtraReports.UI.DetailBand();
this.ruleRateFactorNull = new DevExpress.XtraReports.UI.FormattingRule();
this.topMarginBand1 = new DevExpress.XtraReports.UI.TopMarginBand();
this.bottomMarginBand1 = new DevExpress.XtraReports.UI.BottomMarginBand();
this.Page1 = new DevExpress.XtraReports.UI.GroupHeaderBand();
this.xrLabel7 = new DevExpress.XtraReports.UI.XRLabel();
this.lblAdresse = new DevExpress.XtraReports.UI.XRLabel();
this.xrLabel4 = new DevExpress.XtraReports.UI.XRLabel();
this.xrLabel3 = new DevExpress.XtraReports.UI.XRLabel();
this.xrLabel2 = new DevExpress.XtraReports.UI.XRLabel();
@@ -67,9 +68,9 @@ namespace BeWoTrio
this.xrTableCell46 = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableCell47 = new DevExpress.XtraReports.UI.XRTableCell();
this.GroupFooter1 = new DevExpress.XtraReports.UI.GroupFooterBand();
this.xrLabel10 = new DevExpress.XtraReports.UI.XRLabel();
this.xrLabel1 = new DevExpress.XtraReports.UI.XRLabel();
this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);
this.xrLabel10 = new DevExpress.XtraReports.UI.XRLabel();
((System.ComponentModel.ISupportInitialize)(this.xrTable5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit();
@@ -101,7 +102,7 @@ namespace BeWoTrio
// Page1
//
this.Page1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] {
this.xrLabel7,
this.lblAdresse,
this.xrLabel4,
this.xrLabel3,
this.xrLabel2,
@@ -112,22 +113,23 @@ namespace BeWoTrio
this.Page1.Name = "Page1";
this.Page1.StylePriority.UseFont = false;
//
// xrLabel7
// lblAdresse
//
this.xrLabel7.LocationFloat = new DevExpress.Utils.PointFloat(0F, 0F);
this.xrLabel7.Multiline = true;
this.xrLabel7.Name = "xrLabel7";
this.xrLabel7.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F);
this.xrLabel7.SizeF = new System.Drawing.SizeF(317F, 111.5F);
this.xrLabel7.StylePriority.UseFont = false;
this.xrLabel7.Text = "[RecipientOrganisation]\r\n[RecipientContactPerson]\r\n[RecipientDivision]\r\n[Recipien" +
this.lblAdresse.LocationFloat = new DevExpress.Utils.PointFloat(0F, 0F);
this.lblAdresse.Multiline = true;
this.lblAdresse.Name = "lblAdresse";
this.lblAdresse.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F);
this.lblAdresse.SizeF = new System.Drawing.SizeF(317F, 111.5F);
this.lblAdresse.StylePriority.UseFont = false;
this.lblAdresse.Text = "[RecipientOrganisation]\r\n[RecipientContactPerson]\r\n[RecipientDivision]\r\n[Recipien" +
"tStreet]\r\n[RecipientPostCodeAndTown]";
//
// xrLabel4
//
this.xrLabel4.BackColor = System.Drawing.Color.Transparent;
this.xrLabel4.CanShrink = true;
this.xrLabel4.Font = new System.Drawing.Font("Times New Roman", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.xrLabel4.Font = new DevExpress.Drawing.DXFont("Times New Roman", 10F, DevExpress.Drawing.DXFontStyle.Bold, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {
new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))});
this.xrLabel4.LocationFloat = new DevExpress.Utils.PointFloat(0F, 244.0278F);
this.xrLabel4.Multiline = true;
this.xrLabel4.Name = "xrLabel4";
@@ -142,7 +144,8 @@ namespace BeWoTrio
//
this.xrLabel3.BackColor = System.Drawing.Color.Transparent;
this.xrLabel3.CanShrink = true;
this.xrLabel3.Font = new System.Drawing.Font("Times New Roman", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.xrLabel3.Font = new DevExpress.Drawing.DXFont("Times New Roman", 10F, DevExpress.Drawing.DXFontStyle.Bold, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {
new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))});
this.xrLabel3.LocationFloat = new DevExpress.Utils.PointFloat(0F, 224.0278F);
this.xrLabel3.Name = "xrLabel3";
this.xrLabel3.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F);
@@ -156,7 +159,8 @@ namespace BeWoTrio
//
this.xrLabel2.BackColor = System.Drawing.Color.Transparent;
this.xrLabel2.CanShrink = true;
this.xrLabel2.Font = new System.Drawing.Font("Times New Roman", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.xrLabel2.Font = new DevExpress.Drawing.DXFont("Times New Roman", 10F, DevExpress.Drawing.DXFontStyle.Bold, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {
new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))});
this.xrLabel2.LocationFloat = new DevExpress.Utils.PointFloat(0F, 204.0278F);
this.xrLabel2.Name = "xrLabel2";
this.xrLabel2.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F);
@@ -401,7 +405,8 @@ namespace BeWoTrio
//
// xrTable6
//
this.xrTable6.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.xrTable6.Font = new DevExpress.Drawing.DXFont("Verdana", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {
new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))});
this.xrTable6.LocationFloat = new DevExpress.Utils.PointFloat(0F, 0F);
this.xrTable6.Name = "xrTable6";
this.xrTable6.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] {
@@ -546,12 +551,24 @@ namespace BeWoTrio
this.xrLabel14});
this.GroupFooter1.HeightF = 179.5F;
this.GroupFooter1.Name = "GroupFooter1";
//
// xrLabel10
//
this.xrLabel10.LocationFloat = new DevExpress.Utils.PointFloat(0F, 77.41667F);
this.xrLabel10.Multiline = true;
this.xrLabel10.Name = "xrLabel10";
this.xrLabel10.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F);
this.xrLabel10.SizeF = new System.Drawing.SizeF(535.9375F, 53.6459F);
this.xrLabel10.StylePriority.UseFont = false;
this.xrLabel10.Text = "Nach § 4 Nr. 16 Buchst. H UstG wird keine Umsatzsteuer berechnet.\r\n\r\nMit freundli" +
"chen Grüßen";
//
// xrLabel1
//
this.xrLabel1.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
new DevExpress.XtraReports.UI.XRBinding("Text", null, "GrossClaim", "Gesamtsumme: {0}")});
this.xrLabel1.Font = new System.Drawing.Font("Times New Roman", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.xrLabel1.Font = new DevExpress.Drawing.DXFont("Times New Roman", 10F, DevExpress.Drawing.DXFontStyle.Bold, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {
new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))});
this.xrLabel1.LocationFloat = new DevExpress.Utils.PointFloat(381.1667F, 0F);
this.xrLabel1.Name = "xrLabel1";
this.xrLabel1.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 5, 0, 0, 100F);
@@ -565,17 +582,6 @@ namespace BeWoTrio
// bindingSource1
//
this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO);
//
// xrLabel10
//
this.xrLabel10.LocationFloat = new DevExpress.Utils.PointFloat(0F, 77.41667F);
this.xrLabel10.Multiline = true;
this.xrLabel10.Name = "xrLabel10";
this.xrLabel10.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F);
this.xrLabel10.SizeF = new System.Drawing.SizeF(535.9375F, 53.6459F);
this.xrLabel10.StylePriority.UseFont = false;
this.xrLabel10.Text = "Nach § 4 Nr. 16 Buchst. H UstG wird keine Umsatzsteuer berechnet.\r\n\r\nMit freundli" +
"chen Grüßen";
//
// ServiceInvoiceReport
//
@@ -587,16 +593,19 @@ namespace BeWoTrio
this.DetailReport});
this.DataSource = this.bindingSource1;
this.ExportOptions.PrintPreview.DefaultFileName = "Spitzabrechnung";
this.Font = new System.Drawing.Font("Times New Roman", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Font = new DevExpress.Drawing.DXFont("Times New Roman", 10F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {
new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))});
this.FormattingRuleSheet.AddRange(new DevExpress.XtraReports.UI.FormattingRule[] {
this.ruleRateFactorNull});
this.Margins = new System.Drawing.Printing.Margins(115, 74, 230, 120);
this.Margins = new DevExpress.Drawing.DXMargins(115F, 74F, 230F, 120F);
this.PageHeight = 1169;
this.PageWidth = 827;
this.PaperKind = DevExpress.Drawing.Printing.DXPaperKind.A4;
this.Version = "17.1";
this.Watermark.Image = ((System.Drawing.Image)(resources.GetObject("ServiceInvoiceReport.Watermark.Image")));
this.Watermark.ImageViewMode = DevExpress.XtraPrinting.Drawing.ImageViewMode.Zoom;
this.Version = "23.2";
xrWatermark1.Id = "Watermark1";
xrWatermark1.ImageSource = new DevExpress.XtraPrinting.Drawing.ImageSource("img", resources.GetString("xrWatermark1.ImageSource"));
xrWatermark1.ImageViewMode = DevExpress.XtraPrinting.Drawing.ImageViewMode.Zoom;
this.Watermarks.Add(xrWatermark1);
((System.ComponentModel.ISupportInitialize)(this.xrTable5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit();
@@ -641,7 +650,7 @@ namespace BeWoTrio
private DevExpress.XtraReports.UI.XRTableCell xrTableCell45;
private DevExpress.XtraReports.UI.XRTableCell xrTableCell46;
private DevExpress.XtraReports.UI.XRTableCell xrTableCell47;
private DevExpress.XtraReports.UI.XRLabel xrLabel7;
private DevExpress.XtraReports.UI.XRLabel lblAdresse;
private DevExpress.XtraReports.UI.GroupFooterBand GroupFooter1;
private DevExpress.XtraReports.UI.XRLabel xrLabel1;
private DevExpress.XtraReports.UI.XRLabel xrLabel10;

View File

@@ -1,4 +1,5 @@
using System;
using System.Text;
using BeWo.Report;
using BeWo.Report.ReportObjects;
@@ -26,7 +27,44 @@ namespace BeWoTrio
lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Zeitraum {0:MMMM yyyy} - {1:MMMM yyyy} folgende erbrachte Tätigkeiten:", start, end);
}
SetzeAdresse(pRO);
this.bindingSource1.DataSource = pRO;
}
private void SetzeAdresse(ServiceInvoiceRO pRO)
{
StringBuilder sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && !pRO.RecipientOrganisation.ToLower().Contains("selbstzahler")
&& !pRO.RecipientOrganisation.ToLower().Contains("budget"))
{
sb.AppendLine(pRO.RecipientOrganisation);
}
//if (!String.IsNullOrEmpty(pRO.RecipientAddressLine1))
//{
// sb.AppendLine(pRO.RecipientAddressLine1);
//}
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
{
sb.AppendLine(pRO.RecipientContactPerson);
}
if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientOrganisation) && pRO.RecipientOrganisation.ToLower() != "selbstzahler")
{
sb.AppendLine(pRO.RecipientDivision);
}
if (!String.IsNullOrEmpty(pRO.RecipientPoBox))
{
sb.AppendLine(pRO.RecipientPoBox);
}
else if (!String.IsNullOrEmpty(pRO.RecipientStreet))
{
sb.AppendLine(pRO.RecipientStreet);
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
{
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAdresse.Text = sb.ToString();
}
}
}

File diff suppressed because one or more lines are too long