From 90e65295270904ccf34ba2fb20510286c1563c19 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 31 Aug 2021 10:47:52 +0200 Subject: [PATCH] cb --- BeWo/View/Detail/Report/QueryView.xaml.cs | 25 +- BeWoPlanerMobil/Util/MobileUtils.cs | 29 +- ...6_08_BetreuWo_FlsAuswertungsauswertung.txt | 2 +- .../BetreuWoReports/BetreuWoReports.csproj | 1 + .../FlsAuslastungsauswertung.cs | 5 +- .../FlsAuslastungsauswertung.designer.cs | 30 +- .../FlsAuslastungsauswertung.resx | 304 +++++++------- .../FlsAuslastungsauswertungRO.cs | 396 ++++++++++++++++++ .../Invoicing/HortInvoiceCreation.cs | 2 +- .../Exporter/DatevExporter.cs | 109 ++++- Service/Plugins/PluginLoader.cs | 6 +- 11 files changed, 694 insertions(+), 215 deletions(-) create mode 100644 ReportImp/BetreuWoReports/FlsAuslastungsauswertungRO.cs diff --git a/BeWo/View/Detail/Report/QueryView.xaml.cs b/BeWo/View/Detail/Report/QueryView.xaml.cs index c98ff8b99..666d8c8db 100644 --- a/BeWo/View/Detail/Report/QueryView.xaml.cs +++ b/BeWo/View/Detail/Report/QueryView.xaml.cs @@ -1025,19 +1025,24 @@ namespace BeWo.View.Detail.Report { lQuery.Parameter = parameterList; - var result = ServiceFacade.DoDownloadServiceSync(s => s.CreateQuery(lQuery)); + //var result = ServiceFacade.DoDownloadServiceSync(s => s.CreateQuery(lQuery)); - var path = String.Format("{0}\\{1}", BeWoApp.GetAndCreateUserAppDataPath(), result.FileName); + ServiceFacade.DoDownloadServiceAsync(s => s.CreateQuery(lQuery), result => + this.Dispatch( + delegate + { + var path = String.Format("{0}\\{1}", BeWoApp.GetAndCreateUserAppDataPath(), result.FileName); - var sf = new SaveFileDialog - { - FileName = Path.GetFileName(path), - Filter = "Alle Dateien|*.*" - }; - if (sf.ShowDialog() != true) - return; + var sf = new SaveFileDialog + { + FileName = Path.GetFileName(path), + Filter = "Alle Dateien|*.*" + }; + if (sf.ShowDialog() != true) + return; - BeWoUtils.WriteFile(result.QueryResult, sf.FileName); + BeWoUtils.WriteFile(result.QueryResult, sf.FileName); + })); } else { diff --git a/BeWoPlanerMobil/Util/MobileUtils.cs b/BeWoPlanerMobil/Util/MobileUtils.cs index 7e6259c0b..c8175d562 100644 --- a/BeWoPlanerMobil/Util/MobileUtils.cs +++ b/BeWoPlanerMobil/Util/MobileUtils.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; using BeWoPlanerMobil.Models; - +using BS.Shared; using BS.Shared.Core; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; @@ -203,21 +203,24 @@ namespace BeWoPlanerMobil.Util var catOid2ModelDict = new Dictionary(); foreach (var sd in serviceDescriptions) { - if (!catOid2ModelDict.ContainsKey(sd.Category.ServiceCategoryOid.Value)) + if (sd.Category.ActivationType == ActivationTypeId.Active) { - catOid2ModelDict[sd.Category.ServiceCategoryOid.Value] = new ServiceCategoryModel + if (!catOid2ModelDict.ContainsKey(sd.Category.ServiceCategoryOid.Value)) { - Name = sd.Category.Name, - IsDefault = sd.Category.IsDefault, - Percentage = sd.Category.Percentage, - Position = sd.Category.Position, - OhneHilfeplan = sd.Category.OhneHilfeplan, - ServiceCategoryOid = sd.Category.ServiceCategoryOid, - ServiceDescriptions = new List() - }; - } + catOid2ModelDict[sd.Category.ServiceCategoryOid.Value] = new ServiceCategoryModel + { + Name = sd.Category.Name, + IsDefault = sd.Category.IsDefault, + Percentage = sd.Category.Percentage, + Position = sd.Category.Position, + OhneHilfeplan = sd.Category.OhneHilfeplan, + ServiceCategoryOid = sd.Category.ServiceCategoryOid, + ServiceDescriptions = new List() + }; + } - catOid2ModelDict[sd.Category.ServiceCategoryOid.Value].ServiceDescriptions.Add(sd); + catOid2ModelDict[sd.Category.ServiceCategoryOid.Value].ServiceDescriptions.Add(sd); + } } var list = catOid2ModelDict.Values.ToList(); diff --git a/Model/Changes_2021_06_08_BetreuWo_FlsAuswertungsauswertung.txt b/Model/Changes_2021_06_08_BetreuWo_FlsAuswertungsauswertung.txt index 3a197897e..dbbb65dbb 100644 --- a/Model/Changes_2021_06_08_BetreuWo_FlsAuswertungsauswertung.txt +++ b/Model/Changes_2021_06_08_BetreuWo_FlsAuswertungsauswertung.txt @@ -1,6 +1,6 @@ INSERT INTO query(tid, type, title, notice, insts, version, isactive, reporttypename) VALUES - (24, 0, 'Stundenübersicht Mitarbeiter', 'direct', NOW(), 1, 1, 'BeWo.BetreuWoReports.FlsAuslastungsauswertung), + (24, 0, 'Stundenübersicht Mitarbeiter', 'direct', NOW(), 1, 1, 'BeWo.BetreuWoReports.FlsAuslastungsauswertung'), (24, 0, 'Stundenübersicht Team', 'direct', NOW(), 1, 1, 'BeWo.BetreuWoReports.FlsAuslastungsauswertung') ; diff --git a/ReportImp/BetreuWoReports/BetreuWoReports.csproj b/ReportImp/BetreuWoReports/BetreuWoReports.csproj index 053065b7d..c3120f26e 100644 --- a/ReportImp/BetreuWoReports/BetreuWoReports.csproj +++ b/ReportImp/BetreuWoReports/BetreuWoReports.csproj @@ -98,6 +98,7 @@ FlsAuslastungsauswertung.cs + Component diff --git a/ReportImp/BetreuWoReports/FlsAuslastungsauswertung.cs b/ReportImp/BetreuWoReports/FlsAuslastungsauswertung.cs index 7731432d6..7bbe8c158 100644 --- a/ReportImp/BetreuWoReports/FlsAuslastungsauswertung.cs +++ b/ReportImp/BetreuWoReports/FlsAuslastungsauswertung.cs @@ -17,9 +17,8 @@ using DevExpress.XtraPrinting; using DevExpress.XtraReports.UI; using DevExpress.XtraScheduler; using DevExpress.XtraScheduler.Compatibility; -using FlsAuslastungsauswertungRO = BeWo.Report.ReportObjects.FlsAuslastungsauswertungRO; -namespace BeWo.BetreuWoReports +namespace BetreuWoReports { public partial class FlsAuslastungsauswertung : XtraReport, IBeWoReport { @@ -459,7 +458,7 @@ namespace BeWo.BetreuWoReports } } } - + flsAuslastungsauswertungRo.Customer2Values.Sort((a, b) => a.CustomerName.CompareTo(b.CustomerName)); flsAuslastungsauswertungRo.Customer2Values.DoForEach(customer2Values => { customer2Values.CalcDifferences(); }); flsAuslastungsauswertungRo.UpdateTargetObjectName(); diff --git a/ReportImp/BetreuWoReports/FlsAuslastungsauswertung.designer.cs b/ReportImp/BetreuWoReports/FlsAuslastungsauswertung.designer.cs index a02ad551e..5801e77ce 100644 --- a/ReportImp/BetreuWoReports/FlsAuslastungsauswertung.designer.cs +++ b/ReportImp/BetreuWoReports/FlsAuslastungsauswertung.designer.cs @@ -1,5 +1,5 @@ using BeWo.Report.ReportObjects; -namespace BeWo.BetreuWoReports +namespace BetreuWoReports { partial class FlsAuslastungsauswertung { @@ -332,7 +332,6 @@ namespace BeWo.BetreuWoReports this.xrTableCell285 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell286 = new DevExpress.XtraReports.UI.XRTableCell(); this.xrTableCell287 = new DevExpress.XtraReports.UI.XRTableCell(); - this.objectDataSource1 = new DevExpress.DataAccess.ObjectBinding.ObjectDataSource(this.components); this.WeeklyDetailReport = new DevExpress.XtraReports.UI.DetailReportBand(); this.Detail4 = new DevExpress.XtraReports.UI.DetailBand(); this.GroupHeader3 = new DevExpress.XtraReports.UI.GroupHeaderBand(); @@ -367,17 +366,18 @@ namespace BeWo.BetreuWoReports this.PageInfo = new DevExpress.XtraReports.UI.XRControlStyle(); this.DataField = new DevExpress.XtraReports.UI.XRControlStyle(); this.fieldFLS = new DevExpress.XtraReports.UI.CalculatedField(); - this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); this.topMarginBand1 = new DevExpress.XtraReports.UI.TopMarginBand(); this.bottomMarginBand1 = new DevExpress.XtraReports.UI.BottomMarginBand(); + this.objectDataSource1 = new DevExpress.DataAccess.ObjectBinding.ObjectDataSource(this.components); + this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); ((System.ComponentModel.ISupportInitialize)(this.DailyValueTable)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DailyHeaderTable)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DailySumTable)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.objectDataSource1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.WeeklyValueTable)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.WeeklyHeaderTable)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.MonthlyValueTable)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.MonthlyHeaderTable)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.objectDataSource1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); // @@ -400,7 +400,7 @@ namespace BeWo.BetreuWoReports // xrLabel13 // this.xrLabel13.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { - new DevExpress.XtraReports.UI.XRBinding("Text", null, "Auswertungszeitraum", "FLS-Auswertung im Zeitraum: {0:}")}); + new DevExpress.XtraReports.UI.XRBinding("Text", null, "StartDate", "FLS-Auswertung im Zeitraum: {0:MMMM yyyy}")}); resources.ApplyResources(this.xrLabel13, "xrLabel13"); this.xrLabel13.Name = "xrLabel13"; this.xrLabel13.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); @@ -3058,11 +3058,6 @@ namespace BeWo.BetreuWoReports this.xrTableCell287.Name = "xrTableCell287"; this.xrTableCell287.StylePriority.UseTextAlignment = false; // - // objectDataSource1 - // - this.objectDataSource1.DataSource = typeof(BeWo.Report.ReportObjects.FlsAuslastungsauswertungRO); - this.objectDataSource1.Name = "objectDataSource1"; - // // WeeklyDetailReport // this.WeeklyDetailReport.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { @@ -3352,10 +3347,6 @@ namespace BeWo.BetreuWoReports this.fieldFLS.FieldType = DevExpress.XtraReports.UI.FieldType.Decimal; this.fieldFLS.Name = "fieldFLS"; // - // bindingSource1 - // - this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.QueryRO); - // // topMarginBand1 // resources.ApplyResources(this.topMarginBand1, "topMarginBand1"); @@ -3366,6 +3357,15 @@ namespace BeWo.BetreuWoReports resources.ApplyResources(this.bottomMarginBand1, "bottomMarginBand1"); this.bottomMarginBand1.Name = "bottomMarginBand1"; // + // objectDataSource1 + // + this.objectDataSource1.DataSource = typeof(BetreuWoReports.FlsAuslastungsauswertungRO); + this.objectDataSource1.Name = "objectDataSource1"; + // + // bindingSource1 + // + this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.QueryRO); + // // FlsAuslastungsauswertung // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { @@ -3388,11 +3388,11 @@ namespace BeWo.BetreuWoReports ((System.ComponentModel.ISupportInitialize)(this.DailyValueTable)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.DailyHeaderTable)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.DailySumTable)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.objectDataSource1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.WeeklyValueTable)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.WeeklyHeaderTable)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.MonthlyValueTable)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.MonthlyHeaderTable)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.objectDataSource1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); diff --git a/ReportImp/BetreuWoReports/FlsAuslastungsauswertung.resx b/ReportImp/BetreuWoReports/FlsAuslastungsauswertung.resx index 97b93232a..304b72ba9 100644 --- a/ReportImp/BetreuWoReports/FlsAuslastungsauswertung.resx +++ b/ReportImp/BetreuWoReports/FlsAuslastungsauswertung.resx @@ -124,10 +124,6 @@ 0.23485961334484828 - - - Arial, 10pt, style=Bold - 0.23485961334484828 @@ -138,6 +134,7 @@ MiddleRight + SandyBrown @@ -189,8 +186,8 @@ MiddleCenter - - 0.12252311411632186 + + 0.15828956885751522 SandyBrown @@ -213,11 +210,14 @@ Arial, 10pt, style=Bold + + MiddleCenter + MiddleRight - - MiddleCenter + + 0.23485961334484828 0.23485961334484828 @@ -258,6 +258,9 @@ Tag 4 Soll/Ist Tag 11 + + DarkSeaGreen + 0.23485961334484828 @@ -401,9 +404,6 @@ Tag 10 MiddleCenter - - MiddleRight - 0.15828956885751522 @@ -413,7 +413,7 @@ Tag 10 MiddleRight - + 0.23485961334484828 @@ -444,9 +444,6 @@ Tag 11 0.23485961334484828 - - DarkSeaGreen - Gold @@ -505,17 +502,17 @@ Tag 11 0.23485961334484828 + + 0.15828956885751522 + MiddleCenter 0.23485961334484828 - - MiddleCenter - - - MiddleRight + + 0.23485961334484828 0.23485961334484828 @@ -556,11 +553,14 @@ Tag 11 MiddleCenter + + MiddleCenter + 0.053603856369188511 - - 0.23485961334484828 + + 0.15828956885751522 0.15828956885751522 @@ -595,9 +595,15 @@ Tag 11 0.15828956885751522 + + MiddleRight + MiddleRight + + Black + MiddleRight @@ -621,8 +627,8 @@ Tag 8 0.23485961334484828 - - MiddleCenter + + MiddleRight Diff Soll/Ist @@ -679,6 +685,9 @@ Tag 9 0.23485961334484828 + + MiddleCenter + 0.23485961334484828 @@ -734,6 +743,9 @@ Tag 9 0.23485961334484828 + + 0.23485961334484828 + Diff Soll/Ist Tag 6 @@ -778,6 +790,9 @@ Tag 7 MiddleRight + + 0.23485961334484828 + MiddleRight @@ -813,15 +828,15 @@ Tag 8 Purple - - 0.23485961334484828 + + White Soll Tag 28 - - MiddleCenter + + 0.23485961334484828 MiddleRight @@ -896,9 +911,6 @@ Tag 30 MiddleCenter - - MiddleCenter - Diff Soll/Ist Tag 8 @@ -937,9 +949,6 @@ Tag 27 0.23485961400464381 - - 0.23485961334484828 - MiddleCenter @@ -952,6 +961,9 @@ Tag 27 0.23485961334484828 + + 0.15828956885751522 + MiddleCenter @@ -1014,9 +1026,6 @@ Tag 6 0.15828956885751522 - - MiddleCenter - SandyBrown @@ -1038,9 +1047,6 @@ Tag 6 0.23485961334484828 - - LightBlue - 0.23485961334484828 @@ -1083,6 +1089,9 @@ Tag 19 Ist Tag 28 + + 0.23485961334484828 + White @@ -1100,6 +1109,9 @@ Tag 28 Soll/Ist Tag 5 + + Gold + 0.15828956885751522 @@ -1120,9 +1132,6 @@ Tag 25 0.23485961334484828 - - 0.15828956885751522 - Diff Soll/Ist @@ -1140,9 +1149,6 @@ Tag 19 0.23485961334484828 - - Black - Soll Tag 26 @@ -1185,9 +1191,6 @@ Tag 17 Ist Tag 27 - - 0.23485961334484828 - MiddleRight @@ -1208,8 +1211,8 @@ Tag 25 MiddleRight - - 0.23485961334484828 + + 0.15828956885751522 Diff Soll/Ist @@ -1272,9 +1275,6 @@ Tag 29 1 - - 0.23485961334484828 - Black @@ -1321,8 +1321,8 @@ Tag 26 Differenz Soll/Ist Auswertungszeitraum - - 0.23485961334484828 + + 50 Diff @@ -1369,6 +1369,12 @@ Tag 5 0.15828956885751522 + + 0 + + + 0.23485961334484828 + 0.23485961334484828 @@ -1398,7 +1404,7 @@ Tag 24 Ist Tag 2 - + 0.23485961334484828 @@ -1495,15 +1501,9 @@ Tag 16 Soll/Ist Tag 27 - - Purple - 0.23485961334484828 - - 0.59685145902481074 - 0.15828961038683778 @@ -1516,7 +1516,7 @@ Tag 27 0.15828956885751522 - + 0.23485961334484828 @@ -1548,9 +1548,15 @@ Tag 23 0.23485961334484828 + + 0.15828956885751522 + 0.23485961334484828 + + 0.23485961334484828 + YellowGreen @@ -1568,9 +1574,6 @@ Tag 23 Soll/Ist Tag 21 - - 0.23485961334484828 - MiddleCenter @@ -1612,11 +1615,14 @@ Tag 13 0.23485961334484828 + + MiddleRight + LightBlue - - 0.15828956885751522 + + MiddleRight 0.15828956885751522 @@ -1632,6 +1638,9 @@ Tag 22 1 + + 0.15828956885751522 + MiddleCenter @@ -1654,9 +1663,6 @@ Tag 24 Gold - - 0.23485961334484828 - 200, 23 @@ -1788,12 +1794,6 @@ Tag 15 0.23485961334484828 - - 50 - - - 0.23485961334484828 - MiddleCenter @@ -1846,8 +1846,8 @@ Tag 13 MiddleRight - - 0.23485961334484828 + + White DarkSeaGreen @@ -1873,8 +1873,8 @@ Tag 13 White - - Gold + + 0.23485961334484828 Soll @@ -1886,9 +1886,6 @@ Tag 13 LightBlue - - 5276, 25 - 0.37500010013582996 @@ -1908,6 +1905,9 @@ Tag 22 0.23485961334484828 + + 0.23485961334484828 + 0.23485961334484828 @@ -1924,11 +1924,11 @@ Tag 22 Ist Tag 1 - - White + + 0.23485961334484828 - - 0.15828956885751522 + + 0.23485961334484828 Soll @@ -1952,14 +1952,14 @@ Tag 14 MiddleCenter - - SandyBrown + + Black 0.23485961334484828 - - MiddleRight + + Gold 0.23485961334484828 @@ -2002,8 +2002,8 @@ Tag 20 0.23485961334484828 - - MiddleCenter + + Diff Soll/Ist Tag 2 1 @@ -2023,8 +2023,8 @@ Tag 20 MiddleCenter - - 25 + + 0.12252311411632186 MiddleCenter @@ -2032,9 +2032,6 @@ Tag 20 MiddleRight - - 0.23485961334484828 - MiddleCenter @@ -2073,12 +2070,6 @@ Tag 20 Purple - - Diff Soll/Ist Tag 2 - - - 0.23485961334484828 - 116.6667 @@ -2106,8 +2097,11 @@ Tag 20 Gold - - White + + MiddleCenter + + + 0.23485961334484828 DarkSeaGreen @@ -2142,9 +2136,6 @@ Tag 20 0.23485961334484828 - - 0.23485961334484828 - MiddleRight @@ -2170,8 +2161,8 @@ Tag 21 MiddleRight - - MiddleCenter + + 25 MiddleCenter @@ -2197,11 +2188,17 @@ Tag 21 0.15828956885751522 + + MiddleRight + 0.72502825164709672 - - LightBlue + + 0.23485961334484828 + + + MiddleCenter 1 @@ -2236,8 +2233,8 @@ Tag 21 0.15828956885751522 - - Black + + Arial, 10pt, style=Bold 0.23485961334484828 @@ -2275,8 +2272,8 @@ Tag 21 MiddleCenter - - MiddleRight + + 0.23485961334484828 Purple @@ -2293,17 +2290,14 @@ Tag 21 0.15828956885751522 - - Gold - 0.23485961334484828 - - MiddleLeft + + MiddleCenter - - 0.23485961334484828 + + SandyBrown LightBlue @@ -2311,7 +2305,7 @@ Tag 21 MiddleRight - + MiddleRight @@ -2323,8 +2317,8 @@ Tag 21 0.23485961334484828 - - 0.23485961334484828 + + MiddleCenter MiddleCenter @@ -2338,23 +2332,23 @@ Tag 21 Klient/in - - MiddleRight + + 0.23485961334484828 0.23485961334484828 - - 0.15828956885751522 + + DarkSeaGreen - + Gold - + 0.23485961334484828 - - 0.23485961334484828 + + Purple 0.23485961334484828 @@ -2374,6 +2368,9 @@ Tag 21 MiddleLeft + + MiddleCenter + 0.23485961334484828 @@ -2393,8 +2390,8 @@ Tag 1 0.15828956885751522 - - 0.23485961334484828 + + 0.59685145902481074 0.23485961334484828 @@ -2423,8 +2420,8 @@ Tag 1 0.23485961334484828 - - MiddleCenter + + 0.23485961334484828 0.15828956885751522 @@ -2444,6 +2441,9 @@ Tag 1 MiddleCenter + + MiddleCenter + 0.31020142045216265 @@ -2480,8 +2480,8 @@ Tag 1 MiddleCenter - - 0 + + LightBlue Soll @@ -2490,8 +2490,8 @@ Tag 12 0.15828956885751522 - - 0.15828956885751522 + + 0.23485961334484828 5276, 91.66665 @@ -2508,8 +2508,8 @@ Tag 12 0, 91.66666 - - 0.15828956885751522 + + LightBlue Diff @@ -2527,8 +2527,8 @@ Tag 15 0.15828956885751522 - - 0.15828956885751522 + + MiddleLeft Diff @@ -2541,8 +2541,8 @@ Tag 30 MiddleCenter - - DarkSeaGreen + + 5276, 25 MiddleRight @@ -2559,7 +2559,7 @@ Tag 30 MiddleCenter - + 0.23485961334484828 diff --git a/ReportImp/BetreuWoReports/FlsAuslastungsauswertungRO.cs b/ReportImp/BetreuWoReports/FlsAuslastungsauswertungRO.cs new file mode 100644 index 000000000..cabe66d87 --- /dev/null +++ b/ReportImp/BetreuWoReports/FlsAuslastungsauswertungRO.cs @@ -0,0 +1,396 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Linq; +using BeWo.Data.Entities; +using BS.Shared; +using BS.Shared.Extensions; + +namespace BetreuWoReports +{ + public class FlsAuslastungsauswertungRO + { + public FLSAuswertungstyp FlsAuswertungstyp { get; } + + public string Auswertungszeitraum => $"{StartDate:dd.MM.yyyy} - {EndDate:dd.MM.yyyy}"; + + public Employee Employee { get; set; } + + public string EmployeeName + { + get + { + var name = Employee?.Person?.LastNameFirstName ?? string.Empty; + + var weeklyFls = Employee?.LastContract?.WeeklyFLS == null ? string.Empty : $"({Employee.LastContract.WeeklyFLS.Value})"; + + return $"{name} {weeklyFls}"; + } + } + + public Team Team { get; set; } + + public string TeamName => Team?.Name ?? string.Empty; + + public string TargetObjectDescription { get; } + + public string TargetObjectName { get; set; } + + public List Customer2Values { get; set; } = new List(); + + public DateTime StartDate { get; set; } + + public DateTime EndDate { get; set; } + + public FlsAuslastungsauswertungRO(DateTime startDate, DateTime endDate, FLSAuswertungstyp flsAuswertungstyp) + { + StartDate = startDate; + EndDate = endDate; + FlsAuswertungstyp = flsAuswertungstyp; + } + + public FlsAuslastungsauswertungRO(Employee employee, DateTime startDate, DateTime endDate, FLSAuswertungstyp flsAuswertungstyp) + { + Employee = employee; + TargetObjectDescription = "Mitarbeiter"; + StartDate = startDate; + EndDate = endDate; + FlsAuswertungstyp = flsAuswertungstyp; + } + + public FlsAuslastungsauswertungRO(Team team, DateTime startDate, DateTime endDate, FLSAuswertungstyp flsAuswertungstyp) + { + Team = team; + TargetObjectDescription = "Team"; + StartDate = startDate; + EndDate = endDate; + FlsAuswertungstyp = flsAuswertungstyp; + } + + public void UpdateTargetObjectName() + { + if(Employee != null) + { + TargetObjectName = $"{Employee.Person.LastNameFirstName}({GetVertraglicheArbeitszeit():0.00}) Mehr/Minderarbeit: {GetMehrMinderauslastung():0.00}"; + } + else if(Team != null) + { + TargetObjectName = $"{Team.Name} Mehr/Minderarbeit: {GetMehrMinderauslastung():0.00}"; + } + } + + public Customer2Values GetCustomer2ValuesByCustomer(Customer customer) + { + return Customer2Values?.FirstOrDefault(customer2Values => customer2Values.Customer?.Equals(customer) ?? false); + } + + public int GetMonthCount() + { + return StartDate.GetMonthCount(EndDate); + } + + public int GetWeekCount() + { + return StartDate.GetWeekOfYearCount(EndDate); + } + + public int GetStartWeekOfYear() + { + return StartDate.GetIso8601WeekOfYear(); + } + + public decimal GetMehrMinderauslastung() + { + decimal mehrMinderauslastung = 0; + + foreach(var customer2Value in Customer2Values) + { + mehrMinderauslastung += customer2Value.SollSum + customer2Value.IstSum; + } + + return mehrMinderauslastung; + } + + public decimal GetVertraglicheArbeitszeit() + { + if(Employee != null) + { + var lastContract = Employee.LastContract; + + if(lastContract?.WeeklyFLS != null) + { + return lastContract.WeeklyFLS.Value; + } + } + + return 0M; + } + + public Customer2Values this[long index] + { + get + { + if(Customer2Values == null) + { + Customer2Values = new List(); + } + + return Customer2Values.FirstOrDefault(f => { return f.Customer?.Oid == index; }); + } + } + + + public decimal DiffSum + { + get + { + return Customer2Values.Sum(c2V => { return c2V.DiffSum; }); + } + } + + public decimal SollSum + { + get + { + return Customer2Values.Sum(c2V => { return c2V.SollSum; }); + } + } + + public string DiffSumInPercent + { + get + { + var dsip = SollSum == 0 ? 0M : DiffSum / SollSum * 100; + + return string.Format(new CultureInfo("de-DE"), "{0:0.00}%", dsip); + } + } + } + + public class Customer2Values + { + private readonly FLSAuswertungstyp _FlsAuswertungstyp; + + public readonly Guid Id; + + public string CustomerName => Customer?.Person?.LastNameFirstName; + public Customer Customer { get; set; } + + public FlsValueObject Day1 { get; set; } + public FlsValueObject Day2 { get; set; } + public FlsValueObject Day3 { get; set; } + public FlsValueObject Day4 { get; set; } + public FlsValueObject Day5 { get; set; } + public FlsValueObject Day6 { get; set; } + public FlsValueObject Day7 { get; set; } + public FlsValueObject Day8 { get; set; } + public FlsValueObject Day9 { get; set; } + public FlsValueObject Day10 { get; set; } + public FlsValueObject Day11 { get; set; } + public FlsValueObject Day12 { get; set; } + public FlsValueObject Day13 { get; set; } + public FlsValueObject Day14 { get; set; } + public FlsValueObject Day15 { get; set; } + public FlsValueObject Day16 { get; set; } + public FlsValueObject Day17 { get; set; } + public FlsValueObject Day18 { get; set; } + public FlsValueObject Day19 { get; set; } + public FlsValueObject Day20 { get; set; } + public FlsValueObject Day21 { get; set; } + public FlsValueObject Day22 { get; set; } + public FlsValueObject Day23 { get; set; } + public FlsValueObject Day24 { get; set; } + public FlsValueObject Day25 { get; set; } + public FlsValueObject Day26 { get; set; } + public FlsValueObject Day27 { get; set; } + public FlsValueObject Day28 { get; set; } + public FlsValueObject Day29 { get; set; } + public FlsValueObject Day30 { get; set; } + + + public FlsValueObject Week1 { get; set; } + public FlsValueObject Week2 { get; set; } + public FlsValueObject Week3 { get; set; } + public FlsValueObject Week4 { get; set; } + public FlsValueObject Week5 { get; set; } + public FlsValueObject Week6 { get; set; } + + + public FlsValueObject Month1 { get; set; } + public FlsValueObject Month2 { get; set; } + public FlsValueObject Month3 { get; set; } + + + public DateTime StartDate { get; set; } + public DateTime EndDate { get; set; } + + + public Customer2Values(Customer customer, FLSAuswertungstyp flsAuswertungstyp, DateTime startDate, DateTime endDate) + { + Customer = customer; + _FlsAuswertungstyp = flsAuswertungstyp; + StartDate = startDate; + EndDate = endDate; + + Id = Guid.NewGuid(); + } + + public Customer2Values() + { + Id = Guid.NewGuid(); + } + + public void CalcDifferences() + { + int count; + string prefix; + var sollSum = 0M; + var istSum = 0M; + + switch(_FlsAuswertungstyp) + { + case FLSAuswertungstyp.Daily: + count = 30; + prefix = "Day"; + break; + case FLSAuswertungstyp.Weekly: + count = GetWeekCount(); + prefix = "Week"; + break; + case FLSAuswertungstyp.Monthly: + count = GetMonthCount(); + prefix = "Month"; + break; + default: + count = 30; + prefix = "Day"; + break; + } + + for(var i = 1; i <= count; i++) + { + var propertyName = $"{prefix}{i}"; + var propertyInfo = GetType().GetProperty(propertyName); + + if(propertyInfo != null) + { + var propertyValue = (FlsValueObject)propertyInfo.GetValue(this, null); + + if(propertyValue != null) + { + sollSum += propertyValue.Soll; + istSum += propertyValue.Ist; + } + } + } + + var diffSum = sollSum - istSum; + + SollSum = sollSum; + IstSum = istSum; + DiffSum = diffSum; + + DifferenzGanzerAbrechnungszeitraum = diffSum; + AuslastungNachEnddatumKunde = sollSum > 0 ? diffSum / sollSum * 100 : 0M; + DiffSumInPercent = AuslastungNachEnddatumKunde; + } + + public decimal SollSum { get; set; } + public decimal IstSum { get; set; } + public decimal DiffSum { get; set; } + public decimal DiffSumInPercent { get; set; } + + + public decimal DifferenzGanzerAbrechnungszeitraum { get; set; } + + public decimal AuslastungNachEnddatumKunde { get; set; } + + public decimal RestlicheFlsProWoche { get; set; } + + public void AddOrUpdateDay(string propertyName, decimal soll, decimal ist, string timeUnitString) + { + try + { + var propertyValue = (FlsValueObject) this.GetPropertyValue(propertyName); + + if(propertyValue == null) + { + propertyValue = new FlsValueObject(soll, ist, timeUnitString); + this.SetPropertyValue(propertyName, propertyValue); + } + else + { + propertyValue.Soll += soll; + propertyValue.Ist += ist; + } + } + catch(Exception exception) + { + Debug.WriteLine(exception); + } + } + + public FlsValueObject GetFlsValueObject(string prefix, int suffix) + { + try + { + var propertyInfo = GetType().GetProperty($"{prefix}{suffix}"); + + if(propertyInfo != null) + { + return (FlsValueObject) propertyInfo.GetValue(this, null); + } + } + catch(Exception exception) + { + Debug.WriteLine(exception); + } + + return null; + } + + public int GetMonthCount() + { + return StartDate.GetMonthCount(EndDate); + } + + public int GetWeekCount() + { + return StartDate.GetWeekOfYearCount(EndDate); + } + + public override bool Equals(object obj) + { + if(obj is Customer2Values customer2Values) + { + return Equals(Customer, customer2Values.Customer); + } + + return false; + } + + public override int GetHashCode() + { + return Id.GetHashCode(); + } + } + + public class FlsValueObject + { + public decimal Soll { get; set; } + + public decimal Ist { get; set; } + + public decimal DiffSollIst => Soll - Ist; + + public string TimeUnit { get; set; } + + public FlsValueObject(decimal soll, decimal ist, string timeUnit) + { + Soll = soll; + Ist = ist; + TimeUnit = timeUnit; + } + } +} diff --git a/ReportImp/LebenshilfeFrankfurtOder/Invoicing/HortInvoiceCreation.cs b/ReportImp/LebenshilfeFrankfurtOder/Invoicing/HortInvoiceCreation.cs index 8ffd31794..a00d318c5 100644 --- a/ReportImp/LebenshilfeFrankfurtOder/Invoicing/HortInvoiceCreation.cs +++ b/ReportImp/LebenshilfeFrankfurtOder/Invoicing/HortInvoiceCreation.cs @@ -169,7 +169,7 @@ namespace LebenshilfeFrankfurtOder.Invoicing Start = invoicePeriod.StartDateTime, End = invoicePeriod.EndDateTime }; - sip.Notice = customer.Person.FirstNameLastName; + sip.Notice = customer.Person.LastNameFirstName; var ii = new InvoiceItem(); ii.AmountPerUnit = eigenanteil; diff --git a/ReportImp/ProfEggersStiftung/Exporter/DatevExporter.cs b/ReportImp/ProfEggersStiftung/Exporter/DatevExporter.cs index c2703cbcd..b3840ed71 100644 --- a/ReportImp/ProfEggersStiftung/Exporter/DatevExporter.cs +++ b/ReportImp/ProfEggersStiftung/Exporter/DatevExporter.cs @@ -2,13 +2,21 @@ using System.Collections.Generic; using System.Data; using System.IO; +using System.Linq; using System.Text; +using BeWo.Data; using BeWo.Data.Access; using BeWo.Data.Entities; +using BeWo.Report.ReportObjects; using BeWo.Service.DCEntityMapper; +using BeWo.Service.Invoicing; +using BeWo.Service.Plugins; using BS.Shared; +using BS.Shared.Core; using BS.Shared.DataContracts; +using BS.Shared.DataContracts.Compact; using BS.Shared.Extensions; +using ProfEggersStiftung.Invoicing; namespace ProfEggersStiftung.Export { @@ -37,6 +45,7 @@ namespace ProfEggersStiftung.Export sb.AppendLine("Umsatz (ohne Soll/Haben-Kz);Soll/Haben-Kennzeichen;WKZ Umsatz;Kurs;Basis-Umsatz;WKZ Basis-Umsatz;Konto;Gegenkonto (ohne BU-Schlüssel);BU-Schlüssel;Belegdatum;Belegfeld 1;Belegfeld 2;Skonto;Buchungstext;Postensperre;Diverse Adressnummer;Geschäftspartnerbank;Sachverhalt;Zinssperre;Beleglink;Beleginfo - Art 1;Beleginfo - Inhalt 1;Beleginfo - Art 2;Beleginfo - Inhalt 2;Beleginfo - Art 3;Beleginfo - Inhalt 3;Beleginfo - Art 4;Beleginfo - Inhalt 4;Beleginfo - Art 5;Beleginfo - Inhalt 5;Beleginfo - Art 6;Beleginfo - Inhalt 6;Beleginfo - Art 7;Beleginfo - Inhalt 7;Beleginfo - Art 8;Beleginfo - Inhalt 8;KOST1 - Kostenstelle;KOST2 - Kostenstelle;Kost-Menge;EU-Land u. UStID;EU-Steuersatz;Abw. Versteuerungsart;Sachverhalt L+L;Funktionsergänzung L+L;BU 49 Hauptfunktionstyp;BU 49 Hauptfunktionsnummer;BU 49 Funktionsergänzung;Zusatzinformation - Art 1;Zusatzinformation- Inhalt 1;Zusatzinformation - Art 2;Zusatzinformation- Inhalt 2;Zusatzinformation - Art 3;Zusatzinformation- Inhalt 3;Zusatzinformation - Art 4;Zusatzinformation- Inhalt 4;Zusatzinformation - Art 5;Zusatzinformation- Inhalt 5;Zusatzinformation - Art 6;Zusatzinformation- Inhalt 6;Zusatzinformation - Art 7;Zusatzinformation- Inhalt 7;Zusatzinformation - Art 8;Zusatzinformation- Inhalt 8;Zusatzinformation - Art 9;Zusatzinformation- Inhalt 9;Zusatzinformation - Art 10;Zusatzinformation- Inhalt 10;Zusatzinformation - Art 11;Zusatzinformation- Inhalt 11;Zusatzinformation - Art 12;Zusatzinformation- Inhalt 12;Zusatzinformation - Art 13;Zusatzinformation- Inhalt 13;Zusatzinformation - Art 14;Zusatzinformation- Inhalt 14;Zusatzinformation - Art 15;Zusatzinformation- Inhalt 15;Zusatzinformation - Art 16;Zusatzinformation- Inhalt 16;Zusatzinformation - Art 17;Zusatzinformation- Inhalt 17;Zusatzinformation - Art 18;Zusatzinformation- Inhalt 18;Zusatzinformation - Art 19;Zusatzinformation- Inhalt 19;Zusatzinformation - Art 20;Zusatzinformation- Inhalt 20;Stück;Gewicht;Zahlweise;Forderungsart;Veranlagungsjahr;Zugeordnete Fälligkeit;Skontotyp;Auftragsnummer;Buchungstyp;USt-Schlüssel (Anzahlungen);EU-Land (Anzahlungen);Sachverhalt L+L (Anzahlungen);EU-Steuersatz (Anzahlungen);Erlöskonto (Anzahlungen);Herkunft-Kz;Buchungs GUID;KOST-Datum;SEPA-Mandatsreferenz;Skontosperre;Gesellschaftername;Beteiligtennummer;Identifikationsnummer;Zeichnernummer;Postensperre bis;Bezeichnung SoBil-Sachverhalt;Kennzeichen SoBil-Buchung;Festschreibung;Leistungsdatum;Datum Zuord. Steuerperiode;Fälligkeit;Generalumkehr (GU);Steuersatz;Land"); + var s = GetMonatlicheBetraegeString(date, false); if (!String.IsNullOrWhiteSpace(s)) { @@ -115,7 +124,7 @@ ib.InvoiceId var sql = GetMonatlicheBetraegeSql(date, lvrOrLwl); /* -'Betrag', +betrag c.DebitorNumber, c.CostCenter, CONCAT(p.`LastName`, ', ', p.`FirstName`) as 'Verwendung', @@ -128,29 +137,94 @@ cb2sc.Oid StringBuilder sb = new StringBuilder(); foreach (DataRow row in dt.Rows) { - if (sb.Length > 0) + long oid = (long)row[4]; + decimal betrag = CalculateBillableAmountInTimeSpan(oid, date, date.AddMonths(1)); + if (row[0] != null) { - sb.AppendLine(); + Decimal.TryParse(row[0].ToString(), out betrag); } - DateTime lastDate = new DateTime(date.Year, date.Month, 1); - lastDate = lastDate.AddMonths(1).AddDays(-1); - sb.Append(String.Format("{0:ddMM}", lastDate)); - sb.Append(";"); - sb.Append(String.Format("{0}", row[1])); - sb.Append(";"); - sb.Append(lvrOrLwl ? "4003" : "4004"); // Erlöskonto - sb.Append(";"); - sb.Append(String.Format("{0}", row[3])); - sb.Append(";"); - //sb.Append(""); // Rechnungsnummer leer - sb.Append(";"); - sb.Append(String.Format("{0:0.00}", row[0])); + if (betrag > 0) + { + if (sb.Length > 0) + { + sb.AppendLine(); + } + + //0: Betrag + //1: Konto + //2: Gegenkonto + //3: Belegdatum + //4: Belegfeld 1 + //5: Buchungstext + //6: Kostenstelle + + DateTime lastDate = new DateTime(date.Year, date.Month, 1); + lastDate = lastDate.AddMonths(1).AddDays(-1); + + + String konto = (String) row[1]; + String gegenkonto = lvrOrLwl ? "4003" : "4004"; + String belegdatum = String.Format("{0:MMyy}", date); + String belegfeld = String.Format("{0:MMyy}", date); + String buchungstext = String.Format("{0} {1:MMyy}", row[5], date); + String kostenstelle = "3000"; + + sb.Append(String.Format( + "{0:0.00};S;EUR;;;;{1};{2};;{3};{4};;;{5};;;;;;;;;;;;;;;;;;;;;;;{6};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0;;;;;;", + betrag, konto, gegenkonto, belegdatum, belegfeld, buchungstext, kostenstelle)); + + } + + } return sb.ToString(); } + private static decimal CalculateBillableAmountInTimeSpan(long c2sOid, DateTime start, DateTime end) + { + + var factory = new CustomInvoiceFactory(); + + Dictionary> dict = new Dictionary>(); + + var cs = DAOFactory.GenericDAO.LoadByID(c2sOid); + var relCs = MapperFactory.SupportConceptCostBearerRelDC_CostBearer2SupportConcept.MapToNewDC(cs); + + CompactSupportConceptDC sc = CreateCompactSupportConcept(relCs); + + var allRecords = cs.ServiceRecords.MapToNewDCs(); + allRecords = allRecords.Where(r => r.Start.Value.Date >= start && r.Start < end).ToList(); + dict.Add(sc, allRecords); + + var creator = factory.CreateInvoiceCreator(null, null, dict); + + DateTimeSpan span = new DateTimeSpan(); + span.StartDate = start; + span.EndDate = start.AddMonths(1).AddDays(-1); + + var invoices = creator.GenerateServiceInvoices(cs.CostBearer.Oid.Value, span, dict); + + if (invoices != null && invoices.Count == 1) + { + return invoices[0].ClaimSum ?? 0; + } + + return 0; + } + + private static CompactSupportConceptDC CreateCompactSupportConcept(SupportConceptCostBearerRelDC c2s) + { + var dc = new CompactSupportConceptDC(); + dc.SupportConceptOid = c2s.SupportConcept.SupportConceptOid; + dc.CostBearerRelOids = new List(); + dc.CostBearerRelOids.Add(c2s.CostBearer2SupportConceptOid.Value); + dc.IsApproved = true; + + return dc; + } + private static Dictionary CreateHourlyRateDict(List catOids, DateTime date) { Dictionary dict = new Dictionary(); @@ -208,7 +282,8 @@ IF(crpRateFactor.`CostRateValue` is null, ROUND((sr.`GeleisteteFLM` / 60) * (SEL c.DebitorNumber, c.CostCenter, CONCAT(p.`LastName`, ', ', p.`FirstName`) as 'Verwendung', -cb2sc.Oid +cb2sc.Oid, +org.Name FROM `supportconcept` sc INNER JOIN `costbearer2supportconcept` cb2sc ON sc.`Oid` = cb2sc.`SupportConceptOid` INNER JOIN `costbearer` cb ON cb2sc.`CostBearerOid` = cb.`Oid` diff --git a/Service/Plugins/PluginLoader.cs b/Service/Plugins/PluginLoader.cs index 4b14a135f..88e0d2da8 100644 --- a/Service/Plugins/PluginLoader.cs +++ b/Service/Plugins/PluginLoader.cs @@ -119,7 +119,7 @@ namespace BeWo.Service.Plugins //t = "3341456098"; // Hilfe Daheim (früher BeWo Schillinger) //t = "4271389563"; // Komm Mit //t = "5430005891"; // Marienhospital Eickel - //t = "3265049248"; // Gerdas Pflegedienst + t = "3265049248"; // Gerdas Pflegedienst //t = "1549622397"; // Kontakt und Krisenhilfe //t = "4782194565"; // Skm Rheydt //t = "7535795843"; // Sozialwerk Dürener Christen @@ -224,7 +224,7 @@ namespace BeWo.Service.Plugins //t = "7817461089"; // FAB e.V. (Familienarbeit und Beratung e.V.) //t = "5207911843"; // Pro Balance //t = "8619663355"; // HSH Cologne - t = "1652658918"; // LH Frankfurt Oder + //t = "1652658918"; // LH Frankfurt Oder //t = "7696927868"; // Kuhring Betreuung //t = "6251348980"; // BeWo Gün //t = "6782533512"; // LH Dorsten @@ -279,7 +279,7 @@ namespace BeWo.Service.Plugins //t = "8283849714"; // Forum e.V. (proviel GmbH) //t = "3915346496"; // Sprungbrett 2. DB (Haus Theresia) //t = "2387527289"; // Lebenshilfe Duisburg HPFH - //t = "5595701056"; // Domiziel Ansbach + t = "5595701056"; // Domiziel Ansbach //t = "9430188510"; // Pro INTEGRA //t = "4820371076"; // Zuhause Wohnen Iris Thimm //t = "1078667960"; // FAM Rhein-Sieg Gbr