From 435488a421ac818c2ad94de04476dbcc8264b594 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Fri, 28 Apr 2023 15:26:02 +0200 Subject: [PATCH] DomizielAnsbach diverse Anpassungen --- .../Invoicing/InvoiceHelper.cs | 22 ++++++------ .../DomizielAnsbach/RechnungBezirkDetail.cs | 22 +++++++++--- .../DomizielAnsbach/RechnungPB.Designer.cs | 20 +++++------ ReportImp/DomizielAnsbach/RechnungPB.cs | 9 +++++ .../ServiceInvoiceReport.Designer.cs | 20 +++++------ .../DomizielAnsbach/ServiceInvoiceReport.cs | 34 ++++++++++++++++++- .../SettlementReport.Designer.cs | 20 +++++------ ReportImp/DomizielAnsbach/SettlementReport.cs | 18 ++++++++-- ReportImp/DomizielAnsbach/ZVBerichtBezirk.cs | 2 +- 9 files changed, 118 insertions(+), 49 deletions(-) diff --git a/ReportImp/DomizielAnsbach/Invoicing/InvoiceHelper.cs b/ReportImp/DomizielAnsbach/Invoicing/InvoiceHelper.cs index 36c44c933..415e5b6b3 100644 --- a/ReportImp/DomizielAnsbach/Invoicing/InvoiceHelper.cs +++ b/ReportImp/DomizielAnsbach/Invoicing/InvoiceHelper.cs @@ -26,11 +26,11 @@ namespace DomizielAnsbach.Invoicing if (scap.StartDate <= invoicePeriod.StartDate) start = invoicePeriod.StartDate; else - start = (DateTime)scap.StartDate; + start = (DateTime)scap.StartDate; //Einzugstag wird mit abgerechnet if (scap.EndDate >= invoicePeriod.EndDate) ende = invoicePeriod.EndDate; else - ende = (DateTime)scap.EndDate; + ende = (DateTime)scap.EndDate.Value.AddDays(-1); //Auszugstag wird NICHT abgerechnet var preise = DAOFactory.GenericDAO.GetAllActive(); @@ -40,7 +40,6 @@ namespace DomizielAnsbach.Invoicing while (start <= ende) { - DateTime monatStart = new DateTime(start.Year, start.Month, 1); DateTime monatEnde = monatStart.AddMonths(1); @@ -52,12 +51,13 @@ namespace DomizielAnsbach.Invoicing foreach (var at in customer.AbsenceTimes) { DateTime? startAbw = at.Start; - DateTime? endMinusEinTag = at.End; - if (at.Start.HasValue && at.End.HasValue && at.End.Value.Date.Subtract(at.Start.Value.Date).TotalDays > 0) - { - endMinusEinTag = at.End.Value.AddDays(-1); - } - if (startAbw.HasValue && startAbw.Value < monatEnde && (!endMinusEinTag.HasValue || endMinusEinTag.Value >= monatStart)) + DateTime? endAbw = at.End; + //18.04.2023: Frau Sachsenhauser sagt, jeder Tag Abwesenheit muss mit Platzfreihaltepauschale bezahlt werden + //if (at.Start.HasValue && at.End.HasValue && at.End.Value.Date.Subtract(at.Start.Value.Date).TotalDays > 0) + //{ + // endAbw = at.End.Value.AddDays(-1); + //} + if (startAbw.HasValue && startAbw.Value < monatEnde && (!endAbw.HasValue || endAbw.Value >= monatStart)) { DateTime abwStart = at.Start.Value; if (start > abwStart) @@ -66,9 +66,9 @@ namespace DomizielAnsbach.Invoicing } DateTime abwEnd = monatEnde.AddDays(-1); - if (endMinusEinTag.HasValue && endMinusEinTag < monatEnde) + if (endAbw.HasValue && endAbw < monatEnde) { - abwEnd = endMinusEinTag.Value; + abwEnd = endAbw.Value; } DateTime dt = abwStart; diff --git a/ReportImp/DomizielAnsbach/RechnungBezirkDetail.cs b/ReportImp/DomizielAnsbach/RechnungBezirkDetail.cs index 333aef72e..abbb2d88d 100644 --- a/ReportImp/DomizielAnsbach/RechnungBezirkDetail.cs +++ b/ReportImp/DomizielAnsbach/RechnungBezirkDetail.cs @@ -26,11 +26,21 @@ namespace DomizielAnsbach decimal? sumCustomerMonth = 0; string prevMonth = null; var counter = 0; + string grund = null; if (pRO.ServiceInvoicePeriods != null) { foreach (var sip in pRO.ServiceInvoicePeriods) { + if (sip.CostBearer2SupportConcept.SupportConcept.Customer.TerminationDate.HasValue + && sip.CostBearer2SupportConcept.SupportConcept.Customer.TerminationDate > pRO.AccountingPeriodStart + && sip.CostBearer2SupportConcept.SupportConcept.Customer.TerminationDate < pRO.AccountingPeriodEnd) + { + if (sip.CostBearer2SupportConcept.SupportConcept.Customer.TerminationReason != null) + { + grund = sip.CostBearer2SupportConcept.SupportConcept.Customer.TerminationReason.Value; + } + } counter += 1; if (sip.ServiceInvoiceItems != null) { @@ -54,15 +64,19 @@ namespace DomizielAnsbach } prevMonth = sii.Notice; sii.RateFactor = counter.ToString(); + if (grund != null) + { + sii.ServiceDescription += grund; + grund = null; + } } } } } - lblQuartal.Text = GetQuarter(pRO.AccountingPeriodEnd).ToString() + ". Quartal " + pRO.AccountingPeriodEnd.Year.ToString(); - lblMonate.Text = pRO.AccountingPeriodStart.ToString("MMMM") + " - " + pRO.AccountingPeriodEnd.ToString("MMMM"); - this.bindingSource1.DataSource = pRO; + lblQuartal.Text = GetQuarter(pRO.AccountingPeriodEnd).ToString() + ". Quartal " + pRO.AccountingPeriodEnd.Year.ToString(); + lblMonate.Text = pRO.AccountingPeriodStart.ToString("MMMM") + " - " + pRO.AccountingPeriodEnd.ToString("MMMM"); + this.bindingSource1.DataSource = pRO; } - } } \ No newline at end of file diff --git a/ReportImp/DomizielAnsbach/RechnungPB.Designer.cs b/ReportImp/DomizielAnsbach/RechnungPB.Designer.cs index cc109e89d..cfbf54718 100644 --- a/ReportImp/DomizielAnsbach/RechnungPB.Designer.cs +++ b/ReportImp/DomizielAnsbach/RechnungPB.Designer.cs @@ -65,7 +65,7 @@ namespace DomizielAnsbach this.xrLabel4 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel3 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel2 = new DevExpress.XtraReports.UI.XRLabel(); - this.xrLabel5 = new DevExpress.XtraReports.UI.XRLabel(); + this.lblAnrede = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel8 = new DevExpress.XtraReports.UI.XRLabel(); this.lblAbrechnungszeitraum = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel15 = new DevExpress.XtraReports.UI.XRLabel(); @@ -260,7 +260,7 @@ namespace DomizielAnsbach this.xrLabel4, this.xrLabel3, this.xrLabel2, - this.xrLabel5, + this.lblAnrede, this.xrLabel8, this.lblAbrechnungszeitraum}); this.Page1.Font = new System.Drawing.Font("Verdana", 10F); @@ -478,14 +478,14 @@ namespace DomizielAnsbach this.xrLabel2.Text = "Rechnung Nr. [InvoiceNumber]"; this.xrLabel2.WordWrap = false; // - // xrLabel5 + // lblAnrede // - this.xrLabel5.LocationFloat = new DevExpress.Utils.PointFloat(0F, 312.5F); - this.xrLabel5.Name = "xrLabel5"; - this.xrLabel5.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); - this.xrLabel5.SizeF = new System.Drawing.SizeF(317F, 17F); - this.xrLabel5.StylePriority.UseFont = false; - this.xrLabel5.Text = "Sehr geehrte Damen und Herren,"; + this.lblAnrede.LocationFloat = new DevExpress.Utils.PointFloat(0F, 312.5F); + this.lblAnrede.Name = "lblAnrede"; + this.lblAnrede.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.lblAnrede.SizeF = new System.Drawing.SizeF(317F, 17F); + this.lblAnrede.StylePriority.UseFont = false; + this.lblAnrede.Text = "Sehr geehrte Damen und Herren,"; // // xrLabel8 // @@ -860,7 +860,7 @@ namespace DomizielAnsbach private DevExpress.XtraReports.UI.XRLabel xrLabel4; private DevExpress.XtraReports.UI.XRLabel xrLabel3; private DevExpress.XtraReports.UI.XRLabel xrLabel2; - private DevExpress.XtraReports.UI.XRLabel xrLabel5; + private DevExpress.XtraReports.UI.XRLabel lblAnrede; private DevExpress.XtraReports.UI.XRLabel xrLabel8; private DevExpress.XtraReports.UI.XRLabel lblAbrechnungszeitraum; private DevExpress.XtraReports.UI.XRLabel xrLabel15; diff --git a/ReportImp/DomizielAnsbach/RechnungPB.cs b/ReportImp/DomizielAnsbach/RechnungPB.cs index 216157336..a4ea136fb 100644 --- a/ReportImp/DomizielAnsbach/RechnungPB.cs +++ b/ReportImp/DomizielAnsbach/RechnungPB.cs @@ -63,6 +63,15 @@ namespace DomizielAnsbach lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Zeitraum {0:MMMM yyyy} - {1:MMMM yyyy} folgende erbrachte Tätigkeiten:", start, end); } + if (!String.IsNullOrEmpty(pRO.CustomerSalutation) && pRO.CustomerSalutation.ToLower().Contains("herr")) + { + lblAnrede.Text = String.Format("Sehr geehrter Herr {0},", pRO.CustomerLastName); + } + else if (!String.IsNullOrEmpty(pRO.CustomerSalutation) && pRO.CustomerSalutation.ToLower().Contains("frau")) + { + lblAnrede.Text = String.Format("Sehr geehrte Frau {0},", pRO.CustomerLastName); + } + this.bindingSource1.DataSource = pRO; } } diff --git a/ReportImp/DomizielAnsbach/ServiceInvoiceReport.Designer.cs b/ReportImp/DomizielAnsbach/ServiceInvoiceReport.Designer.cs index 6011a1e9d..d8ad2ce83 100644 --- a/ReportImp/DomizielAnsbach/ServiceInvoiceReport.Designer.cs +++ b/ReportImp/DomizielAnsbach/ServiceInvoiceReport.Designer.cs @@ -73,7 +73,7 @@ namespace DomizielAnsbach this.xrLabel4 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel3 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel2 = new DevExpress.XtraReports.UI.XRLabel(); - this.xrLabel5 = new DevExpress.XtraReports.UI.XRLabel(); + this.lblAnrede = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel8 = new DevExpress.XtraReports.UI.XRLabel(); this.lblAbrechnungszeitraum = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel15 = new DevExpress.XtraReports.UI.XRLabel(); @@ -267,7 +267,7 @@ namespace DomizielAnsbach this.xrLabel4, this.xrLabel3, this.xrLabel2, - this.xrLabel5, + this.lblAnrede, this.xrLabel8, this.lblAbrechnungszeitraum}); this.Page1.Font = new System.Drawing.Font("Verdana", 10F); @@ -612,14 +612,14 @@ namespace DomizielAnsbach this.xrLabel2.Text = "Rechnung Nr. [InvoiceNumber]"; this.xrLabel2.WordWrap = false; // - // xrLabel5 + // lblAnrede // - this.xrLabel5.LocationFloat = new DevExpress.Utils.PointFloat(0F, 312.5F); - this.xrLabel5.Name = "xrLabel5"; - this.xrLabel5.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); - this.xrLabel5.SizeF = new System.Drawing.SizeF(317F, 17F); - this.xrLabel5.StylePriority.UseFont = false; - this.xrLabel5.Text = "Sehr geehrte Damen und Herren,"; + this.lblAnrede.LocationFloat = new DevExpress.Utils.PointFloat(0F, 312.5F); + this.lblAnrede.Name = "lblAnrede"; + this.lblAnrede.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.lblAnrede.SizeF = new System.Drawing.SizeF(317F, 17F); + this.lblAnrede.StylePriority.UseFont = false; + this.lblAnrede.Text = "Sehr geehrte Damen und Herren,"; // // xrLabel8 // @@ -955,7 +955,7 @@ namespace DomizielAnsbach private DevExpress.XtraReports.UI.XRLabel xrLabel4; private DevExpress.XtraReports.UI.XRLabel xrLabel3; private DevExpress.XtraReports.UI.XRLabel xrLabel2; - private DevExpress.XtraReports.UI.XRLabel xrLabel5; + private DevExpress.XtraReports.UI.XRLabel lblAnrede; private DevExpress.XtraReports.UI.XRLabel xrLabel8; private DevExpress.XtraReports.UI.XRLabel lblAbrechnungszeitraum; private DevExpress.XtraReports.UI.XRLabel xrLabel15; diff --git a/ReportImp/DomizielAnsbach/ServiceInvoiceReport.cs b/ReportImp/DomizielAnsbach/ServiceInvoiceReport.cs index b42d367b1..a4bb69549 100644 --- a/ReportImp/DomizielAnsbach/ServiceInvoiceReport.cs +++ b/ReportImp/DomizielAnsbach/ServiceInvoiceReport.cs @@ -4,7 +4,7 @@ using BeWo.Data.Access; using BeWo.Data.Entities; using BeWo.Report; using BeWo.Report.ReportObjects; - +using BS.Shared; using DevExpress.XtraReports.UI; namespace DomizielAnsbach @@ -86,6 +86,8 @@ namespace DomizielAnsbach lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Zeitraum {0:MMMM yyyy} - {1:MMMM yyyy} folgende erbrachte Tätigkeiten:", start, end); } + SetzeAnrede(pRO); + this.bindingSource1.DataSource = pRO; } @@ -124,5 +126,35 @@ namespace DomizielAnsbach } return sb.ToString(); } + + private void SetzeAnrede(ServiceInvoiceRO pRO) + { + String anrede = "Sehr geehrte Damen und Herren,"; + var p = GetKontaktPerson(pRO); + + if (p != null) + { + if (p.Sex.HasValue && p.Sex.Value == Sex.Male) + { + anrede = "Sehr geehrter Herr " + p.LastName + ","; + } + else if (p.Sex.HasValue && p.Sex.Value == Sex.Female) + { + anrede = "Sehr geehrte Frau " + p.LastName + ","; + } + } + + lblAnrede.Text = anrede; + } + + private Person GetKontaktPerson(ServiceInvoiceRO pRO) + { + if (pRO.ServiceInvoicePeriods.Count > 0) + { + var c2s = pRO.ServiceInvoicePeriods[0].CostBearer2SupportConcept; + return c2s.CostBearerContactPerson; + } + return null; + } } } \ No newline at end of file diff --git a/ReportImp/DomizielAnsbach/SettlementReport.Designer.cs b/ReportImp/DomizielAnsbach/SettlementReport.Designer.cs index f89ecd6ca..9fc28e3f4 100644 --- a/ReportImp/DomizielAnsbach/SettlementReport.Designer.cs +++ b/ReportImp/DomizielAnsbach/SettlementReport.Designer.cs @@ -50,7 +50,7 @@ namespace DomizielAnsbach this.rowErbrachteLeistung = new DevExpress.XtraReports.UI.XRTableRow(); this.xrTableCell22 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrLabel6 = new DevExpress.XtraReports.UI.XRLabel(); - this.xrLabel5 = new DevExpress.XtraReports.UI.XRLabel(); + this.lblAnrede = 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(); @@ -357,14 +357,14 @@ namespace DomizielAnsbach this.xrLabel6.StylePriority.UseFont = false; this.xrLabel6.Text = resources.GetString("xrLabel6.Text"); // - // xrLabel5 + // lblAnrede // - this.xrLabel5.LocationFloat = new DevExpress.Utils.PointFloat(0F, 301.7083F); - this.xrLabel5.Name = "xrLabel5"; - this.xrLabel5.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); - this.xrLabel5.SizeF = new System.Drawing.SizeF(317F, 17F); - this.xrLabel5.StylePriority.UseFont = false; - this.xrLabel5.Text = "Sehr geehrte Damen und Herren,"; + this.lblAnrede.LocationFloat = new DevExpress.Utils.PointFloat(0F, 301.7083F); + this.lblAnrede.Name = "lblAnrede"; + this.lblAnrede.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.lblAnrede.SizeF = new System.Drawing.SizeF(317F, 17F); + this.lblAnrede.StylePriority.UseFont = false; + this.lblAnrede.Text = "Sehr geehrte Damen und Herren,"; // // xrLabel4 // @@ -696,7 +696,7 @@ namespace DomizielAnsbach this.xrLabel2, this.xrLabel3, this.xrLabel4, - this.xrLabel5, + this.lblAnrede, this.xrLabel6, this.xrTable1, this.xrLabel8}); @@ -1190,7 +1190,7 @@ namespace DomizielAnsbach private System.Windows.Forms.BindingSource bindingSource1; private DevExpress.XtraReports.UI.ReportHeaderBand ReportHeader; private DevExpress.XtraReports.UI.XRLabel xrLabel6; - private DevExpress.XtraReports.UI.XRLabel xrLabel5; + private DevExpress.XtraReports.UI.XRLabel lblAnrede; private DevExpress.XtraReports.UI.XRLabel xrLabel4; private DevExpress.XtraReports.UI.XRLabel xrLabel3; private DevExpress.XtraReports.UI.XRLabel xrLabel2; diff --git a/ReportImp/DomizielAnsbach/SettlementReport.cs b/ReportImp/DomizielAnsbach/SettlementReport.cs index f3292910f..0e8f8e441 100644 --- a/ReportImp/DomizielAnsbach/SettlementReport.cs +++ b/ReportImp/DomizielAnsbach/SettlementReport.cs @@ -4,6 +4,7 @@ using BeWo.Data.Access; using BeWo.Data.Entities; using BeWo.Report; using BeWo.Report.ReportObjects; +using BS.Shared; using BS.Shared.DataContracts; namespace DomizielAnsbach @@ -77,9 +78,22 @@ namespace DomizielAnsbach } } } - - this.bindingSource1.DataSource = pRO; + var cb2sc = DAOFactory.GenericDAO.LoadByID(pRO.CostBearer2SupportConceptOid); + if (!String.IsNullOrEmpty(pRO.RecipientContactPerson) && cb2sc.CostBearerContactPerson.Sex.HasValue) + { + if (cb2sc.CostBearerContactPerson.Sex.Value == Sex.Female) + { + lblAnrede.Text = "Sehr geehrte Frau " + cb2sc.CostBearerContactPerson.LastName.Trim() + ","; + } + else + { + lblAnrede.Text = "Sehr geehrter Herr " + cb2sc.CostBearerContactPerson.LastName.Trim() + ","; + } + } + + + this.bindingSource1.DataSource = pRO; } private String GetCustomerId(SettlementRO pRO) diff --git a/ReportImp/DomizielAnsbach/ZVBerichtBezirk.cs b/ReportImp/DomizielAnsbach/ZVBerichtBezirk.cs index 92af40bea..746f193c6 100644 --- a/ReportImp/DomizielAnsbach/ZVBerichtBezirk.cs +++ b/ReportImp/DomizielAnsbach/ZVBerichtBezirk.cs @@ -197,7 +197,7 @@ namespace DomizielAnsbach private string GetKrankheiten(Customer c) { - string krankheiten = ""; + string krankheiten = null; foreach (var vv in c.VarFieldValueList) { var varFieldValue = Utils.XMLDeserializeFromString(vv.SerializedValue, Type.GetType(vv.TypeName));