From a71074bae52f915414e6e5a059f85fab059133ac Mon Sep 17 00:00:00 2001 From: Alexandra Date: Fri, 26 May 2023 13:41:40 +0200 Subject: [PATCH] AbwKlassen Abwesenheiten --- ReportImp/AbwKlassen/AbwKlassen.csproj | 18 ++--- .../AbwKlassen/SettlementReport.Designer.cs | 2 +- ReportImp/AbwKlassen/SettlementReport.cs | 70 ++++++++++++++++++- .../AbwKlassen/SettlementReport2.Designer.cs | 2 +- ReportImp/AbwKlassen/SettlementReport2.cs | 69 +++++++++++++++++- 5 files changed, 147 insertions(+), 14 deletions(-) diff --git a/ReportImp/AbwKlassen/AbwKlassen.csproj b/ReportImp/AbwKlassen/AbwKlassen.csproj index 76797c7d6..e71a41e5a 100644 --- a/ReportImp/AbwKlassen/AbwKlassen.csproj +++ b/ReportImp/AbwKlassen/AbwKlassen.csproj @@ -81,18 +81,18 @@ ServicesOverviewReport.cs - - Component - - - SettlementReport2.cs - Component SettlementReport.cs + + Component + + + SettlementReport2.cs + Component @@ -118,12 +118,12 @@ ServicesOverviewReport.cs Designer - - SettlementReport2.cs - SettlementReport.cs + + SettlementReport2.cs + Teamstundenkonto.cs diff --git a/ReportImp/AbwKlassen/SettlementReport.Designer.cs b/ReportImp/AbwKlassen/SettlementReport.Designer.cs index e6b658b69..866a3181f 100644 --- a/ReportImp/AbwKlassen/SettlementReport.Designer.cs +++ b/ReportImp/AbwKlassen/SettlementReport.Designer.cs @@ -1,5 +1,5 @@ using BeWo.Report.ReportObjects; -namespace AbwKlassen +namespace AbwKlassen.Alt { partial class Spitzabrechnung { diff --git a/ReportImp/AbwKlassen/SettlementReport.cs b/ReportImp/AbwKlassen/SettlementReport.cs index 063ab821f..99619c49e 100644 --- a/ReportImp/AbwKlassen/SettlementReport.cs +++ b/ReportImp/AbwKlassen/SettlementReport.cs @@ -5,8 +5,11 @@ using System.ComponentModel; using DevExpress.XtraReports.UI; using BeWo.Report.ReportObjects; using BeWo.Report; +using BeWo.Data.Access; +using BeWo.Data.Entities; +using System.Text; -namespace AbwKlassen +namespace AbwKlassen.Alt { public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport { @@ -78,7 +81,72 @@ namespace AbwKlassen pRO.Betrag3 = String.Format("{0:c}", pRO.GeleisteteFLSMitStundensatzAktuell * (decimal)pRO.RateFactor * pRO.HourlyRateNew); } + + ErstelleAbwesenheiten(pRO); + this.bindingSource1.DataSource = pRO; } + + private void ErstelleAbwesenheiten(SettlementRO pRo) + { + pRo.AbsenceTimes = ""; + + if (pRo.CostBearer2SupportConceptOid < 1) + return; + + var cb2sc = DAOFactory.GenericDAO.LoadByID(pRo.CostBearer2SupportConceptOid); + var c = cb2sc.SupportConcept.Customer; + + if (c.AbsenceTimes != null) + { + var sb = new StringBuilder(); + + foreach (var at in c.AbsenceTimes) + { + if (at.AbsenceSpan != null) + { + if (at.Start != null && at.Start <= pRo.AccountingEndDate && ((at.End != null && at.End >= pRo.AccountingStartDate) || at.End == null)) + { + DateTime start = at.Start.Value.AddDays(1); + DateTime end = DateTime.MaxValue; + if (at.End.HasValue) + { + end = at.End.Value.AddDays(-1); + } + + if (end.Subtract(start).TotalDays > 0) + { + if (sb.Length > 0) + { + sb.Append(", "); + } + + + sb.Append(string.Format("{0:dd.MM.yyyy}", start)); + + sb.Append(" - "); + + if (end == DateTime.MaxValue) + { + sb.Append("unbekannt"); + } + else + { + sb.Append(string.Format("{0:dd.MM.yyyy}", end)); + } + + sb.Append(" "); + sb.Append(at.AbsenceReason.Description); + } + } + } + } + + if (sb.Length > 0) + { + pRo.AbsenceTimes = "Abwesenheitszeiten: " + sb; + } + } + } } } diff --git a/ReportImp/AbwKlassen/SettlementReport2.Designer.cs b/ReportImp/AbwKlassen/SettlementReport2.Designer.cs index 61b8de250..38cd0859a 100644 --- a/ReportImp/AbwKlassen/SettlementReport2.Designer.cs +++ b/ReportImp/AbwKlassen/SettlementReport2.Designer.cs @@ -1,5 +1,5 @@ using BeWo.Report.ReportObjects; -namespace AbwKlassen.Neu +namespace AbwKlassen { partial class Spitzabrechnung { diff --git a/ReportImp/AbwKlassen/SettlementReport2.cs b/ReportImp/AbwKlassen/SettlementReport2.cs index 6e047a556..27ce63392 100644 --- a/ReportImp/AbwKlassen/SettlementReport2.cs +++ b/ReportImp/AbwKlassen/SettlementReport2.cs @@ -7,8 +7,11 @@ using BeWo.Report.ReportObjects; using BeWo.Report; using BS.Shared.Extensions; using System.Text.RegularExpressions; +using BeWo.Data.Access; +using BeWo.Data.Entities; +using System.Text; -namespace AbwKlassen.Neu +namespace AbwKlassen { public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport { @@ -39,7 +42,69 @@ namespace AbwKlassen.Neu } } pRO.RateFactor = (double)rateFactor; - this.bindingSource1.DataSource = pRO; + + ErstelleAbwesenheiten(pRO); + this.bindingSource1.DataSource = pRO; + } + + private void ErstelleAbwesenheiten(Settlement2RO pRo) + { + pRo.AbsenceTimes = ""; + + + var ib = DAOFactory.GenericDAO.LoadByID(pRo.InvoiceBaseOid.Value); + var c = ib.CostBearer2SupportConcept.SupportConcept.Customer; + + if (c.AbsenceTimes != null) + { + var sb = new StringBuilder(); + + foreach (var at in c.AbsenceTimes) + { + if (at.AbsenceSpan != null) + { + if (at.Start != null && at.Start <= pRo.AccountingEndDate && ((at.End != null && at.End >= pRo.AccountingStartDate) || at.End == null)) + { + DateTime start = at.Start.Value.AddDays(1); + DateTime end = DateTime.MaxValue; + if (at.End.HasValue) + { + end = at.End.Value.AddDays(-1); + } + + if (end.Subtract(start).TotalDays > 0) + { + if (sb.Length > 0) + { + sb.Append(", "); + } + + + sb.Append(string.Format("{0:dd.MM.yyyy}", start)); + + sb.Append(" - "); + + if (end == DateTime.MaxValue) + { + sb.Append("unbekannt"); + } + else + { + sb.Append(string.Format("{0:dd.MM.yyyy}", end)); + } + + sb.Append(" "); + sb.Append(at.AbsenceReason.Description); + } + } + } + } + + if (sb.Length > 0) + { + pRo.AbsenceTimes = "Abwesenheitszeiten: " + sb; + } + } } } }